chriscropleyOccasional ContributorJoined 8 years ago6 Posts2 LikesLikes received2 SolutionsView All Badges
ContributionsMost RecentMost LikesSolutionsRe: How to retrieve Node Tree when child value matches text Thanks to some valuable contributions from other sites, I managed to find a solution. It was fairly easy in the end stiching some ideas from those posts. I have put it here in case anyone would like to make use of it. import groovy.util.* import java.text.SimpleDateFormat def sdfDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss") //Parse XML content in the response def completedResponse = context.expand( '${ListCompletedStreams#Response}' ) def parsedcompletedResponse = new XmlSlurper().parseText(completedResponse) //Loop over each Job Entry parsedcompletedResponse.jobs.jobEntry.each { jobEntry -> //Loop over every steo entry and pull out only those steps that fail. Find the parent Job Name and other parent properties. jobEntry.steps.stepEntry.each { stepEntry -> if (stepEntry.stepState.text() == "FAILED" ) { def strJobEntryRunDate = Date.parse("yyyy-MM-dd'T'HH:mm:ss", "${jobEntry.runDate.text()}") log.info "\tJob Stream : ${jobEntry.name.text()} starting at " + sdfDateFormat.format(strJobEntryRunDate) + " has a failed Job Step." log.info "\tJob Step: ${stepEntry.stepName.text()} failed after ${jobEntry.runDuration.text()} minutes." } } } return null How to retrieve Node Tree when child value matches text Dear Smartbear community, it has been a while since I have been at the coal face however I have searched far and wide for a response yet I can't quite find a solution to my problem. I hope someone can help. I am using groovy to parse an API call response in xml. An example is below: <GetJobs> <jobs> <jobEntry> <name>JOB_NAME</name> <status>RUNNING</status> <runDate>2021-08-31T19:58:27+10:00</runDate> <runDuration>0 days 00:47:14</runDuration> <chainName>JOB_NAME_CHAIN</chainName> <runningStep>STEP_FOUR</runningStep> <steps> <stepEntry> <stepName>STEP_ONE</stepName> <stepState>SUCCEEDED</stepState> </stepEntry> <stepEntry> <stepName>STEP_TWO</stepName> <stepState>SUCCEEDED</stepState> </stepEntry> <stepEntry> <stepName>STEP_THREE</stepName> <stepState>FAILED</stepState> </stepEntry> <stepEntry> <stepName>STEP_FOUR</stepName> <stepState>RUNNING</stepState> </stepEntry> <stepEntry> <stepName>STEP_FIVE</stepName> <stepState>NOT_STARTED</stepState> </stepEntry> </steps> </jobEntry> </jobs> <jobStatus>RUN</jobStatus> <startDate>2021-08-31</startDate> <jobName/> <returnType>NEW</returnType> </GetJobs> I essentially want to pull out the <name> and <stepName> for the 'FAILED' steps (i.e. STEP_THREE). Or ALL <stepNames> that meet the search string, like 'RUNNING' or 'FAILED' So it might print line "Job " + node.name.text() + " Step " + node.stepname.text() + " Failed." "Job JOB_NAME Step STEP_THREE Failed." As I say it has been a while since I have needed to solve these problems and I am a bit rusty. I am a big flumoxed and any help would be much appreciated. Solvedmaven-compiler-plugin:3.1:compile java.nio.file.InvalidPathException: Illegal char <*> at index 99 I have followed this https://support.smartbear.com/readyapi/docs/testing/integrations/ci-systems/maven/working.html help file to integrate Ready-Api to Maven. I am using Ready-API 2.1 and Maven 3.5. When I execute this command "mvn clean test" it downloads all of the dependencies and eventually fails with this error... [INFO] --- maven-compiler-plugin:3.7:compile (default-compile) @ b2bresponder --- Nov 23, 2017 6:54:12 PM com.google.inject.internal.MessageProcessor visit INFO: An exception was caught and reported. Message: java.nio.file.InvalidPathException: Illegal char <*> at index 99: C:\Users\chris.cropley\.m2\repository\com\smartbear\utils\analytics\out-app-analytics-provider\lib\*.jar java.nio.file.InvalidPathException: Illegal char <*> at index 99: C:\Users\chris.cropley\.m2\repository\com\smartbear\utils\analytics\out-app-analytics-provider\lib\*.jar at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229) at java.base/java.io.File.toPath(File.java:2300) at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:951) at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:216) at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:148) at java.base/java.util.jar.JarFile.<init>(JarFile.java:324) at java.base/java.util.jar.JarFile.<init>(JarFile.java:295) at java.base/java.util.jar.JarFile.<init>(JarFile.java:261) at org.eclipse.sisu.space.URLClassSpace.getClassPathEntries(URLClassSpace.java:374) at org.eclipse.sisu.space.URLClassSpace.expandClassPath(URLClassSpace.java:301) at org.eclipse.sisu.space.URLClassSpace.getClassPath(URLClassSpace.java:235) at org.eclipse.sisu.space.URLClassSpace.findEntries(URLClassSpace.java:182) at org.eclipse.sisu.plexus.PlexusXmlScanner.scan(PlexusXmlScanner.java:89) at org.eclipse.sisu.plexus.PlexusXmlBeanModule.configure(PlexusXmlBeanModule.java:88) at org.eclipse.sisu.plexus.PlexusBindingModule.configure(PlexusBindingModule.java:63) at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340) at com.google.inject.spi.Elements.getElements(Elements.java:110) at com.google.inject.spi.Elements.getElements(Elements.java:101) at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:75) at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340) at com.google.inject.spi.Elements.getElements(Elements.java:110) at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104) at com.google.inject.Guice.createInjector(Guice.java:96) at com.google.inject.Guice.createInjector(Guice.java:73) at com.google.inject.Guice.createInjector(Guice.java:62) at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:481) at org.codehaus.plexus.DefaultPlexusContainer.discoverComponents(DefaultPlexusContainer.java:460) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.discoverPluginComponents(DefaultMavenPluginManager.java:435) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPluginRealm(DefaultMavenPluginManager.java:414) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm(DefaultMavenPluginManager.java:374) at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm(DefaultBuildPluginManager.java:231) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:102) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345) at org.apache.maven.cli.MavenCli.main(MavenCli.java:191) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [WARNING] ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@504bae78] com.google.inject.CreationException: Unable to create injector, see the following errors: 1) An exception was caught and reported. Message: Illegal char <*> at index 99: C:\Users\chris.cropley\.m2\repository\com\smartbear\utils\analytics\out-app-analytics-provider\lib\*.jar at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:75) A copy of my POM is as follows: <build> <plugins> <plugin> <groupId>com.smartbear</groupId> <artifactId>ready-api-maven-plugin</artifactId> <version>2.1.0</version> <executions> <execution> <configuration> <testSuite>CATS</testSuite> <testCase>6800ReqOnly</testCase> <projectFile>C:\Users\chris.cropley\Documents\SELENIUM\projects\b2bresponder\src\test\resources\Bravo-readyapi-project.xml</projectFile> </configuration> <goals> <!--Do not change. Commands the Maven plugin to run a functional test.--> <goal>test</goal> </goals> </execution> </executions> <configuration> <projectFile>C:\Users\chris.cropley\Documents\SELENIUM\projects\b2bresponder\src\test\resources\Bravo-readyapi-project.xml</projectFile> <testSuite>CATS</testSuite> <testCase>6800ReqOnly</testCase> <readyApiProperties> <property> <name>soapui.home</name> <value>C:\Program Files\SmartBear\ReadyAPI-2.1.0\bin</value> </property> </readyApiProperties> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.9</source> <target>1.9</target> </configuration> <dependencies> <dependency> <groupId>com.smartbear.soapui</groupId> <artifactId>soapui</artifactId> <version>5.3.0</version> </dependency> <dependency> <groupId>com.smartbear.soapui</groupId> <artifactId>soapui-pro</artifactId> <version>5.1.2</version> </dependency> <dependency> <groupId>com.smartbear</groupId> <artifactId>ready-api-runners</artifactId> <version>2.1.0</version> </dependency> <!-- https://mvnrepository.com/artifact/au.com.bytecode/opencsv --> <dependency> <groupId>au.com.bytecode</groupId> <artifactId>opencsv</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.7.0.13</version> <scope>system</scope> <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath> </dependency> </dependencies> </plugin> </build> Does anyone have any idea what might be causing this? I am searching high and wide for an answer online with no luck. Any help or pointers would be appreciated. Thanks, Chris Re: java.lang.NoClassDefFoundError: com/eviware/soapui/SoapUIProCore thrown when integrating with Java I have discovered what the problem was. I had not loaded all of the required lib files into my class path. java.lang.NoClassDefFoundError: com/eviware/soapui/SoapUIProCore thrown when integrating with Java I have been trying to integrate my intelliJ Java tests to execute some ReadyAPI test cases. I have ReadyAPI! 2.1 installed and I have followed this https://support.smartbear.com/readyapi/docs/testing/integrations/junit.html guide to integrate the two. Unfortunately when it comes to executing my Test from intelliJ I receive this stack trace. java.lang.NoClassDefFoundError: com/eviware/soapui/SoapUIProCore at com.intellihub.msats.automation.modules.ReadyAPI.RunReadyAPITestCase(ReadyAPI.java:11) at com.intellihub.msats.automation.teststeps.BravoCATSCreation.createBravoCATS(BravoCATSCreation.java:10) at com.intellihub.msats.automation.tests.BravoCATSTests.createCATSCR6800ReqOnly(BravoCATSTests.java:20) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198) at org.testng.TestNG.runSuitesLocally(TestNG.java:1123) at org.testng.TestNG.run(TestNG.java:1031) at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123) Caused by: java.lang.ClassNotFoundException: com.eviware.soapui.SoapUIProCore at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ... 26 more My simple test is: package com.intellihub.msats.automation.tests; import com.intellihub.msats.automation.modules.TestListener; import com.intellihub.msats.automation.teststeps.BravoCATSCreation; import io.qameta.allure.Description; import io.qameta.allure.Epic; import io.qameta.allure.Feature; import org.testng.annotations.Listeners; import org.testng.annotations.Test; @Listeners({ TestListener.class }) @Epic("eHUB B2B Integration") @Feature("Service Order Tests") public class BravoCATSTests extends BaseTest { test(enabled = true, description = "Create CR6800 Req files only for NMI") @Description("CCreate CR6800 Req files only for NMI") public void createCATSCR6800ReqOnly(){ BravoCATSCreation bravoCATSCreation = new BravoCATSCreation(); bravoCATSCreation.createBravoCATS("6800ReqOnly"); } } Which calls...: package com.intellihub.msats.automation.teststeps; import com.intellihub.msats.automation.tests.BaseTest; import com.intellihub.msats.automation.modules.ReadyAPI; public class BravoCATSCreation extends BaseTest { public void createBravoCATS(String testCase){ ReadyAPI readyAPI = new ReadyAPI(); readyAPI.RunReadyAPITestCase(testCase); } } And then executes the good stuff...: package com.intellihub.msats.automation.modules; import com.smartbear.ready.cmd.runner.pro.*; public class ReadyAPI { public void RunReadyAPITestCase(String testCaseName){ try { SoapUIProTestCaseRunner runner = new SoapUIProTestCaseRunner(); //SoapUITestCaseRunner soapUITestCaseRunner = new SoapUITestCaseRunner(); runner.setProjectFile("src/test/resources/Bravo-readyapi-project.xml"); runner.setTestSuite("CATS"); runner.setTestCase(testCaseName); runner.run(); } catch (Exception e) { e.printStackTrace(); } } } I have the following External Libraries on my class path soapui-5.3.0.jar and soapui-pro-5.1.2.jar I have trawled the internet for a jar file with this class in it. This page http://www.soapui.org/apidocs/pro/ also gives the indication it is in the jar file I have, however it is clearly not there. Am I missing something simple? I have seen other internet pages for different problems with stack traces that have this class being used. Any pointers or help would be greatly appreciated. Thanks, Chris SolvedHas anyone created a sub report with 2 data sources? Essentially what I am trying to do is use the existing Test Case Report which shows everything I need. The one small problem is the Test Case properties which are displayed inside this report only shows the last properties which were created and stored in my Test Case. My test case has a data source loop and each iteration will modify the Test Case properties that are used in my REST call. If for example iteration 5 has a failure I would like to see what properties were used in that REST call for debugging purposes and to add to my defect report. So my thinking was to modify the existing TestStepResults sub report to try to display the Test Case properties above the Test Step results. Has anyone done this or is that possible? Maybe there a more clever way to do it?