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

Update Qualifiers in reports when cucumber json output has information on OS and devices #1154

Open
jit3pam opened this issue Jan 29, 2024 · 8 comments

Comments

@jit3pam
Copy link

jit3pam commented Jan 29, 2024

After completion of tests, it is required of me to add OS and devices information to cucumber reports.
I have a cucumber json output that already has a platform tag for every test feature.

At present, the qualifiers can be added to the reports to display this information.

For example:

"platform":"OS X, Big Sur, Chrome, latest"

However, Feature parser doesn't have any json property for processing this information.

Expected outcome:

  1. Feature parser should have a Json property called 'platform'. For example,
    @JsonProperty("platform")
    private String platform;
  1. Report parser could optionally read the platform property. For example,
feature.setQualifier(
    feature.getPlatform() != null && !feature.getPlatform().isEmpty() ?
    feature.getPlatform() : Objects.toString(configuration.getQualifier(jsonFileName), jsonFileName)
)
@JitendraSingh2TR
Copy link

@damianszczepanik
please if you could share your thoughts on this.

@damianszczepanik
Copy link
Owner

Share the official specification about this

@jit3pam
Copy link
Author

jit3pam commented Feb 4, 2024

Hi @damianszczepanik Thank you for your reply.

I am very new to cucumber-reporting project. I am not aware of the information on specification of feature parser. Please if you could let me know the resources that I can refer to.

According to my knowledge, the third-party plugins can include the tags to the cucumber json outputs. In my project, I use browserstack sdk to run the tests and the information on platform is present in the cucumber json output.
I also do not know whether adding information to feature in cucumber json outputs refer to a specification.

Moreover, I also created a fork https://github.com/jit3pam/cucumber-reporting to check my changes in order to complete an assigned work in my project.

If required I can also prepare a pull request based on our discussion.
Your inputs in this regard will be very helpful.

@JitendraSingh2TR
Copy link

I checked the W3C Specifications at https://www.w3.org/TR/webdriver/#processing-capabilities

name equals "platformName"
If value is not a string return an error with error code invalid argument. Otherwise, let deserialized be set to value.

The Java implementation https://github.com/SeleniumHQ/selenium/blob/b6b209602d544b769a0f4635022cf55a7b8f81b4/java/src/org/openqa/selenium/Capabilities.java#L35

@damianszczepanik @jit3pam

@damianszczepanik
Copy link
Owner

This is webdriver specification and this implementation is based on cucumber bdd concept. Not all attributes - I believe - defined in driver goes to the cucumber result/output

@jit3pam
Copy link
Author

jit3pam commented Feb 17, 2024

I found a related issue cucumber/cucumber-jvm#1343.

cucumber-jvm-parallel-plugin

image

Points to Note

cucumber-jvm-parallel-plugin created files as required by cucumber-reporting, which determines the qualifiers based on the file names.

Now cucumber-jvm has inbuilt support for running test scenarios in parallel.

The feature map implementation

https://github.com/cucumber/cucumber-jvm/blob/edf09f1fbabf0a9bb2cb0d3abab59eb52875585f/cucumber-core/src/main/java/io/cucumber/core/plugin/JsonFormatter.java#L154C5-L179C6

@jit3pam
Copy link
Author

jit3pam commented Feb 25, 2024

Hi @damianszczepanik,

I thought of a different approach.

Is it possible to annotate variable qualifier with @JsonProperty("platform")?

for example:

    @JsonProperty("platform")
    private String qualifier;

and then we could change the setQualifier method in the Feature class.

public void setQualifier(String qualifier) {
        if (getQualifier() != null){
            this.qualifier = getQualifier();
        }
        else {
            this.qualifier = qualifier;
        }
    }

I can submit a pull request with tests and an updated sample json file.

@damianszczepanik
Copy link
Owner

We can talk about implementation after finding specification

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