Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to access more than URL from serenity conf #2458

Closed
nyjoshi opened this issue May 13, 2021 · 4 comments
Closed

Trying to access more than URL from serenity conf #2458

nyjoshi opened this issue May 13, 2021 · 4 comments

Comments

@nyjoshi
Copy link

nyjoshi commented May 13, 2021

Has anyone figured out a way to access more than URLs from serenity.conf? I have been trying to access ID passwords for different env's but keep on getting the null pointer exception. I can access different URLs but not the ID's.

my.webservice.endpoint = "https://localhost/"
my.companyID = "local"
my.userId = "local"
my.password = "local@1234"
@globalworming
Copy link
Collaborator

globalworming commented May 13, 2021

how do you do it? i never had any issues using the EnvironmentVariables class

https://serenity-bdd.github.io/theserenitybook/latest/environment-specific-config.html

@nyjoshi
Copy link
Author

nyjoshi commented May 13, 2021

public class BasePage extends PageObject {
    private EnvironmentVariables environmentVariables;
    
    public void env_var(){
        String environment = EnvironmentSpecificConfiguration.from(environmentVariables).getProperty("my.companyID");
        System.out.println(environment);
    }
}

So this is how I am trying to access it... and my serenity.conf contains the above code in the environments section.

@nyjoshi
Copy link
Author

nyjoshi commented May 13, 2021

pasting my serenity.conf again

webdriver {
  driver = chrome
  autodownload = true
  timeouts.implicitlywait = 5500
  wait.for.timeout = 10000
}

environments {
    funky {
                my.webservice.endpoint = "https://localhost/"
                my.companyID = "local"
                my.userId = "local"
                my.password = "local@1234"
              }
}

@wakaleo
Copy link
Member

wakaleo commented May 14, 2021

You need to set the environment variable to the name of your environment (e.g mvn verify -Denvironment=funky).

@wakaleo wakaleo closed this as completed Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants