Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Running/Skipping Tests by Environment in SOAtest

Options
kseniia
kseniia Posts: 5

I'm on the lookout for a SOAtest solution to selectively run/skip scenarios/test suites and individual tests in specific environments. Ideally, something similar to Cucumber's tagging magic (like @dev, @val) to run or skip tests based on those tags.

We gave test flow logic a shot, but it's not sufficient for all our use cases. Seems it only plays nice with one variable condition, and we need more flexibility.

Answers

  • benken_parasoft
    benken_parasoft Posts: 1,235 ✭✭✭
    Options

    To conditionally run/skip tests within a tst file you would have to use a test logic variable. You can try initializing its value from an environment variable (${varname}) to control this based on the active environment.

    To conditionally run/skip tst files from soatestcli, you can use a ".lst" file. The -resource, -include, and -exclude arguments can accept a ".lst" file.

  • kseniia
    kseniia Posts: 5
    Options

    @benken_parasoft thank you for your response! in order to utilize a test logic variable within a tst, is it necessary to create a test suite variable for each individual test?
    For example, I have a tst with 3 tests in it. I have setup 1 test suite variable per each test, boolean, default to "false". In my test flow for each test I have a condition to run the test only if that variable is true. I then pass those values from my environment. Did I get it right?

  • benken_parasoft
    benken_parasoft Posts: 1,235 ✭✭✭
    edited December 2023
    Options

    is it necessary to create a test suite variable for each individual test?

    No. Variables can be reused or referenced multiple times. For example, you originally described tags like "@dev" and "@val". You could define variables with names like that and assign them to test cases you want executed conditionally.

    for each test I have a condition to run the test only if that variable is true

    Whether you want to use the same variable or different variables is up to you. Which tests you want to execute conditionally based on a "tag" variable is up to you.

    I then pass those values from my environment. Did I get it right?

    It would have to be a variable of type "string" so you can set the value to "${ENV_VAR}". For example, if you have a test variable named "@dev" and an environment variable named "DEV" then you set the value of "@dev" to "${DEV}".

    Another approach could be to have a single variable named "tag" with environment variable "TAG". You would initialize the "tag" variable to "${TAG}". You can then assign "tag" to any tests you want executed conditionally. You would then configure the "variable condition" based on the value of tag, like whether the value is "@dev" or "@val".

  • kseniia
    kseniia Posts: 5
    Options

    @benken_parasoft could we possibly schedule a MS Teams screenshare to walk through the process together? I'm finding it a bit challenging to grasp on my own