soapUI the test file upload

In interface testing you will encounter need to upload the file operations, such as head and other modifications. So soapui this part of the test is how to achieve it. The following file to upload interface as an example.

 

First, access to the file upload interfaces

Interface information can be obtained through the development of interface documentation provided directly, or their own capture.

Example:

 

 

 

 

 

 

Two, soapui run through a single interface

1, into the "Login" interface, and run run pass

a, right-Projects -> New REST Project, playing the box interface "URI" Enter "login" interface address

B, double-click logon request to the request, provided the following:

1) Method for the post,

2) addition request parameter userName, password,

3) Check the "Post QueryString",

4) opening the Headers add cv version number,

5) Click Run to view operating results

 

 

2. Import "upload" interface, and run run pass

a, right-Projects -> New REST Project, the "URI" input interface box bomb "upload" interface address

b, double-click the "Upload file" request the request, set the following:

1) Method for the post,

2) addition request parameter param,

3) Check the "Post QueryString",

4) opening the Headers add token information,

5) Media Type Select multipart / form-data (before selecting for Post QueryString checked here),

6) opening the Attahments, add the files you want to upload, ContentID for the file,

7) Click Run to view the results

 

 

 

Third, script optimization

If you want to test your bulk upload interface, or errors such as file name, format, unequal interface test case, you need to create a test set to test.

Here are some details do not understand, you can look at the article I wrote before, very detailed.

1, right-project project -> new TestSuite -> new TestCase, the login interface to upload files with drag Test Steps and modify the request name

 

 

2, is inserted Property Transfer After logging in, and add a Properties setting a variable to receive the value of the token.

a, Properties token variable value is added

 

 

b, Property Transfer set the following:

1)添加transfers值token

2)设置请求Source为sign,Response,JsonPath为$.data.token

3) 设置Target为 Properties,token

4)点击运行测试一下

5)出现运行结果,表示ok

 

 

3、双击upload请求,点开Headers,values值进行${Properties#token}引用

 

 

4、双击TestCase,点击运行,查看结果显示成功。

 

 

 

Guess you like

Origin www.cnblogs.com/tudou-22/p/11941216.html