serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

Serenity report: feature duplicated in home if feature title differs from .feature filename #143

Open DjerohN opened 6 years ago

DjerohN commented 6 years ago

If the feature title (line after Feature: in .feature file) differs from the filename then it will appear twice in the report home page. One being named by the title and the second being derived from the filename. If some tests are failed then in the second link will be a 100% failure. Property use.test.case.for.story.tag=false does not work for me.

Using these versions:

1.8.21 1.8.21 1.6.10 1.8.21
cliviu commented 6 years ago

Hi @DjerohN . I was not able to reproduce your issue. I have tried with your versions and with the latest ones, I have used the project generated from standard serenity archetype for cucumber where I have changed the feature name in LookupADefinition.feature to Feature: Lookup a good definition. Can you please provide a test project to reproduce your issue ? Thanks !

hariharanravichandran commented 5 years ago

Hi @cliviu I am also facing this problem with following version set:

2.0.10 1.9.20 3.14.0 2.0.10 Please change the following and try: Feature File Name: UserAccessBddForTesting.feature Feature: User Access bDD for testing For the above set, we are getting duplicate entries. 1. user access b dd for testing - this contains the test result 2. User Access bDD for testing - this do not contains any result we are facing this issue only when first letter of any word in feature is lowercase and second one is uppercase. Note: it is not happening when the word is of full lowercase or full uppercase or the only the first letter of a word is uppercase.
wakaleo commented 5 years ago

I would recommend using snake case for feature files.

hariharanravichandran commented 5 years ago

@wakaleo can you provide few examples for how to name feature file and feature. so, that we will follow that to get full use of serenity reports.

wakaleo commented 5 years ago

See http://github.com/serenity-bdd/bdd-trader for some examples. Unusual capitalisation may cause issues.

jojothomas007 commented 4 years ago

I could reproduce the issue. If feature file name contains of period(.), features get duplicated in the home page of serenity report.

Example : 1.2_upload_file.feature If the file name is changed to 1-2_upload_file.feature, then the duplication won't happen. Hope this information helps

Bhala1987 commented 4 years ago

Even I could reproduce the exact same issue Feature filename: features/getFeeQuote.feature Feature: To validate the merchant api getFeeQuote

In the serenity report, I'm getting as follows: image

Serenity version - 2.2.0

wakaleo commented 4 years ago

Can you provide a sample project?

Bhala1987 commented 4 years ago

@wakaleo here you go for the command and see attached: mvn clean verify -Denv="https://merchantapi.taal.com/" merchant_api.zip

kreigy1310garg commented 4 years ago

@wakaleo I am able to replicate the same issue on windows 10. Even without dots if you provide simple name e.g. DataFormTemplate.feature then the same happens with version 2.2.0 using cucumber5. Following version has been used in the project

serenityCoreVersion=2.2.0 serenityCucumberVersion=2.2.0 cucumberCoreVersion=5.5.0

Attaching the screenshot for the same. Screenshot

kreigy1310garg commented 4 years ago

@wakaleo even it is replicable on version 2.2.1 with cucumber 5

arpitsinghmrt commented 4 years ago

@wakaleo I am also facing the same issue with Cucumber5

wakaleo commented 4 years ago

This appears to happen if your feature files are at the root directory of src/test/resources. The workaround (and recommended practice) is to organise your feature files in subdirectories according to functional groups or capabilities, or in some other way that makes sense for the living documentation.

BladimirMolina commented 4 years ago

This appears to happen if your feature files are at the root directory of src/test/resources. The workaround (and recommended practice) is to organise your feature files in subdirectories according to functional groups or capabilities, or in some other way that makes sense for the living documentation.

Esa es la solución, cree dentro del repositorio src/test/resources otro repositorio y moví los archivos .feature src/test/resources/PaginaPrincipal, listo funcionó. Gracias.

image

alfeducor2 commented 4 years ago

