tsundberg / gradle-cucumber-runner

A gradle plugin for running Cucumber-JVM
Apache License 2.0
20 stars 10 forks source link

Two windows per thread #4

Closed ckmoga closed 3 years ago

ckmoga commented 3 years ago

When I set threads to 1, I get two windows opened, if two then 4 windows.

`$ gradle cucumber --threads=2

Scenario: Set performance goal # src/test/java/features/performance-goal.feature:9

Scenario: Set regional preference # src/test/java/features/regional-preference.feature:9 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 44287 Only local connections are allowed. Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 37689 Only local connections are allowed. May 01, 2021 7:03:31 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS May 01, 2021 7:03:31 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch INFO: Found exact CDP implementation for version 90 May 01, 2021 7:03:31 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS May 01, 2021 7:03:31 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch INFO: Found exact CDP implementation for version 90 I am creating Chrome webdriver for scenario 2 I am creating Chrome webdriver for scenario 2 Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 2535 Only local connections are allowed. Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 6226 Only local connections are allowed. May 01, 2021 7:03:40 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS May 01, 2021 7:03:40 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch INFO: Found exact CDP implementation for version 90 May 01, 2021 7:03:40 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS May 01, 2021 7:03:40 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch INFO: Found exact CDP implementation for version 90 I am creating Chrome webdriver for scenario 1 I am creating Chrome webdriver for scenario 1 `

tsundberg commented 3 years ago

This is a behaviour that may happen if you don't close your browser properly.

However, as this runner is just a wrapper around running Cucumber from a command line, it is very unlikely that it is the runner that causes this behaviour. Therefore, I suggest that you run your scenarios some other way to remove the runner from the equation. It will show you that your problem lies somewhere in your step definitions or in some helper you have added.

Unfortunately, at the moment I can’t help you more based on your problem description.

ckmoga commented 3 years ago

Hi @tsundberg On closer investigation I found that my @Before block is executed twice; once as a complete scenario in itself and then again before running the other steps. Not sure why but will keep investigating. Probably has to do with the way I wanted to share login feature across scenarios.

tsundberg commented 3 years ago

Sounds like a reasonable reason.