Automated testing series - UI testing

UI testing is a type of testing, also known as user interface testing, through which we check whether the interface of the application is working properly or whether there are any bugs that prevent user behavior and do not meet the written specifications. Understanding how the user will interact between the user and the website is essential to perform UI testing, by performing UI testing, the tester will try to imitate the behavior of the user to see how the user will interact with the program and see how the website works Whether it is as expected, whether there are defects.

The following is a detailed introduction to the UI testing functions provided:

What is UI testing

UI testing covers user interaction, including the structural and visual parts of the site that users focus on. A web site contains many different web elements from CSS, JavaScript, and many other languages. A web site element can be connected to a screen, keyboard, mouse, or any other tool a user uses to interact with a web site. 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 on all major browsers. Testing on different browsers is known as cross-browser testing and helps testers to test their website on 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 execute each test on each element. For example, testing input fields will require typing different values ​​over and over again for any discrepancies. If your website's UI has fewer components, it's better to do UI testing through a manual process, which can be done quickly. But it is not suitable for complex websites, and websites with rich user interfaces make manual UI testing very inefficient, time-consuming and error-prone.

Scenarios suitable for UI automation testing

Not all test scenarios are suitable for automated testing. For this, you can refer to the following criteria to assist judgment:

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

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

Advantages of UI automation testing

The UI automation testing process simplifies the process of creating UI tests, running the tests, and viewing the results. There are many reasons why development and testing teams choose to automate UI testing, the most notable ones 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. Instead, automation reduces the chances of these errors.
  • Scale – When performing complex iterations, it is difficult to rely on manual testing.
  • Trends – Most organizations have realized how they can benefit from automated testing, so there is increasing pressure to jump on the automation bandwagon.
现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:110685036

Design principles for UI automation testing

  • A test case completes a function point test (commonly used): a manual test case corresponds to an automated test case;
  • A script is a complete scene;
  • The scripts are independent and cannot depend on each other (the 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 depend on each other, the test script for login will fail In some cases, the personal center, order details, and test scripts for order shopping will be wiped out, and the follow-up repair and maintenance costs will be high;
  • Set up an appropriate checkpoint: judge the success of the use case through assertions;
  • Well-designed framework: The commonly used test frameworks for Python include unittest and pytest. Using the framework and encapsulating shared test modules reduces the workload of automated test script maintenance;

Introduction to WEB-side UI testing tools

The API test case is mainly composed of four parts, namely: basic information of the use case, pre-steps, request script and assertion.

UTF

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

Robot Framework

It is an automated testing framework written based on the Python language. It has good scalability, supports keyword-driven, 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 testing web applications. It supports multi-platform, multi-browser, and multi-language to realize 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) automation test 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 as 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, which reduces time and improves test 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 reporting.
  • Selenium requires fewer resources than other automated testing tools.
  • The WebDriver API has been tried to be integrated in Selenium, which is one of the most important changes made to Selenium.
  • Selenium Web Driver does not require server installation, test scripts interact directly with the browser.
  • Selenium commands are categorized according to different classes, making them easier to understand and implement.
  • Selenium Remote Control (RC) is known as Selenium 2.0 together with the WebDriver API. This release is designed to support dynamic web pages and Ajax.

Three 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: Selenium Automation testing helps us to execute tests correctly as long as the tests are written correctly. The main disadvantage of manual testing is that it is prone to human error.
  • Transparency: Selenium Automation testing also helps to generate reports quickly and share them with the team as soon as the testing is complete. On the other hand, manual testing takes time to extract the results and report the results manually to generate reports through software or manually.

Choerodon UI test

Install

If you use UI testing in Choerodon, you need to install Selenium IDE first.

Selenium IDE (Integrated Development Environment) is an open source web automation testing tool under Selenium Suite. Unlike Selenium WebDriver and RC, it does not require any programming logic to script its tests, but simply records interactions with the browser to create test cases. Afterwards, the test case can be rerun using the play option. Note: Selenium IDE is only available as a Firefox and Chrome add-on, it cannot record test cases on browsers other than Firefox and Chrome. Recorded test scripts can also be exported to programming languages ​​such as C#, Java, Ruby or Python.

Firefox browser

Chrome browser

use

Record and playback scripts using Selenium IDE on Chrome browser

1. Open the IDE, the initialization interface is as shown in the figure:

2. Create and start recording, enter the recorded web address

3. After the recording is completed, right-click the test case, save or export. Selenium IDE saves all .side single files

The UI test in Xiao Ma is imported into the system through the side file generated by recording in Selenium IDE, and the corresponding test cases and steps are generated in the UI test interface; then the corresponding test file can be directly executed to test the UI operation of the interface , you can visually see the generated test report.

Summarize

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 also why UI or user interface becomes so important and hence UI testing.

The following are supporting learning materials. 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!

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

Information acquisition method:

Guess you like

Origin blog.csdn.net/IT_LanTian/article/details/132278861