m2u icon indicating copy to clipboard operation
m2u copied to clipboard

testsuite tag contains 2 attributes 'tests' => impossible to import into eclipse

Open tomateetcarotte opened this issue 9 years ago • 11 comments

  • Error
    The test run could not be imported from file 'newsuggest.xml'. Attribute "tests" was already specified for element "testsuite".
  • generated junit xml file output
    newsuggest.xml contains following entry
    <testsuite tests="0" tests="522999" name="jmeter" skipped="0" disabled="0" errors="0" failures="45"  timestamp="0">
    
  • expected junit xml file output
    should be :
    <testsuite tests="522999"  disabled="0" errors="0" failures="45" name="jmeter" skipped="0" tests="522999" timestamp="0">
    

    Only one attribute "tests" should be set

  • jtl input file
    newsuggest.xml: content
    <?xml version="1.0" encoding="UTF-8"?>
    <testResults version="1.2">
    <httpSample t="705" lt="705" ts="1442842365971" s="true" lb="Authentication GET " rc="200" rm="OK" tn="Suggest Test Plan 1-1" dt="text" by="4000" ng="1" na="1">
      <assertionResult>
        <name>Assertion:Response code</name>
        <failure>false</failure>
        <error>false</error>
      </assertionResult>
      <responseData class="java.lang.String">resp</responseData>
      <cookies class="java.lang.String"></cookies>
      <method class="java.lang.String">GET</method>
      <queryString class="java.lang.String"></queryString>
    </httpSample>
     </testResults>
    
  • command executed
    java -jar m2u.jar --input newsuggest.jtl --output newsuggest.xml
  • tomateetcarotte avatar Sep 24 '15 09:09 tomateetcarotte

    I was running into this issue as well, i'm not a java expert but can someone have a look at the failed test?

    Nr18 avatar Jan 02 '17 21:01 Nr18

    Hi - I fixed this issue in my local copy but fixed another issue that is in general not related and may not be desirable to everyone.

    In short, to fix the duplicate field, update src/com/tguzik/m2u/data/junit/TestSuite.java so the timeSpentInMilis field refers to the XStreamAsAttribute:time, not tests. The field name is correct but was just tied to a duplicate attribute name. The totalTests field refers to the attribute tests as expected.

    This fix caused a test failure but I fixed that by editing the expected results. Not totally sure that editing was correct, but ... it worked. ;-) Honestly however, it took me 2 minutes to find/fix the bug and an 2 hours to figure out how to fix the tests. So... if you're game, I could give the tests some help to make them easier to diagnose.

    Separately, the target JUnit tc name value was being plucked exclusively from the JMeter Thread name. This doesn't work if you're explicitly using the Samplers as test cases. So I added some code to src/com/tguzik/m2u/data/JtlToJunitConverter.java. If the sample.getThreadName() == null; use sample.getLabel()...

    This works fine - but you need to include/exclude some fields from generated *.jtl results (using the custom logger) to make this fit together. I needed to get this working right away so it's a bit of a hack. Ultimately, you'd like to support a new command line parameter that could tell the tool which *.jtl field to use as the JUnit test case name.


    Sorry for this long note. I could have just jumped right to a pull request but I'd like to hear back from you first, to see whether you'd like to consider these updates or whether I should just keep my forked version as private.

    dksAutodesk avatar Jan 10 '17 23:01 dksAutodesk

    Is anyone watching this repo? I see there's a months-old pull request and some of these comments are really old.

    dksAutodesk avatar Jan 11 '17 17:01 dksAutodesk

    Exactly my question...

    Nr18 avatar Jan 11 '17 18:01 Nr18

    I just looked at the submissions on this repo and the most recent ones are 2 years old. It looks pretty certain it is no longer monitored by @tguzik.

    @Nr18 - if you're motivated, we could create a new repo and collaborate there.

    For my company's internal purposes I just made the fixed jar and archived it in our internal package system. So we're good for now. I may fork this repo to our internal git, so we can contribute to it as necessary. But that's a shame, to steal this public work and make it private; that's why I hesitate to do it.

    What do you think?

    dan

    dksAutodesk avatar Jan 12 '17 03:01 dksAutodesk

    I'm not a java developer i just use the package, @rikribbers has also created a pull request for this issue (See the reference in this thread). My plan was to wait for a week or so and then use his fork from there on, so if you are looking for a co-maintainer @rikribbers would be a better fit i guess.

    Nr18 avatar Jan 12 '17 07:01 Nr18

    I came to the same conclusion that this repo is no longer active, I needed the fix for internal usage so forked it and fixed my issue. So if you have any issues I am willing to put in some effort, however like everybody my time is also limited.

    rikribbers avatar Jan 12 '17 07:01 rikribbers

    It sounds like we all have our private/forked solutions - not to mention our own priorities and pressures.

    It's a pity to see the Open Source system break down. I guess at some point if there's enough interest, one of our forks can become the "live" stream.

    Anyway, thanks for your comments and considerations.

    dksAutodesk avatar Jan 12 '17 17:01 dksAutodesk

    ps. I'll create a fork with my fixes too.

    dksAutodesk avatar Jan 12 '17 17:01 dksAutodesk

    errrr.... sorry for the spam... @rikribbers - would you like me submit a pull request into your fork, with my updates?

    dksAutodesk avatar Jan 12 '17 17:01 dksAutodesk

    please do so, I will merge them

    Gr, Rik

    On 12 Jan 2017, at 18:42, dksAutodesk [email protected] wrote:

    errrr.... sorry for the spam... @rikribbers https://github.com/rikribbers - would you like me submit a pull request into your fork, with my updates?

    — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tguzik/m2u/issues/2#issuecomment-272230803, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5O3pN-YcesteKZXnPrhIOyauHlQ2raks5rRmYXgaJpZM4GC-vH.

    rikribbers avatar Jan 12 '17 17:01 rikribbers