13 years ago
Capturing Assertion failure when running from command line
I built a Test Suite for calling a web method and I added an assertion using the XPath Match. The assertion has been written in a way where it is expecting a static value thus always failing.
I have a c# wrapper class that uses the ProcessInfo class to call the testrunner.bat batch file. The arguments passed look like
-r -a -ehttp://localhost:2000/MyService.svc -c"TestCase" -f"D:\SoapUI\Results" -I -g "D:\Projects\Prototype\SOAPUI Projects\MyService.xml"
When I check the StandardError for the ProcessInfo once the process is complete, it is empty.
When I check the StandardOutput, I see (displaying only a portion of the StandardOutput)
09:20:27,739 DEBUG [HttpClientSupport$SoapUIHttpClient] Connection can be kept alive indefinitely
09:20:28,102 INFO [SoapUIProTestCaseRunner] Assertion [XPath Match] has status FAILED
09:20:28,103 ERROR [SoapUIProTestCaseRunner] ASSERTION FAILED -> XPathContains assertion failed for path [declare namespace ns2='http://core.relayhealth.com/services/2006/11/practice';
//ns2:CreatePracticeResponse] : Exception:org.custommonkey.xmlunit.Diff
[different] Expected text value '1' but was '63750' - comparing <a:Value ...>1</a:Value> at /CreatePracticeResponse[1]/CreatePracticeResult[1]/KeyValueOfstringint[2]/Value[1]/text()[1] to <a:Value ...>63750</a:Value> at /CreatePracticeResponse[1]/CreatePracticeResult[1]/KeyValueOfstringint[2]/Value[1]/text()[1]
09:20:28,103 ERROR [SoapUIProTestCaseRunner] CreatePractice failed, exporting to [D:\SoapUI\Results\PracticeTestSuite-CreatePractice_TestCase-CreatePractice-0-FAILED.txt]
My question being, is the only way for me to identify that a Test Case has failed is to look in the StandardOutput and look for the Assertion Failed keyword. What if there was a fault, why are the errors not thrown in the StandardError from the batch file ?
I have a c# wrapper class that uses the ProcessInfo class to call the testrunner.bat batch file. The arguments passed look like
-r -a -ehttp://localhost:2000/MyService.svc -c"TestCase" -f"D:\SoapUI\Results" -I -g "D:\Projects\Prototype\SOAPUI Projects\MyService.xml"
When I check the StandardError for the ProcessInfo once the process is complete, it is empty.
When I check the StandardOutput, I see (displaying only a portion of the StandardOutput)
09:20:27,739 DEBUG [HttpClientSupport$SoapUIHttpClient] Connection can be kept alive indefinitely
09:20:28,102 INFO [SoapUIProTestCaseRunner] Assertion [XPath Match] has status FAILED
09:20:28,103 ERROR [SoapUIProTestCaseRunner] ASSERTION FAILED -> XPathContains assertion failed for path [declare namespace ns2='http://core.relayhealth.com/services/2006/11/practice';
//ns2:CreatePracticeResponse] : Exception:org.custommonkey.xmlunit.Diff
[different] Expected text value '1' but was '63750' - comparing <a:Value ...>1</a:Value> at /CreatePracticeResponse[1]/CreatePracticeResult[1]/KeyValueOfstringint[2]/Value[1]/text()[1] to <a:Value ...>63750</a:Value> at /CreatePracticeResponse[1]/CreatePracticeResult[1]/KeyValueOfstringint[2]/Value[1]/text()[1]
09:20:28,103 ERROR [SoapUIProTestCaseRunner] CreatePractice failed, exporting to [D:\SoapUI\Results\PracticeTestSuite-CreatePractice_TestCase-CreatePractice-0-FAILED.txt]
My question being, is the only way for me to identify that a Test Case has failed is to look in the StandardOutput and look for the Assertion Failed keyword. What if there was a fault, why are the errors not thrown in the StandardError from the batch file ?