Automated test series – UI automated testing

UI testing is a type of testing also known as user interface testing, through which we check if the interface of the application is working properly or if there are any bugs that hinder user behavior and do not comply with the written specifications. It is crucial to understand how the user will interact between the user and the website to perform UI testing. By performing UI testing, the tester will try to imitate the user’s behavior to see how the user will interact with the program and to see how the website performs. Does it work as expected and is it defective?

What is UI testing?

UI testing covers the user interaction part, including the structural and visual parts of the website that users care about. Web sites contain many different web elements from CSS, JavaScript and many other languages. Website elements can be connected to the screen, keyboard, mouse or any other tool that the user uses to interact with the website. UI testing captures these elements and tests them. Test and declare.

When performing UI testing, care needs to be taken to ensure that the application does not have any cross-browser compatibility issues. Since each browser uses a different browser engine and may not support the same CSS features. Therefore, it is important to ensure that the UI renders seamlessly across all major browsers. Testing on different browsers is called cross-browser testing and helps testers test their website under multiple combinations of all major browsers and devices including mobile phones, tablets, etc.

Manual or automatic, how to choose?

Like any other type of testing, UI testing can be performed manually or through automation. Manual testing requires testers to manually perform every test on every element. For example, testing an input field will require typing different values again and again for any differences. If the website UI has fewer components, UI testing is best done quickly through a manual process. But it is not suitable for complex websites. Websites with rich user interfaces make manual UI testing very inefficient, time-consuming and error-prone.

Now I have also found a lot of test friends and created a communication group to share technology, sharing a lot of technical documents and video tutorials we collected.
If you don’t want to experience the feeling of not being able to find resources when studying on your own, having no one to answer your questions, and persisting for a few days before giving up.
You can join us to communicate. And there are many technical experts who have made certain achievements in automation, performance, security, test development, etc.
Share their experience, and also share many live lectures and technical salons
You can learn for free! Focus on it! Open source! ! !
QQ group number: 110685036 [password: csdn999]

Scenarios suitable for UI automated testing

Not all test scenarios are suitable for automated testing. In this regard, you can refer to the following standards to assist in judgment:

  • Project requirements do not change frequently
  • The UI of the page has entered a stable stage
  • The project cycle is long enough
  • A large number of regression testing tasks

Among them, some projects are obviously not suitable for UI automation testing, such as video players, music players and other software that are highly interactive and have strong concurrency dependencies.

Advantages of UI automated testing

The UI automation testing process simplifies the process of creating UI tests, running tests, and viewing results. There are many reasons why development and testing teams choose automated UI testing, the most noteworthy include:

  • Time – Manual testing is slow and cannot keep pace with many development processes.
  • Cost – Manual testing is resource intensive and costly.
  • Accuracy – Manual testing is prone to more errors when performing repetitive tasks. In contrast, automation reduces the chance of these errors.
  • Scaling – When performing complex iterations, it’s difficult to rely on manual testing.
  • Trend – Most organizations have realized how to benefit from automated testing and therefore, there is increasing pressure to jump on the automation bandwagon.

UI automation test design principles

  • One test case completes one function point test (commonly used): one manual use case corresponds to one automated test case;
  • A script is a complete scene;
  • The scripts are independent and cannot have dependencies (scripts are isolated from each other): for example, use cases related to login status: personal center, order details, order shopping, etc. If the scripts are not independent and dependent on each other, the login test script will fail. In this case, the personal center, order details, and test scripts for ordering and shopping will all be destroyed, and subsequent repair and maintenance costs will be high;
  • Set appropriate checkpoints: determine the success or failure of the use case through assertions;
  • Well-designed framework: Commonly used test frameworks in Python include unittest and pytest. Use the framework to encapsulate shared test modules to reduce the workload of automated test script maintenance;

Introduction to WEB-side UI testing tools

API test cases mainly consist of 4 parts, namely: basic information of the use case, pre-steps, request scripts and assertions.

UTF

UTF(Unified Functional Testing) = QTP(Quick Test Pro) + ST(Service Test) is developed by HP. It is an enterprise-level automatic testing tool that provides powerful and easy-to-use recording and playback functions. It is compatible with both object recognition mode and image recognition mode, and supports software testing in both B/S and C/S architectures. It is currently the mainstream automated testing tool. Mainly used for regression testing and testing of new versions of the same software.

Robot Framework

It is an automated testing framework written in the Python language. It has good scalability, supports keyword drive, can test multiple types of clients or interfaces at the same time, and can perform distributed testing.

Selenium

Selenium overview

Selenium is also a tool for web application testing. It supports multiple platforms, multiple browsers, and multiple languages to implement automated testing. It is currently the most widely used in the field of web automation.

Selenium is one of the most widely used open source web UI (user interface) automated testing suites, originally developed by Jason Huggins in 2004 as an internal tool at Thought Works. Selenium supports automation across different browsers, platforms and programming languages.

Selenium features

  • Selenium is an open source and portable web testing framework.
  • Selenium IDE provides playback and recording capabilities for authoring tests without having to learn a test scripting language.
  • It can be considered as a leading cloud-based testing platform that helps testers record their actions and export them into reusable scripts with an easy-to-understand and easy-to-use interface.
  • Selenium supports various operating systems, browsers and programming languages. The following list:
    • Programming languages: C#, Java, Python, PHP, Ruby, Perl and JavaScript
    • Operating system: Android, iOS, Windows, Linux, Mac, Solaris.
    • Browser: Google Chrome, Mozilla Firefox, Internet Explorer, Edge, Opera, Safari, etc.

  • It also supports parallel test execution, thereby reducing time and increasing testing efficiency.
  • Selenium can be integrated with frameworks such as Ant and Maven for source code compilation.
  • Selenium can also be integrated with testing frameworks like TestNG for application testing and report generation.
  • Selenium requires less resources compared to other automated testing tools.
  • The WebDriver API has been attempted to be integrated into Selenium, which is one of the most significant changes to Selenium.
  • The Selenium web driver requires no server installation and the test scripts interact directly with the browser.
  • Selenium commands are categorized according to different classes to make them easier to understand and implement.
  • Selenium Remote Control (RC) together with WebDriver API is called Selenium 2.0. This version is designed to support dynamic web pages and Ajax.

Three major advantages of Selenium

  • Speed: Time is the main resource of every company, and automated testing can save a lot of time. Selenium Automation testing requires us to write tests only once and run them again and again without any intervention with different values and different scenarios.
  • Accuracy: As long as the tests are written correctly, Selenium Automation tests can help us execute the tests correctly. The main disadvantage of manual testing is the vulnerability to human error.
  • Transparency: Selenium Automation testing also helps in quickly generating reports and sharing them with the team as soon as the test is completed. Manual testing, on the other hand, requires time to extract the results and report the results manually to generate reports either through software or manually.

Summary

UI testing is an important part of the software testing cycle and is an important driver of improving user experience and customer satisfaction. Most end users care more about what they actually see and touch. So this is why UI or user interface becomes so important hence UI testing.

END Today’s sharing ends here, like and follow to avoid getting lost