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

Skipping a test suite with ternary format causes broken xml result #93

Open
heqiao opened this issue Mar 15, 2018 · 2 comments
Open

Skipping a test suite with ternary format causes broken xml result #93

heqiao opened this issue Mar 15, 2018 · 2 comments

Comments

@heqiao
Copy link

heqiao commented Mar 15, 2018

The problem

Using ternary operator on describe level causes this reporter generates broken xml result.

Environment

  • WebdriverIO version: 4.12.0
  • Node.js version: 8.9.4
  • wdio-junit-reporter version: 0.4.2 and 0.3.1

Details

Setup

true ? describe.skip : describe('google', () => {
    it('should open home page', () => {
        homePage.open();
        homePage.searchBox.waitForVisible();
    });

    it('should search things', () => {
        homePage.search('the answer to life the universe and everything');
        resultPage.calculatorBox.waitForVisible();
        expect(resultPage.calculatorBox.getText()).equals('42');
    });
});

Expected:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="google" timestamp="2018-03-15T14:26:22" time="0.018" tests="2" failures="0" errors="0" skipped="2">
    <properties>
      <property name="specId" value="6ed49d49e69c669eba8317ca37ef6a22"/>
      <property name="suiteName" value="google"/>
      <property name="capabilities" value="chrome"/>
      <property name="file" value=".\specs\google.spec.ts"/>
    </properties>
    <testcase classname="chrome.google" name="should_open_home_page" time="0">
      <skipped/>
    </testcase>
    <testcase classname="chrome.google" name="should_search_things" time="0.001">
      <skipped/>
    </testcase>
  </testsuite>
</testsuites>

Actual:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites/>

false ? describe : describe.skip('google', () => {}); and describe.skip generate expected result with no problem.

@christian-bromann
Copy link
Contributor

Have you tried:

describe('my test', () => {
    true ? describe.skip : describe('google', () => {
        it('should open home page', () => {
            homePage.open();
            homePage.searchBox.waitForVisible();
        });

        it('should search things', () => {
            homePage.search('the answer to life the universe and everything');
            resultPage.calculatorBox.waitForVisible();
            expect(resultPage.calculatorBox.getText()).equals('42');
        });
    });
})

?

@heqiao
Copy link
Author

heqiao commented Mar 16, 2018

Got the broken result as well.

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