Giter VIP home page Giter VIP logo

serenity-cucumber6's People

Contributors

ccharnkij avatar cliviu avatar jiri72 avatar schup avatar wakaleo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

serenity-cucumber6's Issues

Unable to initialize Chrome driver with serenity version 2.3.12

@wakaleo Getting "net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.chrome.ChromeDriver
Caused by: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (Trailing char < > at index 4: true ). See below for more details.
Caused by: java.nio.file.InvalidPathException: Trailing char < > at index 4: true " trying to initialize chromedriver.

Note:

  1. Kept chromedriver.exe into project root folder
  2. passed below value in serenity.properties file
    driver=chrome
    drivers.windows.webdriver.chrome.driver=chromedriver.exe
  3. Using serenity-cucumber6
  4. Getting "Uninitialised WebDriverFacade" value for driver.
  5. ChromeBrowser version: 88.0.4324.104
  6. ChormeDriver version: 88.0.4324.96

Please let me know in-case of any other additional information required

Rerunning the failed cases from Scenario Outline deletes records of passed examples from Serenity reports

Lets say, there are total 10 Scenarios in the feature file & 1 Scenario consist of 3 examples. When the main runner file completes execution, one of the 3 examples case fails due to random issue.
When the 'ReRunFailedCases' runner is executed then the failed example passes. Post execution of 'ReRunFailedCases' runner, in the serenity report there should be total 12 results including 3 data records but there are only 9 records, with Scenario outline showing only 1 example which was ran again due to failure.

Serenity Main runner:->

@RunWith(CucumberWithSerenity.class)
    @CucumberOptions(
            plugin = {"pretty",
                    "rerun:target/failed-scenarios/failed-feature1.txt"},
            features = "src/test/resources/features/feature1.feature"
    )
public class TestSuite{}

In case of failure runner:->

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
        plugin = {"pretty",
                "rerun:target/failed-scenarios/failed-feature1.txt"},
        features = {"@target/failed-scenarios/failed-feature1.txt"}
)
public class ReRunFailedCases {}

The first runner runs with 'gradle clean test' and 2nd runner just as 'gradle test'

Scenarios marked as @manual are throwing io.cucumber.java.PendingException

Hello,

I'm currently facing an issue when using Cucumber with Serenity.
io.cucumber.java.PendingException are thrown by Cucumber for @manual scenarios

To reproduce

Download the serenity-cucumber-starter and add a test.feature file :

Feature: Do a dummyfeature

  @manual
  @manual-result:passed
  Scenario: This is a dummy scenario
    Given some manual things
    When doing something manually
    Then we must see something

Running the tests using mvn clean verify "-Dcucumber.features=.\src\test\resources\features\search\test.feature" gives the following output :

[...]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
13:17:16.518 [main] INFO  i.c.core.plugin.SerenityReporter - Running feature from file:///C:/Users/Gaspre01/Downloads/serenity-cucumber-starter-master/./src/test/resources/features/search/test.feature

13:17:16.875 [main] INFO   -

-------------------------------------------------------------------------------------
     _______. _______ .______       _______ .__   __.  __  .___________.____    ____
    /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   /
   |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /
    \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|

 News and tutorials at http://www.serenity-bdd.info
 Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/
 Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core
 Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport
-------------------------------------------------------------------------------------


13:17:16.880 [main] INFO   - Test Suite Started: Do a dummyfeature

13:17:17.684 [pool-2-thread-1] INFO   -
  _____   ___   ___   _____     ___     _     ___   ___   ___   ___
 |_   _| | __| / __| |_   _|   | _ \   /_\   / __| / __| | __| |   \
   | |   | _|  \__ \   | |     |  _/  / _ \  \__ \ \__ \ | _|  | |) |
   |_|   |___| |___/   |_|     |_|   /_/ \_\ |___/ |___/ |___| |___/

This is a dummy scenario (manual test)
----------------------------------------------------------------------



Undefined scenarios:


file:///C:/Users/Gaspre01/Downloads/serenity-cucumber-starter-master/./src/test/resources/features/search/test.feature:5 # This is a dummy scenario




1
 Scenarios (
1 undefined
)


3
 Steps (
2 skipped
,
1 undefined
)


0m
1,190s






You can implement missing steps with the snippets below:




@Given("some manual things")
public void some_manual_things() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}




@When("doing something manually")
public void doing_something_manually() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}




@Then("we must see something")
public void we_must_see_something() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}






13:17:17.819 [pool-2-thread-1] INFO  n.t.core.reports.ReportService - net.thucydides.core.reports.json.JSONTestOutcomeReporter@5241cf67: Generating report for test outcome: Do a dummyfeature:This is a dummy scenario

13:17:17.911 [pool-3-thread-1] INFO  n.t.core.reports.ReportService - net.thucydides.core.reports.html.HtmlAcceptanceTestReporter@37eeec90: Generating report for test outcome: Do a dummyfeature:This is a dummy scenario

13:17:20.097 [main] INFO  i.c.core.plugin.SerenityReporter - Cleanup test resources for URI file:///C:/Users/Gaspre01/Downloads/serenity-cucumber-starter-master/./src/test/resources/features/search/test.feature

[INFO] Running Do a dummyfeature

@manual @manual-result:passed
Scenario: This is a dummy scenario # src/test/resources/features/search/test.feature:5
13:17:17.219 [pool-2-thread-1] INFO  i.c.core.plugin.SerenityReporter - Running feature from file:///C:/Users/Gaspre01/Downloads/serenity-cucumber-starter-master/./src/test/resources/features/search/test.feature
13:17:17.339 [pool-2-thread-1] INFO   -
  _____   ___   ___   _____     ___   _____     _     ___   _____   ___   ___
 |_   _| | __| / __| |_   _|   / __| |_   _|   /_\   | _ \ |_   _| | __| |   \
   | |   | _|  \__ \   | |     \__ \   | |    / _ \  |   /   | |   | _|  | |) |
   |_|   |___| |___/   |_|     |___/   |_|   /_/ \_\ |_|_\   |_|   |___| |___/

This is a dummy scenario(do-a-dummyfeature;this-is-a-dummy-scenario)
--------------------------------------------------------------------------------
  Given some manual things         # null
  When doing something manually    # null
  Then we must see something       # null
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.769 s <<< FAILURE! - in Do a dummyfeature
[ERROR] Do a dummyfeature.This is a dummy scenario  Time elapsed: 0.769 s  <<< ERROR!
io.cucumber.junit.UndefinedStepException:
The step 'some manual things' and 2 other step(s) are undefined.
You can implement these steps using the snippet(s) below:

@Given("some manual things")
public void some_manual_things() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}
@When("doing something manually")
public void doing_something_manually() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}
@Then("we must see something")
public void we_must_see_something() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}


[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   The step 'some manual things' and 2 other step(s) are undefined.
You can implement these steps using the snippet(s) below:

@Given("some manual things")
public void some_manual_things() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}
@When("doing something manually")
public void doing_something_manually() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}
@Then("we must see something")
public void we_must_see_something() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO]
[INFO] --- serenity-maven-plugin:2.4.24:aggregate (serenity-reports) @ cucumber-starter ---
[INFO] Test results for 1 tests generated in 2.3 secs in directory: file:/C:/Users/Gaspre01/Downloads/serenity-cucumber-starter-master/target/site/serenity/
[INFO] -----------------------------------------
[INFO]  SERENITY TESTS : SUCCESS
[INFO] -----------------------------------------
[INFO] | Tests executed         | 1
[INFO] | Tests passed           | 1
[INFO] | Tests failed           | 0
[INFO] | Tests with errors      | 0
[INFO] | Tests compromised      | 0
[INFO] | Tests pending          | 0
[INFO] | Tests ignored/skipped  | 0
[INFO] ------------------------ | --------------
[INFO] | Total Duration         | 359ms
[INFO] | Fastest test took      | 359ms
[INFO] | Slowest test took      | 359ms
[INFO] -----------------------------------------
[INFO]
[INFO] SERENITY REPORTS
[INFO]   - Full Report: file:///C:/Users/Gaspre01/Downloads/serenity-cucumber-starter-master/target/site/serenity/index.html
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M5:verify (default) @ cucumber-starter ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  25.425 s
[INFO] Finished at: 2021-06-11T13:17:26+02:00
[INFO] ------------------------------------------------------------------------
[...]

A possible workaround might be to run cucumber in non-strict mode, but this is now deprecated and does not work :

@CucumberOptions(
        strict = false
)

Is there a way to avoid the errors thrown by Cubumber for the @manual tests ?

Thanks

Unable to use non capturing group with {actor}

Lets say, I have written a two different scenario line as below
Scenario: number 1
Given Ben opens reports
And he chooses "report type 1"
When he selects filters as ......

Scenario: number 2
Given Lisa opens reports
And she chooses "report type 2"
When she selects rows as ......

In above example, step definition is same for 'When'; hence i m trying to use non capturing group as
@when({actor} selects (?:filters|rows) as)
public void methodName(){
....}

and I have a defined actor paramter as below:
@ParameterType(".*")
public Actor actor(String actorName) {
return OnStage.theActorCalled(actorName);
}

however, using {actor} in the step definition shows that there is no step definition mapped to a scenario line. So tried below:
@when("^(.*) selects (?:filters|rows) as$")
public void methodName(){
....}

After using (.*) instead of {actor}, cucumber shows that the step definition is present but when i run the code it throws me error as -
io.cucumber.core.exception.CucumberException: Could not convert arguments for step [^(.*) selects (?:filters|rows) as$]

can you please suggest?

Serenity Summary Report - Incorrect hyperlinks attached to the individual scenarios

Issue: After Generating serenity summary report with property 'serenity.report.url', every scenario's will have hyperlinks. But when i clicked on them it gave an error as 'Your file couldn’t be accessed It may have been moved, edited or deleted.' Where as 'View full Report' works perfectly fine.

Seems to be issue with hyperlinks of individual scenarios (links on case 1, case 2, case 3 etc).

Here is the summary sample screenshot:

image

Q 1: Is there a way i can not have hyperlinks for each scenarios (as they are not working), but keep view full report??

Q 2: Summary report has a heading 'Serenity Summary Report', but in serenity BDD book i can see project name mentioned instead of serenity summary report. Can you please share the property name to set report name in the heading?

Getting "NoStageException: No stage available" error while running from feature file

Environment:
serenity.version: 2.3.6
serenity.maven.version: 2.3.6
serenity.cucumber.version: 2.3.6
junit: 4.12

Steps to reproduce:

  1. Pull the project from below github url
    https://gitlab.com/alltempprojects/tempuiwebjvjunitcucumberserenity.git
  2. Run VerifyLinksUnderMyAccountInFooter.feature from feature file itself

Expected:
Feature should be run successfully with out any errors

Actual:
Getting below error
net.serenitybdd.screenplay.actors.NoStageException: No stage available - it looks like you haven't called the setTheStage() method before calling this one.

Note1: Run got success with out any errors when running from TestRunner file or mvn command

See the snapshot for reference

serenity feature file issue

How can I limit possible options in Cucumber Expressions?

In the "old" regex style, I could catch one of the provided, allowed String versions. How could I do that in Cucumber Expressions? For example following step definition will allow me only to provide "red" or "Blue" String and catch which of them were provided:

@Given(^I like '(red|Blue)' color$)
public void performAction(String oneOftheColors) {}

I know that in Cucumber Expressions I could just use

@Given("I like red/blue colour")

But I need also to know which value was provided in step / catch it.

Is it possible in Cucumber Expressions?

Different way of handling an empty string in the Datatable after switching to Cucumber 6

I switched my tests from Cucumber 2 (Serenity 2.1.5) to Cucumber 6.
I've noticed that empty strings values in the datatable are handled in different way than previously. For example

Given myActor checks values in datatable:
   | column1 | someValue     |
   | column2 | differentValue |
   | column3 |                        |

