The second set of software test questions for the 2023 National Vocational College Skills Competition


The second set of software test questions in the 2023 National Vocational College Skills Competition

Event name: Software Testing
English name: Software Testing
Event number: GZ034
Industry: Electronics and Information
Category: Higher Vocational Education

Main content of the competition:

Task
No. Skill Competition
Module Name Skill Competition Content Weight
Proportional Competition
Time
Task 1 Environment Construction and
System Deployment According to the requirements of the software testing competition project, build and configure the test environment, install and deploy the application system. 5% 480
minutes
Task 2 Unit testing According to the requirements of the software testing competition, write the application program, design the test data and obtain the test results, and write the unit test report. 10%
Task 3 Test documents According to the requirements of the software test competition project, develop test plan documents and test summary report documents. 10%
Task 4 Functional testing According to the requirements of the software testing competition project, design functional test cases, and submit defect reports after execution. 25%
Task 5 Automated testing According to the requirements of software automated testing, write and execute automated testing scripts. 20%
task 6 performance test is performed according to the requirements of software performance test
18% task 7 interface test is performed according to the
requirements of software interface test 5S" (Sorting, Straightening, Sweeping, Cleaning and Quality). 5%

Task 1 environment construction and system deployment

1. Task requirements

  1. Use the CentOS system in VirtualBox (Note: the system is not a pure system, there may be situations such as port occupation) to install related software and solve problems encountered in the installation. All operations must be completed using the command interface.
  2. CentOS system root account password is: 123456.
  3. The relevant deployment files provided are stored in the /opt directory of the CentOS system.
  4. Install and configure JDK:
    In the CentOS system, use the provided JDK installation package to install JDK;
    After the installation is successful, check the JDK version information
    ; Screenshot of JDK version information.
  5. Install and configure MySQL:
    In the CentOS system, use the provided MySQL installation package to install MySQL;
    Change the root account password of MySql to: root;
    After MySQL is installed successfully, initialize the human resources comprehensive service system database (suthr.sql) ;
    Screenshot requirements: a total of 2 pictures: ①Screenshot of the root account successfully logging in to MySQL; ②Screenshot of the command to initialize the database of the comprehensive human resources service system.
  6. Install and configure Tomcat:
    In the CentOS system, use the provided Tomcat installation package to install Tomcat; After Tomcat is installed successfully, visit the Tomcat homepage
    through the browser of the host machine;
    Screenshot; ②Access the screenshot of the Tomcat homepage through a browser.
  7. Application system deployment:
    Deploy the human resources system (suthr.war) to Tomcat; After the deployment is successful, access the system login page
    through the browser of the host machine;
    Finally, take a screenshot of the webapps directory; ②Access the screenshot of the system login page through a browser.
    2. Report writing
    According to the environment construction situation, refer to the environment construction and system deployment report template, intercept the screenshots of the environment construction process and results as required and paste them into the template, and complete the environment construction and system deployment report.
    Task 2 unit test

1. Task requirements
Topic 1: Enter any two positive integer values ​​and store them in x and y respectively, and complete the following analysis accordingly: If x≤0 or y≤0, the prompt: "The input does not meet the requirements."; if If the values ​​of 2 are the same, it will prompt "can build a circle or square"; if 2<|xy|≤5, it will prompt "can build an ellipse"; if |xy|>5, it will prompt "can build a rectangle"; if 0< |xy|≤2, it prompts "rectangle can be constructed". Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the statement coverage test, and write a test method in the test class for each test data. Use assertEquals to determine whether the expected result value of the input data test method is consistent with the actual return value.
Topic 2: Enter an uppercase letter and a lowercase letter. Judging the day of the week based on the first letter entered and the first capital letter of the day of the week English word, if it cannot be judged based on the first capital letter, continue to judge based on the second lowercase letter entered, and finally return the correct one Words of the day of the week in English. Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the statement coverage test, and write a test method in the test class for each test data. Use assertEquals to determine whether the expected result value is consistent with the actual return value.
Topic 3: It is usually necessary to enter a user name and password when registering the system. The user name is required to be composed of 8 letters, and the password is composed of 6 (including 6) numbers. If the requirements are met, it will prompt "registration successful", otherwise it will prompt "**does not meet the requirements" (** is the user name or password) according to the actual situation. Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the statement coverage test, and write a test method in the test class for each test data. Use the containsString assertion in assertThat to judge whether the expected result value of the output text is consistent with the actual return value.
Question 4: Enter a lowercase string. If the string prefix starts with ab, then replace the prefix ab with ef and print out the replaced string, and return the text "The string after replacing the prefix is:" and the value of the replaced string; if the suffix is ​​cd and the prefix is ​​not ab, replace all cd in the string with gh and print out the replaced string, return the text "The string after replacing cd is:" and the string value after replacement; otherwise output all letters in uppercase, return the text "Characters of uppercase letters The string is: " and the converted string value. Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the conditional coverage test, and use the parameterized test (@Parameters) to complete the test in the test class. Use assertEquals to determine whether the expected result value is consistent with the actual return value.
2. Report writing
According to the unit test situation, refer to the unit test report template, paste the written java source code, test class related code and relevant screenshots into the template as required, and complete the unit test report.

Task Three Test Documentation

1. Test plan

  1. Overview
    1.1 Project Background
    【Explain the overall background of the test project】

1.2 Purpose of writing
【Explain the purpose of writing the test plan document】

  1. Test task
    2.1 Test purpose
    [respectively explain the purpose of functional testing, automated testing, performance testing, and interface testing]

2.2 Test reference documents
[reference documents used to explain the test process]

2.3 Test scope
[respectively explain what tests are used for functional testing, automated testing, performance testing, and interface testing, and the specific test content]

  1. Test resources
    3.1 Software configuration
    [respectively explain the test environment and tools used in the process of functional testing, automated testing, performance testing, and interface testing]

Test Type Test Environment and Tools

3.2 Hardware configuration
[Speaking of the related hardware configuration of the client and mobile terminal]
the configuration of the number of equipment items
Client
Mobile terminal

3.3 Human resource allocation
[describe the role, responsibilities and final output of testers]
personnel
(station number) role main responsibilities output

  1. Test plan
    4.1 Overall test progress planning
    [Explain the time and personnel arrangement of each test stage]
    Time arrangement and personnel arrangement for the test stage

4.2 Functional test plan
[describe the goal, scope, technology, steps, start and end criteria of functional test]
test target
test scope
application technology
execution steps
start standard
completion standard

4.3 Automated test plan
[describe the goal, scope, technology, steps, start and end criteria of automated test]
test target
test scope
application technology
execution steps
start standard
completion standard

4.4 Performance test plan
[describe the objective, scope, technology, steps, start and end criteria of performance test]
Test objective
Test scope
Application technology
Execution steps
Start standard
Finish standard

4.5 Interface test plan
[describe the objectives, scope, technology, steps, start and end criteria of the interface test]
test objectives,
test scope
, application technology,
execution steps
, start criteria,
completion criteria

  1. Publishing standards
    [explaining functional testing, performance testing, interface testing, and document testing can be released after testing]
    test type publishing standards

  2. Relevant risks
    【Explain the assumed risks in the testing process and how to deal with them】
    Risk types Risk details and countermeasures

2. Test report

  1. Overview
    1.1 Project Background
    【Explain the overall background of the test project】

1.2 Purpose of writing
【Explain the purpose of writing the test report】

  1. Test result document
    [document describing the output of test result]

  2. Test Design
    3.1 Introduction to Functional Test Method Design
    【Describe the methods used in the functional test process】

3.2 Introduction to the Design of Automated Testing Methods
【Explain the methods used in the automated testing process】

3.3 Introduction to the design of performance testing methods
[explain the methods used in the performance testing process]

3.4 Introduction to interface test method design
[explain the method used in the interface test process]

  1. Test Review
    4.1 Review of the Functional Test Process
    【Explain the overall process and results of the functional test】

4.2 Review of the automated testing process
[describe the overall process and results of automated testing]

4.3 Review of the performance test process
[describe the overall process and results of the performance test]

4.4 Review of the interface testing process
[describe the overall process and results of the interface testing]

  1. Summary of use cases
    【Description of summary statistics of test cases】
    Number of test cases for functional modules on the device side Use case writer
    (station number) Executor
    (station number)

Total use cases (pieces)

  1. Bug Summary
    【Description of Defect Bug Summary Statistics】
    Device Function Module Bug Severity Bug Type
    Severe High High Medium Low Total Function UI Suggestive Total

Total (pieces)

  1. Test conclusion
    [Explanation of test result summary, process problem statistics, system quality evaluation and team experience and lessons]

Task 4 Functional Test
1. Test Cases

2. Bug list

Task 5 automated testing
1. Task requirements
Topic 1: Follow the steps below to write and execute automated test scripts in PyCharm.

  1. Set the smart time to wait 5 seconds and maximize the browser window;
  2. Introduce the By method class;
  3. Locate the user name input box through the NAME attribute, and enter the user name XTGLY;
  4. Locate the password input box through the NAME attribute, and enter the password 123456;
  5. Use the CLASS_NAME method to locate the login button, and use the click() method to click the login button;
  6. Locate the customer information button through the PARTIAL_LINK_TEXT method, and use the click() method to click;
  7. Use the LINK_TEXT plural method to locate the target attribute of the first piece of data in the page and delete the target attribute;
  8. Click the view button of the first data on the page;
  9. Add 2 seconds mandatory waiting time;
  10. Use get_screenshot_as_file to take a screenshot of the page (name it test_target01.png, and store it in the root directory of the D drive);
  11. Click the X in the upper right corner of the view customer popup.
    Topic 2: Follow the steps below to write and execute automated test scripts in PyCharm.
  12. Build the unittest framework;
  13. Introduce the By method class;
  14. Define the setUp method to start the browser, add 3 seconds of intelligent waiting, and maximize the browser window;
  15. Define the tearDown method to close the browser;
  16. Define the test_denglu01 method to enter the system login page, use the ID method to locate the user name input box, use the NAME method to locate the password input box and enter the account number and password (XTGLY/123456), use the TAG_NAME method to locate and click the login button;
  17. Define the test_denglu02 method to enter the system login page, use the NAME method to locate the user name input box, use the ID method to locate the password input box and enter the account number and password (XTGLY/123456), use the CLASS_NAME method to log in to the system, use the LINK_TEXT method to locate and click "Customer Information " button;
  18. Test cases are executed through the unittest.main() method.
    Topic 3: Follow the steps below to write and execute automated test scripts in PyCharm.
    Test data:
    Product brand name Expected results
    Product brand name is required, please re-enter.
    Step 1: Create a new test data testdata.csv in csv format, and write the csvv.py script to read the test data in csv.
    Step 2: Create a new test01.py:
  19. Introduce the written data reading method and ddt method class in step 1;
  20. Introduce the By method class;
  21. Build the unittest framework;
  22. Open Google Chrome in setUp, add 5 seconds of intelligent time waiting, and maximize the browser window;
  23. Exit the browser in tearDown;
  24. Create a new test case, locate the user name input box through the CLASS_NAME attribute, and enter the user name XTGLY;
  25. Locate the password input box through the ID attribute, and enter the password 123456;
  26. View the login button element on the login page, locate the login button through the TAG_NAME method, and use the click() method to click the login button to enter the system homepage;
  27. Use the PARTIAL_LINK_TEXT method to locate, and use the click() method to click the "product brand" button;
  28. Locate the plural form of TAG_NAME and click the "Add" button;
  29. Use the CLASS_NAME method to locate the product brand name input box and use data-driven input to "product brand name";
  30. Locate through the XPATH method and click the "Save" button;
  31. Use the CLASS_NAME method to locate and obtain the prompt message text, use the assertEqual assertion method to verify whether the expected result is consistent with the actual result, if not, use get_screenshot_as_file to take a screenshot of the page;
  32. Test cases are executed through the unittest.main() method.
    Topic 4: Follow the steps below to write and execute automated test scripts in PyCharm.
    Write scripts based on test cases:

