I. WEB+ Network

1. HTTP code table

404: Failed to find resource test interview guide

500: Server internal error, unable to complete the request.

501: The server did not support the requested functionality and could not complete the request.

502: A server acting as a gateway or proxy received an invalid request from the remote server.

301: Permanent move. The requested resource has been permanently moved to the new URI, the return message will include the new URI, the browser will automatically redirect to the new URI, and any future new requests should be replaced with the new URI.

302: Temporary move. Similar to 301. However, the resource is only temporarily moved and the client should continue to use the original URI.

200: Success.

2. TCP/IP layer 4 network model

Link layer, network layer, transport layer, and application layer.

3. TCP/UDP?

**TCP: ** reliable transmission protocol, need three handshake connection, confirm retransmission mechanism, is characterized by reliable, accurate, congestion control, disadvantage is relatively slow, transmission is relatively small, suitable for upgrading, download; In a word: TCP is a reliable transport.

**UDP: ** unreliable transport protocol, non-connection-oriented protocol, advantage is large transmission volume, fast, disadvantage is lost, no congestion control, suitable for live broadcasting, video, etc. In a word: UDP is unreliable transport.

4. What is the order in which HTML CSS JS runs?

When the interface is loaded, the HTML is loaded first, the CSS is loaded last, the JS is loaded

5. What is the difference between session and cookie

1. Session is stored on the server to verify the identity of the client

2. The cookie is stored on the client. Each time a client sends a request to the server, the cookie is sent to the server to verify the identity of the client

Two, interface test

1. How to test the interface with JMeter?

If using JMeter for interface testing:

  1. Understand the requirements before the test and sort out the business according to the interface specification;

  2. Next design case, analysis of the interface into the ginseng and ginseng, points out what are the effective input and invalid input, design cases (principle: with the least amount of use cases covering all valid input, for each invalid input to design a test case, if there is an error code without cover, and the error code of each uncovered design a use case) respectively.

  3. Prepare test data, such as account numbers, passwords, and keys.

  4. Open JMeter, create a thread group, according to the interface type, fill in the corresponding interface address and request mode, etc.

  5. Parameter configuration, add configuration element CSV Data Set Config, define variables, and prepare Data in CSV format, variable reference in ${variable name} format;

  6. Assertions are added to determine the correctness of test results, with response assertions being used most frequently.

  7. Add listeners, such as view the result tree, to listen to test results;

  8. Run test cases;

  9. View the listener result to judge whether the execution of the use case is successful or failed, and analyze the failure reason for the failed use case.

  10. For the problem found in the test, develop the bill of lading until the problem is finally resolved.

  11. Finally, output the test report.

2. How to use Postman to test interface?

If using the Postman test interface:

The main steps of the tool are to add the corresponding request, fill in the host URL and enter the parameter, add the test suite, run the test suite, and analyze the results and report.

3. How do I take the result of the previous request as the parameter of the next request on JMeter?

Use the regular expression extractor to extract information from the response to the previous request, save a reference name such as ABC, and reference the extracted result in the format ${ABC} in the parameters of the next request.

Common regular expression formats :(.+?) Where. Indicates that any string is matched, and + indicates that only one string is matched. Stop when a match is found.

Three, performance test

It’s usually the last two or three days when we finish functional testing to test performance.

1. First, analyze the requirements and calculate the concurrency, TPS, response time and CPU, memory, hard disk and network IO indicators.

2. Develop test plan, including environment, plan and test those scenarios (reliability, concurrency, load, stress test, etc.)

3. Record the script with Badboy according to the scenario and export it to the script supported by JMeter tool.

4. Open the script with JMeter tool, debug the script, add some assertions, listeners, parameterization, etc.

5. Next, perform the performance test, and then mainly collect listeners and collect server CPU, memory, hard disk and network IO to analyze whether they meet the requirements. If so, output the performance test report.

6, if the indicators can not meet, feedback to the development for tuning. After tuning, continue testing until the requirements are met and the final test report is output.

Iv. Automated testing

1. How does Python define a function?

You can define a function that has the function you want. Here are some simple rules

  1. The function code block begins with the def keyword, followed by the function identifier name and parentheses ().

  2. Any passed arguments and arguments must be placed between parentheses. Parentheses can be used to define parameters.

  3. The first line of the function can optionally use the docstring – to hold the function description.

  4. Function content starts with a colon and is indented

  5. Return terminates the function, optionally returning a value to the caller. Return without an expression is equivalent to returning None

Python 2 slices

List1 =[sa,fe, FAW,ve,eta,t] list1[2:] list1[:] list1[20:]Copy the code

3. What libraries/modules have you used on Python?

Webdriver: Locate and manipulate elements

Time: Sets the waiting time

ActionChains: Action chain, complete the related operations of the mouse

Keys: keyboard operations

WebDriverWait: Sets explicit wait

Expect_Conditions: Set up explicit waiting scenarios for a single element

PIL: screenshots

Select: Indicates the operation of dropping down the selection box

Unittest Python: A built-in unit testing framework

HTMLTestRunner: Run scripts and generate reports

DDT: Data driven testing, behavior and data separation

4. Have you ever done automated tests?

In my last job, the company also started planning for Web automation in the second half of last year, using Python as the development language, Selenium WebDriver to locate and manipulate page elements, and unitTest as the automation framework. I was mainly responsible for writing test scripts.

Assume a test team of 5 people: 1 senior (test manager)+ 2-3 intermediate (automation + manual)+1 junior (manual)

5. What tools were used for automated testing

The tool used is Selenium (Web Automation tool)

6. What programming language

With the Python

7. Which version does Selenium use? What version of Python is used?

Selenium 3.11.0 and Python2.7.10 are used

8. How does Selenium work?

1) Locate HTML elements

2) Simulate click, input and select the elements located in the first step. In a word, locate elements and operate elements.

9. What are the elements location methods?

Main points: 8 positioning methods

  1. Location based on element attribute values, such as ID, name, class, tag name, link text, and partial link text;

  2. Positioning according to CSS selectors;

  3. Positioning according to XPath;

10. How to position elements in a child page?

First switch to the frame, and then locate, use the switch_to_frame function according to the sub-page ID or name, switch to the sub-page; If you want to reposition the elements of the home page after locating them, use the switch_to_default_content function to return to the home page first.

11. How to locate the Alert popover? Or ask: What about javascript native Windows?

Main points: It mainly involves clicking the popover confirmation button, forcibly closing the popover, obtaining the text in the popover and other operations.

  1. Click ok on the popover and use the following function:

driver.switch_to_alert().accept()

  1. To forcibly close it, click the cross in the upper right corner and use the following function:

driver.switch_to_alert().dismiss()

  1. To get the text in the popover, use the following function:

driver.switch_to_alert().text

12. How to run automated use cases and generate test reports?

Taking UnitTest as an example, my usual practice is to load the use cases into the test suite, make a script, run the script in the command window, and generate the report using the third-party module HTML TestRunner.

13. How to locate/operate the captcha in the picture?

Tesseract OCR engine is used to process the captcha in the image.

(1) Take a screenshot of the whole screen and save it as a PNG image;

(2) Locate the position coordinates of the captcha image in the captured image;

(3) Take screenshots of verification codes according to coordinates;

(4) Extract the verification code from the picture and input it to the input box. Test interview guide