Web automation testing common interview questions

1. The possible reasons for the element not being found:

1. The element expression is wrong
2. Not in the specified frame
3. The waiting time is short and the page loading speed is slow
4. Executing the script opens a new page, which is not in the specified window

2. Optimize the efficiency of web automation testing

Avoid using forced waiting, it will waste waiting time

3. Understanding of PO mode

1. PO mode achieves code reusability
2. Improves code maintainability and readability

  • Separate business logic from test logic
  • When the page changes, the test logic does not need to change, only the business logic needs to be changed
  • When the test logic changes, the business logic does not need to change, only the test logic needs to be changed

3. Page methods generally return self or other pages
4. Do not write assert assertions in the page
5. If there may be return values ​​in multiple situations, encapsulate multiple methods (behaviors)

4. Problems of Stability and Efficiency

1. Prioritize stability
2. If improving efficiency will affect stability, ignore improving efficiency

5. Problems with the verification code

1. Turn off the development
2. Set the universal verification code for development

6. What kind of projects are suitable for automated testing

1. The demand is relatively stable and does not change frequently
2. The project cycle is relatively long (promotional activities, Mid-Autumn Festival, Dragon Boat Festival, the function is one-time, and it took half a month to write the code once)
3. The code is highly reusable and can be cross-platform , cross-system
4, relatively standardized process design
5, often required regression testing

Seven, the difference between pytest and unittest

1. pytest has the function of automatically collecting use cases
2. pytest has thousands of plug-ins, its own plug-in system
3. pytest has the function of re-running after failure
4. pytest has very flexible test fixtures, fixtures, setUp, tearDown
5. pytest is fully compatible with unittest

8. What factors affect the stability of web automation?

1. Backend service, loading some static pages, sometimes the rendering is slow

9. The process of automated test cases (the process of writing code)

1. Carry out manual testing, familiarize yourself with the process, and prepare element positioning expressions
2. Form test steps
3. Steps to convert to code version
4. Write code

Ten, the general structure of the test framework

1. common, public method layer: encapsulate some commonly used methods, log configuration files,
2, config, configuration layer: log level, mysql database information, account information
3, data, data layer: test cases
4, img, image layer: Page error screenshot
5, logs, log file layer: script running log
6, output, test report layer
7, pages, business logic layer
8, testcases, test logic layer
9, main file: script entry

11. Please list your commonly used assertion (verification) methods in web automation

1. Assert according to the url of the page (verify whether the page after the jump is correct)
2. According to the title of the page (verify whether the title after the jump is consistent)
3. According to the prompt information of the page (after the recharge is successful, jump to the recharge if the recharge is successful text)
4. According to the display of certain elements (the user name after the jump)

12. How to design UI automation test cases?

UI automation test cases are extracted from manual test cases. Compared with manual tests, automated test cases pay more attention to the rigor of use cases. 1. Prioritize the
selection of use cases that cover the core functions of the product
. 2. Considering the cost, do not choose the process that is too complicated 3. The
selected use cases can be repeated execution, cumbersome parts, such as field verification and prompt message verification
4. Prioritize the positive test cases. The reverse case is generally complex, large in number, and time-consuming

Thirteen. In order to improve the stability of UI automation scripts, what work have you done?

1. Element positioning expression, try to choose the xpath expression of the relative path
2. Use explicit waiting first to find elements
3. Try to avoid dependence between use cases
4. Try to ensure a separate test environment and avoid other students running synchronously
5 , After the script fails to run, add a re-run mechanism to improve the stability of the use case

14. Use PO mode

Separate the business logic from the test logic. When the page changes, you don’t need to change the test code, just change the page code; when the test logic changes, you don’t need to change the page code, just change the test code to test the data
and Separate use cases and maintain test data separately

15. What do you think is the most difficult part of ui automation?

1. Stability is sometimes not high
. 2. Stability is often affected when efficiency is improved. Stability ranks first.
3. Requirements often change and maintenance costs are high.
4. Special elements are difficult to locate
. 5. Scripts are unstable

16. Please describe the characteristics of the Web automation framework you designed?

1. Organize and manage test cases through the pytest unit test framework.
2. Introduce the idea of ​​page object for hierarchical design of use cases, and separate business code and test code
. Capture, use case failure screenshot
4. In the test case, use data drive
5. Logging log introduction, problem location
6. Allure report, screenshot after use case failure
7. Retry the use case failure to improve the stability of the use case
8. Integrate into jenkins, every day \hour build multiple times

Seventeen, how to do UI automation?

1. Before writing scripts, we will evaluate the requirements and confirm whether the requirements can be automated.
2. If possible, select the use cases that can realize automated testing from the manual use cases, which are generally used in the main process test, regression testing .
3. We use selenium tools to realize automation, using python scripting language, pytest test framework and UI automation test framework built by PO mode.
4. For example, the script of the recharge function, we do this: First, according to the built test framework, the test framework includes testcase, which is mainly used to store test case codes, and report is used to store test reports. 5. Secondly, we
will Encapsulate the public part of the use case into common.
6. Finally, use the run.py file to run the project automation use case.
7. After the script is debugged, we will use the jenkins continuous integration tool to set the script to run the script every night at 10 o'clock, run After completion, generate an automated test report in html format and automatically send an email

18. Is there anything that can be optimized in the web testing framework?

Commonly used methods, or methods with a large amount of code, can be encapsulated into a public method to reduce code writing and enhance code readability and maintainability

19. What layers are implemented in the framework?

Layering of page logic and test logic Layering of
test data and test code
Element positioning locator and method layering Layering
of basepage public methods

20. What is the execution strategy for your automation use case?

1. Automated test cases are used for monitoring. For another purpose, we set the automated test cases to be executed regularly, and execute them every 30 minutes. Just create a timed task on jenkins. 2. Use cases that must be returned
. Some test cases require regression testing before any changes to the product are launched.
3. For test cases that do not need to be executed frequently, we do not need to return to execute them all the time. After all, it is time-consuming. Sometimes non-essential businesses do not need to be frequently returned. 4
. Test cases that do not need to be executed frequently need to be executed manually. Create a task in jenkins and build it manually when it needs to be executed

Guess you like

Origin blog.csdn.net/YZL40514131/article/details/123930162#comments_27657921