0

I've got a project with Serenity properties file configuration and I want to put a security code before to start the test, so at the beginning when I prepare the test, I clean the value like this:

...
serenity.timeout=1000
secretVariable=
serenity.verbose.steps=FALSE
...

but when I run the test, I want to change the serenity.properties like this:

...
serenity.timeout=1000
secretVariable=24C20-00034D2
serenity.verbose.steps=FALSE
...

So , my question is, is this possible using a java code and/or maven configuration?

1 Answer 1

0

If you want to change some non-configuration file settings, I may only provide configuration related to the springboot project, you can set your vm option:

--serenity.timeout=1000
--secretVariable=24C20-00034D2
--serenity.verbose.steps=FALSE

Or you can modify the args parameter of your launch:

 String[] arg=new String[3];
 arg[0]="--serenity.timeout=1000";
 arg[1]="--secretVariable=24C20-00034D2";
 arg[2]="--serenity.verbose.steps=FALSE";

This is the method I can think of. I have not tried to use maven to manage these parameter configurations, but I have used maven to manage parameter modules. You can use this method to manage, and it supports .yml and .proerties, I will give you an example, but for the specific usage method, you need to go to the official springboot documentation to find the detailed usage method:

maven:

<!--Configure maven multi-environment development-->
<profiles>
    <profile>
        <id>enc_dev</id>
        <properties>
            <profile.active>dev</profile.active>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
    </profile>
    <profile>
        <id>enc_dev</id>
        <properties>
            <profile.active>dev</profile.active>
        </properties>
    </profile>
</profiles>

application.proerties:

[email protected]@
spring.profiles.group.dev=devMVC,devDB
spring.profiles.group.pro=proMVC

This way you can easily manage the modules you want and do targeted configuration, hope this helps you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.