如何使用script validation 验证消息
assertmessageExchange.getResponseContentType().contains("application/json")
assertmessageExchange.responseHeaders["#status#"].toString().contains("304")
http://www.soapui.org/Functional-Testing/script-assertions.html
ThemessageExchange object available in the script exposes a bunch of propertiesrelated to the last request/response messages (check out theJavadoc), lets look at some simple examples:
1. Validate the content of an HTTP Headerin the response
// check for the amazon id header
assertmessageExchange.responseHeaders["x-amz-id-1"]!= null
2. Validate a certain response time
// check that response time is less than400 ms
assertmessageExchange.timeTaken< 400
3. Validate the existence of an attachmentin the response
// check that we received 2 attachments
assertmessageExchange.responseAttachments.length== 2
4. Validate the existence of a specificXML element in the response
// check for RequestId element inresponse
defholder = newXmlHolder(messageExchange.responseContentAsXml )
assertholder["//ns1:RequestId"]!= null
http://www.soapui.org/apidocs/com/eviware/soapui/model/iface/MessageExchange.html
| |
| |
| getProperty |
| |
| |
getRequestAttachmentsForPart | |
| |
| |
getResponseAttachmentsForPart | |
| |
| |
| |
| |
| |
| hasRequest |
| |
|
How to enlarge SoapUI JVM memory size.
1. If you want toenlarge UI part, should updatesoapui.bat in {Program Files}\eviware\soapUI-4.0.0\bin is forSoapUI UI part like below.
Change setJAVA_OPTS=-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties"-Dsoapui.home=%SOAPUI_HOME%\" to
setJAVA_OPTS=-Xms2048m -Xmx2048m -XX:MaxNewSize=1024m -XX:MaxPermSize=1024m-Dsoapui.properties=soapui.properties "-Dsoapui.home=%SOAPUI_HOME%\"
2. If you want toenlarge command part, should updatetestrunner.bat in {Program Files}\eviware\soapUI-4.0.0\bin isfor SoapUI UI part like below.
Change setJAVA_OPTS=-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties"-Dsoapui.home=%SOAPUI_HOME%\" to
setJAVA_OPTS=-Xms2048m -Xmx2048m -XX:MaxNewSize=1024m -XX:MaxPermSize=1024m-Dsoapui.properties=soapui.properties "-Dsoapui.home=%SOAPUI_HOME%\"
TestRunnerparameters
Running functional testsfrom the command-line is straightforward using the included testrunner.bat/.shscript, which takes a number of arguments to control which tests to run,output, etc:
- e : The endpoint to use when invoking test-requests, overrides the endpoint set in the project file
- h : The host:port to use when invoking test-requests, overrides only the host part of the endpoint set in the project file
- s : The TestSuite to run, used to narrow down the tests to run
- c : The TestCase to run, used to narrow down the tests to run
- u : The username to use in any authentications, overrides any username set for any TestRequests
- p : The password to use in any authentications, overrides any password set for any TestRequests
- w : Sets the WSS password type, either 'Text' or 'Digest'
- d : The domain to use in any authentications, overrides any domain set for any TestRequests
- r : Turns on printing of a small summary report (see below)
- f : Specifies the root folder to which test results should be exported (see below)
- j : Turns on exporting of JUnit-compatible reports, see below
- a : Turns on exporting of all test results, not only errors
- o : Opens the generated report in a browser (soapUI Pro only)
- i : Enables soapUI UI-related components, required if you use the UISupport class for prompting or displaying information
- t : Sets the soapui-settings.xml file to use, required if you have custom proxy, ssl, http, etc setting
- x : Sets project password for decryption if project is encrypted
- v : Sets password for soapui-settings.xml file
- D : Sets system property with name=value
- G : Sets global property with name=value
- P : Sets project property with name=value,e.g. -Pendpoint=Value1 -PsomeOtherProperty=value2
- S : Sets to save the project file after tests have been run
- I : Do not stop if error occurs, ignore them
- R : Selects which report to generate for the test objects executed, for example if running the entire project, this could specify the name of a test-suite-level report that would be generated for each TestSuite. The report is saved as specified with the -F option to the folder specified with the -f option. (soapUI Pro only)
- F : Sets the format of the report specified with the -R option, for Printable reports this is one of PDF, XLS, HTML, RTF, CSV, TXT, and XML. For Data Export this is either XML or CSV (soapUI Pro only)
- g : Sets the output to include Coverage HTML reports ( soapUI Pro only )