Skip to content

Fix junit reporter test duplication issue for WDIO v8#10977

Merged
christian-bromann merged 9 commits intowebdriverio:mainfrom
jemishgopani:fix-junit-reporting
Aug 27, 2023
Merged

Fix junit reporter test duplication issue for WDIO v8#10977
christian-bromann merged 9 commits intowebdriverio:mainfrom
jemishgopani:fix-junit-reporting

Conversation

@jemishgopani
Copy link
Contributor

@jemishgopani jemishgopani commented Aug 20, 2023

Proposed changes

  • Added fix for the below issues for WDIO v8,
  1. [🐛 Bug]: wdio/junit-reporter : xml report shows testcases twice even when the test is executed only once #10962
  2. [🐛 Bug]: Junit reports n * n test suites in case of grouping test specs to run sequentially #8497

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Reviewers: @webdriverio/project-committers

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a test for this?

@jemishgopani
Copy link
Contributor Author

Let me do that after that I'll ping you

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jemishgopani
Copy link
Contributor Author

Hi @christian-bromann
I have changed required things if we are agree on this change then I'll add test for wdio v7 as well

@jemishgopani
Copy link
Contributor Author

Can you please go through this generates xml output correctly when the addFileAttribute option is set I feel like we don't need that test.

@christian-bromann
Copy link
Member

I feel like we don't need that test.

How so?

@jemishgopani
Copy link
Contributor Author

I feel like we don't need that test.

How so?

it('generates xml output correctly when the addFileAttribute option is set', () => {
        reporter = new WDIOJunitReporter({ stdout: true, addFileAttribute: true })
        reporter.suites = featuresLog as any

        // verifies the content of the report but omits format by stripping all whitespace and new lines
        expect(reporter['_buildJunitXml'](mochaRunnerLog as any).replace(/\s/g, '').replace(/file:\/\//g, '').replace(/C:\//g, '')).toMatchSnapshot()
    })

Because that test we are running on mocha-runner mochaRunnerLog but the specified suites reporter.suites = featuresLog as any are the cucumber feature.

@jemishgopani
Copy link
Contributor Author

@christian-bromann

@jemishgopani
Copy link
Contributor Author

Hi @christian-bromann
Can you please help here with what can I do with that unit test case that I mentioned above?

@christian-bromann
Copy link
Member

but the specified suites reporter.suites = featuresLog as any are the cucumber feature.

Just replace featureLog with suiteLog and verify that the test still tests what it suppose to.

@jemishgopani
Copy link
Contributor Author

@christian-bromann Fixed junit reporter unit test please review it

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Aug 27, 2023
@christian-bromann christian-bromann merged commit cea9e66 into webdriverio:main Aug 27, 2023
@christian-bromann
Copy link
Member

Great job, thank you @jemishgopani

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants