My serenity project feature is working perfectly, by running maven project by using
mvn clean verify
But our leadership is against keeping login credentials(userId, password) in the feature file or any external properties file. Only supplying them in the command line like
mvn exec:java -Dexec.mainClass="com.module.test.Main" -Dexec.args="arg0 arg1 arg2"
But in Serenity, there is no Main.java file with main() method. Then
how do I invoke my serenity feature file to run using Maven with the provided 2 arguments ?
Your suggestions are highly appreciated,
First off, your company is doing the right thing. Sensitive data should never be committed to code. If it is then anybody who has access to the code has access to everything.
Serenity allows parameters to be passed at runtime, e.g.
mvn clean verify -DUSERNAME=bob -DPASSWORD=mysupersecurepassword
This will pass the values into the serenity runner. Serenity then provides a utility to read in these values using SystemEnvironmentVariables.createEnvironmentVariables, e.g.
EnvironmentVariables envs = SystemEnvironmentVariables.createEnvironmentVariables();
String username = env.getProperty("USERNAME");
String password = env.getProperty("PASSWORD");