0

We in our company decided to give JMeter a try for the functional testing of our Http APIs. I see that the JMeter primarily being a performance testing tool, the terminology involved is a bit different like ThreadGroups, Test Fragment, Test Plan and so on. At the end we will want to run these JMeter tests in Jenkins and email the reports. I want something like

TestSuite       TotalTestCases    PassedTestCases      FailedTestCases 
FuncTestSuite1 7 6 1
FuncTestSuite2 10 8 2

How can I accomplish this kind of test result reporting in JMeter? I can think of creating jmx file for each test case and place them in a folder which represents the testsuite. By this organisation, I could write a utility that runs these JMeter tests and determine pass and fail for each tests, then generate a Junit file that can be published in Jenkins. Is there an alternate way of achieving this with purely JMeter alone or should I settle for this kind of work around to achieve the desired reporting? Is there a way to get pass, fail for each ThreadGroup, so the ThreadGroup can be used as a test case instead of the entire file? Thanks in advance.

1 Answer 1

1

The easiest way of getting JUnit-style reports out of JMeter test execution is running JMeter using Taurus tool as the wrapper.

Taurus provides JUnit XML Reporter which is capable of converting results of a JMeter test into JUnit format.

The minimal Taurus YAML configuration file would be something like:

execution:
  - scenario: mytest

scenarios:
  mytest:
    script: test.jmx

reporting:
  - module: junit-xml
    filename: result
    data-source: sample-labels

And you will get a JUnit XML file like:

<?xml version='1.0' encoding='UTF-8'?>
<testsuites>
    <testsuite name="sample_labels" package_name="bzt">
        <testcase classname="bzt-11388721" name="FuncTestSuite1-Test1"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite1-Test2"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite1-Test3">
            <error message="OK" type="Error">OK
                (status code is 200)
                (total errors of this type: 1)</error>
        </testcase>
        <testcase classname="bzt-11388721" name="FuncTestSuite1-Test4"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite1-Test5"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite1-Test6"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite1-Test7"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test1"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test10"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test2"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test3"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test4">
            <error message="OK" type="Error">OK
                (status code is 200)
                (total errors of this type: 1)</error>
        </testcase>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test5"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test6"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test7"/>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test8">
            <error message="OK" type="Error">OK
                (status code is 200)
                (total errors of this type: 1)</error>
        </testcase>
        <testcase classname="bzt-11388721" name="FuncTestSuite2-Test9"/>
    </testsuite>
</testsuites>

Taurus execution would be as simple as:

bzt test.yaml

enter image description here

And references test.jmx script looks like:

enter image description here

More information: Navigating your First Steps Using Taurus

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.