Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Examples that pass are reported as failed #16

Closed
fawick opened this issue May 15, 2014 · 6 comments
Closed

Examples that pass are reported as failed #16

fawick opened this issue May 15, 2014 · 6 comments

Comments

@fawick
Copy link

fawick commented May 15, 2014

I have the following output of go test -v. ExampleOp just performs very few floating point operations for which go test reports a duration of 0.

=== RUN: ExampleA
--- PASS: ExampleA (4.0002ms)
=== RUN: ExampleOp
--- PASS: ExampleOp (0)

I run the tests and go2xunit with

go test -v package | tee $outfile
go2xunit -fail -input $outfile -output $outfile.xml

This is the content of $outfile.xml:

<?xml version="1.0" encoding="utf-8"?>

  <testsuite name="package" tests="2" errors="0" failures="1" skip="0">
    <testcase classname="package" name="ExampleA" time="4.0002">

    </testcase>
    <testcase classname="package" name="ExampleOp" time="N/A">

      <failure type="go.error" message="error">
        <![CDATA[--- PASS: ExampleOp (0)]]>
      </failure>    </testcase>
  </testsuite>

And there is another minor bug visible here: For ExampleA, the 4.0002 ms are parsed as 4 s seconds, so it is off by three orders of magnitude. That is not a showstopper for me, but it might be important for other users. Shall I open another issue for this?

@fawick
Copy link
Author

fawick commented May 15, 2014

I forgot: Ran with 0.2.11 (92bba4)

@fawick fawick closed this as completed May 15, 2014
@fawick fawick reopened this May 15, 2014
@tebeka
Copy link
Owner

tebeka commented May 15, 2014

Thanks for reporting! I'll take a look

@tebeka
Copy link
Owner

tebeka commented May 22, 2014

@fawick Can you attach the output file? When I run go2xunit on the example you wrote, it reports "error: no tests found"

@fawick
Copy link
Author

fawick commented May 26, 2014

Sure thing.

$ cat testfile
=== RUN ExampleA
--- PASS: ExampleA (4.0003ms)
=== RUN: ExampleOp
--- PASS: ExampleOp (0)
PASS
ok      package 0.194s
$ go2xunit.exe -fail -input testfile
<?xml version="1.0" encoding="utf-8"?>

  <testsuite name="package" tests="2" errors="0" failures="1" skip="0">
    <testcase classname="package" name="ExampleA" time="4.0003">

    </testcase>
    <testcase classname="package" name="ExampleOp" time="N/A">

      <failure type="go.error" message="error">
        <![CDATA[--- PASS: ExampleOp (0)]]>
      </failure>    </testcase>
  </testsuite>
$ go version
go version go1.2.2 windows/386

@fawick
Copy link
Author

fawick commented May 26, 2014

NB: It is safe to ignore the whole runtime of 0.194s in the above output. It simply comes from the fact that I edited testfile prior to feed it to go2xunit (removed some tests). The bug will occur if the whole time is 0.010s, too.

@tebeka
Copy link
Owner

tebeka commented Jun 4, 2014

Fixed in 0.2.12, sorry for the delay.

@tebeka tebeka closed this as completed Jun 4, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants