1
votes

Is there a way in jmeter to compare two separate .csv files? I want to compare the exact cell in file1 to the cell in file2.

At the minute I am searching through the file for the row I want and then pulling the value out using regex. This seems to work, but I'm trying to work out an easier/more reliable solution.

2
CSVs don't really have 'cells.' Do you know how many values across each CSV has? Or is this a generalized 'compare any two CSVs?' - RowlandB
can you please show us current solution and explain why it's not optimal? that would be a better discussion. - Kiril S.
Both csv files have the same amount of values across. The current solution is to grep to get the correct row and then using regex to extract the value. - user3871995

2 Answers

1
votes

You can compare 2 files automatically using Response Assertion like:

  1. Add Response Assertion somewhere in your test plan.
  2. Configure it as follows:

    • Name: ${__FileToString(/path/to/first/file,,foo)}
    • Apply to: JMeter Variable -> foo
    • Pattern Matching Rules: Equals
    • Patterns to Test: ${__FileToString(/path/to/second/file,,)}

      Response Assertion

The assertion will automatically fail parent sampler if files are different.

See How to Use JMeter Functions article for more information on __FileToString() and other JMeter functions

0
votes

Take a look at the jmeter plugins. You have the jp@gc - Merge Results plugin to compare two csv files.