Unittest+Selenium module-driven automated testing practice

The Unittest + Selenium automated testing framework uses a module-driven test model to encapsulate redundant code into classes, and based on the PageObject automation design pattern , it separates page objects, operations, and services in a layered manner.

1. First create the file module architecture of the automated test framework , create common, base, testcase, reports, and logs folders to store public module classes, basic classes, test case files, test reports, and log files respectively, and create the main file in the root directory. Function run file runner.py

2. Create the basePage.py file through the PageObject design mode to encapsulate the page element object, the loginPage.py file is used for the operation class of the login function, and the test_login.py file is used to test the login function of the user business

(1) bagPage.py file, which defines the methods of opening the browser, locating elements, and inputting element content

(2) loginPage.py file, which defines specific element positioning operations and login operation functions 

(3) test_login.py file, write test cases for login function

 3. Create a runner.py file, import the HTMLTextRunner test report plug-in, add test cases to the test suite, and run the main function to generate a test report

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

insert image description here

Software testing interview applet

The software test question bank maxed out by millions of people! ! ! Who is who knows! ! ! The most comprehensive quiz mini program on the whole network, you can use your mobile phone to do the quizzes, on the subway or on the bus, roll it up!

The following interview question sections are covered:

1. Basic theory of software testing, 2. web, app, interface function testing, 3. network, 4. database, 5. linux

6. web, app, interface automation, 7. performance testing, 8. programming basics, 9. hr interview questions, 10. open test questions, 11. security testing, 12. computer basics

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can help you too!    

Guess you like

Origin blog.csdn.net/nhb687095/article/details/132407568