automated-teststosca

How do you Build test cases in Tosca that supports SIT and UAT environments in one script


Does anyone have a good working pattern/style/best practice for handling this situation:

I'm trying to develop test cases that are designed to work in either an SIT or UAT environment by simply switching the Test Configuration Parameter: "TestEnvironment" from SIT to UAT...

I'm running into all kinds of roadblocks due to things Tosca CANNOT do... For example, Tosca cannot handle extrapolating test configuration parameters {CP[]} nested inside {XL[]} reference during template instantiation... (i.e. this is invalid: {XL[Preconditions.URL.{CP[TestEnvironment]}]} (it CAN, however handle nested stuff during runtime, for example this is valid at runtime: {B[URL-{CP[TestEnvironment]}]} )

So, the issue I'm trying to resolve is storing the URL, test site ID, User ID, password, and other enviroment specific data such that the test script can properly call data from either SIT or UAT on the fly as needed...

I've tried storing the separate environment data in the test sheets (which doesn't support hiding passwords), I've tried storing data in buffers, but buffers are machine specific, so they would need to be pre-loaded from datasheets anyway) but I feel like the preloading is an ugly kludge.

Clearly, Tricentis intended test configuration parameters to be the key switching mechanism for this... But how do you implement it? Has anyone solved this in an -elegant- way?


Solution

  • You can nest configuration parameters and introduce a pattern for naming them accordingly.

    Define all parameters for the environment with a unique identifier at the beginning:

    SITUrl, SITUser,...

    UATUrl, UATUser,...

    You can use another CP called TestEnvironment that you set to "UAT" or "SIT" to switch between them:

    {CP[{CP[TestEnvironment]}User]}

    {CP[{CP[TestEnvironment]}URL]}

    This will always use the user and URL depending on the value set in TestEnvironment.