jmeter-java-dsl icon indicating copy to clipboard operation
jmeter-java-dsl copied to clipboard

Integration with RestAssured

Open BojteTamasMO opened this issue 5 years ago • 9 comments

This is another feature 💯 . It would be nice to have a way to integrate with RestAssured to reuse the actual steps.

BojteTamasMO avatar Oct 29 '20 15:10 BojteTamasMO

Hello @BojteTamasMO,

can you give an example of how you envision such integration?

Regards

rabelenda avatar Oct 29 '20 15:10 rabelenda

if you have:

public void postCartItem(String payload) {
  TestPlanStats stats =
      testPlan(
              threadGroup(
                  18,
                  10,
                  httpSampler("https")
                      .header("content-type", JSON.toString())
                      .header("Authorization", "Bearer " + getAccessToken())
                      .post(payload, MimeTypes.Type.APPLICATION_JSON)),
              influxDbListener("http://localhost:8086/write?db=jmeter"),
              // this is just to log details of each request stats
              jtlWriter("test.jtl"))
          .run();
  assertThat(stats.overall().elapsedTimePercentile99()).isLessThan(Duration.ofSeconds(5));

can be nice to have a way to add in the request name or the link in the description

BojteTamasMO avatar Nov 02 '20 15:11 BojteTamasMO

I still don't understand what is what you expect, and how the second comment relates to integrating with rest assured. Can you provide and example of expected jmeter-java-dsl or rest assured code and example of expected result?

rabelenda avatar Nov 02 '20 16:11 rabelenda

Sorry for being unclear. The request should be to have the httpSampler method with the type of parameter 'RequestSpecification', and there this library will get everything what it needs. For example you have :

  private RequestSpecification request(String url) {
    return requestSpecification
        .get()
        .baseUri(url)
        .contentType("application/vnd.api+json")
        .accept(ContentType.JSON);

testPlan(threadGroup( 18, 10, httpSampler(request("url")).run()

BojteTamasMO avatar Nov 03 '20 16:11 BojteTamasMO

Thank you,

I now understand what you are trying to achieve. Is this just an idea or do you have a specific requirement?

We could implement such feature, but seems to cover a very specific use case, which we will not invest efforts for the time being.

If this issue receives more votes we may consider implementing a jmeter-java-dsl to support this particular feature.

You are more than welcome to submit a pull request for such a feature if you like.

Regards, and thank you again for clarifying and proposing new ideas like this one.

rabelenda avatar Nov 16 '20 23:11 rabelenda

This will be very nice feature to have.

aabirdaneshyar avatar Jan 04 '21 18:01 aabirdaneshyar

Hi,

@BojteTamasMO, did you close this issue for any particular reason? Are you no longer interested in this feature? Maybe makes sense to keep the issue open to collect feedback from other potentially interested users and eventually (if there is enough interest), implement requested support.

Regards

rabelenda avatar Jan 08 '21 17:01 rabelenda

I've thought that you have a lot of work and you don't have time.

BojteTamasMO avatar Jan 08 '21 17:01 BojteTamasMO

Yes, thank you for your consideration. But, if enough interest arises in this matter I may re prioritize things.

Regards

rabelenda avatar Jan 08 '21 18:01 rabelenda