Forum Discussion

stelle's avatar
stelle
New Contributor
14 years ago

XPath assertions always fail with maven plugin

I'm hoping to either get some help or wondering if I may need to file a bug for an issue I'm having. I have a test suite created in soapUI and all the tests pass in the UI, but when I run them on the command line with maven, any test that uses XPath is failing. If I were to switch to using the contains assertion, I can make all the tests pass, but contains is not as powerful as XPath.

I can paste all my code, but that might get a little verbose, so let me know if more information is needed. My pom.xml is very basic, I don't change the settings in any way, just tell it the project file to use and where to put logs.

Below is the output of the failing tests. The payload is printed immediately following and the payload is correct. There's no reason that the XPath assertion should fail, so I'm wondering if it's a library issue.

Environment:
windows 7 64 bit
java version "1.6.0_26"
maven-soapui-plugin version 4.0.0

[INFO]
[INFO] --- maven-soapui-plugin:4.0.0:test (soapUI) @ HelloWorld_stelle ---
soapUI 4.0.0 Maven2 TestCase Runner
Setting soapui.logroot value C:\Users\stelle\projects\CustomerAPI\CustomerAPI\test/logs/
15:33:43,042 WARN [SoapUI] Missing folder [C:\Users\stelle\projects\CustomerAPI\CustomerAPI\test\.\ext] for external libraries
15:33:43,206 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\stelle\soapui-settings.xml]
15:33:43,880 INFO [WsdlProject] Loaded project from [file:/C:/Users/stelle/projects/CustomerAPI/CustomerAPI/test/testing.xml]
15:33:44,096 INFO [SoapUITestCaseRunner] Running soapUI tests in project [testing]
15:33:44,098 INFO [SoapUITestCaseRunner] Running Project [testing], runType = SEQUENTIAL
15:33:44,106 INFO [SoapUITestCaseRunner] Running soapUI testcase [validatePhoneNumber TestCase]
15:33:44,112 INFO [SoapUITestCaseRunner] running step [ValidPhone]
15:33:44,804 INFO [SoapUITestCaseRunner] Assertion [XPath Match] has status FAILED
15:33:44,804 ERROR [SoapUITestCaseRunner] ASSERTION FAILED -> junit/framework/ComparisonFailure
15:33:44,805 ERROR [SoapUITestCaseRunner] ValidPhone failed, exporting to [C:\Users\stelle\projects\CustomerAPI\CustomerAPI\test/reports/\testing-vali
datePhoneNumber_TestCase-ValidPhone-0-FAILED.txt]
15:33:44,811 INFO [SoapUITestCaseRunner] Finished running soapUI testcase [validatePhoneNumber TestCase], time taken: 685ms, status: FAILED
15:33:44,811 INFO [SoapUITestCaseRunner] Project [testing] finished with status [FAILED] in 710ms
[ERROR] java.lang.Exception: XPath Match in [ValidPhone] failed;
[junit/framework/ComparisonFailure]
Status: FAILED
Time Taken: 685
Size: 560
Timestamp: Thu Aug 11 15:33:44 EDT 2011
TestStep: ValidPhone
  • stelle's avatar
    stelle
    New Contributor
    I was able to work around this issue by downgrading the version of maven-soapui-plugin to 3.5.1. I'd still like to get version 4.0.0 to work though, since we're developing our tests in that version of soapUI. I am guessing that there's some missing dependency for xpath. The only dependency that I have right now is:


    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
    </dependency>
  • robski's avatar
    robski
    New Contributor
    This is a known issue - there are other posts on the subject and the solution was found to be drop back to version 3.6.1 at the time.
    I encountered the same problem and solution earlier this week.

    I believe some of the later versions (after 4.0.0) don't have the problem, but I couldn't get them to work due to dependency problems.
  • stelle's avatar
    stelle
    New Contributor
    Thanks for the response robski, I didn't see the other threads. Do you know if anyone has reported this as a bug?
  • I got this to work by adding a <dependency> to the soapui plugin:


    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.8.2</version>
    </dependency>