tguzik / m2u

JMeter JTL to JUnit reports converter
GNU General Public License v2.0
15 stars 25 forks source link

Plugin takes thread name as testname #12

Open chintanvadgama opened 6 years ago

chintanvadgama commented 6 years ago

Hi,

I have installed this plugin & was able to run it successfully. When I ran the plugin, I see that this plugin takes "jmeter_thread_name" as "testcase-classname" for junit.xml. I am using JMeter for API testing & all testcases are written as "label" and not "threadname".

Is there any way to map "label" from jtl report to "testcase-classname" in junit report?

Sample JTL Report:

<testResults version="1.2">
<httpSample t="197" lt="197" ts="1521511843388" s="true" **lb="Delete version details"** rc="405" rm="Method Not Allowed" tn="Get Version 1-1" dt="text" by="618" ng="1" na="1">
    ......
    ......
</httpSample>
<httpSample t="80" lt="80" ts="1521511843697" s="true" **lb="Verify version gets deleted"** rc="200" rm="OK" tn="Get Version 1-1" dt="text" by="1221" ng="1" na="1">
    ......
    ......
</httpSample>
</testResults>

Sample JUnit XML report:

<testsuites disabled="0" errors="0" failures="0" name="jmeter" tests="0" time="0">
  <testsuite disabled="0" errors="0" failures="0" tests="3" name="jmeter" skipped="0" time="0.331" timestamp="0">
    <properties/>
    <testcase assertions="1" _**classname="Get Version 1-1"**_ name="Get Version 1-1" time="0.171">
     .....
     .....
    </testcase>
    <testcase assertions="2" **_classname="Get Version 1-1"_** name="Get Version 1-1" time="0.082">
      ......
      ......
    </testcase>
  </testsuite>
</testsuites>
tguzik commented 6 years ago

Hi,

Yeah, that sounds reasonable. I've added 4b8f6b1 that would build the junit classname and testName to look like ${threadName} - ${label}, skipping the empty components and unnecessary separators if needed. I think this should provide some flexibility for different inputs or styles of JMeter tests - let me know if that works for you.

Thanks!