Dry goods - roll up, enterprise-level web automation testing in practice (1)


foreword

Before starting - project discussion

What parts of the project are eligible for automated testing? (Target and scope, entry and exit standards)
Stable demand points, pages with less changes;
daily build after daily build test verification;
more frequent regression tests;
the same test cases that need to be run on multiple platforms, Combined traversal tests, a large number of repetitive tasks;

What is the coverage rate of test cases for automation use cases in the entire project?
50% + for general requirements;
80% + for key requirements;
according to the specific requirements of the project, the coverage rate needs to be considered separately for projects with particularly large changes;

Project team building

Establish an automated testing group, ideally with 4 people, test development, middle and senior automated testing engineers, and 2 junior automation engineers; in non-ideal situations, there may be only one person.

Test development: basic answer: construction of automation framework, determination of design patterns of automation framework, encapsulation of third-party code tools, design and invocation of intermediate public modules, test cases, management and execution of test suites, output of test reports and test results (file output and email notification)

Optional Advanced: If possible, it is necessary to build a continuous integration server (CI, Continuous Integration Server) environment for continuous delivery and automated smoke testing.

The task of training requires training other members on the framework of the design and the driver of the package.

Experience in implementing automation solutions, development background, and continuous integration background, etc.

Intermediate and senior automated test engineers: cooperate with test developers to implement the construction of test frameworks. Mainly responsible for the implementation and instantiation of intermediate public modules, as well as the scripting and debugging of some highly difficult and complex automation use cases.

Has participated in the construction of automation solutions, has rich experience in script writing, can code debugging, understands web testing, etc.

Junior automation test engineer:
According to the design of the intermediate public modules, instantiate public modules and method combinations to realize the writing of automated use case scripts. Have computer programming thinking, code experience, can read scripts and HTML, etc.

Project technical solution selection

Selenium WebDriver、Python(unittest) Java(JUnit)、CI Server

Technical solution:
Choose the technical solution of Python + Selenium.
Use: Python+Selenium4+Pytest/Unittest+POM+Allure+Jenkins;

First of all, technical tools are free, Python tools use PyCharm community version, and Selenium's WebDriver is an open source tool. Using the relatively simple Python language for automated testing is more practical in terms of personnel learning costs, and the learning time is short, which has advantages.

In addition, the unittest unit testing framework that comes with Python can easily implement tasks such as the design and execution of automated use cases and the management of automated use case suites. Python is a pure object-oriented language, and it can also be transitioned to Java + Selenium for richer automated testing.

In addition, you can choose Jenkins as the continuous integration server to conduct automated smoke testing with the Python+Selenium solution.

Source code management tools (VCS, version control system)

Choose SVN (git) as the source code management tool for the code.

The steps to integrate in PyCharm are as follows:
Put the code in the folder directory where SVN checks out locally, such as D:\SVN\XXProject\Trunck

Open the newly deployed code with PyCharm
Select PyCharm's VCS|Enable VCS integration, select Subversion (svn) or Git

Right-click the root directory of the project file, select Subversion | add to VCS,
right-click the root directory of the project file, or select VCS | Commit Directory...
After opening the code every day, first Subversion | update project

Hardware:
The hardware requirements are not high, and an independent test environment is mainly required. In addition, the computer used by the testers is preferably a Windows desktop operating system, and the Firefox browser needs to be installed to avoid the latest version of 47.0. It is best for testers to use the Chrome browser to assist in the positioning of Web elements.

automated testing environment

Python + Selenium WebDriver
steps to build the environment:
install python3.x (windows xp does not support python3.5+);
set the environment variable path (you can also check add python.ext to path during installation);
install Selenium and install pip with the pip command install -U selenium;

Are there any questions?
path, pip may not be able to locate it, and pip may also locate it in another folder (perl)

Solution: cd c:\python34\scripts
external network ip problem. The reason for the switch is the same ip in the LAN, causing the installation to time out

Firefox version 46.0 and below
Windows 7 x64 and above systems need to run cmd in administrator mode, otherwise the installation will fail.
normal use

Positioning method
by id, name, class_name, tag_name, css_selector, xpath, link_text, partial_link_text
mainly uses id, name, css_selector, xpath, link_text

Python + Selenium environment construction

To install Python, 3.x (3.4 3.5 3.6 3.7 3.8)
needs to add "C:\Python34;C:\Python34\Scripts;" to Path

Steps:
Right-click My Computer Properties | Advanced System Settings | Environment Variables
Find System Variables | Path and double-click | Ctrl+C | Edit | Ctrl+V

Install Selenium
cmd | pip install -U selenium

-U = --upgrade 升级安装

Similar to the problem that the linux command
command -x param
is prone to

Environment variable
cd C:\Python34\Scripts
and then install
Administrator rights
Right-click administrator mode to run

The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

Only with unremitting efforts can we write a wonderful chapter in life; only by not being afraid of hardships and hardships can we create our own brilliant future. No matter what kind of challenges you encounter, you must meet them with a positive attitude, believe in your own potential, go forward bravely, and strive endlessly!

Only those who dare to pursue their dreams and face challenges can create their own brilliant life. Every effort is a solid step towards success, don't give up, fight, victory is ahead!

Only by doing your best can you see your unlimited potential; only by striving constantly can you realize the great dream in your heart; only by persevering can you create your own brilliant life. Believe in yourself and keep challenging, you will definitely be the best version of yourself!

Guess you like

Origin blog.csdn.net/csdnchengxi/article/details/131599266