user3871995
user3871995

Reputation: 1213

Compare two csv files in jmeter

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.

Upvotes: 1

Views: 2316

Answers (2)

Janp95
Janp95

Reputation: 584

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

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168002

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

Upvotes: 1

Related Questions