Forum Discussion

d19price's avatar
d19price
Occasional Contributor
16 days ago

Set active environment on Save

 

What is the correct way to always set the active environment to "Dev" upon saving a project?

Forgetting to do this creates a huge number of Git differences.

I tried with the below in my Project->Save Script and this works if the active environment is already set to "Dev", but fails with a bunch of errors if the active environment in the GUI is set to, for example, "Test" (the switch is actually made though to "Test").

project.environmentList.setActiveEnvironment("Dev")

 

 

 

2 Replies

  • d19price's avatar
    d19price
    Occasional Contributor

    *I tried with the below in my Project->Save Script and this works if the active environment is already set to "Dev", but fails with a bunch of errors if the active environment in the GUI is set to, for example, "Test" (the switch is actually made though to "Dev").

  • I'm not sure if this is what you mean, but when you select Configure Environments from the drop down to the right, you can select which one of the environments if the Active one for a given project. That config will persist even when you restart ReadyAPI.

    Is that what you were looking for?

    Let me know how it goes!