PO frame reference picture:

  1. Create a new EPR_PO folder;
  2. Create a new driver folder and Website folder under the EPR_PO folder;
  3. Create a new driver.py file under the driver folder to store the browser driver;
  4. Create a new test_case folder, test_report folder, and test_data folder under the Website folder;
  5. Create a new model folder and page_object folder under the test_case folder;
  6. Create a new function.py file under the model folder to encapsulate screenshots, data-driven reading and other methods;
  7. Create a new myunit.py file under the model folder to encapsulate methods such as Setup (add 5 seconds of smart waiting and browser window maximization) and tearDown (exit the browser) in the unittest framework;
  8. Create a new BasePage.py file under the test_report folder to encapsulate the basic operation methods of selenium (get, find_element, etc.);
  9. Create a new LogingPage.py file under the test_report folder, introduce the encapsulated method in BasePage.py, introduce the By method class, and encapsulate the location and operation of the login use case page elements (use the CLASS_NAME method to encapsulate the user name input box, and use the NAME method to encapsulate the password input Box, use the ID method to encapsulate the location of the login button, and encapsulate operations such as inputting the user name, password, and clicking the login button);
  10. Create a new AddPage.py file under the test_report folder, introduce the packaged method in BasePage.py, introduce the By method class, package the product category and add page elements (use the PARTIAL_LINK_TEXT method to package the product category button, use the CSS method to package the new button, Use the XPATH method to encapsulate the product category name input box, use the CSS method to package the save button, package click the product category button, click the new button, enter the product category name, click the save button, etc.), package the prompt message text of adding success or failure ;
  11. Create a new srceenshot folder in the test_report folder to store test screenshots;
  12. Create a new test_csv.csv file in the test_data folder to store test data;
  13. Create a new test_add.py file under the test_report folder, introduce unittest, ddt, and the method classes in the previously packaged model, LoginPage, and AddPage, write 6 test case scripts according to the use cases, create data parameters to receive test data, and use the data Drive to input user name and password (XTGLY/123456), use data to drive to input product classification name, then perform screenshot operation, and finally perform assertIn assertion operation on each test case, and compare whether the prompt information is consistent with expectations;
  14. Create a new run_test.py file under the Website folder, use the discover method to execute the test_add.py test case and introduce the HTMLTestRunner method to generate an html test report (the title of the test report is Test Report, and the description content is erp test).
    2. Report writing
    According to the automated test situation, refer to the automated test report template, write the automated test script as required and paste all the scripts into the template to complete the automated test report.
    Task six performance test

1. Task requirements
Topic 1: Use LoadRunner to perform performance testing.

  1. Script recording:
    (1) Script 1:
    Script name: ProductAdd.
    Script content: The system administrator logs in and performs new product operations.
    The specific requirements are as follows:
    All scripts are stored in Action. The first two digits of the product name are fixed value SP, and the characters after the fixed value can be set arbitrarily. Set the transaction for the new commodity save operation, transaction name: T_SPAdd. Set a checkpoint, using the content of the response body of the successfully added product server as the checkpoint. Add a rendezvous point before saving the new product. The name of the rendezvous point: R_SPAdd.
    Screenshot requirements: 1 picture in total: ①Screenshot of the newly added product saving operation in Action.
    (2) Script 2:
    Script name: PlanAdd.
    Script content: The production specialist logs in, adds a new production plan, saves and submits the operation.
    The specific requirements are as follows:
    All scripts are stored in Action. Just add a new line for the planned production consumables and planned production products, and choose any one of the commodities. Set the transaction for saving and submitting the production plan, transaction name: T_PlanAdd. Set a checkpoint, use the server's response body content of the save and submit operation success as the checkpoint. Add a rendezvous point before saving and submitting the newly added production plan, the name of the rendezvous point: R_PlanAdd.
    Requirements for screenshots: 1 picture in total: ①Screenshot of the operation part of saving and submitting the newly added production plan sheet in Action.
  2. Script playback: Use the playback function to verify the correctness of the script.
    (1) Script 1 The specific requirements for script playback are as follows:
    Modify the product name, the first 4 digits are fixed value SPHF, and the characters after the fixed value can be set arbitrarily.
    Run the script, check the playback result, and require the script playback to successfully implement the new product business.
    Screenshot requirements: 1 picture in total: ① Add screenshots of product save operation and playback log.
    (2) Script 2 The specific requirements for script playback are as follows:
    Run the script and view the playback results. It is required that the script playback can successfully save the new production plan and submit the business.
  3. Script parameter setting requirements: After the script playback is successful, set the script parameters as required.
    (1) The specific requirements for script 1 parameterization are as follows:
    New parameters: parameter name: uniNo, parameter type: unique number, numbering starts from 1, the block size of each Vuser is 100, numbering format: %04d.
    New parameter: parameter name: VuID, parameter type: Vuser ID, text format: %s.
    Parametrize the product name: the first 4 digits of the product name are fixed value SPCS, and the fixed value is followed by parameters VuID and uniNo.
    Parameterize the purchase price: parameter name: price1, parameter type: random number, random range: 100-200, number format: %lu.
    Parameterize the sales price: parameter name: price2, parameter type: random number, random range: 200-300, number format: %lu.
     The number of script iterations is 3 times.
    Screenshot requirements: 1 picture in total: ① Add screenshots of product save operation and parameter list.
    (2) The specific requirements for script 2 parameterization are as follows:
    Parameterize the quantity of planned consumables: parameter name: Amount, parameter type: random number, random range: 500-1000, number format: %lu.
    Create a parameterized file center.dat, which contains three fields: centerId, centerCode, and centerName. CenterId enters the 10 warehouse id values ​​preset by the system, centerCode enters the corresponding warehouse number value, and centerName enters the corresponding warehouse name value.
    Parametric settings for planned production consumables warehouses: use the parameter centerId for the warehouse ID, use the parameter centerCode for the warehouse number, and use the parameter centerName for the warehouse name, all using the center.dat parameterization file.
    The centerId parameter selects the column using the name method, and randomly selects a value for each iteration. The centerCode and centerName parameters select the column using the name method, and the value is the same as the centerId row.
     The number of script iterations is 3 times.
    Requirements for screenshots: 1 picture in total: ①Add a screenshot of the save and submit operation and parameter list of the production plan sheet.
  4. Scene setting: Set the number of virtual users and perform scene configuration as required.
    Script modification: Add a thinking time of 45 seconds before adding a product assembly point, and change the fixed value of the first 4 digits of the product name to SPCJ.
    Script modification: Add a thinking time of 30 seconds before adding a meeting point for the production plan.
    Select the two scripts of new commodity and new production plan to set the scene.
    User allocation selection percentage mode: new products account for 35%. The scenario operation mode selects the actual plan.
    Settings when two scripts are running in the scene: Thinking time: use a random percentage of the recorded thinking time, the interval is: 70%-150%.
    Global plan: initialize each virtual user before running; start 5 users (start 5 every 5 seconds) for 5 minutes, stop all users after execution (stop 5 every 5 seconds); start 10 more Users (start 5 every 5 seconds) execute for 5 minutes, stop all users after execution (stop 5 every 5 seconds); start another 15 users (start 5 every 5 seconds) execute for 5 minutes, stop all users after execution users (stop 5 every 5 seconds).
    Screenshot requirements: 2 pictures in total, which are: ①screenshot of the scene design interface; ②screenshot of the new product thinking time setting interface.
  5. Graphical result analysis: Take a screenshot of the test results after the scene is executed.
    All screenshots need to capture the complete result graph, including the description below and the tree structure on the left.
    Screenshot requirements: 1 picture in total: ①Running Vusers - Connections screenshot.
    Topic 2: Perform performance testing using JMeter.
  6. Script addition:
    Script file name: PurAndInve.
    Test plan name: PurAndInve.
    Add two thread groups under the test plan:
    (1) Thread group one:
    Thread group name: PurAdd.
    Thread group content: the purchaser logs in, adds a new purchase order, saves and submits the operation.
    The specific requirements are as follows:
    Warehouses, suppliers can be selected at will, and any kind of goods can be selected. Purchase order save operation request name: purchase order save; purchase order submit operation request name: purchase order submit. Set the transaction for the purchase order save and submit operation, transaction name: T_PurAdd. Set the checkpoint, use the content of the response body of the server that submits the operation successfully as the checkpoint, and checkpoint name Reg_PurAdd.
    Screenshot requirements: 1 picture in total: ① Add a screenshot of the save operation of the purchase order.
    (2) Thread group two:
    Thread group name: InveAdd.
    Thread group content: the warehouse supervisor logs in and performs new inventory list operations.
    The specific requirements are as follows:
    Arbitrarily choose the warehouse, and choose any kind of commodity. Added inventory list save operation request name: add inventory list save. Set the transaction for the save operation of the new inventory list, transaction name: T_InveAdd. Set the checkpoint, use the newly added inventory list to save the response body content of the successful server as the checkpoint, and the checkpoint name is Reg_InveAdd. Add a rendezvous point before the save operation of the new inventory list. The name of the rendezvous point: R_InveAdd.
    Screenshot requirements: 1 picture in total: ① Add a screenshot of the save operation of the inventory list.
  7. Script playback: Use the playback function to verify the correctness of the script.
    (1) The specific requirements for thread group 1 playback are as follows:
    Run the script, view the playback results, and require the script playback to successfully save and submit the new purchase order.
    Save and submit operation If association is required, use regular expression extractor, parameter name PurId.
    Screenshot requirements: 1 picture in total: ① Add a screenshot of the purchase order submission operation.
    (2) The specific requirements for thread group 2 playback are as follows:
    Run the script and view the playback results. It is required that the script playback can successfully implement the new inventory list business.
  8. Script parameter setting requirements: After the script playback is successful, set the script parameters as required.
    (1) The specific requirements for parameterization of thread group 1 are as follows:
    Create a new parameterization file center.dat, which contains two fields, centerId and centerName. CenterId enters the 10 warehouse id values ​​preset by the system, and centerName enters the corresponding warehouse name value. .
    Parametric settings for the warehouse: use CSV data file settings to achieve parameterization, use the center.dat file. Warehouse ID parameter name: centerId, warehouse name parameter name: centerName.
    Parameterize the purchase quantity: Use the Random function to realize parameterization, range: 200-500.
    Parameterize the actual purchase price: Use the Random function to realize parameterization, range: 50-100.
     The number of script iterations is 3 times.
    Screenshot requirements: 1 picture in total: ① Add a screenshot of the save operation of the purchase order.
    (2) The specific requirements for the parameterization of thread group 2 are as follows:
    Parameterize the save operation: click the Save or Save and Submit button. Create a new parameterized file status.dat, which contains the status field, and the status input saves and saves and submits the status value. Use CSV data file settings to achieve parameterization, parameter name: status.
    Parameterize the inventory warehouse: use the Random function to realize parameterization, range: 10 warehouse id values ​​preset by the system.
     The number of script iterations is 3 times.
    Screenshot requirements: 1 picture in total: ① Add a screenshot of the save operation of the inventory list.
  9. Scene setting: Set the number of virtual users and perform scene configuration as required.
    Script modification: add 30 seconds of thinking time before saving the purchase order; add 40 seconds of thinking time before saving the inventory list; add 5 seconds of thinking time in other steps.
    Added inventory collection point setting: simulation quantity: 5, timeout time 30 seconds.
    Scenario configuration:
    New purchase order scene configuration: Action after sampler error: continue; number of threads: 10; Ramp-Up time: 20 seconds; cycle 10 times.
    Added inventory single scene configuration: action after sampler error: start the next process cycle; number of threads: 10; Ramp-Up time: 20 seconds; duration: 10 minutes; start without delay.
     Run in non-GUI mode.
    Screenshot requirements: There are 2 pictures in total, which are: ① Screenshot of newly added purchase order scene configuration; ② Screenshot of non-GUI running interface.
  10. Graphical results: Take a screenshot of the test results after the analysis scenario is executed.
    Screenshot requirements: 1 picture in total: ① Latencies Over Time screenshot.
    2. Report writing
    According to the performance test situation, refer to the performance test report template, intercept the screenshots of the performance test process and results as required, and paste them into the performance test report to complete the performance test report.