Hi @wakaleo I am having an issue as a consequence of moving the .feature files in subdirectories: image After I moved the .feature files I am getting warning for all the Scenario's steps "Step 'xxxxxx' does not have a matching glue code". If I run my automation suite it works fine just these Warning Messages, not sure if there is a way to get rid of them. When the .feature files were in: /src/test/resources/features it was not displaying the warning, but I was having the duplicated issue in the report.

I am using: Eclipse IDE for Enterprise Java Developers. Version: 2019-06 (4.12.0) Build id: 20190614-1200

In my TestRunner I tried different things, but still same issue: @RunWith(CucumberWithSerenity.class) @CucumberOptions( //features = "src/test/resources/features/Navigation", plugin = {"pretty"}, features = {"src/test/resources/features/NativeNavigation/","src/test/resources/features/Navigation/","src/test/resources/features/NativePromotion/","src/test/resources/features/NativeNotification/"}, glue = {"com.qualitestgroup.dierbergs.commonsteps","com.qualitestgroup.dierbergs.steps","com.qualitestgroup.dierbergs.stepsPages"}
//features = {"classpath:NativeNavigation.feature","classpath:NativeNotification.feature","classpath:NativePromotion.feature","classpath:Navigation.feature"} //features = {"src/test/resources/features/NativeNavigation/","src/test/resources/features/Navigation/","src/test/resources/features/NativePromotion/","src/test/resources/features/NativeNotification/"} ) public class TestRunner { }

I am attaching my pom.xml in case is useful.

pom.zip

Any help or advice will be highly appreciated. Thanks!

wakaleo commented 4 years ago

If the tests run correctly it is probably an Eclipse caching issue. I'm not familiar with Eclipse, but rebuiding or reimporting the project might help.

alfeducor2 commented 4 years ago

Sounds good, I will try that. Thanks!

BladimirMolina commented 4 years ago

Hi @alfeducor2

The problem is not the folder that was created and where you stored the features: image This is Good

use: features = "src/test/resources/features/" (This searches for all the features independent of the child folders. Clean Code), use tags for execution.

Try redirecting the glue to the definitions classes (try a single package with all those classes): glue = "com.qualitestgroup.dierbergs.definitions"

My structure is: definitions --> steps -->pages

I use eclipse version: Version: 2019-03 (4.11.0), Build id: 20190314-1200 (Don't have any problem whit this.)

Send a picture of the structure of your project what I assume is that the problem is with the glue.

pom.xml:

2.2.2 2.2.2 2.2.0 5.6.0 net.serenity-bdd serenity-core ${serenity.version} test io.cucumber cucumber-core io.cucumber cucumber-junit ${cucumber.version} test io.cucumber cucumber-java ${cucumber.version} Disculpa pero prefiero escribir en español :)
alfeducor2 commented 4 years ago

Thanks @BladimirMolina, sorry for the delay, I was trying but not able to make it work, so I had to go back to previous serenity builds:

2.1.5 2.1.5 1.9.5 This is the structure of my project: ![image](https://user-images.githubusercontent.com/40179266/81245116-0dbe5f80-8fc9-11ea-88e1-4df5b7ee4fef.png) With these builds everything is working fine. Thanks! (Gracias)
BladimirMolina commented 4 years ago

Gracias @BladimirMolina , perdón por el retraso, estaba intentando pero no pude hacerlo funcionar, así que tuve que volver a las versiones anteriores de serenidad:

2.1.5 2.1.5 1.9.5 Esta es la estructura de mi proyecto: ![imagen](https://user-images.githubusercontent.com/40179266/81245116-0dbe5f80-8fc9-11ea-88e1-4df5b7ee4fef.png) Con estas compilaciones todo funciona bien. ¡Gracias! (Gracias)

Me alegra que haya podido solucionar el inconveniente, sin embargo es un poco frustrante que no se haya podido solucionar el problema con la última versión.

Si gusta me puede enviar el proyecto (el que no funciona) y lo reviso para mirar que es lo que está ocurriendo.

I'm glad you were able to fix the issue, however it is a bit frustrating that you were unable to resolve the issue with the latest version.

If you like, you can send me the project (the one that doesn't work) and I check it to see what is happening.

alfeducor2 commented 4 years ago

Hi @BladimirMolina , sorry for the delay. Here is my project in case you still have some time to take a look. As a summary, project works fine, only problem is that I get warning in the feature files like: Step 'user started the automation' does not have a matching glue code for all the steps

Project_Latest_Serenity.zip

Chankami commented 4 years ago

Hi @wakaleo , @alfeducor2 , Im also facing the same issue, using cucumber 5. My folder structure is like below src/test/resources/features/ POM

UTF-8 2.2.9 2.2.9 2.2.5 UTF-8 Can any one help me to resolve this issue Thanks alot
wakaleo commented 4 years ago

It's a known issue in the backlog.

Chankami commented 4 years ago

@wakaleo thanks for the quick response, any workaround without downgrading?

wakaleo commented 4 years ago

Yes, place your feature files in subdirectories of the src/test/features directory (e.g organised by capability or high level functionality)

Chankami commented 4 years ago

@wakaleo thanks a lot it working now

ShayanAhmad commented 3 years ago

image Hi @wakaleo , I have the features in this (referring to the screenshot) file structure. Still I get duplicate ATs in my cucumber-reports on Jenkins with different time durations.

PS: Cucumber version: 6.2.2 Jenkins: 2.235.1 Cucumber reports plugin version: 5.3.1

wakaleo commented 3 years ago

Read the comments above.

Chelinadevi commented 3 years ago

Hi,

[main] WARN io.cucumber.core.plugin.SerenityReporter - Feature from **/loginAPI.feature is not under the 'features' directory. Requirements report will not be correctly generated! The folder structure is shown below:

image

The following is what I'm seeing in the report:

image

Please help me resolve this issue. Thanks in advance!

wakaleo commented 3 years ago

The workaround is in the comments above.

a-en commented 3 years ago

@cliviu seems that your changes in context of this issue has broken correct report generation in our case. I'm referring to commit 0db4b3e and changes in elementsOf method of LastElement class. Let me provide the interim results of my research. Let's say we have following structure of tests (with serenity.requirement.types set as "service,feature,suite"):

Once test is finished, Serenity generates tags for it (via call in BaseStepListener), collecting requirements from providers. One of those providers is PackageRequirementsTagProvider with its method getTagsFor. In this method we try to find matchingRequirement for the result of testOutcome.getUserStory().asTag(). Here we face the difference: before your changes, the result of this asTag method in our case was package2/suite1, but now it is package1.package2/suite1 (normalized in both cases). Then we try to find actually find matchingRequirement by walking through all of the requirements, but no matches found -- requirements provided by FileSystemRequirementStore doesn't contain package1 in their names. So, no matchingRequirement found and no tags returned from the method. As result, generated report doesn't contain expected information on the tabs (according to requirement types).

I'm not quite sure what would be the best way to address issue above (except just reverting change to LastElement class and get it back later without breaking functionality). @wakaleo @cliviu could you guys take a look and share your thoughts?

cliviu commented 3 years ago

hey @a-en . Can you please help me with a small project to reproduce this issue ? Thanks !

a-en commented 3 years ago

hi @cliviu , sure thing - please take a look on this repo. You could get report generated with mvn clean test. Once report is generated, please take a look on 'Features' list on the index page and then check separate tabs (Services, Features, Suites). If you want to compare that report with the one, which we were getting previously, you could roll back to any Serenity version that doesn't contain changes in LastElement class (for example, we used 2.1.6)

One more thing to be mentioned - the issue, I've described above could be resolved with changes to isAsOrMoreSpecificThan method by adding extra condition

        if (testTag.normalisedName().replaceFirst(".*?([^\\.]+)$", "$1").equals(this.normalisedName()) && (this.getType().equals(testTag.getType()))) {
            return true;
        }

I've tried locally and it worked fine, however, I'm not quite sure about potential impact and if this is the best way to address it.