0

Can we integrate the Rest Assured API Testing code with Jmeter?

I am planning to use Rest Assured for API testing but also want the same tests to carryout the performance testing with JMeter. Is there a way we can integrate the code created in testing Rest Assured with JMeter?

Nahor
  • 83
  • 1
  • 7

1 Answers1

0

If current tests are developed using JUnit framework the easiest option is using JUnit Request sampler, just:

  1. Drop the .jar with your tests under lib/junit folder of your JMeter installation
  2. Drop rest assured jar and any other dependencies under JMeter Classpath
  3. Add a JUnit Request sampler per test method

If your test design doesn't assume JUnit you can always record your rest assured tests using JMeter's HTTP(S) Test Script Recorder

  1. Start JMeter HTTP(S) Test Script Recorder
  2. Add this line to the beginning of your tests:

    RestAssured.proxy = host("127.0.0.1").withPort(8888);
    
  3. Start your tests normally
  4. That's it, JMeter will capture the requests and store the relevant HTTP Request samplers under the Recording Controller
Dmitri T
  • 159,985
  • 5
  • 83
  • 133