TestSuite: Setup Script: How to get current environment selected using the groovy script?
Solved! Go to Solution.
Sorry, took the liberty to provide an anwser here
def active_environment = testSuite.project.activeEnvironment.name
Bonus: Handy script to enable/disable some testcases based on your environment name looks like this:
def active_environment = testSuite.project.activeEnvironment.name def tc1 = testSuite.getTestCaseByName("GET xxxxxxxx") def tc2 = testSuite.getTestCaseByName("GET yyyyyyyy") if (active_environment != "Sandbox" && active_environment != "TEST" && active_environment != "BETA"){ log.info ("Active environment = "+ active_environment + " --> Higher than BETA, so we do not have a mock authorization service available ------> disabling GET test cases") tc1.setDisabled(true) tc2.setDisabled(true) } else{ tc1.setDisabled(false) tc2.setDisabled(false) }
Issue is resolved
That's great to hear!
Do you mind sharing the solution you've found? It will help other users in the future.
Sorry, took the liberty to provide an anwser here
def active_environment = testSuite.project.activeEnvironment.name
Bonus: Handy script to enable/disable some testcases based on your environment name looks like this:
def active_environment = testSuite.project.activeEnvironment.name def tc1 = testSuite.getTestCaseByName("GET xxxxxxxx") def tc2 = testSuite.getTestCaseByName("GET yyyyyyyy") if (active_environment != "Sandbox" && active_environment != "TEST" && active_environment != "BETA"){ log.info ("Active environment = "+ active_environment + " --> Higher than BETA, so we do not have a mock authorization service available ------> disabling GET test cases") tc1.setDisabled(true) tc2.setDisabled(true) } else{ tc1.setDisabled(false) tc2.setDisabled(false) }
Thank you, @JoostDG!
User | Count |
---|---|
6 | |
6 | |
4 | |
2 | |
1 |