Task seven interface test

1. Task requirements
Topic 1: Write and execute the script of the login interface.

  1. The login interface is described as follows:
    Interface function: Provide user login function processing, and judge the login status according to the incoming user name and password.
    Interface address (replace by yourself according to the actual system IP and port):
    http://XX.XX.XX.XX:XXXX/prod-api/auth/login.
    Request method: POST.
    Request parameters:
    Parameter required type description
    username True Int username
    password True Int user password
    roleId True Int login ID (default 1)
    Response result:
    Return when login is successful:
    { “code”: 200, “msg”: xxx, “ data”: { “access_token”: “xxx”, “name”: xxx, “photo”: “xxx”, “expires_in”: xxx };  Return when login fails (wrong password): { “msg”: “login Password error", "code": 500 } Return when login fails (password is empty): { "msg": "Please enter password", "code": 500 }

















  2. Description of interface test requirements:
    Create a new Collections set in Postman, and name the test set Data_Driver; Create a
    new data_driver script under the test set Data_Driver;
    Create new json parameters (username, password, roleId) under raw in the script Body to pass values , where the username and password parameters are changed to variables to receive the data in the data driver;
    Create a new josn file to save the interface data driver test data, the josn parameter names are username and password; the username and password data are: username
    password
    XTGLY 123456
    XTGLY 123
    XTGLY
    New Test case set Data_Driver, execute Run, set the execution requirements on the test set run page, the number of runs is required to be 3 times, the request interval is 500ms, and the data file sent for the request is imported into the newly created json data file in front; The setting is completed and the test case set is executed
    ;
    Screenshot requirements: a total of 6 pictures, which are: ①The test case script contains screenshots of parameters related to the URL and raw; ②The screenshots of the preview data after the test case set imports json data; ③The screenshots of the Collection Runner page; ④, ⑤, ⑥ Screenshot the entire content of the Response Body in the test report of the three use cases.
    Topic 2: New interface script writing and execution test, and execute the script.
  3. The description of the interface for adding product categories is as follows:
    Interface function: Provides processing for adding new product categories.
    Interface address (replace by yourself according to the actual system IP and port):
    http://XX.XX.XX.XX:XXXX/prod-api/manager/category/add.
    Request method: POST.
    Request parameters:
    parameter required type description
    createBy True Int add id (default 2)
    name True String product category name
    Response result:
    {"msg": "Operation succeeded", "code": 200}
    The rest failed.
  4. Interface test requirements description:
    Create a new Collections set in Postman, and name the test set Test_Add; Create a
    new test case 1 in Test_Add, Login script;
    Login script URL is: http://XX.XX.XX.XX:XXXX /prod-api/auth/login;
    Login script Json parameters are: {"username": "XTGLY", "password": "123456", "roleId": 1};
    Write code in Tests of Login script, Convert the responseBody returned by the Login interface into a json string and use the setEnvironmentVariable method to store the value of the access_token in the responseBody into the environment variable, which is named token; Create a new test case 2 in Test_Add, Add script
    ;
     Put the variable token obtained in Login in the Bearer Token under the Add script Authorization interface;
    In Environment, create a new environment variable with VARIABLE value as "token" and other values ​​as empty, which is convenient for debugging the Add script;
    Add script URL It is: http://XX.XX.XX.XX:XXXX/prod-api/manager/category/add;
    Add script Json parameter is: {"createBy":"2", "name": "test data" };
    Assert and judge the execution result in the Tests of the Add script, and set two assertions: ① judge that the response status code is 200; ② use the JSON value check method to judge that there is "operation successful" in the returned msg parameter value in the response content string;
    Set and execute the test set Test_Add;
    Screenshot requirements: a total of 4 pictures, which are: ①The screenshot of the Body interface of the use case Add, which needs to include the interface submission method, URL and the content in raw; ②The screenshot of the Authorization interface of the use case Add, which needs to include the interface Submit method and Type and content in Token; ③ screenshot of Tests interface of use case Add; ④ screenshot of test case set Test_Add execution result interface.
    Topic 3: Modify the interface script to write and execute the test, and execute the script.
  5. The description of the commodity classification modification interface is as follows:
    Interface function: provide commodity classification modification processing.
    Interface address (replace by yourself according to the actual system IP and port):
    http://XX.XX.XX.XX:XXXX/prod-api/manager/category/update.
    Request method: PUT.
    Request parameters:
    parameter required type description
    id True Int modify id
    name True String product category name
    Response result:
    {“msg”: “Operation succeeded”, “code”: 200}
    The rest failed.
  6. Interface test requirements description:
    Create a new Collections set in Postman, and name the test set Test_Revise; Create a
    new test case 1 in Test_Revise, Login script;
    Login script URL is: http://XX.XX.XX.XX:XXXX /prod-api/auth/login;
    Login script Json parameters are: {"username": "XTGLY", "password": "123456", "roleId": 1};
    Write code in Tests of Login script, Convert the responseBody returned by the Login interface into a json string, and use the setEnvironmentVariable method to store the value of the access_token obtained in the responseBody into an environment variable named token; Create a new test case 2 in Test_Revise, Revise script
    ;
     Put the variable token obtained in Login into the Bearer Token under the Revise script Authorization interface;
    In the Environment, create a new environment variable with VARIABLE value as "token" and other values ​​as empty, which is convenient for debugging the Revise script;
    Revise script URL It is: http://XX.XX.XX.XX:XXXX/prod-api/manager/category/update;
    Revise script Json parameter is: {"id":"1", "name": "test"} ;
    Assert and judge the execution result in the Tests of the Revise script, and set two assertions: ① judge that the response status code is 200; ② use the JSON value check method to judge that there is an "operation successful" string in the returned msg parameter value in the response content ;
    Set and execute the test set Test_Revise;
    Screenshot requirements: a total of 4 pictures, which are: ①The screenshot of the Body interface of the use case Revise, which needs to include the interface submission method, URL and the content in raw; ②The screenshot of the Authorization interface of the use case Revise, which needs to be included Interface submission method and Type and content in Token; ③Tests interface screenshot of use case Revise; ④Test case set Test_Revise execution result interface screenshot.
    2. Report writing
    According to the interface test situation, refer to the interface test report template, intercept the interface test script and result screenshots as required, and paste them into the interface test report to complete the interface test report.

Guess you like

Origin blog.csdn.net/qq_50377269/article/details/130317900