Mate Mrše
Mate Mrše

Reputation: 8394

Cucumber report starting with "When" instead of "Given"

When running a test using this JUnit runner:

@RunWith(Cucumber.class)
@CucumberOptions (
        features = "C:\\myfeature.feature",
        glue = {"stepmethods"},
        plugin = {pretty},
        junit = "--step-notifications",
        dryRun = false
)

public class RunTest {

}

and with a standard feature file

**Given** I'm on the homepage
**When** I enter the correct credentials
**And** I click submit
**Then** I will get a userlist

when I run this console log shows that the test starts with the When keyword. (I know this because I occasionally print to console some checkpoints.)

If I comment out the When, And and Then steps, I get the correct output.

What could be the issue?

UPDATE:

Tests run in the right order, but they are not logged to console in the same order.
It seems this has to do with plugin = {pretty} option. When it is excluded, logging seems fine.

I would still like to keep this option. Is there a workaround?

Upvotes: 0

Views: 343

Answers (2)

Ramesh Korla
Ramesh Korla

Reputation: 64

You have to give below way also working

@CucumberOptions 
(
features = "C:\\myfeature.feature",

glue = {"stepmethods"},

plugin = {"pretty", "html:some/dir"},

stepNotifications=true,

dryRun = false

)

Upvotes: 0

MikeJRamsey56
MikeJRamsey56

Reputation: 2819

Try putting pretty between double-quotes and adding a report type.

@CucumberOptions (
    features = "C:\\myfeature.feature",
    glue = {"stepmethods"},
    plugin = {"pretty", "html:some/dir"},
    junit = "--step-notifications",
    dryRun = false
)

Upvotes: 1

Related Questions