Open jackpaul24 opened 7 months ago
You need to fetch the environment variables by calling SerenityInfrastructure.getEnvironmentVariables().
You need to fetch the environment variables by calling SerenityInfrastructure.getEnvironmentVariables().
Thanks @wakaleo , tried SerenityInfrastructure but still getting the same error 👎
`import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import net.serenitybdd.annotations.Step; import net.serenitybdd.annotations.Steps; import net.serenitybdd.model.environment.EnvironmentSpecificConfiguration; import net.serenitybdd.core.di.SerenityInfrastructure;
public class ConnectionSteps extends BaseSteps {
@Steps SerenityInfrastructure environmentVariables;
@Step public void testConnection(EnvironmentVariables environmentVariablesIn) { reachHost(environmentVariablesIn); }
@Step public void testConnection() { reachHost(environmentVariables); }
private void reachHost(EnvironmentVariables environmentVariables) { String driverConfig = EnvironmentSpecificConfiguration.from(environmentVariables).getProperty("webdriver.driver"); assertThat(driverConfig).isNotNull(); logger.info("Testing connection with driver config: {}", driverConfig); } }`
You shouldn't have the @Steps annotation for the EnvironmentVariable field - just use SerenityInfrastructure.getEnvironmentVariables() whenever you need the environment variables.
Hi, is there a resolution for this? I am also getting the same error but its not related to environment variables
I am getting NoClassDefFoundError : net/thucydides/core/ThucydidesSystemProperty error while upgrading serenity version from 2.2.2 to 4.x.x with Java 17. Any suggestions?
What happened?
I was trying upgrade serenity version in the Test framework from 2.6.x to 4.0.15 and followed the migiration steps as outlined in https://serenity-bdd.github.io/docs/tutorials/migrating_to_serenity_4
After upgrade when i try to run a test encontered with Step InitialisationExcetion
Error message: Step failed net.serenitybdd.core.exceptions.StepInitialisationException: Failed to create step library for ConnectionSteps:Failed to create step library for EnvironmentVariables:Could not create type
ConnectionSteps.java
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import net.serenitybdd.annotations.Step; import net.serenitybdd.annotations.Steps; import net.serenitybdd.model.environment.EnvironmentSpecificConfiguration; import net.thucydides.model.util.EnvironmentVariables;
public class ConnectionSteps extends BaseSteps {
}
What did you expect to happen?
@wakaleo All my test are running find in the older version 2.6.x but in the 4.0.15 it started to faile due to StepInitialisationException
Serenity BDD version
4.0.15
JDK version
11
Execution environment
Local
How to reproduce the bug.
Create project with Page class extends BasePage Steps extends BaseSteps Create feature file and runner class Execute test
How can we make it happen?
Add it to the Serenity BDD backlog and wait for a volunteer to pick it up