Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yeti junit output for qunit tests doesn't contain testcase elements. #78

Open
wdemoss opened this issue Feb 26, 2014 · 2 comments · May be fixed by #79
Open

Yeti junit output for qunit tests doesn't contain testcase elements. #78

wdemoss opened this issue Feb 26, 2014 · 2 comments · May be fixed by #79

Comments

@wdemoss
Copy link

wdemoss commented Feb 26, 2014

Running the latest version of qunit with the --junit flag produces incomplete an xml file. Here is my simple test case:

my index.html:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>QUnit Example</title>
  <link rel="stylesheet" href="qunit.css">
</head>
<body>
  <div id="qunit"></div>
  <div id="qunit-fixture"></div>
  <script src="qunit.js"></script>
  <script src="tests.js"></script>
</body>
</html>

my tests.js:

test( "hello test", function() {
  ok( 1 == "1", "Passed!" );
});

qunit.js was downloaded from http://code.jquery.com/qunit/qunit-1.14.0.js
qunit.css was downloaded from http://code.jquery.com/qunit/qunit-1.14.0.css

Yeti version:
$ yeti --version
0.2.27

I ran yeti:

$ yeti --junit index.html > junit.xml
Creating a Hub. Open `yeti --server` in another Terminal to reuse browsers for future batches.

Waiting for agents to connect at http://192.168.1.75:9000
...also available locally at http://localhost:9000
When ready, press Enter to begin testing.
  Agent connected: Chrome (33.0.1750.117) / Mac OS from 127.0.0.1

✓ Testing started on Chrome (33.0.1750.117) / Mac OS
✗ ✖ QUnit Example on Chrome (33.0.1750.117) / Mac OS

✓ Agent completed: Chrome (33.0.1750.117) / Mac OS
✗ Failures: 1 of 2 tests failed. (0.26 seconds)

The output junit.xml:

$ cat junit.xml 
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="Chrome (33_0_1750_117) / Mac OS.✖ QUnit Example" failures="1" total="2" time="0.088">
</testsuite>
</testsuites>
@wdemoss
Copy link
Author

wdemoss commented Feb 26, 2014

I was able to get yeti to produce valid junit xml by including a module():

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>QUnit Example</title>
  <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.14.0.css">
</head>
<body>
  <div id="qunit"></div>
  <div id="qunit-fixture"></div>

  <script src="http://code.jquery.com/qunit/qunit-1.14.0.js"></script>

  <script type="text/javascript">
    QUnit.config.autostart = false;
  </script>

  <script type="text/javascript">
    module("Group A");
    test("hello test", function() {
      ok( 1 == "1", "Passed!" );
    });
  </script>

</body>
</html>

Running yeti:

$ yeti --junit index.html > junit.xml
Creating a Hub. Open `yeti --server` in another Terminal to reuse browsers for future batches.

Waiting for agents to connect at http://192.168.1.75:9000
...also available locally at http://localhost:9000
When ready, press Enter to begin testing.
  Agent connected: Chrome (33.0.1750.117) / Mac OS from 127.0.0.1

✓ Testing started on Chrome (33.0.1750.117) / Mac OS
✓ Agent completed: Chrome (33.0.1750.117) / Mac OS
✓ 1 tests passed! (0.20 seconds)

Produces junit.xml:

$ cat junit.xml 
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="Chrome (33_0_1750_117) / Mac OS.✔ QUnit Example" failures="0" total="1" time="0.082">
<testcase name="Group A: test1" time="0"/>
</testsuite>
</testsuites>

@reid
Copy link
Contributor

reid commented Feb 28, 2014

@wdemoss Thanks for the useful info!

reid added a commit to reid/yeti that referenced this issue Mar 1, 2014
reid added a commit to reid/yeti that referenced this issue Mar 1, 2014
The old implementation required moduleDone in order to collect
test results. This change introduces changes that allow results
to be sent even without modules by using testStart and testDone APIs.
@reid reid linked a pull request Mar 1, 2014 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants