serenity-bdd / serenity-cucumber

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

Serenity Report not reporting correctly #163

Open bl101 opened 6 years ago

bl101 commented 6 years ago

Currently I have a project running with serenity-cucumber. The following is the setup for gradle:

`buildscript { ext.kotlin_version = '1.2.40' ext.serenity_version = '1.9.6'

repositories {
    mavenCentral()
    jcenter()
}
dependencies {
    classpath "net.serenity-bdd:serenity-gradle-plugin:$serenity_version"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

apply plugin: 'kotlin'
apply plugin: 'net.serenity-bdd.aggregator'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
}
configurations {
    cucumberRuntime {
        extendsFrom testRuntime
    }
}

dependencies {
    compile "junit:junit:4.12"
    compile "net.serenity-bdd:serenity-core:1.9.6"
    compile "net.serenity-bdd:serenity-junit:1.9.4"
    compile 'net.serenity-bdd:serenity-cucumber:1.9.4'
    compile 'net.serenity-bdd:serenity-rest-assured:1.9.4'
    compile "org.assertj:assertj-core:3.6.2"
    compile "org.slf4j:slf4j-simple:1.7.7"
    compile group: 'com.browserstack', name: 'browserstack-local-java', version: '1.0.2'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    compile "org.jetbrains.kotlin:kotlin-reflect"
    compile 'io.github.bonigarcia:webdrivermanager:2.2.0'
    compile "com.github.tomakehurst:wiremock-standalone:2.17.0"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

gradle.startParameter.continueOnFailure = true`

After running the tests I would have a gradle report showing 200+ tests but within the serenity report it would output a very small number of tests e.g 5 tests > 4 tests. I would also noticed each test would have a large number of steps but this isn't the case in the actual test. Here is an example image of the report:

screen shot 2018-07-18 at 18 06 35

Is this a known issue or an issue within my setup?

wakaleo commented 6 years ago

What do your tests look like?

bl101 commented 6 years ago

Tests have the following structure: -features -shopping -stepDefinitions ShoppingTestRunner.kt orderproduct.feature

Test runner look like this:

package features.shopping

import cucumber.api.CucumberOptions
import net.serenitybdd.cucumber.CucumberWithSerenity
import net.thucydides.core.annotations.Managed
import org.junit.runner.RunWith
import org.openqa.selenium.WebDriver

@RunWith(CucumberWithSerenity::class)
@CucumberOptions(
        features = ["src/test/kotlin/features/shopping"],
        glue = ["features"])
class ShoppingTestRunner {

    @Managed
    lateinit var driver: WebDriver
}

Then standard BDDTests:

Scenario: A user selects a product and adds it to their basket Given I am on a product page And there are a range of products within the store When I click the 'Add to cart' button Then I see the item within my basket

and example within StepDefinitions:

import cucumber.api.java.en.Given
import cucumber.api.java.en.Then
import cucumber.api.java.en.When
import features.shopping.steps.ShoppingSteps
import features.sharedSteps.NavigationSteps
import mocking.MockingClient
import mocking.defaults.MockDefaults
import net.serenitybdd.core.Serenity
import net.thucydides.core.annotations.Steps
import org.apache.http.HttpStatus.*
import org.junit.Assert.*
import javax.servlet.http.Cookie

class ShoppingStepDefinitions {

    @Steps
    lateinit var navigation: NavigationSteps
    @Steps
    lateinit var shopping: ShoppingSteps

    val mockingClient = MockingClient.instance
    val customer = MockDefaults.customer

    @Given("^There are a range of products within the store$")
    fun thereAreARangeOfProductsWithinTheStore() {
        shopping.generateStubsForShop()
    }
wakaleo commented 6 years ago

Do any of the features or scenarios have identical names?

bl101 commented 6 years ago

No. They are all unique.

wakaleo commented 6 years ago

Could you provide a sample project?

bl101 commented 6 years ago

I'll need to confirm tomorrow. Is there anything I could look at that would cause this issue? They had been working for a time. Just seems strange it outputs such a minimal number of tests to report. The number of tests has gradually been getting bigger, could it be to do with the number of tests?

wakaleo commented 6 years ago

No, it is more likely the process crashing because a feature is not being processed correctly for some reason. Serenity test suites routinely have thousands of tests.