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

Xunit in xml format. #1

Open
mfpinheiro opened this issue Jul 7, 2016 · 13 comments
Open

Xunit in xml format. #1

mfpinheiro opened this issue Jul 7, 2016 · 13 comments

Comments

@mfpinheiro
Copy link

Hey

I use this package to export a report , but i only see the result on the browser console.
How can i exporte the result text to xunit file ou xml file ?
Thanks.

@jsep
Copy link

jsep commented Jul 8, 2016

Hello @mfpinheiro, here is how you can export a xml file

spacejam test --driver-package=practicalmeteor:mocha-xunit-reporter --xunit-out file.xml

Make sure you are using the latest releases of the packages.

Let me know if its working for you 😄

@mfpinheiro
Copy link
Author

Hey @jsep, thank you for the response.

So i never use this before, so a i'm a bit confused. I try running, with the
spacejam test --driver-package=practicalmeteor:mocha-xunit-reporter --xunit-out file.xml
And now got the error:

spacejam test --driver-package=practicalmeteor:mocha-xunit-reporter --xunit-out file.xml
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/xunit using test-in-console
------------------------------------------------
----------------PACKAGE VERSIONS----------------
practicalmeteor:mocha: 2.4.5_5
practicalmeteor:mocha-console-runner: 0.2.2
practicalmeteor:mocha-xunit-reporter: 0.1.0
------------------------------------------------
------------------------------------------------
phantomjs: There is no route for the path: /xunit
    http://localhost:4096/packages/kadira_flow-router.js?hash=09ea12875d3801955ee70797bf8e4a70feebc570: 519
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: Unhandled error in meteor client side code. Exiting.

I'm searching for something similar, but if you know about this, please explain for me.
Thanks :)

@jsep
Copy link

jsep commented Jul 11, 2016

Hello @mfpinheiro It seems to be kadira:flow-router its making spacejam to fail,

What you can do is declare a route with flow-router that do nothing:

FlowRouter.route('/xunit', {
    action: function(params, queryParams) {
        console.log("XUnit reporter");
    }
});

@mfpinheiro
Copy link
Author

Hi @jsep, unfortunately this don't work.
I wondering if, there's any way, to make Kadria_flow-route ignore this route,
and continue the process. What you think about that ?
A update you project, for the lastest version of meteor, and no conflicts :)

@mfpinheiro
Copy link
Author

Hi @jspe ,
Great news. Finally works. I make two empty files in my folder for public templates
tests.js and tests.html, and i import this tests.js in my public route.js
Heres is the code of the my public routes:

route.js

import { FlowRouter } from 'meteor/kadira:flow-router';

import '../../../ui/public/tests.js';

const publicRedirect = (context, redirect) => {
  if (Meteor.userId()) {
    redirect('index');
  }
};

const tests = FlowRouter.group({
    name: 'xunit',
    triggersEnter: [publicRedirect],
});

tests.route('/xunit', {
  name: 'xunit',
  triggersEnter: [publicRedirect],
});

To run i use

spacejam test --driver-package=practicalmeteor:mocha-xunit-reporter --xunit-out file.xml

And now he created this file.xml in the root direct of the project.
Thanks a lot for your support @jsep . If i discovered more, about this error or a better way to handle with this i share in here.

o /

@thebarty
Copy link

This feels really hacky, but thanks for the code!

OK, I am one step ahead, BUT now I am getting an error: Potentially incompatible change required to top-level dependency: practicalmeteor:mocha 2.4.5_5, was 2.4.5_6 when trying to install practicalmeteor:mocha-xunit-reporter

@mfpinheiro
Copy link
Author

@thebarty Hey man, sorry for the late response.
In a recent project a friend my used https://github.com/practicalmeteor/spacejam
and to out a xunit file
The command line options to pass to phantomjs. The default is --load-images=no --ssl-protocol=TLSv1.
--xunit-out

after the commands of spacejam.

in their website, have a lot examples.

hope this help you.
o /

@thebarty
Copy link

@mfpinheiro Thanks a lot for your help, buddy! I should have looked at those spacejam docs a lot earlier! 👍 OK, lets see if I get it running!

@thebarty
Copy link

thebarty commented Mar 27, 2017

@mfpinheiro: YEAH MAN!! After wasting days and hours I am finally seeing an XML. You saved my day!!!

@jsep : This should be in the docs!!!! Really really really!!!

// this is how it works
spacejam test --driver-package=practicalmeteor:mocha-xunit-reporter --load-images=no --ssl-protocol=TLSv1 --xunit-out ./unit-integrational-results.xml --port 7357

@thebarty
Copy link

https://forums.meteor.com/t/how-to-run-mocha-unit-tests-on-circleci-and-output-xml/35108

@mfpinheiro
Copy link
Author

@thebarty Hey brother. I really glad that those things work out. I have a really hard time with this.
My friend @lucasmonteiro001 managed to get things done recently :D

@thebarty
Copy link

@mfpinheiro : Hey ho! Yeah same over here. Getting the first xml output took me like 2 workdays.

OH DAMN!! I am still NOT done: on CircleCi spacejam runs sooo long, that it times out after 2 hours.

The integrational-tests run around 10 minutes on my osx using dispatch:mocha.
When I run them locally osx using spacejam they take 1 hours.
On CircleCi they take 2+ hours and hit the 2 hour timeoff limit.

I guess it has to do with phantomjs that those tests run sooo slow using spacejam.

Damn!!

Any other ideas??

@mfpinheiro
Copy link
Author

@thebarty hey dude!
Unfortunately i never used CircleCi.
One thing i can think of is about meteor test full app command, because there's a difference in between meteor simple test and full app test. But not sure if this is a issue.
Sorry for not helping this time.

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

No branches or pull requests

3 participants