How to manage multiple environments

Best practices, code snippets for common functionality, examples, and guidelines.
d3-luca
Posts: 2
Joined: Tue Feb 13, 2018 11:09 am

How to manage multiple environments

Post by d3-luca » Tue Feb 13, 2018 11:17 am

Hi,
I'm evaluating the Ranorex product. I need to perform Web automated tests against multiple environment (development, staging, production, etc.)
For each environment I have different data (url, form data, credentials) to be provided to my test cases. I thought run configuration is a great option to choose the environment but I don't know how to switch data for the selected environment.
Could someone help me, please?

Thank you

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to manage multiple environments

Post by odklizec » Wed Feb 14, 2018 1:14 pm

Hi,

Well, running tests at different sites and with different credentials is easy. Simply create a data connector, where each row contains address and user name/password for each environment. This data connector should be added to first TestCase/SmartFolder, so it will act as a loop, which runs set of modules under this TC/SF on each environment stored in data connector. For example, it will run all your tests first at development env. (first row), then staging env. (second row), then anything else (third row). If you don't want to run your tests at all places at once, you can define (either via GUI, command line or additional code), which data connector row should be started under which circumstance.

As for different data on each environment, that's hard one. I don't have a clue what kind of data we are talking about? Some external files, or simply different tables/cells selected/validated during test? You should have all "random" inputs variabilized, so then you can easily change the content of inputs during the test, based on the actual environment. But again without knowing more about your test and data, it's hard to suggest something sensible and reliable ;) There is no general solution of this problem, except using variables, data connector etc...

To be honest, the best approach is to have a separate test automation environment with the same data on each system. These data should not be used or changed by anyone else, except your test automation and eventually, they should be restored at the end of test back to their initial state. If someone tells you that you can't have a separate test environment/data for TA, then feel free to tell him (or his/yours superior) that he cannot have consistent results from TA :D Seriously, if someone expects consistent results, then the data/settings should be the same on all systems. Creating and maintaining separate test data for each system is a nightmare, especially if data changes over the time.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

d3-luca
Posts: 2
Joined: Tue Feb 13, 2018 11:09 am

Re: How to manage multiple environments

Post by d3-luca » Wed Feb 14, 2018 2:09 pm

Hi,
thanks for your answer.
Can you please specify how run a test using a specific row, please?

Thank you

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to manage multiple environments

Post by odklizec » Wed Feb 14, 2018 2:15 pm

Hi,

You can specify the test case data range via command line (as described here)...
run second row:
YourTestName.exe /tcdr:TestCaseOrSmartFolderName=2

run second to fourth row:
YourTestName.exe /tcdr:TestCaseOrSmartFolderName=2-4
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration