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

serenity-bdd long context value #597

Closed
TKlauenberg opened this issue Jun 15, 2020 · 4 comments
Closed

serenity-bdd long context value #597

TKlauenberg opened this issue Jun 15, 2020 · 4 comments
Labels

Comments

@TKlauenberg
Copy link

TKlauenberg commented Jun 15, 2020

tldr: the context value of a test is too long when using serenity-bdd report

I am using cucumber-js and protractor and the problem is shown like this:

I have a Scenario Outline with 4 examples and for these 4 examples the serenity-bdd reporter generates one report. But in the context value, the browser and platform is added 4 times. So in my example it is "chrome,windows,chrome,windows,chrome,windows,chrome,windows". When I now try to generate the report with the serenity-bdd cli I get the error that some file could not be generated. The file has a really long filename which I think is the error there.

From my point of view I don't know if the error is in the serenity-js/serenity-bdd reporter or in the report creation in serenity-bdd itself (that the file name should be shortened there).

So first: is it desired that the context value in the report is so long and that it repeats itselft multiple times?

@jan-molak
Copy link
Member

jan-molak commented Jun 15, 2020

Hey @TKlauenberg the repeated values don't sound right. Would you be able to provide a minimal reproducible example based on Serenity/JS Protractor Cucumber template so that I could try to reproduce the issue?

The issue with report generation could be due to Windows not supporting files with long names. What you can do is to shorten the filenames Serenity BDD produces by invoking the serenity-bdd run command with --shortFilenames.

@TKlauenberg
Copy link
Author

TKlauenberg commented Jun 15, 2020

Hey @jan-molak thank you very much for the help. The --shortFilenames option did resolve the problem. Anyway I have created a repository where you can see this behaviour. The Problem seems to be a very long scenario name in Gherkin and multiple examples in a "Scenario Outline" test.

As far as my understanding of the code base is, the problem is that serenity refers to multiple tests in a Scenario Outline as one test and then appends the Platform and Browser Tag to the context on every execution.

The Code is from the SceneReport.ts in the serenity-bdd reporter

.when(BrowserTag,    (browserTag: BrowserTag) => {
    report.context   = [report.context, browserTag.browserName].filter(part => !! part).join(',');
    report.driver    = browserTag.browserName;
    report.id        = new SceneReportId(browserTag.name, report.id).value;
})
.when(PlatformTag,   (platformTag: PlatformTag) => {
    report.context   = [report.context, platformTag.name].filter(part => !! part).join(',');
    report.id        = new SceneReportId(platformTag.name, report.id).value;
})

@jan-molak
Copy link
Member

jan-molak commented Jun 15, 2020

Hey @TKlauenberg and thanks for helping me to reproduce the issue. It has been addressed in version 2.10.3. Please let me know if you spot anything else.

@TKlauenberg
Copy link
Author

TKlauenberg commented Jun 16, 2020

Hey @jan-molak thank you that fixes the error 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants