Comments (4)
Hello,
Have you tried using Spring ConditionalOnProperty
?
This should only create the web driver bean if the tag you pass at runtime is @fe
@Configuration
@ConditionalOnProperty(name = "cucumber.tags", havingValue = "@fe")
public class WebDriverConfiguration {
}
// or
@Bean
@ConditionalOnProperty(name = "cucumber.tags", havingValue = "@fe")
public WebDriver webDriver() {
}
Pass it at runtime / or define it as a default in your app config
gradle test -Dcucumber.tags="@fe"
from courgette-jvm.
Thank you for your response.
I do have a solution if running via gradle cmd, but the issue is when setting a tag of @fe, then I won't be able to fire the API test. The problem is that the tags are not seen when @bean is called from CourgetteRunner class or when running test via Feature / Scenario level in Feature file.
from courgette-jvm.
Have you considered making your bean @Lazy
?
@Bean
@Lazy
public WebDriver webDriver() {
}
So only tests that require a webDriver bean will call it to launch a browser.
As your API tests doesn't need a webDriver bean, it simply won't be loaded / created and as a result, no browser will be launched.
You could also dynamically register the bean based on the Cucumber tags at runtime.
@Before
public void before(Scenario scenario) {
if (scenario.getSourceTagNames().contains("fe")) {
// register your webDriver bean here
}
}
from courgette-jvm.
Thank you for your feedback. Not tried @lazy will give it a go.
from courgette-jvm.
Related Issues (20)
- How to have the status as WARNING in the Courgette Report? HOT 5
- How to embed a URL in the courgette report as URL instead of just String? HOT 2
- How to integrate courgette with docker container HOT 4
- How fix java.lang.ClassNotFoundException: Files\Git\cmd;;/ HOT 3
- Running on Specific Devices HOT 18
- Parallel execution is not working running test on real devices (Android or iOS), it works fine on emulator and simulator HOT 1
- With Appium version 2.x is throwing error "org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented" HOT 1
- Courgette error processing reports HOT 2
- No Courgette Report is being produced if there are no tags as specified by the user, not in the project repo though. HOT 1
- Execute Courgette having test suite in a FAT JAR HOT 10
- Unable to override cucumber tags from the maven command line HOT 5
- Maven Build is failing with this error 'java: package com.fasterxml.jackson.datatype.jdk8 does not exist' HOT 3
- Query : How to retrieve System and environment info details HOT 5
- Report output get only show all failed HOT 1
- Reports not generated HOT 9
- error=206, The filename or extension is too long trying to execute my project with courgette-jvm HOT 1
- Courgette report index.html is not generated properly HOT 5
- Cucumber html report in Jenkins is not generated HOT 10
- Courgette test runner with junit 5 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from courgette-jvm.