Mattihew / k6-to-junit

tool to convert k6 output to junit xml
18 stars 6 forks source link

Testsuites test count = 0 after upgrade to v 1.0.3 #3

Open acn-sbuad opened 4 years ago

acn-sbuad commented 4 years ago

First part of print out after upgrading to v1.0.3

<?xml version="1.0"?>
<testsuites tests="0" failures="0" time="2.258">
  <testsuite name="src/tests/test.js" tests="0" failures="0" time="2.258" timestamp="2020-05-22T14:33:00.084Z">
    <system-out>

When downgrading to v1.0.2 and running the same tests the result is

<testsuites tests="2" failures="0" time="2.433">
Mattihew commented 4 years ago

Hi, could you provide the name(s) of some of the thresholds from your tests? As the regex for parsing those was the only thing that changed between 1.0.2 and 1.0.3

jeevananthank commented 4 years ago

@Mattihew threshold used in the test: export const options = { thresholds:{ "errors": ["count<1"] } };

Lampei commented 3 years ago

@Mattihew I think I may be experiencing something similar. I'm at v1.0.3 and here's an example of the output in the junit.xml file (and the output even has been changed as you see below). Running it like this: k6 run --insecure-skip-tls-verify -e HOST_NAME=<host> -e ACCOUNT_NUMBER=<account_number> -e USER_EMAIL=<user_email> -e PASSWORD=<password> .\scripts\walkthru.js | k6-to-junit junit.xml

The partial file output: `

Lampei commented 3 years ago

Although mine seems to have some encoding issues (as you can see in the output)

Lampei commented 3 years ago

I tried using the v1.0.2 but that still did not fix the issue.

Lampei commented 3 years ago

Sorry for all the comments, but one more thing I tried: If I remove the pipe and k6-to-junit section, then output is correct again, so whatever the pipe is doing, it's messing up the stdout and maybe whatever you are doing to parse it.

jeevananthank commented 3 years ago

@Mattihew I think i have found the issue. We used k6-to-junit@1.0.2 to report each checks as a test case. And the check names were GET response code is 200:. Since the names had a semicolon(:) in the end, those were reported as tests in the junit xml.

in 1.0.3, the regex is changed and a check name GET response code is 200.: is working.

Is it possible to expand the tool to include checks as testcases, which will be helpful in reporting when the scripts are run as functional verification where each check is a testcase.

Mattihew commented 3 years ago

hi all, sorry for the delay in responding. i'm planning on archiving this add-on soon as there is now offical suppord for exporting junit files directly from k6 ( see https://k6.io/docs/results-visualization/end-of-test-summary#handlesummary-callback). i'm going to put out another version before then to try and fix these issues (pull requests welcome) but i recomend using the offical junit summary for now.