=headers,verify=False) A Prints.cookies - - #two cookies required to add a login thec =Requests.cookies.RequestsCookieJar () - -C.set ('. Cnblogscookie','this is the catch.')#Fill in the contents of the above grab bag -C.set ('. Cnblogs.AspNetCore.Cookies','this is the catch.')#Fill in the contents of the above grab bag +C.set ('alwayscreateitemsasactive',"True") -C.set ('admincookiealwaysexpandadvanced',"True") + s.cookies.update (c) A Prints.cookies at - #save edits after successful login -
2. The programmeFor the above API, when doing interface testing, the test cases need to be up to 10 +, this time in a data-driven way to write the common content of the configuration file may be more appropriate.Here consider the API, parameters, and expected results preprint in the formatted CSV, using the CSV component to read the URL, parameters, and expected results from the CSV, requests component initiates the request, compare the response resul
, Automatically searches CAs in the specified directory, constructs the test set, executes the order of names: Executes the Test_add first, then executes test_sub discover = Unittest.defaultTestLoader.discover (test_ Dir, pattern= ' test_*.py ') # instantiates Texttestrunner class runner = UnitTest. Texttestrunner () # Run the test suite with the Run () method (that is, run all the use cases in the test suite) Runner.run (Discover)The above only solves the problem of how to manage
. Request parameter: Keywords=yoyoketang, can be passed as a dictionary: {"Keywords": "Yoyoketang"}3. Multiple parameter formats: {"Key1": "Value1", "Key2": "value2", "Key3": "Value3"}Iv. Content1. Baidu Homepage If using R.text will find the content has garbled, because Baidu home response content is gzip compressed (non-text text)2. If the Fiddler tool is garbled, it can be decoded after the click, in the code can be used r.content This method, content will automatically decode gzip and deflat
Interface 3: Adding student informationBrief description: Add student information, enter parameter is JSON typeRequest Url:http://api.nnzhp.cn/api/user/add_stuRequest mode: Post, parameter is JSON type
Name of parameter
Must-Choose
Type
Description
Name
Y
String
Student Name
Grade
Y
String
Class
Phone
Y
Int
Phone
Sex
Interface 2: LoginRequest Method: PostRequest URL:http://api.nnzhp.cn/api/user/login1. Open JMeter, right click on test Plan, select Add-threads-thread Group2, click on Thread Group, right-add sampler-http request3,http Request page, server name or IP field input: api.nnzhp.cn; mode selection Psot; path input:/api/user/loginClick Parameters, click the Add button, name Input: Username value input: xxx;passwd value input: XXX4, click on Thread Group, ri
Interface 3: Adding student informationBrief description: Practice passing JSON type parametersRequest URL:http://api.nnzhp.cn/api/user/add_stuRequest Method: Post1. Open JMeter, right click on test Plan, select Add-threads-thread Group2, click on Thread Group, right-add sampler-http request3,http Request page, server name or IP field input: api.nnzhp.cn; method select Post; path input:/api/user/add_stuClick Body Data to enter the JSON parameter{"Name
nothing wrong. If the time is more than 1s, the problem will come.(obviously, more than 1s, only the number of decimal parts is intercepted)3. So the correct posture to get response time should be: R.elapsed.total_seconds (), unit is STimeout timed out1. If a request response time is longer, cannot wait, can set a timeout time, let it throw an exception2. The following request, setting timeout of 0.5s, will throw this exception: Requests.exceptions.ConnectTimeout:HTTPConnectionPoolimport reques
This time to everyone to bring PHPUnit Interface automation test function implementation, PHPUNIT interface Automation test function to realize the considerations of what, the following is the actual case, take a look.
An accidental opportunity at the beginning of the year came into contact with PHPUnit, an open sourc
, deflate", - "Referer":"http://127.0.0.1/zentao/user-login.html", - #"Cookie": # Do not use cookies until the head is logged in, as cookies are kept logged in the "Connection":"keep-alive", - "Content-type":"application/x-www-form-urlencoded", - } - +BODY = {" Account":"Admin", - "Password":"e10adc3949ba59abbe56e057f20f883e", + "keeplogin[]":" on", A "Referer":"http://127.0.0.1/zentao/my/" at } - -s = requests.session ()#hold Session -R = S.
I. Description of TEST requirements
A series of HTTP interface functional tests on the service backend.
Input: Constructs different parameter input values according to the interface description
Output: XML file
Eg:http://xxx.com/xxx_product/test/content_book_list.jsp?listid=1
Second, the realization method
1. Use Python script to drive test
2, the Use of Excel table management test data, including use case
The Robot framework is a keyword-driven acceptance automation testing framework that is now being used more and more widely in China. A common test solution for Web UI Automation is Robot Framework+selenium2library (RFS). In general, to use the Selenium2library library, you must configure the browser driver (driver). Otherwise, you will not be able to drive the browser to execute
1, online installationThen open file, Settings, Pugins, Browse repositories as follows, enter Android parcelable code generator search directly down the line (but you should download it unsuccessfully, Why, you know * * * *, see offline installation)!2, offline installation, Click here to download the installation packageAfter you have downloaded it, open the Install plugin from disk, pugins, file--Settings, select the. zip package you just downloaded, then OK, restart it!3. How to use:To write
The following two types of post submission data are common:The first type: Application/json, which is the common JSON format, in the following format: {"input1": "xxx", "Input2": "Ooo", "Remember": false}The second type: application/x-www-form-urlencoded, the browser's native form form, in the following form: input1=xxxinput2=ooo1. Post request in JSON format:ImportRequestsImportJsonurl='Http://www.tuling123.com/openapi/api'Data={'Key':'4b6ce82fbe554a11b99dabfa3a4ae6d9','Info':'my city is in Bei
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.