Forum Discussion

SKoneru's avatar
SKoneru
Contributor
12 years ago

Environment switch doesn't work

Hi,

I did respond to this issue in my original post and noticed that I did not get any response(guessing may be because the Subject for that forum request is set as [Resolved]).
So created this new post. But please refer to my issue in this forum.
viewtopic.php?f=2&t=21716

The suggestion I got is to rely on "environment" option in settings.

I did try providing <environment> option and it didn't work. The value that I provided does not override with what is saved with the project.

In maven pom.xml file, I defined the environment in configuration section as follows-
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-pro-plugin</artifactId>
<version>4.5.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>Trading-soapui-project.xml</projectFile>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<outputFolder>${outputdir}</outputFolder>
<settingsFile>../Common/soapui-settings.xml</settingsFile>
<environment>QA</environment>
</configuration>
</execution>
</executions>

In the test case there is a Groovy test step that just prints the environment. Below is the simple Groovy script:-
def env = testRunner.testCase.testSuite.project.getActiveEnvironment().getName()
log.info "environment= ${env}"

This always prints the environment value with what is saved in the project. The value that we provided does not override. I saved the project with environment as "Production", so the
value displays as "Production" rather than "QA".

Can you please validate if this functionality is working.

Thanks in advance.

1 Reply

  • Hi,

    If you provide environment name in maven plugin configuration it uses all the values related to that environment. Although, it does not actually switch the active environment saved in your project but it should give you same functionality behind the scene.

    I have tried it in 4.6.1 plugin and verified that maven plugin uses configured environment related values though it does not switch the active environment. Let us know if you have any further questions on this.

    Shadid
    SmartBear Sweden