Forum Discussion

rajs2020's avatar
rajs2020
Frequent Contributor
4 years ago
Solved

ReadyAPI - Running a test with configurations

I have some tests in which I have to manually change one setting in a config file to run the tests. The setting depends on which test we are running. I don't know if this approach to using ReadyAPI itself is good or bad. But, I would like to be able to create test run configurations for any test instead of manually finding that file and editing it each time. Let me explain more with an example.

In programming IDEs like Intellij IDEA/Eclipse, you can run a test with configurations and you can have multiple configurations for a test. Here is a generic example of how we use that feature. Say we have a test for login to Gmail. For that test, we can have one run config with browserName = chrome. Another config could be browserName = all which will run that test in chrome, firefox and safari. So, for my test, I could make a config like mySetting = abc.

Similarly, do we have run configs for ReadyAPI tests? If not, then why?

Keywords - Run configuration, Debug configuration, Test configuration, Run Config, Debug config, Run time configs.


  • ChrisA's avatar
    ChrisA
    4 years ago

    Hi,

    You could use the 'CustomProperties' tab in the Environments UI.  You can then 'pull' those environment level customer properties into any test you are using.

     

    As for config in a Groovy script, may you use the Setup Script tab (availability at Project, test Suite, Test Case) layers to pull in the config from your groovy script.

3 Replies

  • rajs2020 :

     

    I would suggest you to use global properties in this case. You can set the desired values in global properties and fetch the values from there.

     

    Settings -> Preferences -> Global Properties

     

     

    • rajs2020's avatar
      rajs2020
      Frequent Contributor

      Thanks. What if the config is stored in a groovy script and we have to first load the script from project settings, before running any tests?

      • ChrisA's avatar
        ChrisA
        Contributor

        Hi,

        You could use the 'CustomProperties' tab in the Environments UI.  You can then 'pull' those environment level customer properties into any test you are using.

         

        As for config in a Groovy script, may you use the Setup Script tab (availability at Project, test Suite, Test Case) layers to pull in the config from your groovy script.