End-to-end Web front-end unit test and evaluation method
Through end-to-end front-end web front-end unit testing and evaluation methods, problems in the existing technology that are difficult to find deep problems, poor coverage, high dependence and high isolation are solved, and test evaluation with high accuracy and good results are achieved, improving the reliability and user experience of the system.
Patent Information
- Application Number
- CN202411848140.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-05-02
AI Technical Summary
In the prior art, it is difficult to find deep problems, poor coverage, high dependency and high isolation, and it is difficult to implement end-to-end testing in the software and code directions.
An end-to-end web front-end unit testing and evaluation method is proposed, including setting up test cases, establishing communication with the browser and simulating login, executing test cases and generating test results, and evaluating and generating test reports based on test results.
It achieves the purpose of high accuracy, good results, accurate ratings and easy to maintain and develop. Through a systematic and comprehensive testing process, it can effectively discover errors and defects across multiple systems or components, improve user experience, and improve system reliability and maintainability.
Smart Images

Figure CN119917404A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of error detection, and in particular to preventing errors through software testing or debugging. Background Art
[0002] In the current development of informatization, more and more attention is paid to code quality and self-test pass rate, so unit testing is very necessary. However, unit testing can only cover methods and data, and cannot simulate real user operations. The shortcomings of unit testing mainly include the following aspects: 1. Limitations of test coverage: Although unit testing can cover various parts of the code, sometimes it may not be able to fully cover all possible scenarios due to insufficient test case design or lack of comprehensiveness. This may cause some potential errors or problems to be ignored without being tested. 2. Dependency issues: Unit testing usually requires simulating external dependencies or using stub data to simulate the behavior of other components. This may make the test code complex and difficult to maintain, and it is also not conducive to understanding the true behavior of the code. 3. Possible masking of problems: Sometimes, unit testing may mask deeper problems. For example, a unit test may only focus on whether the output of a function meets expectations, while ignoring possible logical errors or potential efficiency problems within the function. 4. Isolation: Traditional unit testing focuses on the correctness of a single module or function, while ignoring the context and business logic of the entire system. This may cause errors or exceptions in code that seems correct in unit testing when integrated with other modules.
[0003] For example, the Chinese patent with publication number CN109977005B discloses an end-to-end test method, medium, device and computing equipment, and provides the following technical solutions. The embodiments of the present invention provide an end-to-end test method, including: obtaining the test declaration information of the test project, wherein the test declaration information includes: parameter information of each test node in the multiple test nodes contained in the test project and the association information between the multiple test nodes; based on the test declaration information, determining each test node and the candidate test node set of each test node; based on each test node and the candidate test node set of each test node, constructing a test trajectory diagram, wherein the test trajectory diagram includes multiple test trajectories representing the test sequence of the multiple test nodes; and based on the test trajectory diagram, executing the test operations corresponding to the multiple test nodes, so that the multiple test nodes are traversed from the initial test node to the end test node. The embodiments of the present invention also provide an end-to-end test device, medium and computing equipment. However, the above-mentioned end-to-end test method, medium, device and computing equipment are mainly end-to-end testing of hardware, and it is difficult to achieve end-to-end testing in the direction of software and code. Summary of the invention
[0004] The present invention solves the problems in the prior art that it is difficult to find deep problems, the coverage is poor, the dependence is high and the isolation is high, and proposes an end-to-end Web front-end unit testing and evaluation method, which achieves the purpose of high accuracy, good effect, precise scoring and convenience for subsequent maintenance and development.
[0005] To achieve the above object, the present invention adopts the following technical solution: An end-to-end Web front-end unit testing and evaluation method comprises the following steps: S1: Set test cases according to the simulation operation process; S2: Establish communication with the browser and simulate login; S3: The browser executes the test case and generates a test result; S4: Send the test result to the client, and the client makes an evaluation based on the test result.
[0006] The advantage of this design is that it provides a complete end-to-end testing process, from test case setting to result generation and evaluation, ensuring the systematic and comprehensive nature of the testing process and providing good evaluation and feedback on the test situation.
[0007] Preferably, step S3 includes the following steps: S3.1: The browser receives the client's test case; S3.2: The browser executes the test for each test case according to the priority order; S3.3: Determine whether the test case can be executed. If so, the test case is covered. If not, proceed to step S3.5; S3.4: Determine whether the test case can be executed. If so, the test case is passed. If not, the test case is not passed. S3.5: Return to step S3.2 until all test cases have completed testing; S3.6: Generate test results based on the coverage and pass status of test cases.
[0008] The advantage of this design is that each test case is executed in order according to priority, and coverage and pass status are judged, which enhances the accuracy and traceability of the test results.
[0009] Preferably, step S4 includes the following steps: S4.1: The client receives the test result; S4.2: Calculate the comprehensive score through the evaluation model based on the test results and determine the evaluation level; S4.3: Generate a test report and provide feedback based on the test results and evaluation levels.
[0010] The advantage of this design is that it can process test results in a systematic way, quantitatively evaluate test quality through comprehensive scores and evaluation levels, and generate detailed test reports to help the development team confirm the test status and take corresponding measures.
[0011] Preferably, the test case includes an identifier, input data and conditional results, the conditional results include preconditions, expected results and actual results, the identifier serves as a number or name for tracking and management, and the browser generates a test result by comparing the expected results and the actual results.
[0012] Preferably, the communication process between the client and the browser during the execution of the test case includes: The client sends test case execution instructions to the browser via the JSON protocol; The browser monitors and receives test instructions and data from the client; The browser parses and executes the specific operation steps in the test case; The browser returns the execution result to the client via the JSON protocol.
[0013] The advantage of this design is that it uses the standardized JSON protocol for communication, ensuring the structuring and compatibility of data transmission, while clarifying the process of sending, executing, and returning results of instructions, improving the system's collaborative efficiency and data consistency.
[0014] Preferably, among the test cases, a priority is assigned to each test case according to the importance of the business requirements, and additional descriptions are given to specific test cases.
[0015] The advantage of this design is that, through priority allocation and additional instructions, the order of test execution can be reasonably arranged to ensure that key functions and high-priority use cases are tested first, thereby improving the targetedness and efficiency of the test.
[0016] Preferably, step S2 includes the following steps: initializing a session with the browser, sending instructions in JSON format to the browser, operating DOM elements, simulating a user entering credentials and submitting them on a login page, and entering a test target page.
[0017] The advantage of this design is that it describes in detail the initialization of the test environment and the simulation process of user login, ensuring that the prerequisites for the test are met, allowing subsequent tests to be performed on the correct page and in the correct state, and improving the accuracy and reliability of the test.
[0018] Preferably, the test results include test pass rate and test coverage as well as test failure information, wherein the test failure information includes failure priority, failure reason and importance, and the failure reason includes defects in the system itself and test case design defects.
[0019] The advantage of this design is that it comprehensively records the key indicators of the test results and detailed failure information, helping the development team to clarify the nature and severity of the problem, so as to facilitate targeted repairs and optimizations.
[0020] Preferably, step S4 also includes analyzing the test results according to the recorded test results; for the passed test cases, it is necessary to confirm whether they meet the expected output and functions; for the failed test cases, it is necessary to analyze whether the failure causes are defects in the system itself or defects in the test case design; all the test results are summarized and analyzed, and the defects of each part are fed back to the client.
[0021] The advantage of this design is that it can deeply analyze the specific circumstances of the test results, distinguish the causes of failed test cases, provide comprehensive feedback information, and promote continuous improvement of the system and optimization of test cases.
[0022] Preferably, the evaluation model is: in: P is the passing rate; C is the coverage rate; W p is the pass rate weight; W c is the coverage weight; W f Weight for failed use cases; S i Score the severity of failed test cases; N fail is the number of test cases that failed; α, β, and γ are nonlinear exponents that adjust the sensitivity of each part; Wp+Wc+Wf=1.
[0023] Compared with the prior art, the invention has the following beneficial effects.
[0024] 1. The present invention ensures the accuracy of the overall process. During the execution of the test, it not only tests a single functional point, but also ensures that all related system parts, such as interfaces, processes, etc., operate as expected. This helps to discover errors and defects across multiple systems or components, thereby ensuring the integrity and accuracy of the entire system.
[0025] 2. End-to-end testing helps improve user experience. Since it simulates the complete process of users actually using the system, defects and problems that may cause user confusion or difficulty in use can be discovered and fixed in a timely manner. This not only improves the user's operating experience, but also helps the subsequent development and maintenance of the system.
[0026] 3. The testing method of the present invention is closely related to the design, requirements and user experience requirements of the software, and is of great help in discovering and understanding process defects and finding the root causes. Since it involves complex details such as the overall system environment and interactions, this testing method is also helpful to design and development personnel to have a deeper understanding of the entire system process.
[0027] 4. The present invention uses a multi-factor, nonlinear model to score by comprehensively considering the pass rate, coverage, and severity of failed test cases, thereby ensuring accurate assessment of test quality. Weight allocation and index adjustment enhance the flexibility and sensitivity of the model, allowing for a reasonable integration of different indicators. Priority allocation improves test efficiency, and detailed records of failure causes help to quickly locate and repair defects. Comprehensive test result analysis and feedback mechanisms promote continuous improvement of the system and optimization of test cases. The overall approach achieves high-precision test evaluation, improves system reliability and maintainability, and facilitates subsequent development. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 The present invention provides an overall flow chart of an end-to-end Web front-end unit testing and evaluation method.
[0029] Figure 2 This is a flow chart of communication with a Chrome browser in an embodiment of an end-to-end Web front-end unit testing and evaluation method of the present invention.
[0030] Figure 3 This is an example diagram of test results in an embodiment of an end-to-end Web front-end unit testing and evaluation method of the present invention. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical scheme and advantages of the present disclosure clearer, the following will further describe the embodiments of the present disclosure in detail with reference to the accompanying drawings. The proportions of the components are not drawn according to the actual proportions, and the proportions and sizes shown in the accompanying drawings should not limit the substantial technical scheme of the present invention. These embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described.
[0032] See also Figure 1-3 As shown, an end-to-end Web front-end unit testing and evaluation method includes the following steps: S1: Set test cases according to the simulation operation process; S2: After the client establishes communication with the browser and simulates login, it sends the test case to the browser; S3: The browser executes the test case and generates a test result; S4: Send the test results to the client, and the client evaluates the test results and generates a test report.
[0033] like Figure 1 In one embodiment shown, Figure 1 The present invention provides an end-to-end Web front-end unit testing and evaluation method, and its specific process is as follows: First, in step S1, test cases are set according to the simulated operation process. The design of test cases is based on actual business needs to ensure that all functions and operation paths of the system are covered. Each test case contains an identifier, input data, and conditional results, where the conditional results are further subdivided into preconditions, expected results, and actual results. The identifier is used to track and manage test cases to ensure the orderly progress of the testing process. According to the importance of business requirements, each test case is assigned a priority, and additional instructions are given to specific test cases so that they can be executed and evaluated in a targeted manner in subsequent tests.
[0034] Next, in step S2, the client establishes communication with the browser and simulates login. The specific steps include initializing a session with the browser, sending JSON formatted instructions to the browser, manipulating DOM elements, simulating the user entering credentials on the login page and submitting, and finally entering the test target page. In this way, the operating environment of a real user can be simulated, providing a reliable foundation for subsequent test execution.
[0035] In step S3, the browser receives the test cases sent by the client and executes the tests one by one according to the priority order. The specific process is as follows: First, the browser receives the test cases from the client (step S3.1); then, each test case is executed in sequence according to the priority order of the test cases (step S3.2). During the execution process, the system first determines whether the test case can be executed (step S3.3). If it can be executed, the test case is recorded as covered; otherwise, jump to step S3.5 and continue to execute the next test case. Then, the system determines whether the execution result is passed (step S3.4). If it is passed, it is recorded as a test pass; if it is not passed, it is recorded as a test failure. This process continues until all test cases are tested (step S3.5). Finally, the test results are generated according to the coverage and pass status of the test cases (step S3.6). These results include the test pass rate, test coverage rate and detailed failed test information.
[0036] In step S4, the client receives the test results generated by the browser (step S4.1), and comprehensively scores the test results according to the preset evaluation model to determine the evaluation level (step S4.2). Subsequently, the client generates a detailed test report based on the test results and the evaluation level, and feeds the report back to the relevant parties (step S4.3). The test report not only includes the pass rate and coverage, but also lists in detail the priority, failure reasons and importance of the failed tests. The reasons for failure are further subdivided into defects in the system itself and defects in the test case design, providing clear guidance for subsequent defect repair and test case optimization.
[0037] When designing test cases, we assign priorities based on the importance of business requirements, and provide additional instructions for specific test cases. This not only ensures focused testing of key functions, but also improves the comprehensiveness and depth of test coverage. During the test execution process, the browser generates test results by comparing expected results with actual results, ensuring the accuracy and reliability of the test. The test results include not only the pass rate and coverage, but also detailed information on failed tests, including the priority of the failed tests, the reasons for failure, and their importance. This detailed result recording and analysis helps to quickly locate and fix system defects or optimize test case design, thereby improving overall software quality.
[0038] In one embodiment, in step S4, the following steps are also included: Receive test results. The client receives the test results returned by the browser through WebSocket, including coverage (C), pass rate (P), number of passed test cases, number of failed test cases (N fail ), and the severity of each failed use case (S i ).
[0039] Calculate the comprehensive score, apply the above complex scoring model, and calculate the score based on the received test results.
[0040] Generate evaluation results and determine the final evaluation level (unqualified, qualified, excellent) based on the value of Score.
[0041] Generate a detailed test report containing the following: overall pass rate (P), overall coverage (C), comprehensive score (Score), evaluation level, and detailed information of failed test cases (including number, severity, failure reason, etc.).
[0042] Provide improvement suggestions and priority adjustments for failed test cases to help the development team quickly locate and fix problems.
[0043] The implementation steps of the evaluation model are as follows: Parameter initialization: Determine the weight coefficients (Wp, Wc, Wf) and nonlinear exponents (α, β, γ) and adjust them according to project requirements.
[0044] Data collection and compilation: Collect all data generated during the test execution, including the execution results and severity of each test case.
[0045] Rating calculation: in: P is the passing rate; C is the coverage rate; W p is the pass rate weight. In this embodiment, W p =0.5; W c is the coverage weight. In this embodiment, W c =0.3; W f is the weight of the failed case. In this embodiment, W f =0.2; S i Score the severity of failed test cases; N fail is the number of test cases that failed; α, β, and γ are nonlinear exponents for adjusting the sensitivity of each part. In this embodiment, α=2, β=1.5, and γ=2.
[0046] The weights are allocated according to actual needs and importance, and should satisfy Wp+Wc+Wf=1.
[0047] In the pass rate item, (P / 100)^α: nonlinear adjustment of the pass rate, increasing or decreasing the impact of the pass rate on the final score.
[0048] In the coverage term, (C / 100)^β: nonlinear adjustment of coverage.
[0049] Failure deduction Middle: Non-linear scaling of the mean severity of failed test cases.
[0050] Apply the scoring model formulas in sequence to calculate the Score.
[0051] Score conversion, in order to convert the score into an evaluation level (pass, excellent, unqualified), define the following score ranges: Failure: Score < 60; Pass: 60≤Score<95; Excellent: Score ≥ 95.
[0052] Result classification and reporting: The evaluation level is determined based on the Score and a corresponding report is generated.
[0053] In one embodiment, the test results are as follows: P = 92% C=97% N total (Total number of test cases) = 100 N pass (Number of passed test cases) = 92 N fail (Number of failed test cases) = 8 S i (severity of failed test cases): [3,4,2,5,3,4,2,3] W p =0.5,W c =0.3,W f =0.2 α=2,β=1.5,γ=2.
[0054] Calculation steps: Calculate the sum of the severity of failed cases: Calculate the score: Score=(0.5×0.8464)+(0.3×0.952)-(0.2×0.0676) Score=0.4232+0.2856-0.01352=0.69528×100=69.528; Final score: 69.528; Evaluation level: Pass.
[0055] The evaluation model of the present invention has the following advantages: Multi-factor integration: Comprehensively consider the pass rate, coverage rate, and severity of failed use cases; Nonlinear adjustment: Use exponential adjustment (α, β, γ) to enhance the sensitivity of the model to different factors; Weight distribution: The importance of different factors is reflected through weight distribution; Severity impact: The severity of failed test cases has a significant impact on the final score, prompting testers to focus on critical defects; Dynamic scoring: The scoring is adjusted dynamically as the test results change, providing a more detailed evaluation.
[0056] During the test result analysis process, for the passed test cases, the system will confirm whether they meet the expected output and functions to ensure their effectiveness in actual applications. For failed test cases, it is necessary to deeply analyze the reasons for their failure to determine whether it is due to defects in the system itself or problems in the test case design. This refined analysis can help the development team accurately locate the root cause of the problem and take targeted improvement measures. At the same time, all test results are summarized and analyzed, and the defects of each part are fed back to the client in detail to further optimize the test process and system functions.
[0057] The end-to-end Web front-end unit test and evaluation method of the present invention can efficiently and accurately evaluate the functions and performance of the Web front-end through systematic and process-oriented test steps. Its specific process covers all aspects such as test case design, test execution, result generation and feedback, ensuring the comprehensiveness and reliability of the test. Through priority allocation and detailed failure cause analysis, the pertinence of the test and the accuracy of problem location can be effectively improved. In addition, the generated test report not only provides comprehensive test data, but also intuitively reflects the overall quality and performance level of the system through comprehensive scoring and evaluation levels. The implementation of this method helps the development team to discover and repair defects at an early stage, optimize functional design, improve user experience, and ultimately improve the quality and market competitiveness of software products. The method of the present invention can also realize the automation and repeatability of the test process, reduce the errors and workload caused by human operation, improve test efficiency and accuracy, and further promote the agility and continuous integration development of software development. Therefore, the end-to-end Web front-end unit test and evaluation method of the present invention has significant advantages such as clear process, simple operation, detailed results, and timely feedback, and can significantly improve the overall level of Web front-end development and testing in practical applications.
[0058] In another embodiment, the scenario involved in the application of the present invention includes three stages: business logic generation test case, browser communication execution case and result output.
[0059] Write test cases for business logic: Simulate the user's browser operation process to write test cases, for example: after logging into the software, add or delete a document on the list page.
[0060] Chrome Devtools Protocol communication: When the test case is executed, the browser needs to give feedback. After opening the page, a network connection is established with Chrome's CDP service through WebSocket, and the test case is executed to send instructions to the browser. After receiving the command, the browser will perform the corresponding operation and return a response to the client.
[0061] Simulate login: simulate opening a page and log in to the browser through code operations on DOM elements.
[0062] Execute test cases: Send execution instructions to the browser according to the test cases.
[0063] Test result output: Execute operations according to the test case, and the browser receives the operation and outputs the instruction results.
[0064] Write specific test cases according to requirements and plans. Each test case should contain the following information: 1. Identifier: a unique number or name for easy tracking and management; 2. Preconditions: conditions that need to be met before executing the test case; 3. Input data: data or operation steps that need to be entered; 4. Expected results: the expected output or result after performing the operation; 5. Actual results: The actual output or result after executing the operation, used to compare with the expected results; 6. Priority: Assign a priority to each test case based on the importance of the business requirement; 7. Notes: Additional instructions or notes for specific test cases.
[0065] According to the business logic execution method logic writing, the present invention supports the JavaScript language of ECMAScript5 and above, and the editor adopts the open source component: Monaco Editor. The code is written in the standard ECMAScript 6 modular way.
[0066] In this example, the code is as follows: const editurl = 'https: / / '; / / test url address test.describe('API',()=>{ test.beforeEach(async({page})=>{ await page.goto(editurl); }); test('get / setValue',async({page})=>{ ... / / Execution logic }) })
[0067] A large number of open source third-party packages are referenced within the front-end system. The present invention also combines the modular characteristics of ECMAScript and supports the introduction of any open source NPM library in the form of import. Such references will be automatically processed during the runtime of the logic arrangement and converted into browser-compatible versions.
[0068] Before executing the test cases, you need to ensure that the test environment has been set up, prepare the test case documents, and clarify the input, expected output, and execution conditions of each test case. Test case execution and results are crucial links in the software testing process. It involves comprehensive and systematic testing of the software system to ensure the quality and stability of the software. According to the recorded test results, the results are analyzed. First, for the passed test cases, it is necessary to confirm whether they meet the expected output and functions; for the failed test cases, it is necessary to deeply analyze the cause of the problem, whether it is a defect in the system itself or a problem in the test case design. Secondly, it is necessary to summarize and analyze all the test results to find out the problems and defects in the software system and provide a basis for subsequent repair work.
[0069] The test cases need to be parsed by the test tool into a format that the browser can receive and recognize. A third-party package can be introduced to compile the test code. It is necessary to build a test scenario that meets business needs and provide a simulated and repeatable test environment for the software to ensure the stability and performance of the software under different conditions.
[0070] like Figure 2 In one embodiment shown, Figure 2 This is a flow chart of communication with the Chrome browser in one embodiment of an end-to-end Web front-end unit testing and evaluation method of the present invention. The core of end-to-end testing is to execute test cases under specific conditions after communicating with the browser through code. Figure 2 It is the communication process with the Chrome browser. The developer starts a session and connects to the Chrome DevTools protocol, which is usually implemented through WebSocket (ws) or other TCP-based connections. All requests and responses in the session use JSON format. Each message usually consists of two main parts: id and parameters (if necessary). Among them, id is used to track each individual message or event.
[0071] like Figure 3 In one embodiment shown, Figure 3This is an example diagram of test results in an embodiment of an end-to-end Web front-end unit testing and evaluation method of the present invention. When executing a test case, you need to follow the instructions in the test case document. First, set up the test environment according to the input conditions of the test case. Then, run the test case and observe the response of the system. If the system responds according to the expected output, then the test case passes the test; if an error occurs or the response does not meet the expectations, then it means that there is a problem with the test case. The example diagram of the test result is as follows: Figure 3 As shown, the test coverage and pass rate are shown. 87.5% Functions means that 87.5% of the methods in the test cases pass; 96.61% Lines means that 96.61% of the code lines are covered by the test cases.
[0072] In summary, the present invention proposes an end-to-end Web front-end unit testing and evaluation method, which aims to solve the problems of difficulty in discovering deep problems, poor comprehensive coverage, high dependence and high isolation in the prior art, and achieve the goals of high accuracy, high effect, precise scoring and convenience for subsequent maintenance and development. The method includes the following main steps: setting test cases (S1): designing test cases based on simulated operation processes to ensure coverage of various functions and operation paths of the system. Each test case contains an identifier, input data and conditional results (preconditions, expected results, actual results), and assigns priorities according to the importance of business needs, and attaches additional instructions for targeted execution and evaluation. Establish communication and simulate login (S2): The client establishes communication with the browser, and by initializing the session, sending JSON instructions, and operating DOM elements, simulates the user entering credentials and submitting them on the login page, and enters the test target page to ensure that the test environment is consistent with the real user operation. Execute test cases and generate results (S3): The browser receives and executes test cases in order of priority, determines whether each case can be executed and its pass status, records coverage and pass rate, and generates detailed test results, including the priority of failed cases, reasons for failure and their importance. Evaluation and report generation (S4): The client receives the test results, calculates the comprehensive score and determines the evaluation level (unqualified, qualified, excellent) based on the preset multi-factor, non-linear evaluation model, generates a test report containing the overall pass rate, coverage, comprehensive score and detailed information on failed cases, and provides improvement suggestions and priority adjustments, which are fed back to the relevant development team. The present invention realizes efficient and accurate test evaluation through systematic and process-based test steps combined with a multi-factor comprehensive evaluation model. It has the advantages of clear process, simple operation, detailed results, and timely feedback, which significantly improves the overall level of Web front-end development and testing, and helps improve software quality and market competitiveness.
[0073] The present invention is not limited to the above-mentioned embodiments. No matter any changes are made in the shape or material composition, any structural design provided by the present invention is a variation of the present invention and should be considered to be within the protection scope of the present invention.
Claims
1. An end-to-end Web front-end unit testing and evaluation method, characterized in that: The following steps are involved: S1: Set test cases according to the simulation operation process; S2: After the client establishes communication with the browser and simulates login, it sends the test case to the browser; S3: The browser executes the test case and generates a test result; S4: Send the test results to the client, and the client evaluates the test results and generates a test report.
2. According to claim 1, an end-to-end Web front-end unit testing and evaluation method is characterized in that: The step S3 includes the following steps: S3.1: The browser receives the client's test case; S3.2: The browser executes the test for each test case according to the priority order; S3.3: Determine whether the test case can be executed. If so, the test case is covered. If not, proceed to step S3.5; S3.4: Determine whether the test case can be executed. If so, the test case passes. If not, the test case fails. S3.5: Return to step S3.2 until all test cases have completed testing; S3.6: Generate test results based on the coverage and pass status of test cases.
3. According to claim 1, an end-to-end Web front-end unit testing and evaluation method is characterized in that: The step S4 includes the following steps: S4.1: The client receives the test result; S4.2: Calculate the comprehensive score through the evaluation model based on the test results and determine the evaluation level; S4.3: Generate a test report and provide feedback based on the test results and evaluation levels.
4. An end-to-end Web front-end unit testing and evaluation method according to claim 1, 2 or 3, characterized in that: The test case includes an identifier, input data and conditional results, wherein the conditional results include preconditions, expected results and actual results. The identifier serves as a number or name for tracking and management, and the browser generates a test result by comparing the expected results and the actual results.
5. According to claim 3, an end-to-end Web front-end unit testing and evaluation method is characterized in that: The communication process between the client and the browser during the execution of the test case includes: The client sends test case execution instructions to the browser via the JSON protocol; The browser monitors and receives test instructions and data from the client; The browser parses and executes the specific operation steps in the test case; The browser returns the execution result to the client via the JSON protocol.
6. The end-to-end Web front-end unit testing and evaluation method according to claim 1, characterized in that: The step S2 includes the following steps: initializing a session with the browser, sending instructions in JSON format to the browser, operating DOM elements, simulating a user entering credentials on a login page and submitting, and entering a test target page.
7. The end-to-end Web front-end unit testing and evaluation method according to claim 2, characterized in that: The test results include the test pass rate and test coverage as well as test failure information, wherein the test failure information includes failure priority, failure reason and importance, and the failure reason includes system defects and test case design defects.
8. An end-to-end Web front-end unit testing and evaluation method according to claim 1 or 3, characterized in that: The step S4 also includes analyzing the test results according to the recorded test results; for the passed test cases, it is necessary to confirm whether they meet the expected output and function; for the failed test cases, it is necessary to analyze whether the failure reason is a defect in the system itself or a defect in the test case design; all the test results are summarized and analyzed, and the defects of each part are fed back to the client.
9. An end-to-end Web front-end unit testing and evaluation method according to claim 1, 2 or 3, characterized in that: In the test cases, each test case is assigned a priority according to the importance of the business requirements, and additional descriptions are given to specific test cases.
10. The end-to-end Web front-end unit testing and evaluation method according to claim 3, characterized in that: The evaluation model is: in: P is the passing rate; C is the coverage rate; W p is the pass rate weight; W c is the coverage weight; W f Weight for failed use cases; S i Score the severity of failed test cases; N fail is the number of test cases that failed; α, β, and γ are nonlinear exponents that adjust the sensitivity of each part; Wp+Wc+Wf=1。