-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple-soapui-project.xml
59 lines (55 loc) · 5.14 KB
/
simple-soapui-project.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project activeEnvironment="Default" name="simple-soapui-project" resourceRoot="" soapui-version="5.0.0" xmlns:con="http://eviware.com/soapui/config"><con:settings/><con:interface xsi:type="con:RestService" wadlVersion="http://wadl.dev.java.net/2009/02" name="http://192.168.12.170:10000" type="rest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:settings/><con:definitionCache type="TEXT" rootPart=""/><con:endpoints><con:endpoint>http://192.168.12.170:10000</con:endpoint></con:endpoints><con:resource name="Query" path="/basis/department/query"><con:settings/><con:parameters/><con:method name="Query" method="POST"><con:settings/><con:parameters/><con:representation type="REQUEST"><con:mediaType>application/json</con:mediaType><con:params/></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:quer="http://192.168.12.170/basis/department/query">quer:Response</con:element></con:representation><con:request name="Request 1" mediaType="application/json" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://192.168.12.170:10000</con:endpoint><con:request>{
"userId":111,
"entId":123
}</con:request><con:originalUri>http://192.168.12.170/basis/department/query</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:request></con:method></con:resource></con:interface><con:testSuite name="TestSuite"><con:settings/><con:runType>SEQUENTIAL</con:runType><con:testCase failOnError="true" failTestCaseOnErrors="true" keepSession="false" maxResults="0" name="departmentQuery" searchProperties="true" id="a1ea5f8d-54bb-439a-920c-2030ecf78ee3"><con:settings/><con:testStep type="restrequest" name="departmentQuery"><con:settings/><con:config service="http://192.168.12.170:10000" resourcePath="/basis/department/query" methodName="Query" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="departmentQuery" mediaType="application/json" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://192.168.12.170:10000</con:endpoint><con:request>{
"userId":123,
"entId":123
}</con:request><con:originalUri>http://192.168.12.170/basis/department/query</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:restRequest></con:config></con:testStep><con:testStep type="groovy" name="Groovy Script"><con:settings/><con:config><script>
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
//获取上下文对象,转化成groovyUtils对象
def wsdlResponse=testRunner.testCase.testSteps["departmentQuery"].getTestRequest().getResponseContentAsXml()
//com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep
def logFolder = context.expand( '${#TestSuite#LogFolder}' )
File log = new File("${logFolder}/test.log")
log.withWriterAppend( 'GB2312' ){ w->
w<<wsdlResponse+'\n'
}
</script></con:config></con:testStep><con:properties/><con:reportParameters/></con:testCase><con:properties><con:property><con:name>LogFolder</con:name><con:value/></con:property><con:property><con:name>ExcelReport</con:name><con:value>COP-Report.xls</con:value></con:property></con:properties><con:setupScript>import java.io.*;
import jxl.*;
import jxl.write.*;
import java.util.*;
def updateOutput(writableWorkbook,sheetName,column,row,content){
Sheet[] sheet= writableWorkbook.getSheets();
ws = writableWorkbook.getSheet(sheetName);
if(ws==null){
ws = writableWorkbook.createSheet(sheetName,sheet.length)
}
ws.addCell(new jxl.write.Label(column,row,content));
}
def logFolder = new File(context.expand('${#TestSuite#LogFolder}'));
def flagFileName = (context.expand('${#TestSuite#LogFolder}')+"flag.txt");
def flagFile = new File(flagFileName);
def excelName = (context.expand('${#TestSuite#ExcelReport}'));
def worksheet = "Result";
WritableWorkbook workbook;
try{
workbook = Workbook.createWorkbook(new File(excelName));
WritableSheet sheet = workbook.createSheet(worksheet, 0);
updateOutput(workbook,worksheet,0,0,"Case ID");
updateOutput(workbook,worksheet,1,0,"Description");
updateOutput(workbook,worksheet,2,0,"Response Code");
updateOutput(workbook,worksheet,3,0,"Expected Code");
updateOutput(workbook,worksheet,4,0,"Result");
updateOutput(workbook,worksheet,5,0,"Response Details");
workbook.write();
workbook.close();
}catch(Exception e){
e.printStackTrace();
log.info(e);
}
if(!flagFile.exists()){
flagFile.createNewFile();
flagFile.write("1");
}
flagFile.write("1");</con:setupScript><con:reportParameters/></con:testSuite><con:requirements/><con:properties/><con:wssContainer/><con:databaseConnectionContainer/><con:oAuth2ProfileContainer/></con:soapui-project>