For the knowledge of automated testing framework, reading this article is enough!

Automated testing has gradually become a "trend" for testers due to its advantages of cost saving, efficiency improvement, and manual intervention reduction. Practitioners are increasingly aware that implementing an automation framework is one of the key factors for the success of software automation projects. This article will elaborate on what is a real automated testing framework, how automated scripts work, and how an automated testing framework will provide you with a competitive advantage in the testing process, allowing you to step into automated testing through this article The field of the frame.

Advantages of automated testing

The popularity and many advantages of automated testing do not mean that it is a panacea. Customized projects, short cycles, and ease of testing are not suitable for automated testing. But it is undeniable that if the automated testing framework is carefully planned and executed, it will indeed bring the following benefits to software development and testing companies:

The shortest time - maximum profit

Building any viable automation testing framework and automation scripts minimizes the time spent writing and running tests, allowing for maximum output in a short amount of time. In addition, having a good automated testing framework frees manpower from common problems such as synchronization, error management, local configuration, report generation, interpretation, etc.

Reusable and readable automation code

When you use the code mentioned in the existing component library, you can rest assured that it will still be readable and reusable at a later time, and all related tasks (such as reporting, synchronization and troubleshooting) will become easier. more accessible.

resource optimization

Some companies don't benefit from automation implementation as much as they thought, because the benefit from automated testing depends on the flexibility to adopt it. If an automated system is flexible and compatible with different teams working on individual components, it can provide huge benefits in terms of resource optimization and knowledge sharing. ,

Definition of automated testing framework

In many other industries, "automation" refers to the automation of processes through intelligent algorithms, with little or no human intervention required to run the process. In the software industry, automated testing refers to various tests of software applications through automated tools (licensed version or open source version). From a technical point of view, an automated testing framework is a set of customized interactive components that can be used to execute scripted tests and comprehensively report test results.
To successfully build an automated testing framework, it is necessary to consider the advice of software quality assurance experts who can help observe and help control the entire testing process and improve the accuracy of test results. A well-designed automation testing framework enables testers to perform automated testing in a practical and simplified manner.

Types of automated testing frameworks

Tool-Centric Framework

Both commercial automation tools and open source automation tools have a system infrastructure that facilitates report generation, test suites, and distributed test execution in a test environment. Such as the Selenium automation framework, which has a main component WebDriver - a web browser-based plug-in for controlling and manipulating the DOM model of an application in a web browser. The Selenium test automation framework also has useful coding libraries and record playback tools.

Another important tool-specific framework is Serenity, an accelerator built around the Selenium Web driver. In this case, to speed up the test automation implementation process, the community combines specific components in a common entity.

It is difficult to make a definitive judgment when using tool-specific frameworks such as TestComplete, Ranorex HP QTP, as they are all pre-built with deployed infrastructure with motion simulators, reporting and scripting IDEs.

Application-Centric Framework

This type of framework is tailored to automate a specific application project. Application-centric frameworks support the need for test automation for a specific target application, driven by components built from open source libraries. This framework can create a friendly test environment around the SUT to run some basic functions, including deploying developed applications, running applications, test case execution, direct test result reporting and wrapper controls for easy coding. The application-centric framework will also have a component to support test runs across various cloud environments on different operating systems and browsers.

Keyword Driven Framework

Keyword-driven frameworks primarily appeal to novice developers and testers with little coding experience, and can be either tool-centric or project-centric. Keyword-driven frameworks allow non-coding-skilled employees to participate in writing and understanding automation scripts. The set of keywords used for coding (e.g. Login, NavigateToPage, Click, TypeText) is installed as a keyword repository in the codebase, and the scripted spreadsheet based on the provided keyword references will be passed to the keyword interpreter to execute the tests .

insert image description here

The main components of an ideal automated testing framework

If you want to implement a powerful and high-performance test automation framework (whether open source or commercial), you must include certain components that form its core. Some frameworks may include all components, and some frameworks include only a few of them, so not all components mentioned below need to be involved in every framework.

1. Test base components

a) unit tests

Unit testing infrastructure components can be an essential part of any automated testing framework. It can be used in the following situations:

● Define the test method being used through specific forms such as @test or [test]
● Execute assertions that affect the final result of automated tests
● Run simple and clear tests

Whether running tests from the command line, an IDE, a dedicated tool, or a CI (continuous integration) system, to ensure that unit tests are run in an easy way, unit testing libraries provide test runners.

Unit testing libraries support almost all programming languages, such as the following: Java's JUnit and TestNG, .NET's NUnit and MSTest, Python's unittest (formerly PyUnit).

b) Integration and end-to-end testing

While performing integration and end-to-end test automation, it is also very suitable to practice the functions provided by existing test libraries. API-level testing driven by the application UI requires components that remove unnecessary coding burdens, making it easier to interact with the application under test. Thus, the tester is not troubled by the coding work of connecting to the application, sending the request, and receiving the resulting response.

A few important test components of this type are: Selenium (available for major languages), protractor (JavaScript-specific), Karate DSL (Java-specific API-level integration tests).

c) Behavior Driven Development (BDD)

Components dedicated to BDD target behavioral specifications, creating executable specifications in the form of executable code. In this part, testers can translate different features and scenarios of predicted behavior into code. Although not directly interacting with the application under test like other testing tools, it can be used as a support for the BDD process, creating active documentation consistent with the scope and intent of the automated tests. Typical examples of BDD components are: cucumber (supports major languages), Jasmine (JavaScript), SpecFlow (for .NET).

2. Test data management

In the process of software test automation and test creation, the biggest difficulty is how to utilize the test data management system. As the amount of automated testing increases, there is always the problem of ensuring that some of the test data required to execute a particular test is available or can be created when the test is executed. There is currently no one-size-fits-all solution to this situation, which requires a solid approach to test data management for automation to work successfully.
Therefore, the automated testing framework adopted needs to be configured sufficiently to provide basic remedial measures to enter or create and clear test data to be executed. The solution to this problem is to use appropriate simulation tools to make the data more simplified, clearer and easier to understand.

3. Mocks, stubs and virtual assets

In the process of practicing and exploring automated testing, the following situations may arise:

Want to isolate modules from connected components experienced in unit testing

● Handle cumbersome and critical dependencies common in modern application integration, or end-to-end testing

In these cases, you may find it necessary to create mocks, stubs, and virtual assets that reflect the behavior of connected components, and you may find that dealing with mocks and stubs is a large-scale, high-volume task. Regardless, testers will realize that it is very important to choose a useful virtualization tool during the development of an automated testing framework.

Generic Mechanisms for Implementing Patterns

In addition to the automation framework components mentioned above, there are some useful mechanisms to help create, use and maintain automated tests, such as:

Wrapper methods : When using Selenium WebDriver components, creating custom wrappers makes it easier to handle errors. Once you've created a custom wrapper for your Selenium API calls, you can better handle timeouts, exception handling, and fault reporting. Afterwards, the people who created the automated tests can be reused, so that they can avoid the concerns of complex processes and focus on conducting valuable tests.

Abstraction methods : Abstraction means improved readability and masking of redundant details. For example, the purpose of using page objects when creating Selenium WebDriver tests is to expose user input actions on a web page, including entering credentials or clicking somewhere on the page, with the goal of enabling advanced Test Methods. This approach works for many similar applications and automated tests.

Test result report

When choosing a library or mechanism to report test results into your automation framework, you need to take into account the target audience who will be viewing this report. In this regard, there are a few considerations to follow:

● Unit testing frameworks such as Junit and TestNG generate reports primarily for receiving systems such as CI (continuous integration) servers, which eventually interpret and present them in an XML format that other software can consume.

● When looking to use a language that most people can understand as a reporting tool, you may want to consider using commercial tools that are compatible with unit testing frameworks, such as UFT-Pro for Junit, NUnit, and TestNG.

●Another option is to utilize a third-party library such as ExtentReports, which creates reports of test results in an easy-to-understand format, including visual explanations via pie charts, graphs, or images.

auxiliary platform

In addition to the automated testing framework itself, some auxiliary platforms related to continuous integration will also be of great help to automated testing. For example, CI can perform deliverable deployment and test scheduling; the source code platform can manage the code of products and test scripts; dependency managers are generally dependency management tools for certain language libraries, such as using nexus to manage general java types developed by employees of the company ; Zen Road ZTF includes features such as continuous integration, unit testing, and version library management.

insert image description here

CI platform

To conduct application testing in a faster and more coherent manner, a continuous integration platform can help you build your software regularly and run various tests for new releases. This approach enables developers and testers to get regular feedback and rapid response on application quality when new features are developed and deployed, and when existing features are updated. Some of the current prominent continuous integration platforms are TeamCity, CircleCI, Jenkins, etc.

source code management

Like manual testing, automated testing involves writing and storing versions of source code. Every development company has a curated source code and version control system to preserve and protect the source code. Automated testing requires a sound source code management system, which can come in handy when working with production code. Typical source control examples are Git and Subversion.

Create a dependency manager

The main purpose of a dependency manager is to assist in the collection and management of existing dependencies and libraries that have been implemented in the functionality of an automation software solution. Some tools, such as Maven and Gradle, both act as dependency managers and help build tools. Build tools are designed to help you develop automated software and run tests from source code and supporting libraries. Tools for this include Ant, npm, and NuGet.

Zen Road ZTF

ZTF supports seamless integration with ZenTao, and can bind ZenTao use cases and automated test scripts one by one. The execution results can be submitted to ZenTao as test results, and scripts that fail to execute can also automatically create bugs. The ZTF automated testing framework realizes the continuous integration function with Jenkins. After the user initiates the task, the test script is automatically executed through ZTF, and the result of the unit test is sent back to Zen Road. The two cooperate to open the closed loop of continuous integration.

Framework construction and implementation process

Here are a few ways to plan to implement an automated testing solution:

●Discuss the practical applicability of automation from the customer's point of view, check whether it looks good from all angles, and test it on underused technologies. In contrast, there is little need for automated testing if the effort to automate development greatly outweighs the expected benefits.

● It is critical to pay close attention to the technology of the system under test in order to find the most suitable automated testing tool that perfectly simulates user behavior.

● A phase-based approach to implementation is recommended, where each phase has a priority for delivering automated test scripts, while adding framework functionality to enable expected script execution.

● Before launching software automation testing, to ensure that the automation decision is executed correctly, it is necessary to first estimate the return on investment after implementation, proof of concept, time to run manual regression or smoke tests, and the number of run cycles for each version.

in conclusion

In today's fast-paced, brutal software development ecosystem, automated testing frameworks play an integral role in maintaining the speed, efficiency, and clarity of the software testing cycle. As artificial intelligence is being introduced into software testing, organizations considering adopting an automated testing framework must delve into the design of the final framework before venturing into this space. A good framework design and strategy for using components will lay the foundation for the final automated testing framework.

The best way to build a mature, granular, and flexible automated testing framework architecture is to start small, test and audit frequently, and gradually build extended versions to higher layers. It is convenient to prepare a large number of automated tests from an early stage to see the working framework sooner and avoid conflicts or damage later in the automated testing phase.

The guidelines set forth above are intended to help software testers and companies to learn from those projects that have successfully performed automated testing.

Finally : In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free【保证100%免费】

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

全部资料获取:

insert image description here

Guess you like

Origin blog.csdn.net/m0_53918927/article/details/131725522