In-depth analysis of automated testing process (pure dry goods)

Recently, many small partners have asked how to do automated testing? What is the process like? What do you need to pay attention to at each stage? This article also mainly starts with the basic process of automated testing, which will be of great help to students who interview automated testing engineers. For working friends, you can also refer to this process to promote the automated testing of your own projects.


Today, through this article, I will give you an in-depth analysis of the automated testing process.

The process of automated testing and functional testing are actually quite similar. The whole process is also in accordance with the requirements analysis and test planning stage, test design stage, test execution and test summary stage. The summary is the following picture, which is purely hand-painted in ppt, and the effect is not good. , everyone forgive me:

 

1. Test requirements analysis and planning stage

Automated testing is carried out after manual testing, which is the regression testing phase. At this time, there are already complete functional test cases, and after the previous functional testing, the system version has been relatively stable, which is automated testing. The necessary conditions, the following small tasks need to be completed:

1. Sampling analysis of the feasibility of project automation testing

Before conducting project automation testing, the first step is to confirm its feasibility and whether test automation can be implemented. If the project time is tight, the project cycle is short, and the project requirements are volatile, it is recommended to discuss with the superiors and not to carry out automated testing. If you want to carry out automated testing, you should still follow the following prerequisites:

  • Software requirements change infrequently
  • The project cycle is long enough
  • Automated test scripts can be reused

After passing the feasibility analysis, the next step is to make a demo, use the selected framework to try to identify page elements, and run a simple script. If there is no problem, you can use the framework to automate the test of the project. The common verification environment is required have:

  • Is it feasible to use the python+selenium+unittest framework for automated testing on the WEB side?
  • Is it feasible to use the Java+Appium+Junit framework for App-side automated testing?

 

2. Test requirements analysis

Reorganize the functional requirements of the system, and divide the requirements that can be automated. The criteria for the division are generally simple, repeatable, and low-complexity requirements. confidence. On the contrary, if you choose complex business requirements, you will spend a lot of time on script production, and the handling of various abnormal situations will seriously hit our enthusiasm and confidence in promoting automated testing, and finally lose our original intention of automation (Automated testing does not need or need to achieve 100% coverage). Therefore, at the stage of test requirements analysis, determining the test coverage rate, automated test granularity, and screening of test cases are all key tasks.

3. Make a test plan

Ideally, testing begins with the establishment of test objectives and a test strategy that meets the requirements of the test objectives. The management's test plan includes evaluating the time to complete all testing activities, testing activity arrangement and resource allocation, controlling the testing process and tracking the activities required for the entire testing process. These high-level activities should be implemented before the project starts and run through the project the entire development process.

Test planning is the most important activity in the testing process, including the following activities:

  • The principle of entry and exit, to determine when automation can be carried out, what standards are met, and the automation project can be ended
  • Test scope, identification and prioritization of test requirements
  • Schedule, when to deliver what results
  • Personnel arrangement, according to the situation of team members, complex script implementation with good technology; dismantling of functional steps with strong business ability, etc.
  • Risk assessment, to estimate the risks in the project process

 

2. Test design and development phase

The main work at this stage is the design of test cases and script development. Generally, we design test cases first. After passing the evaluation and ensuring that the test cases have covered the requirements, we proceed to the development of test scripts. The method is proven by practice and is the most ideal practice.

1. Test case design

As mentioned earlier, automated test cases do not have to start from 0, they can be used directly from functional test cases through screening and simple modification. The main steps are:

  • Filter function test cases
  • Turn it into an automation use case template
  • Supplement and modify use cases that are not suitable for automation
  • Ongoing maintenance and optimization of automation use cases

The standard reference for screening functional test cases is as follows:

  • Not all manual test cases should be converted to automated test cases
  • Considering the cost of script development, do not choose use cases with too complicated process
  • Selected use cases should preferably be framed as scenarios
  • The selected use case can be a part that you think is repetitive and cumbersome
  • The selected use case can be the main process, which is suitable for smoke testing

Principles to be followed in the process of designing (supplementing and modifying) automated test cases:

  • A use case is a complete scenario, from the user logging into the system to finally logging out and closing the browser
  • A use case only verifies one function point, do not try to verify all functions after the user logs in
  • Write as few reverse test cases as possible.
  • Try to avoid dependencies between use cases and use cases
  • After a use case is tested, the test scenario needs to be restored to avoid affecting the execution of other use cases

2. Test script development

Test script development includes creating test programs that are maintainable, reusable, simple, and robust. At the same time, care should be taken to ensure the structure and consistency of automated test development. According to the developed test cases, write automated test scripts for each function point, and add checkpoints for parameterization. This process also requires writing data file processing scripts, log file processing scripts, database processing scripts, public checkpoint processing scripts, and so on.

In script development, common models are:

  • Linear Model: is the basis for our development script
  • Modular drive test: Some functional modules need to be isolated for easy maintenance and calling
  • Data-driven testing: Refer to the author's article:
  • Keyword-driven testing: Refer to the author's article:

In order to better teamwork for automated testing, we need to manage the project hierarchically. We can divide public module parts, test cases, test data, test reports, test logs, etc. according to needs, and provide the main module for execution.

Among them, the public modules can include: log module, mail sending module, public login and exit module, database operation module, etc., which are mainly convenient for calling in test cases.

The execution main module is mainly responsible for all test case scheduling, you can refer to the following code:

import unittest
import time
from HTMLTestRunner import HTMLTestRunner
from public.mailsend1 import mailsend
from public.Loginmodel import verylogin,veryLogout

import os
if __name__=='__main__':
    path1 = os.path.dirname(__file__)+r"/test_cases/"
    path2 = os.path.dirname(__file__)+r"/test_report/"
    send = mailsend()
    discover = unittest.defaultTestLoader.discover(path1,pattern='veryReg*.py')
    filename1 = time.strftime("%Y-%m-%d-%H-%M-%S")
    filename2 = filename1+r'.html'
    filename = path2+filename2
    with open(filename,'wb') as f:
        runner = HTMLTestRunner(stream=f,title='测试结果',description='第一轮测试结果')
        runner.run(discover)

    time.sleep(3)
    send.sendFujian(filename1)

Finally, in order to produce a visual report, we can choose the HTML format report for secondary development

3. Test Execution Phase

With the establishment of the test plan and the construction of the test environment, the test is executed according to the schedule of the test program, which can be performed manually, automatically, or semi-manually and semi-automatically, and each of them can find different types of errors. After the test is executed, it is necessary to compare, analyze and verify the test results to obtain a test report (including a summary report and a detailed report).

If the script is stable, you can use the Jenkins tool for continuous integration, and finally realize unattended testing. The integration method

Fourth, the test summary stage

Analyze the record of the error reported in the test result file, and submit a defect report if it is indeed caused by the defect of the system under test. Summarize the results of automated testing, analyze the problems existing in the system, and submit the "Test Report".

 

5. To sum up

1. Limitations of automated testing

For automated testing, different levels have different efficiencies, and the project needs to carefully consider the choice. According to the test pyramid model and the input/output ratio, the lower the level, the higher the rate of return.

  • Unit automated testing (data processing layer): refers to the inspection and verification of the smallest testable unit in the software, generally requires the use of unit testing frameworks, such as java's Junit, TestNG, python's unittest, pytest;
  • Interface automated testing (business logic layer): mainly check the call return between verification modules and the data exchange between different systems and services. Common interface testing tools include postman, jmeter, loadrunner, etc.;
  • UI automated testing (GUI interface layer): The UI layer is the entrance for users to use the product. All functions are provided to users through this layer. Most of the testing work is concentrated on this layer. Common testing tools include UFT, Robot Framework, Selenium, and Appium wait;

With the investment in automated testing of Google, the leader in the automated testing industry, it is not difficult to see that the stalk is rich:

  • Small test (Unit): accounting for 70%;
  • Intermediate test (Service): accounting for 20%;
  • Big test (UI): accounted for 10%;

The biggest challenge for automated testing is change, because changes will cause test cases to fail, so it is necessary to continuously debug automated scripts. How to control and reduce costs is a challenge to automated testing tools and human capabilities.

2. How to promote the implementation of automated testing

Automated testing is a basic skill required by mid-level test engineers in enterprises. If you want to have core competitiveness in the software testing industry, you need to work hard in this area. I hope to provide students with interview ideas for automated test engineers. For working friends, provide methods to promote automated testing of their own projects.

Well, let’s write here first, there are still many shortcomings in the article, and we will continue to maintain and update it in the future.


If you think it is helpful to you, please like, like, bookmark this article, and encourage the author! ! !


 

The following is the supporting information. For friends who do [software testing], it should be the most comprehensive and complete preparation warehouse. This warehouse also accompanied me through the most difficult journey. I hope it can help you too!

How to get it for free:

加入我的软件测试交流群:110685036免费获取~(同行大佬一起学术交流,每晚都有大佬直播分享技术知识点)

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

method of obtaining:

Guess you like

Origin blog.csdn.net/jiangjunsss/article/details/130866245