Selenium2+python automation 63-easy project construction

foreword

In unittest, we can basically build a simple project framework. We can use a run_main.py script to control the execution of all use cases, generate reports, and send emails for a series of actions

 

1. New construction

1. Open File>New Project in the upper left corner of pycharm, and enter the project name in the Location location: D:\test\test_blog

2. After creation, select Opin in current window

 

2. Project structure

1. Under the test project, create a folder, you must choose the way of Python Package to create, otherwise there will be various problems when importing your own modules later.

2. Create the following files under the project

--test_case This folder puts all test cases

----blog_home can be divided by functional use case module

---------test_home

---------test_home_1 Test cases are named starting with test

----blog_login

---------test_login

----blog_set

---------test_set

--test_report

--run_main.py

 

3. run_main

1. The main function is written in the script run_main.py to control the execution of all use cases. In the end, we only need to run this script.

2. We can also execute this script file in cmd, so that we don't have to rely on pycharm to execute it (subsequent execution with jenkins is the same, start cmd to execute the script)

>>d:

>>cd test\test_blog

>>python run_main.py

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325473091&siteId=291194637