Forum Discussion

elamink's avatar
elamink
Regular Visitor
9 years ago

Aoth mvn soap ui

Running soap ui from maven below is my POM.  I have OAUTH 2.0 implicit grant that works when I run my test in soap ui.  I automated it in Java script.  When i execute my soap ui project from maven I recieve an error that auoth cant authenticate.  What do i need to do to get my oauth to work when running in maven locally and then in jenkins.

 

<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>SoapUITestRunner2</groupId>
    <artifactId>SoapUITestRunner2</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>SoapUITestRunner2</name>
    <description>SoapUITestRunner2</description>
    <repositories>
        <repository>
            <id>soapUI</id>
            <url>http://www.eviware.com/repository/maven2/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>smartbear-sweden-plugin-repository</id>
            <url>http://www.soapui.org/repository/maven2/</url>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
            <groupId>com.smartbear.soapui</groupId>

<artifactId>soapui-maven-plugin</artifactId>
<version>5.0.0</version>
<configuration>
            <projectFile>Exposure-soapui-project.xml</projectFile>
            <projectProperties>
                <value>message=Hello World!</value>
            </projectProperties>
        </configuration>

<executions>
</executions>

            </plugin>
             <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>**/*Test.java</exclude>
                </excludes>
            </configuration>
        </plugin>
        </plugins>
        
    </build>
    
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
    </dependencies>
    <profiles>
    <profile>
        <id>integration-tests</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <includes>
                            <include>**/*IntegrationTest.java</include>
                        </includes>
                        <excludes>
                            <exclude>**/*Test.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
</project>

1 Reply

  • Varma's avatar
    Varma
    New Contributor

    Hi All,

    I'm having similar problem from long time. In our case using "Authorization Code Grant". My pom.xml & Maven execution log are as below. Any help on this will be really appreciated.

     

    POM.XML:-

    <profile>
                <id>apismoke-testing</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>com.smartbear</groupId>
                            <artifactId>ready-api-maven-plugin</artifactId>
                            <version>1.4.1</version>
                            <dependencies>
                                <dependency>
                                    <groupId>com.github.fge</groupId>
                                    <artifactId>json-schema-validator</artifactId>
                                    <version>2.2.6</version>
                                </dependency>
                            </dependencies>
                            <configuration>
                                <projectFile>${basedir}/src/test/resources/Marketlink-API-soapui-project.xml</projectFile>
                                <outputFolder>${basedir}/target/soapui</outputFolder>
                                <junitReport>true</junitReport>
                                <printReport>true</printReport>
                                <endpoint>https://ecx-xxx-xx-xx-xxx.compute-1.amazonaws.com:8xx9</endpoint>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>

     

    Log:-

    15:11:20,830 INFO  [SoapUIProTestCaseRunner] running step [GET List]
    15:11:20,845 INFO  [OAuth2RequestFilter] The access token has expired, trying to refresh it.
    15:11:21,551 ERROR [SoapUI] An error occurred [Unable to refresh expired access token.], see error log for details
    15:11:22,118 INFO  [SoapUIProTestCaseRunner] Assertion [Valid HTTP Status Codes] has status FAILED