Python interface automation test with Excel data easily (i)

Source: Internet
Author: User

Just entered the testing industry, the first is to do functional testing, I think many partners and I, feel that automated testing is very high-end, very mysterious. Eager to learn to do automated testing.

Used to compare commonly used database +python do automation, the later found that Excel personally feel more suitable, just began to do automatic test, very eager to build the whole frame immediately, but impatient to eat hot tofu,

or from the basics, here is a python combination of Excel data to implement a single interface to automate testing steps, understand this, you can use the entire framework, encapsulated into a common module, bulk read data, execute data.

Now with our company's login interface as a column, the input parameters are "Doc_info", "user_pwd", "source" three items, only if "Doc_info =" 15899860330 ",", "user_pwd" = 123456a, Time, To return the correct JSON format, the returned code is "000000" returned:

If the parameters are incorrect, different code will be returned, and the reason

Here, the beginning of the idea, for this interface, we like functional testing, write down what columns, and then design a table, fill in the Excel table,

Next we're going to check to see if the returned code value is equal to the value we expect (that is, the contents of cell expected_code), such as consistent, which means that the column is passed. How it is implemented, see the code below

If the end is pass, then the use case executes successfully

Automated testing of an interface and Excel data is done, and in practice we sometimes want to write the results of the final printout of our judgment into a field in an Excel table, such as Final_reslut, so that we can open the Excel table more clearly, Equivalent to a test report.

Python can reference the XLWT3 module, you can write data to Excel, but found that this feeling is more troublesome, could not reference xlwt3, directly in the original list written? The answer is yes. I will continue to update for this later.

More information or software downloads can follow my blog or join the following groups, qq:511213522

We exchange software tests together and progress together.

Python interface automation test with Excel data easily (i)

Related Article

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.