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.

SOATest-Can we define environments at project level?

Testuser
Testuser Posts: 41

Our team is trying to work in SOATest and checking in our SOATest files into IBM RTC (Rational Team Concert). We are working on different tst files under the same project. But the challenge is we use the same Environment so I was wondering if there is a way to define Environments at the Project level instead of Test Suite level ? We cant go with working on the same .tst file and adding different tests under the same Test Suite because that will cause conflicts.
Can someone please help us to understand how to tackle this problem of running all the tst files under the same project using the same environment at a global level ?

Tagged:

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    I'd recommend managing your environments from a .envs file. See Parasoft SOAtest User's Guide > Functional/Integration Testing > End-to-End Test Scenarios > Referencing Environments

    "Using environment references, you can easily modify the configurations of multiple projects from a single location."

  • Testuser
    Testuser Posts: 41

    Thanks for the response. This was really helpful.

  • Testuser
    Testuser Posts: 41

    I referred this in the SOATestUser Guide . Its asking to use .env file. I am sorry but I am not aware if the .env file has to be in a certain format so that I can use that in the Environment Reference. Any pointers would be really helpful. Thank!

  • Testuser
    Testuser Posts: 41

    Sorry, I could find the way out. I exported the existing environment into my file system and could get the sample .env file. Thank you so much!

  • OmarR
    OmarR Posts: 233 admin

    Testuser!

    It may be easier to export your current environment from the GUI and use the file as a template. Simply right-click your favorite environment in the GUI and click "Export Environment" to view the format.

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited February 2017

    The format of an Environment Set file is relatively straight forward. You can create one from a tst file with internal environments by selecting the environment nodes (CTRL+click), then clicking Export from the right-click menu. The file extension is .envs (note the 's' at the end). For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <Environments xmlns="http://www.parasoft.com/schema/environment/1.0" product="SOAtest">
       <Environment name="a">
          <Variable>
             <Name>FOO</Name>
             <Value>123</Value>
          </Variable>
          <Variable>
             <Name>BAR</Name>
             <Value>456</Value>
          </Variable>
       </Environment>
       <Environment name="b">
          <Variable>
             <Name>FOO</Name>
             <Value>789</Value>
          </Variable>
          <Variable>
             <Name>BAR</Name>
             <Value>012</Value>
          </Variable>
       </Environment>
    </Environments>
    
  • Testuser
    Testuser Posts: 41

    Thank you all for your response. I tried this and it worked fine for me.

  • Testuser
    Testuser Posts: 41
    edited March 2017

    So I found one issue with using Reference Environment.
    I want to run my multiple tst files against a common environment.
    1) I exported one of the environment into 'Env1.env' file and exported second environment into 'Env2.env' file.
    2)In my system I created a copy of Env1.env file and renamed it to 'TestEnv.env file'.
    Now in SOATEST, I created Environment Reference for the individual tst files and referred to 'TestEnv.env' file and ran my tests and it ran fine.
    3)Then I closed my SOATEST and then reopened and in my system(Windows explorer) where my environment file was saved (Step2), removed the 'TestEnv.env file', I created a copy of Env2.env file and renamed it to TestEnv.env file.(did this so as to switch between Env1 and Env2).
    4) In SOATest clicked on refresh, it showed the Env2 under Environment Reference. Then ran my tests and it failed with below error:
    Error Message:
    DataSource: Models (row 1), Models (row 1): Unable to instantiate class "${jdbc_driver}". Please
    check the DB driver classname and the jar file locations in Parasoft > Preferences > JDBC
    Drivers.: 08001

    5) Now I went to one of the tst file > Environment > Environment references and right clicked on Env2 and Selected as 'Set as Active' and then ran the test and it ran fine.

    So does this mean if I have to switch between environments , I need to go to the individual Environment References in SOATest and set the environment to Active?I have enclosed my environment file.
    Also isn't there an indicator/flag in the environment xml file which says if its active or not

  • Testuser
    Testuser Posts: 41
    edited March 2017

    Not sure if everyone can see my environment file attachment. So pasting the contents below:
    <?xml version="1.0" encoding="UTF-8"?>


    HOST
    fiisfdns94.fmr.com


    jdbc_driver
    oracle.jdbc.OracleDriver


    jdbc_url
    jdbc:oracle:thin:@fiisfsa03t.fmr.com:1521/sn_fsa03t


    jdbc_username
    fsabatch

  • jakubiak
    jakubiak Posts: 795 admin

    Yes, in order for an environment to be used it needs to be active. You can do that in the UI the way that you did. You also have controls to configure the active environment in the test configuration settings: you could set up two different test configurations, one which uses one environment and another which uses a different environment. If you are running from command line there are also CLI flags that you can pass to control which environment gets used.

  • Testuser
    Testuser Posts: 41
    edited March 2017

    Thanks jakubiak. So if I have to run 100 tst files and all of them are using Environment reference and if I switch environment, I need to go to individual tst files > Environment Reference to make the environment active ? Isnt it cumbersome and trumps the purpose of having a common environment reference ?
    When you are saying this can be done form Test Configurations, can you please give me some pointers how can I reference environment in Test Configurations and I assume through this it will set up the active environment for all tst files under a project correct ?

  • jakubiak
    jakubiak Posts: 795 admin

    Each project needs to have the same environments with the same names. In the Test Configuration, you simply need to specify the name of the environment and it will use it for all tst files since each tst file will have that named environment.

  • Testuser
    Testuser Posts: 41

    Thanks jakubiak. This option in the Test Configuration will make our lives easier if we have to run multiple tests against multiple environments.
    I think Reference Environment is not the preferred solution if you want to run multiple tests against couple of environment without going to each and every individual tst file but setting the environment option in Test Configuration sure is.

Tagged