Skip to content

Setting the Environment Variables with version 1.18.0 not working with Junit 5 #70

@visha-r

Description

@visha-r

I am trying to set the environment variables using the version 1.18.0 and I am always getting null. I am using Junit 5 and have no issues using 1.17.2 version to set the system environment variables. I need to set different environment values for different tests, so not setting the value right after creating the rule. My code looks like the following:

@Rule
private final EnvironmentVariables environmentVariables = new EnvironmentVariables();

@Test
void testEnvValues() {
    environmentVariables.set("service_env", "dev");
    assertEquals("dev", System.getenv("service_env")); // always fails
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions