当前位置:网站首页>Interface performance test: Web service interface test

Interface performance test: Web service interface test

2022-06-09 03:47:00 Pengyuyan from the testing industry

WSDL agreement

WSDL( Network service description language ,Web Services Description Language) It's based on XML Language , Used to describe Web Services And how to access them

One WSDL The main structure of the document is similar to this :

<definitions> 
<types> definition of types........ </types> 
<message> definition of a message.... </message> 
<portType> definition of a port....... </portType> 
<binding> definition of a binding....</binding> 
</definitions>

Here's a simple one WSDL Example

<message name="getTermRequest"> <part name="term" type="xs:string"/> </message> <message name="getTermResponse"> <part name="value" type="xs:string"/> </message> 

<portType name="glossaryTerms"> <operation name="getTerm"> <input message="getTermRequest"/> <output message="getTermResponse"/> </operation> </portType>

Pull left and right to view the complete code

web service Interface test steps

WSDL Interface test steps :

1. choice web service The protocol adds a script  

2. stay manage service Import the service to be tested in , There are usually two ways : One is URL Address ; Second, import files . It should be noted that if we use URL The way , that URL The address should be followed by "?wsdl", If it is an export file, the file suffix is .wsdl, That is to say, the object of our test is actually one person wsdl file . 

3. add to add service call, Add the method we want to test , Set up the data we want to test , I.e. input data

4. Parameterize the test data , The parameterized method is just like our previous parameterized method  

5. Check whether the returned result is the most correct , The function used is strstr

if(strstr(lr_eval_string("{response}"),"hello") == NULL) { lr_output_message("FAIL"); }else { lr_output_message("PASS");}

web_service_call function

web_service_call Function syntax :

int web_service_call( const char *StepName, [URL,] ExpectedResponse, specifications>,[BEGIN_ARGUMENTS,Arguments,END_ARGUMENTS,] [Send Attachments,][BEGIN_RESULT, Results, END_RESULT,] [Receive Attachments, ] LAST );

Pull left and right to view the complete code

1.StepName

Step name

2.SOAPMethod​​​​​​​

"SOAPMethod=EnglishChinese|EnglishChineseSoap|TranslatorString", Server name | Port name | Operation method 

Pull left and right to view the complete code

3.ResponseParam

The parameter name saved by the returned response result

4.Service

Server name

5.ExpectedResponse

Indicates the response result or the returned result

"ExpectedResponse=SoapResult"

Pull left and right to view the complete code

6.Arguments​​​​​​​

Indicates the input parameters for calling this method ​​​​​​​

BEGIN_Arguments"Name1=Value1","Name2=Value2",END_Arguments

7.RESULT

Represent the input results or save the output results in a variable ​​​​​​​

BEGIN_RESULT," Output item = Variable name ","TranslatorStringResult/*[1]=Param_string",END_RESULT,

8.ATTACHMENT_ADD

Indicates uploading attachments , There are two ways to add attachments :fifilename、paramname​​​​​​​

ATTACHMENT_ADD, "FileName=file1.txt", "ContentType = text/plain", "ID=TXT1",ATTACHMENT_ADD, "ParamName=paramMyAttachment", "ContentType = image/gif",

9.Receive Attachments

It means downloading or accepting files , There are two types of acceptance documents :ATTACHMENT_SAVE_BY_INDEX Accept files by index number 、ATTACHMENT_SAVE_ALL Accept all documents .​​​​​​​

ATTACHMENT_SAVE_BY_INDEX, "Index=1", "ParamName=myNameParam1"ATTACHMENT_SAVE_ALL,"ParamNamePrefix=myParam"

A little help

Finally, thank everyone who reads my article carefully , Watching the rise and attention of fans all the way , Reciprocity is always necessary , Although it's not very valuable , If you can use it, you can take it

These materials , For those who want to advance 【 automated testing 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! Everything should be done as soon as possible , Especially in the technology industry , We must improve our technical skills . I hope that's helpful …….

原网站

版权声明
本文为[Pengyuyan from the testing industry]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090338304077.html