Contributions
Re: Groovy script - How to run a teststep from another testsuite in your testsuite teardown script?
This is very strange, I also get the error message ERROR:groovy.lang.MissingPropertyException: No such property: testRunner for class: Script2 But no results are shown since the script just stops when the error appears... Is it really not possible to use the runner variable to execute a teststep from another testsuite...?11KViews0likes3CommentsIssue using multiple executions via soapui-maven-plugin
When executing SoapUI tests from one project in Jenkins via the soapui-maven plugin, I use the following pom.xml and everything works just fine: <?xml version="1.0" encoding="UTF-8"?> <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.davke</groupId> <artifactId>soapuirunner</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>soapuirunner</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies> <pluginRepositories> <pluginRepository> <id>smartbear-sweden-plugin-repository</id> <url>http://www.soapui.org/repository/maven2</url> </pluginRepository> </pluginRepositories> <build> <plugins> <plugin> <groupId>com.smartbear.soapui</groupId> <artifactId>soapui-maven-plugin</artifactId> <version>5.4.0</version> <configuration> <settingsFile>${SoapUI_GlobalSettings}</settingsFile> <projectFile>${SoapUI_ProjectFile}</projectFile> <testSuite>${SoapUI_TestSuite}</testSuite> <outputFolder>${basedir}/SoapUI-Reports</outputFolder> <junitReport>true</junitReport> <exportAll>true</exportAll> <printReport>true</printReport> <testFailIgnore>false</testFailIgnore> </configuration> <executions> <execution> <phase>test</phase> <goals> <goal>test</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>com.jgoodies</groupId> <artifactId>jgoodies-forms</artifactId> <version>1.9.0</version> </dependency> </dependencies> </plugin> </plugins> </build> </project> Now I would like to execute multiple projects and by reading online it seems to be possible when adding multiple executions in the pom.xml using the pom setup as described athttps://www.soapui.org/test-automation/maven/maven-2-x.html#6-Full-Example. When rearranging my pom.xml to use the same described setup (for now I use only one execution to test if it works), I have the following pom.xml: <?xml version="1.0" encoding="UTF-8"?> <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.davke</groupId> <artifactId>soapuirunner</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>soapuirunner</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies> <pluginRepositories> <pluginRepository> <id>smartbear-sweden-plugin-repository</id> <url>http://www.soapui.org/repository/maven2</url> </pluginRepository> </pluginRepositories> <build> <plugins> <plugin> <groupId>com.smartbear.soapui</groupId> <artifactId>soapui-maven-plugin</artifactId> <version>5.4.0</version> <dependencies> <dependency> <groupId>com.jgoodies</groupId> <artifactId>jgoodies-forms</artifactId> <version>1.9.0</version> </dependency> </dependencies> <executions> <execution> <phase>test</phase> <goals> <goal>test</goal> </goals> <configuration> <settingsFile>${SoapUI_GlobalSettings}</settingsFile> <projectFile>${SoapUI_ProjectFile}</projectFile> <testSuite>${SoapUI_TestSuite}</testSuite> <outputFolder>${basedir}/SoapUI-Reports</outputFolder> <junitReport>true</junitReport> <exportAll>true</exportAll> <printReport>true</printReport> <testFailIgnore>false</testFailIgnore> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> But when running the jenkins job, I get following console output: 10:42:41 Started by user d4vke 10:42:41 Building in workspace C:\Users\d4vke\.jenkins\workspace\SoapUI-Maven-Plugin 10:42:41 Parsing POMs 10:42:41 Established TCP socket on 54016 10:42:41 [SoapUI-Maven-Plugin] $ "C:\Program Files\Java\jdk1.8.0_144/bin/java" -cp "C:\Users\d4vke\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.12-alpha-1.jar;C:\Program Files\apache-maven-3.5.4\boot\plexus-classworlds-2.5.2.jar;C:\Program Files\apache-maven-3.5.4/conf/logging" jenkins.maven3.agent.Maven35Main "C:\Program Files\apache-maven-3.5.4" C:\Users\d4vke\.jenkins\war\WEB-INF\lib\remoting-3.25.jar C:\Users\d4vke\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.12-alpha-1.jar C:\Users\d4vke\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.12-alpha-1.jar 54016 10:42:43 <===[JENKINS REMOTING CAPACITY]===>channel started 10:42:44 Executing Maven: -B -f C:\Users\d4vke\.jenkins\workspace\SoapUI-Maven-Plugin\pom.xml com.smartbear.soapui:soapui-maven-plugin:test -DsettingsFile=C:\Users\d4vke\soapui-settings.xml -DprojectFile=SoapUI\EmployeePortal-soapui-project.xml -DtestSuite=EmployeePortal Tests 10:42:46 [INFO] Scanning for projects... 10:42:46 [INFO] 10:42:46 [INFO] ----------------------< com.davke:soapuirunner >---------------------- 10:42:46 [INFO] Building soapuirunner 0.0.1-SNAPSHOT 10:42:46 [INFO] --------------------------------[ jar ]--------------------------------- 10:42:47 [INFO] 10:42:47 [INFO] --- soapui-maven-plugin:5.4.0:test (default-cli) @ soapuirunner --- 10:42:48 SoapUI 5.4.0 Maven2 TestCase Runner 10:42:48 10:42:48,851 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\d4vke\soapui-settings.xml] 10:42:50 10:42:50,423 INFO [PluginManager] 0 plugins loaded in 1 ms 10:42:50 10:42:50,423 INFO [DefaultSoapUICore] All plugins loaded 10:42:50 10:42:50,979 INFO [SoapUI] File [C:\Users\d4vke\.jenkins\workspace\SoapUI-Maven-Plugin\soapuirunner-soapui-project.xml] does not exist, trying URL instead 10:42:50 10:42:50,979 ERROR [SoapUI] An error occurred [no protocol: soapuirunner-soapui-project.xml], see error log for details 10:42:50 java.net.MalformedURLException: no protocol: soapuirunner-soapui-project.xml 10:42:50 at java.net.URL.<init>(URL.java:593) 10:42:50 at java.net.URL.<init>(URL.java:490) 10:42:50 at java.net.URL.<init>(URL.java:439) 10:42:50 at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:227) 10:42:50 at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:41) 10:42:50 at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:28) 10:42:50 at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:349) 10:42:50 at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:202) 10:42:50 at com.eviware.soapui.maven2.TestMojo.execute(TestMojo.java:114) 10:42:50 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) 10:42:50 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 10:42:50 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) 10:42:50 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) 10:42:50 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) 10:42:50 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) 10:42:50 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) 10:42:50 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 10:42:50 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) 10:42:50 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) 10:42:50 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) 10:42:50 at org.jvnet.hudson.maven3.launcher.Maven35Launcher.main(Maven35Launcher.java:130) 10:42:50 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 10:42:50 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 10:42:50 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 10:42:50 at java.lang.reflect.Method.invoke(Method.java:498) 10:42:50 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 10:42:50 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 10:42:50 at jenkins.maven3.agent.Maven35Main.launch(Maven35Main.java:176) 10:42:50 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 10:42:50 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 10:42:50 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 10:42:50 at java.lang.reflect.Method.invoke(Method.java:498) 10:42:50 at hudson.maven.Maven3Builder.call(Maven3Builder.java:139) 10:42:50 at hudson.maven.Maven3Builder.call(Maven3Builder.java:70) 10:42:50 at hudson.remoting.UserRequest.perform(UserRequest.java:212) 10:42:50 at hudson.remoting.UserRequest.perform(UserRequest.java:54) 10:42:50 at hudson.remoting.Request$2.run(Request.java:369) 10:42:50 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) 10:42:50 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 10:42:50 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 10:42:50 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 10:42:50 at java.lang.Thread.run(Thread.java:748) 10:42:51 [ERROR] java.lang.Exception: Failed to load SoapUI project file [soapuirunner-soapui-project.xml] 10:42:51 [JENKINS] Recording test results 10:42:51 [WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/ 10:42:51 [WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/ 10:42:51 [INFO] ------------------------------------------------------------------------ 10:42:51 [INFO] BUILD FAILURE 10:42:51 [INFO] ------------------------------------------------------------------------ 10:42:51 [INFO] Total time: 4.938 s 10:42:51 [INFO] Finished at: 2018-09-27T10:42:51+02:00 10:42:51 [INFO] ------------------------------------------------------------------------ 10:42:51 Waiting for Jenkins to finish collecting data 10:42:51 [ERROR] Failed to execute goal com.smartbear.soapui:soapui-maven-plugin:5.4.0:test (default-cli) on project soapuirunner: SoapUI Test(s) failed: SoapUI Test(s) failed: 10:42:51 [ERROR] Failed to load SoapUI project file [soapuirunner-soapui-project.xml] 10:42:51 [ERROR] -> [Help 1] 10:42:51 [ERROR] 10:42:51 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 10:42:51 [ERROR] Re-run Maven using the -X switch to enable full debug logging. 10:42:51 [ERROR] 10:42:51 [ERROR] For more information about the errors and possible solutions, please read the following articles: 10:42:51 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 10:42:51 [JENKINS] Archiving C:\Users\d4vke\.jenkins\workspace\SoapUI-Maven-Plugin\pom.xml to com.davke/soapuirunner/0.0.1-SNAPSHOT/soapuirunner-0.0.1-SNAPSHOT.pom 10:42:51 channel stopped 10:42:52 Archiving artifacts 10:42:52 Finished: FAILURE I have no clue why it does not pickup my soapui project, but tries to execute a non-existingsoapuirunner-soapui-project.xml Is this not a valid pom.xml setup? Because Smartbear is using the same in it's online example: https://www.soapui.org/test-automation/maven/maven-2-x.html#6-Full-Example.1.3KViews0likes1CommentRe: Execute next testcase when the previous one failed
HiHimanshu, Thanks for the feedback, but unfortunately it does not provide a solution. Unchecking the "abort on error" option, keeps executing the next teststeps in the testcase, which I want to avoid. Let's say you have 3 teststeps: Add data Retrieve data Delete data If teststep add data fails, I don't want the other 2 to be executed.2.4KViews0likes2CommentsExecute next testcase when the previous one failed
I have the following setup: Atestsuite with 2 testcases TCA and TCB. Each testcase contains 3 teststeps (TSA1, TSA2, TSA3 &TSB1, TSB2, TSB3). In TSA2 I have added an assertion that makes the teststep fail. I'm executing the SoapUI project via the soapui-maven plugin in Jenkins. When executing via Jenkins, it runs TCA and fails at TSA2, and therefor it does not execute TSA3 (which is fine), but it does not start TCB (which it should execute). In SoapUI itself there is an option on the testcase level "Abort test if an error occurs" which is enabled by default. So i disabled it on both testcases and rerun it via Jenkins: When running TCA it fails at TSA2 but now it runs TSA3 (which should be skipped), and afterwards it runs TCB (which is what I need). So using the"Abort test if an error occurs" option does not provide a solution to my problem. How can I make it possible that if a teststep fails in a testcase: it does not execute the next teststep(s) of the same testcase it does execute the next testcase(s) Any help is appreciated!Solved2.5KViews0likes4CommentsGroovy script - How to run a teststep from another testsuite in your testsuite teardown script?
I'm able to run a testcase teardown script in my testsuite TS1 that runs a teststep from another testsuite TS2. testRunner.testCase.testSuite.project.testSuites["TS2"].testCases["TC2"].testSteps["STEP2"].run(testRunner, context); But as this teststep should run for all my testcases in TS1, I need to add the teardown script for each testcase. I want to know if I could achieve the same thing directly from the testsuite teardown script, which would save me a lot of script maintenance. Unfortunately the testrunner object is not available at testsuite level, but I don't know how (or if it's possible) to do it using the runner object. Any help is much appreciated!11KViews0likes9Comments