Measurement of APIs load and performance within a Cucumber test case possible?



  • Baseline: Currently, within a Java environment and Maven integration, we use Cucumber for our API testing procedures inside Junit Test.

    This is also well implemented and accordingly everything works.

    However, we would now like to measure the respective speed of the APIs and thus the response times.

    Also a further planning regarding load and performance testing for the simulation of load and performance is planned.

    Example for the current state:

    Feature: Test 1
    

    Scenario Outline: Test 1
    Given Retrieving Ingresses of Google Environment
    Then response code should be
    Given <MS_NameAuth> MicroService<MS_RouteAuth> with path<MS_PathAuth>
    When Template Request
    When User send POST REST request for Creating User
    Then response code should be
    Then save response fields Using JsonUtility
    | $.access_token | subjectToken |
    Given MicroService <MS_Route> with path <MS_Path>
    When User send GET request with additional Path
    Then response code should be
    Then Validate response with expected JSON with ignored values

    Questions:

    • Is there a direct way within a Junit test including Cucumber integration to do a direct measurement and simulation of load and performance?
    • Is there any way to include Jmeter in Cucumber?
    • Is there any other solution besides Jmeter that we could include as a step in Cucumber?
    • Is it possible to measure individual APIs, e.g. response times?
    • Would integration into a CI be possible?

    What would be desirable:

    A possibility of a solution that can be extended, at the beginning pure measurements of the response times of an API, but later also complex load and performance tests.



    • Is there a direct way within a Junit test including Cucumber integration to do a direct measurement and simulation of load and performance?

      There are microbenchmarking libraries like https://openjdk.java.net/projects/code-tools/jmh/ which could be used for running specific Java methods in parallel

    • Is there any way to include Jmeter in Cucumber?

      It's possible to configure and run JMeter tests from Java code using https://jmeter.apache.org/api/index.html , see https://www.blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui article for more details. There is also https://github.com/abstracta/jmeter-java-dsl , it doesn't support everything but it provides nice API for creating and running the tests, it might be sufficient for your needs

    • Is there any other solution besides Jmeter that we could include as a step in Cucumber?

      Depending on what you're trying to achieve you might want to consider https://www.baeldung.com/maven-junit-parallel-tests , however it won't give you KPIs like concurrency, connect time, response time, etc. which could be provided by JMeter in case of using https://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request samplers so you might want to convert your tests to "pure" JMeter by running them via JMeter's https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.html




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2