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

XML output misses contexts #62

Closed
osherx opened this issue Sep 16, 2015 · 12 comments
Closed

XML output misses contexts #62

osherx opened this issue Sep 16, 2015 · 12 comments

Comments

@osherx
Copy link

osherx commented Sep 16, 2015

having: test suite that provides the following mocha output:

  client
    ✔ is cool
    ✔ is awsome
    client utility
      ✔ has absolutely no bugs
  Sender
    ✔ should be a module object
    ✔ should have API post(objRequest)
    using it
      get request
        ✖  should not fail
      POST request
        ✔ should not fail

expected: testcase name to include the context, like:
<testcase name="Sender using it get request should not fail" time="0.816" classname="Android_4_1_2_(Android_4_1_2).Sender">
but got:
<testcase name="should not fail" time="0.816" classname="Android_4_1_2_(Android_4_1_2).Sender">

or, alternatively - if the format allows (im not sure what the JUnit xml spec sais) - then let suite nest context suite elements.
my personal hunch is that the first would be easier, and parsed by all builders that open JUnit xml files the same way they are parsed now :)

You can also look at failed tests of this build:
https://circleci.com/gh/el-net/bs_karma_eval/21
correspond to the code here:
https://github.com/el-net/bs_karma_eval

@duncangrist
Copy link

We're seeing this too. It's causing our Bamboo server to miss tests as many tests appear to be named the same in the generated junit xml file.

Downgraded to [email protected] for now as this doesn't exhibit this issue.

@NeverwinterMoon
Copy link

Same problem for us on Bamboo - with latest reporter version, out of 750 tests, Bamboo, after parsing, shows only 570 tests. With 2.2.2 Bamboo was showing a more realistic number (still not everything).

@dignifiedquire
Copy link
Member

Thanks for the report

@developit
Copy link

+1 would love to see a fix for this, or a tip on where to look if I were to try a PR ;)

@gunnx
Copy link

gunnx commented Nov 12, 2015

I noticed this too after upgrading, the classname used in the XML is only the top level "describe" any nested "describe" names are omitted, so tests group under the one level instead of splitting out.

@marty-buly
Copy link

This error was introduced by e4f7ebd. In order to generate Sonar compatible report, one have changed generation of classname parameter from result.suite.join(' ') to result.suite[0].

@phillipj
Copy link
Contributor

Played with this locally and found that prefixing the test description with the parent suite names, ended it with the @osherx expected output test name.

From line #125

var spec = suites[browser.id].ele('testcase', {
  name: result.suite.join(' ') + ' ' + result.description, // was result.description
  time: ((result.time || 0) / 1000),
  classname: getClassName(browser, result)
})

I could possibly open a PR with that fix if @dignifiedquire thinks it looks good?

@jpaulin
Copy link
Contributor

jpaulin commented Dec 21, 2015

👍 for the idea of getting the nested describes working. We are also for now resorting to 0.3.3 downgrade most likely soon. I am writing a simple test for testing whether I could extinguish the bug; made by using that older working result.suite.join(' ') with enough sanity testing also so not to introduce new creepers. :) But so relative-newbie still (mostly in the tooling and philosophy of practical opensource) that I'll most likely be having a PR earliest 2016, if any.

@dignifiedquire
Copy link
Member

@phillipj sorry for the late reply but yes that sounds good

@jpaulin
Copy link
Contributor

jpaulin commented Dec 22, 2015

Can this be tested by test suites within the reporter? Ie. does karma-junit-reporter itself have tests? I was also a bit hesitant in putting forward a blind PR.

@jpaulin
Copy link
Contributor

jpaulin commented Jan 14, 2016

@dignifiedquire Hi, has there been progress in this individual issue either through fix or the latest version containing changes? There's at least one pull request but the thing is that it should be tested with at least some known instances where the buggy 0.3.3 (-> onwards) name flattening happens. I didn't have test data at hand to test the PR.

@karniemi
Copy link

karniemi commented Feb 2, 2016

+1

phillipj added a commit to phillipj/karma-junit-reporter that referenced this issue Mar 7, 2016
This fixes issue reported in karma-runner#62 where test names doesn't include parent test suites in the generated report.

Also created minimal unit test setup.
phillipj added a commit to phillipj/karma-junit-reporter that referenced this issue Mar 7, 2016
This fixes issue reported in karma-runner#62 where test names doesn't include parent test suites in the generated report.

Also created minimal unit test setup.
phillipj added a commit to phillipj/karma-junit-reporter that referenced this issue Mar 7, 2016
This fixes issue reported in karma-runner#62 where test names doesn't include parent test suites in the generated report.

Also created minimal unit test setup.
phillipj added a commit to phillipj/karma-junit-reporter that referenced this issue Mar 7, 2016
This fixes issue reported in karma-runner#62 where test names doesn't include parent test suites in the generated report.

Also created minimal unit test setup.
phillipj added a commit to phillipj/karma-junit-reporter that referenced this issue Mar 9, 2016
This fixes issue reported in karma-runner#62 where test names doesn't include parent test suites in the generated report.

Also created minimal unit test setup.
phillipj added a commit to phillipj/karma-junit-reporter that referenced this issue Mar 9, 2016
This fixes issue reported in karma-runner#62 where test names doesn't include parent test suites in the generated report.

Also created minimal unit test setup.
@hicom150 hicom150 closed this as completed Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests