12

My pom.xml looks like this

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.cvent</groupId>
    <artifactId>soa-readyapi</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>OnSite Solutions ReadyAPI Tests</name>
    <properties>
        <soapui.environment/>
        <soapui.test-suite/>
        <soapui.test-case/>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>com.smartbear</groupId>
                <artifactId>ready-api-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <projectFile>${soapui.projectFile}</projectFile>

                            <iface>IOrderService</iface>
                            <tool>wsi,axis1,axis2</tool>
                            <settingsFile>soapui-settings.xml</settingsFile>
                            <!-- <environment>${soapui.environment}</environment> -->
                            <outputFolder>output</outputFolder>
                            <junitReport>true</junitReport>
                            <printReport>true</printReport>
                            <projectProperties>
                                <value>one_api="https://someurl:4000"</value>
                                <value>two_api="https://someurl:4001"</value>
                                <!-- <value>environment=${soapui.environment}</value> -->
                            </projectProperties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

When I attempt to run this project with the following command -

mvn clean test -Dsoapui.projectFile=smokeTest

The tests appear to run with whatever the last active environment was set to in ReadyAPI. It ignores

   <value>one_api="https://someurl:4000"</value>
   <value>two_api="https://someurl:4001"</value>

I know I can use the environment feature to do this but that doesn't help me for my current use case. I would like to set it at run time, for now I am hardcoding the pom.xml to see if that would work but it has not.

Any ideas as to why readyAPI is ignoring the values I am setting in pom.xml?

Thank you

Anton Koscejev
  • 4,603
  • 1
  • 21
  • 26
moorecats
  • 3,242
  • 3
  • 21
  • 23

1 Answers1

0

I make the follow test to check if this works or not.

First I create a Groovy testStep and use the follow code to expand the project properties to check if there are loaded correctly from pom.xml:

log.info context.expand('${#Project#one_api}')
log.info context.expand('${#Project#two_api}')

Then I also add a REST testStep and I set ${#Project#one_api} as endpoint:

enter image description here

Finally I take your pom.xml (as @SiKing suggest it's necessary to drop the quotes from the value, as one_api=https://someurl:4000 instead of one_api="https://someurl:4000") and then execute the mvn clean test -Dsoapui.projectFile=./soaptestprj.xml.

The mvn trace show the following:

15:16:37,406 INFO  [SoapUIProTestCaseRunner] running step [Groovy Script INIT]
15:16:37,653 INFO  [log] https://someurl:4000
15:16:37,653 INFO  [log] https://someurl:4001
15:16:37,655 INFO  [SoapUIProTestCaseRunner] running step [initProcess]
15:16:40,491 ERROR [WsdlSubmit] Exception in request: java.net.UnknownHostException: someurl

Despite the fact that evidently it can not resolve someurl, seems that the plugin is passing correctly the <projectProperties>.

My guess is that may be the problem is that you're not referencing correctly the project property, check that you're specifying this correctly as ${#Project#YourProperty}.

Hope it helps,

albciff
  • 18,112
  • 4
  • 64
  • 89