I am almost 100% sure that in in Serenity 2.1.5 column3 value was mapped as an empty String.
However, now it is mapped as NULL.

  1. Is it a bug or expected behaviour?
  2. Should I expect that always an empty column will be mapped as NULL?
  3. Are there any placeholders for empty string or NULL values or should I create my own (and handle them in steps definitions)?

Duplicate features names appearing in overall test results

Hi,

Duplicate entries of feature files are coming the overall summary. I tried moving features folder outside resources too; but in that case requirements are showing feature files, but it opens a blank feature page.
Is there any workaround here ?

PFA screenshots of report, test runner, properties file & resources structure:

image

Test Suite runner:
image

serenity.properties file:
image

Folder Structure
image

Regards,
Goraksha

Error when running a scenario from a feature file (intellij)

Hello,

I have configured my intellij feature file as described in this post. This works fine when running the whole feature, or when running from Maven, but I get the following error when I explicitly run a scenario from a .feature file.

java.lang.NullPointerException: No BaseStepListener has been registered
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:900)
	at net.thucydides.core.steps.StepEventBus.getBaseStepListener(StepEventBus.java:137)
	at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:77)
	at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:58)
	at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:48)
	at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
	at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:59)
	at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
	at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
	at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
	at io.cucumber.core.runner.TestStep.run(TestStep.java:63)
	at io.cucumber.core.runner.TestCase.run(TestCase.java:95)
	at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
	at io.cucumber.core.runtime.Runtime.lambda$execute$5(Runtime.java:110)
	at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
	at io.cucumber.core.runtime.Runtime.lambda$execute$6(Runtime.java:110)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at io.cucumber.core.runtime.Runtime$SameThreadExecutorService.execute(Runtime.java:233)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
	at io.cucumber.core.runtime.Runtime.lambda$run$2(Runtime.java:86)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.SliceOps$1$1.accept(SliceOps.java:204)
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at io.cucumber.core.runtime.Runtime.run(Runtime.java:87)
	at io.cucumber.core.cli.Main.run(Main.java:79)
	at io.cucumber.core.cli.Main.main(Main.java:33)

`

Undefined Parameter type {actor}, Please register a Parameter Type for {actor}

ERROR:

Showing an error in Spring tool suite IDE console : "Undefined Parameter type {actor}, Please register a Parameter Type for {actor}" for each step definition files
image

ParameterDefinitions.java:

import io.cucumber.java.ParameterType;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.actors.OnStage;

public class ParameterDefinitions {

@ParameterType(".*")
public Actor actor(String actorName) {
	return OnStage.theActorCalled(actorName);
}

}
Stedefinitions.java

@given("{actor} open(s) a browser and launch Web portal")
public void logsWebPortal(Actor actor) {
actor.wasAbleTo(GoTo.theWebPortalLoginPage());
actor.wasAbleTo(GoTo.clickLogin());
}

build.gradle:

ext {
logbackVersion = '1.2.3'
junitVersion = '4.12'
assertJVersion = '3.8.0'

serenityCoreVersion = '2.3.9'
cucumberVersion = '6.8.1'

}

dependencies {
implementation "ch.qos.logback:logback-classic:${logbackVersion}",
"net.serenity-bdd:serenity-core:${serenityCoreVersion}",
"net.serenity-bdd:serenity-screenplay:${serenityCoreVersion}",
"net.serenity-bdd:serenity-screenplay-webdriver:${serenityCoreVersion}",
"net.serenity-bdd:serenity-screenplay-rest:${serenityCoreVersion}",
"net.serenity-bdd:serenity-ensure:${serenityCoreVersion}",
"org.assertj:assertj-core:${assertJVersion}"

testImplementation "junit:junit:${junitVersion}",
		"net.serenity-bdd:serenity-cucumber6:${serenityCoreVersion}",
		"io.cucumber:cucumber-java:$cucumberVersion",
		"io.cucumber:cucumber-junit:$cucumberVersion"

}

Add support for cucumber's lambda step definitions

Cucumber has support for using lambdas to create step definitions (https://cucumber.io/docs/cucumber/step-definitions/). When I attempt to use this with serentity-cucumber6, I get the following error "java.lang.NullPointerException: No BaseStepListener has been registered".

When I remove the serenity dependencies and using the standard cucumber runner it works as expected.

Reproducing:

  1. Clone https://github.com/Mistborn94/serenity-cucumber-java8-issue
  2. Run mvn clean verify

Full stack trace:

java.lang.NullPointerException: No BaseStepListener has been registered
     at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:900)
     at net.thucydides.core.steps.StepEventBus.getBaseStepListener(StepEventBus.java:137)
     at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:77)
     at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:58)
     at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:48)
     at io.cucumber.java8.Java8Backend.buildWorld(Java8Backend.java:64)
     at io.cucumber.core.runner.Runner.buildBackendWorlds(Runner.java:99)
     at io.cucumber.core.runner.Runner.runPickle(Runner.java:65)
     at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
     at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
     at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
     at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
     at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
     at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
     at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
     at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:234)
     at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:57)
     at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
     at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
     at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:262)
     at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
     at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
     at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
     at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
     at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
     at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
     at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
     at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Multiple issues with Serenity

Pull the project from below github url
https://gitlab.com/alltempprojects/tempuiwebjvjunitcucumberserenityv3-defaultdriver.git

Issue1. How to prevent the multi level logs in serenity reports?
logs are displaying two times, I want to log only one error log. see the snapshot for reference in (reports>serenity-reports folder).
Ex: Test is failed at 'Sendkeys' method in 'SeleniumLib' class.
Note:'Sendkeys' is overloaded method in 'SeleniumLib' class.
command used to run chrome: mvn verify -Drunner=TestRunnerForWeb -Denvironment=cr
serenity duplicate logs

Issue2. What it the serenity property for running edge in headless?

Issue3. How to use dynamic property in 'serenity.conf' file.
Ex: path for 'appium.app' property is need to use dynamically when running in jenkins.
Tests are running fine in local, but failing in jenkins due to absolute path for 'appium.app' property in 'serenity.conf' file

Issue4. I want to start/stop the appium server before/after running the android tests.
for that I have created BeforeClass, AfterClass methods in TestRunnerForMobile.java runner class.
Ran the 'TestRunnerForMobile' runner class.
But getting null value for 'webdriver.driver' property at line 24 in 'TestRunnerForMobile' class.
How to get 'webdriver.driver' property in runner class?
Note: Need to run 'TestRunnerForMobile' runner class
++++++++++ below is code for 'TestRunnerForMobile' runner class ++++++++++++
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
plugin = {"pretty"
},
features = "src/test/resources/features/Addition.feature",
glue = {"stepdefinitions", "common"}
)
public class TestRunnerForMobile {
static EnvironmentVariables environmentVariables;

@BeforeClass
public static void beforeClass() {
    try {
        String value = EnvironmentSpecificConfiguration.from(environmentVariables).getProperty("webdriver.driver");
        if (value.equalsIgnoreCase("appimum")) {
            System.out.println("Appium server Started");
        }
    } catch (Exception e) {
    }
}

@AfterClass
public static void afterClass() {
    try {
        String value = EnvironmentSpecificConfiguration.from(environmentVariables).getProperty("webdriver.driver");
        if (value.equalsIgnoreCase("appimum")) {
            System.out.println("Appium server stopped");
        }
    } catch (Exception e) {
    }
}

}

+++++++++++

Issue in sharing driver with other class

I want to share driver object to other class. For example, I have created some common methods in 'SeleniumLib' class.

I have created constructor in homepage and passing driver to 'SeleniumLib' class. After that trying to use 'SeleniumLib' class, but it throws null pointer. Can you please help me to share the driver object in "SeleniumLib" class.

Steps to reproduce:

  1. Pull the project from below github url
    https://gitlab.com/alltempprojects/tempuiwebjvjunitcucumberserenityv2
    2.Run VerifySearchInHomePage.feature
    Observe that, "When User enter "T-shirt" in search box" step is failed due to driver is null

Expected:
step should run successfully

Actual:
Getting null pointer exception for driver

Console log:
C:/Users/DELL/IdeaProjects/AllProjects/AllTempProjects/TempUIWebJVJunitCucumberSerenityV2/src/test/resources/features/VerifySearchInHomePage.feature
Before --> Tue Mar 16 12:42:05 IST 2021 --> Thread id: 1 --> Verify Search in Home Page
Navigated to shop.edzotech home page
03-16-2021 12:42:05.603 [main] INFO n.s.c.w.d.ChromeDriverProvider - Using automatically driver download
03-16-2021 12:42:05.798 [main] INFO i.g.bonigarcia.wdm.WebDriverManager - Using chromedriver 89.0.4389.23 (resolved driver for Chrome 89)
03-16-2021 12:42:05.821 [main] INFO i.g.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as C:\Users\DELL.cache\selenium\chromedriver\win32\89.0.4389.23\chromedriver.exe
03-16-2021 12:42:06.286 [main] INFO n.s.c.w.d.ProvideNewDriver - Instantiating driver
03-16-2021 12:42:06.286 [main] INFO n.s.c.w.d.ProvideNewDriver - Driver capabilities: Capabilities {acceptInsecureCerts: false, browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, loggingPrefs: org.openqa.selenium.logging...}
Starting ChromeDriver 89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}) on port 40573
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Mar 16, 2021 12:42:07 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
java.lang.NullPointerException
at utilities.SeleniumLib.sendKeys(SeleniumLib.java:28)
at pages.HomePage.enterSearchBox(HomePage.java:24)
at stepdefinitions.VerifySearchInHomePageStepDef.userEnterInSearchBox(VerifySearchInHomePageStepDef.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
at io.cucumber.java.Invoker.invoke(Invoker.java:24)
at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29)
at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66)
at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
at io.cucumber.core.runner.TestStep.run(TestStep.java:63)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:49)
at io.cucumber.core.runner.TestCase.run(TestCase.java:99)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.core.runtime.Runtime.lambda$execute$5(Runtime.java:110)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.core.runtime.Runtime.lambda$execute$6(Runtime.java:110)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at io.cucumber.core.runtime.Runtime$SameThreadExecutorService.execute(Runtime.java:233)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at io.cucumber.core.runtime.Runtime.lambda$run$2(Runtime.java:86)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.SliceOps$1$1.accept(SliceOps.java:204)
at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1351)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at io.cucumber.core.runtime.Runtime.run(Runtime.java:87)
at io.cucumber.core.cli.Main.run(Main.java:79)
at io.cucumber.core.cli.Main.main(Main.java:33)

Possible to expose an interface for Filtering tests to run?

In our organization we are filter the tests to run based on the test cases defined in Zephyr.
We would like to filter running only the scenarios that are in the define the test cycle.

Any way for the framework to expose an Filter interface to implement so the runner can apply(TestTags tags) to see if it should run

Serenity Cucumber 6 uses encoded URI for features path

Currently, Serenity uses the URI path of a feature to create the story that will be used for reporting, this causes that if a feature is inside a folder that contains special characters like spaces or Latin accents, then the URI is encoded which cause that at the end the report presents duplicated features.

Parallel test execution with serenity.fork.count doesn't work when running with net.serenitybdd.cucumber.CucumberWithSerenity

Hi,
I have upgraded my project's dependencies to latest Cucumber and Serenity versions. After that I observed the parallel test execution using serenity.fork.count> 1 does not work in Jenkins as well as local. The sliced runner example given in your project directly using io.cucumber.junit.CucumberWithSerenity, which is the super class of net.serenitybdd.cucumber.CucumberWithSerenity. With the given information, could you please help me resolve the issue?

Version of Gradle plugin: net.serenity-bdd:serenity-gradle-plugin:2.6.0
Version of Gradle wrapper: gradle-6.4-bin.zip
Given below are dependencies:
testImplementation('io.cucumber:cucumber-java:6.10.4')
testImplementation('io.cucumber:cucumber-junit:6.10.4')
testImplementation('io.cucumber:cucumber-java8:6.10.4')
testImplementation group: 'io.cucumber', name: 'cucumber-testng', version: '4.8.1'
testImplementation(group: 'net.serenity-bdd', name: 'serenity-core', version: '2.6.0')
testImplementation(group: 'net.serenity-bdd', name: 'serenity-cucumber6', version: '2.6.0')
testImplementation(group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: '2.6.0')

Below is the test task I am using in Gradle:
test {
systemProperties System.properties
List runners = file('demo/runners').listFiles()
.collect { it.name }
.findAll { it =~ 'SerenityRunner' }
.collect { it.take(it.lastIndexOf('.')) } as List
int runnerCount = runners.size();
runners.clear();
for (int i = 1; i <= runnerCount; i++) {
runners.add("SerenityRunner" + i);
}
maxParallelForks = System.properties.'serenity.fork.count' as Integer ?: 1
maxParallelForks = [maxParallelForks, runners.size()].min()
systemProperty 'serenity.fork.count', maxParallelForks
maxParallelForks.times { filter.includeTestsMatching runners[it] }
ignoreFailures = true
testLogging.exceptionFormat = 'full'
}

Below is a Sliced runner class and an inherited Serenity runner class

import net.serenitybdd.cucumber.CucumberWithSerenity;
import net.thucydides.core.guice.Injectors;
import net.thucydides.core.util.EnvironmentVariables;

public class SlicedRunner1 extends CucumberWithSerenity{
public SlicedRunner1(Class clazz) throws Throwable {
super(clazz);
Injectors.getInjector().getInstance(EnvironmentVariables.class)
.setProperty("serenity.fork.number", "1");
}
}

import demo.Parallel.SlicedRunner1;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

@RunWith(SlicedRunner1.class)
@CucumberOptions(features = "src/test/resources/features",
glue = {"demo.steps"}
)

public class SerenityRunner1 {
}

"Could not convert arguments for step" / It appears you did not register a data table type.

I have the following scenario:

@usuarios-5
  Scenario: Eliminar usuarios
    Given el usuario ramiro se autentica en la plataforma de comercios de zunify y tiene creado un usuario
      | nombre             | correo             | usuario       | nombreArchivo                 |
      | Actor automatizado | [email protected] | UsuarioBorrar | json/usuario_por_defecto.json |

and their stepDefinition:

 @Dado("el usuario {word} se autentica en la plataforma de comercios de zunify y tiene creado un usuario")
    public void elUsuarioSeAutenticaEnLaPlataformaDeComerciosDeZunifyYTieneCreadoUnUsuario(String usuario,List<UsuarioComercial> listUsuario){
        infoUsuario = listUsuario.get(0);
...
}

model class UsuarioComercial():

public class UsuarioComercial {

    private static final String FORMATO_MENSAJE_ERROR_EN_JSON = "error al obtener json";
    private String nombre;
    private String usuario;
    private String cedula;
    private String tipoUsuario;
    private String correo;
    private String nombreArchivo;
    private JsonObject jsonCreacion;
    private String sucursales;
    private String estadoUsuario;

....... getters and setters....
}

but when a run it I get the following ERROR

Eliminar usuarios
---------------------------------------------------------------------
[Test worker] ERROR  -     Test failed at step: Dado el usuario ramiro se autentica en la plataforma de comercios de zunify y tiene creado un usuario | nombre | correo | usuario | nombreArchivo | | Actor automatizado | [email protected] | UsuarioBorrar | json/usuario_por_defecto.json |
[Test worker] ERROR  -     

**Could not convert arguments for step [el usuario** {word} se autentica en la plataforma de comercios de zunify y tiene creado un usuario] defined at 'com.zunify.qa.stepdefinitions.UsuariosStepDefinitions.elUsuarioSeAutenticaEnLaPlataformaDeComerciosDeZunifyYTieneCreadoUnUsuario(java.lang.String,java.util.List<com.zunify.qa.models.UsuarioComercial>)'.
**It appears you did not register a data table type.**
io.cucumber.core.exception.CucumberException: Could not convert arguments for step [el usuario {word} se autentica en la plataforma de comercios de zunify y tiene creado un usuario] defined at 'com.zunify.qa.stepdefinitions.UsuariosStepDefinitions.elUsuarioSeAutenticaEnLaPlataformaDeComerciosDeZunifyYTieneCreadoUnUsuario(java.lang.String,java.util.List<com.zunify.qa.models.UsuarioComercial>)'.
It appears you did not register a data table type.
	at io.cucumber.core.runner.PickleStepDefinitionMatch.registerDataTableTypeInConfiguration(PickleStepDefinitionMatch.java:95)
	........

**Caused by: io.cucumber.datatable.UndefinedDataTableTypeException: Can't convert DataTable to List<com.zunify.qa.models.UsuarioComercial>.
Please review these problems:

 - There was no table entry or table row transformer registered for com.zunify.qa.models.UsuarioComercial.
   Please consider registering a table entry or row transformer.

 - There was no default table entry transformer registered to transform com.zunify.qa.models.UsuarioComercial.
   Please consider registering a default table entry transformer.**

Note: Usually solving one is enough
	at io.cucumber.datatable.UndefinedDataTableTypeException.listNoConverterDefined(UndefinedDataTableTypeException.java:110)
	at io.cucumber.datatable.DataTableTypeRegistryTableConverter.toList(DataTableTypeRegistryTableConverter.java:136)
	at io.cucumber.datatable.DataTableTypeRegistryTableConverter.convert(DataTableTypeRegistryTableConverter.java:102)
	at io.cucumber.datatable.DataTable.convert(DataTable.java:360)
	at io.cucumber.core.stepexpression.StepExpressionFactory.lambda$createExpression$0(StepExpressionFactory.java:66)
	at io.cucumber.core.stepexpression.DataTableArgument.getValue(DataTableArgument.java:19)
	at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:47)
	... 55 more

What can i do????

feature is not under the 'features' directory. Requirements report will not be correctly generated!

15:15:39.536 [Test worker] INFO  i.c.core.plugin.SerenityReporter - Running feature from file:///D:/serenity-cucumber-starter/src/test/resources/features/search/search_by_keyword.feature
    15:15:39.536 [Test worker] WARN  i.c.core.plugin.SerenityReporter - Feature from file:///D:/serenity-cucumber-starter/src/test/resources/features/search/search_by_keyword.feature is not under the 'features' directory. Requirements report will not be correctly generated!

This happens on Windows using the vanilla serenity-cucumber-starter project.

In SerenityReporter the following code checks for the existence of \features\ in the URI ....
The usage of File.separatorChar is incorrect as the URI will always contain a forward slash.

        String featuresRoot = File.separatorChar + FEATURES_ROOT_PATH + File.separatorChar;
        if (pathURIAsString.contains(featuresRoot)) {

Command used to run the build:

gradlew build test aggregate reports

Unable to share data between steps

Environment:
serenity.version: 2.3.6
serenity.maven.version: 2.3.6
serenity.cucumber.version: 2.3.6
junit: 4.12

Steps to reproduce:

  1. Pull the project from below github url
    https://gitlab.com/alltempprojects/tempuiwebjvjunitcucumberserenity.git
  2. Run VerifyContactEmailInFooter.feature

Observe that, Then Verify test name as "VerifyContactEmailInFooterFeature" step is failed due to data is not shared between steps.

Expected:
Then Verify test name as "VerifyContactEmailInFooterFeature" step should be passed

Actual:
Then Verify test name as "VerifyContactEmailInFooterFeature" step is FAILED with null value

Note1: Used "TestContext" class in common folder to share data between steps
Note2: For reference see the results in "reports>serenity-reports" folder
Note3: It is working fine, while using with below 2 lines of code.
Serenity.setSessionVariable("testName").to(name);
String actualName = Serenity.sessionVariableCalled("testName");

serenity shared data issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.