interface automation

Alibabacloud.com offers a wide variety of articles about interface automation, easily find your interface automation information here online.

Python interface Automation Test 11: Pass parameters: Data and JSON

# Pass JSON parametersRequests= ' xxxxxxxx '= {' xxx ': ' xxx ',' xxx ': ' xxx '}# body is in JSON formatRequests.post(URL, json=body)Print(r.text)# The second methodJsonRequests.post(url, data=json.dumps(body))Print(r.text)Import RequestsURL = "Http://v.juhe.cn/weather/index"= {" cityname": " Shenzhen ", # City name or city ID, such as:" Suzhou ", Need UTF8 UrlEncode"Dtype": "JSON", # Return Data format: JSON or XML, default JSON"format": "1", # Next 7 Days Forecast (future) Two return formats,

Python Interface Automation 2-send a POST request

+ "/zentao/user-login.html"H = {"User-agent": "mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) gecko/20100101 firefox/44.0 "," Accept ":" text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 " , "Accept-language": "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3", "accept-encoding": "gzip, deflate", "R Eferer ": host+"/zentao/user-login.html ", #" cookie ": # Do not use cookies until the head is logged in, because the cookie is the" Connection "that keeps the login:" K Eep-alive "," Content-type ":

Python interface automation 22-download file (Excel)

ObjectiveContent-type type is octets/stream, this is generally a file type, such as sometimes need to export Excel data, download Excel this scenario how to use Python to implement it?Grab Download interface1. Download the scene as2. Use the Fiddler tool to grab the bag, first find the Export button, click the export time to grab the packet3.fiddler captured data as follows (response is normal, the file type is not displayed in the tool, the tool only shows the characters)Code implementation1. G

Python Interface Automation 12-case Study (Csrftoken)

, Jsessionid, userName), + "Connection":"keep-alive", - "Content-type":"application/x-www-form-urlencoded", + "Content-length":" the" A } at -BODY = {"Instantmessageid":" About", - "name": U"haha 1", - "Order":"", - "Csrftoken": Csrftoken, - "type":"QQ", in " Account":"1001"} - tos =requests.session () +R1 = s.post (URL, headers=h1, Data=body, allow_redirects=False) - PrintR1.status_code the #gets the URL address of the redirect *Redirect

Python Interface Automation 2-send a POST request

) gecko/20100101 firefox/44.0", A "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", - "Accept-language":"zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3", - "accept-encoding":"gzip, deflate", the "Referer": host+"/zentao/user-login.html", - #"Cookie": # Do not use cookies until the head is logged in, as cookies are kept logged in - "Connection":"keep-alive", - "Content-type":"application/x-www-form-urlencoded", + } -

Python Interface automation test four: code to send HTTPS requests

HTTPS:Geturl = ' HTTPS://WWW.JUHE.CN/DOCS/API/ID/39 'r = Requests.get (URL) #发送get请求Print (R.status_code) #打印状态码Print (r.headers) #打印返回的报头 (head)Print (R.text) #查看返回结果的文本形式 (body part)Sslerror: Certificate Issue:Method 1: Check if the Faddler is closed and the access is successful whenMethod 2: The request parameter is followed by the Verify=falseVerify defaults to True, at which time the certificate is validated and false will not validate the certificatehave a Body section:content-type:applica

Python interface automation Test IX: REDIRECT Correlation

Allow_redirects=false not redirected# Get redirected AddressesLOC = R.headers# relative AddressHost = ' https://i.cnblogs.com/'url = host+ ' editposts.aspx?opt=1 'loc = r.headers[' Location ']URL1 = host+loc # stitching out redirected addresses# Trace Redirection Processhis = R.historyPrint (the type (HIS))Print (HIS)# Track Second request contentr2 = his[1]Print (R2)# Get the return content by response objectPrint (R2.url)Print (R2.status_code)Print (r2.headers)Print (r2.test)Python

Python interface Automation--JSON parameter substitution

is a list or tuple, then the _get_value is calledreturn dic#替换参数子方法#数据类型判断, call the unused method after traversaldef replace_target (Self,key, Val, changedata):For Val_ in Val:If Isinstance (Val_, dict):Self.replace_target_value (Key, Val_, Changedata) # The value of the incoming data is a dictionary, then the replace_target_value is calledElif isinstance (Val_, (list, tuple)):Self.replace_target (Key, Val_, Changedata) # The value of the incoming data is a list or a tuple, it calls itselfif _

Python Interface Automation--requests 1

#_*_ encoding:utf-8 _*_ImportRequests#Request a blog home, no parameter GET requestR = Requests.get ('http://www.cnblogs.com/cindy-cindy/')Print(R.status_code)Print(R.text)#Search for content in the blog park, get requests with parametersPar = {"Keywords": U"the path of the young woman's Test"}R1= Requests.get ('Http://zzk.cnblogs.com/s/blogpost', params=par)Print(R1.status_code)Print(R1.text)#get Baidu home page, Baidu Home response is gzip compressed (non-text text)#if the filder inside can be

Python interface Automation 19-requests-toolbelt processing Multipart/form-data

Requests-toolbelt1. Official document Address: Requests-toolbelt official documents2. Installation of the environment Pip Install Requests-toolbelt Multipart/form-data Pass Filefrom requests_toolbelt import MultipartEncoderimport requestsm = MultipartEncoder( fields={'field0': 'value', 'field1': 'value', 'field2': ('filename', open('file.py', 'rb'), 'text/plain')} )r = requests.post('http://httpbin.org/post', data=m, hea

Interface Automation Test Python (2) _ Use Python to manipulate Excel

How to use Python to do simple work with ExcelI. install XLWT via PIP, xlrd these two modules*pip Install XLWT*pip Install xlrd Two. Prepare a copy of the interface test case, Excel documentThree. Python script reads Excel content#ReadExcelContentImport xlrd#GetExcelFile storage Addressdata = Xlrd.open_workbook (‘.. \dataconfig\interfacetestcase.xlsx ')#Get the first1ASheettables = Data.sheets () [0] # print sheet name print data.sheet_names () #

Python3 Interface Automation Call runner

For example: when there is no test report, use runner = Unitttest. Texttestrunner () Can execute use cases, use case results printed in the console, and when a test report is available, the line code is not required to execute the test case, and the use case results are printed in the report.Reason:Runner = Htmltestrunner () This is the runner provided by the Htmltestrunner.Runner = Unitttest. Texttestrunner () This is the runtime provided by the UnitTest Unit test framework by default. A test c

Python interface Automation Test 26: Using the Pymysql module to link the database

Tags: automated data connection MySQL Pytho host technology share. EXE Gorgeous cal#!/usr/bin/env python#-*-Coding:utf-8-*-# @Time: 2018/5/28 18:51# @Author: Stalloneyang# @File: mysql_test.py# @desc:# Connect to DatabaseImport Pymysql.cursors# Connect to MySQL DatabaseConnection = pymysql.connect (host= ' localhost ', port=3306, user= ' Yang ', password= ', db= ' Test_yang ', charset= ' utf8mb4 ' , Cursorclass=pymysql.cursors.dictcursor)# Create a cursor from the cursorcursor = Connection.curso

Selenium webdriver Automated test Design (Webdriver Automation architecture design, definition interface, log processing, Java robot class applications)

Wind net login, modify the personal information instance, demonstrate the use of the above Webdriver API6th ChapterOverview of the design of the automation architecture design purpose and purpose of specific classes, including:BaselibSeleniumbase LibBusinesslibObjectStore interfaceMethodoutputmessage interfaceInputdatastore interfaceConfig.properties file7th ChapterOutlines how to generate debug-level test reports and regression test reportsSummarize

Interface Automation Test Python (1) _ Environment Setup Configuration

Windows underI. Python download installation configuration environment variables1. python:https://www.python.org/downloads/2. Install Python all you need to do is download the Python-x.x.x.msi file and click on the "Next" button3. After the installation is complete, you need to set the Python environment variable. Right-click Computer, properties, advanced environment variable, modify the system variable path, add the Python installation address, this example uses the D:\python, need to install

PHP interface Automation test tools have you ever used it?

Is it possible to automate the testing of interfaces through this automated test tool when the code release is automatically built through Jenkins?? Reply content: Is it possible to automate the testing of interfaces through this automated test tool when the code release is automatically built through Jenkins?? phpunit + guzzleCombinationphpunitAs a tool for automated testing, add guzzle as the HTTP client in your test code to test your API. No, Mark. PHPUnit? It depends on whet

HTTP Interface Automation Test framework implementation

 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://www.***.com/shoes_product/test/nike_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 cas

Inside com Reading Notes-scheduling interface and automation

1. A new communication method Idispatch provides another communication mode for customers and components. With idispatch, the COM component can provide the services it supports through a standard interface, there is no need to provide multiple specific and service interfaces. 1.1 old communication methods Communication between a customer and a component is completed through an interface, which has an arra

In the Android automation test, uiautomator modifies uiautomatorviewer to fail to obtain the dynamic interface.

In the first article: Comparison of controls obtained by hierarchyviewer and uiautomatorviewer in android automated testing (1) I said that an error will be reported when uiautomatorviewer obtains the dynamic interface. The error is as follows: Today, when I learned uiautomator and used dumpWindowHierarchy () to obtain control information, I found that this method can obtain dynamic interface informat

COM principles and applications----Automation (Automation) objects

1, Automation technology Automation technology both previously mentioned in OLE Automation. Although automation technology is based on COM, automation is much more extensive than COM applications. On the one hand, automation inhe

Total Pages: 15 1 .... 10 11 12 13 14 15 Go to: Go

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.