Page testing method and device, electronic equipment and storage medium

By using the preset test tool to automatically parse the use case table and use case step table, generate use case data files and test case files, the problem of low page testing efficiency is solved and more efficient page testing is achieved.

CN115687107BActive Publication Date: 2025-10-10GUANGZHOU AUTOMOBILE GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211313986.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-25
Publication Date
2025-10-10
Estimated Expiration
2042-10-25

AI Technical Summary

Technical Problem

The efficiency of page testing in the existing technology is low, mainly because technicians are required to manually write test cases and test case data files.

Method used

By obtaining the target test table, using the preset test tools to parse the use case table and use case step table, generating the use case data file and test case file, the target page can be tested directly, eliminating the need for manual writing steps.

Benefits of technology

The efficiency of obtaining use case data files and test case files is improved, thereby improving the testing efficiency of the target page.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115687107B_ABST
    Figure CN115687107B_ABST
Patent Text Reader

Abstract

The application discloses a page test method and device, electronic equipment and storage medium. The method comprises the following steps: obtaining a target test table for a target page, wherein the target test table comprises a use case table and a use case step table of the use case table, the use case table comprises a target test use case for the target page, and the use case step table comprises test content of each test step in the target test use case; analyzing the use case table and the use case step table by using a preset test tool to obtain a use case data file and a test use case file; and testing the target page according to the use case data file and the test use case file to obtain a test result for the target page. According to the method, the use case data file and the test use case file are directly obtained through the use case table and the use case step table, and a test use case and a use case data file do not need to be manually written by a technician, so that the use case data file and the test use case file are obtained efficiently, and the test efficiency of the target page is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronic device control, and more particularly, to a page testing method and device, an electronic device, and a storage medium. BACKGROUND

[0002] Currently, the testing and verification of a page (such as a front-end page) is generally performed manually by a technician through a tool such as JavaScript, by writing a test case, and testing the page through the written test case. However, the testing efficiency is low when the page is tested in this way. SUMMARY

[0003] In view of this, the present application provides a page testing method, device, electronic device, and storage medium to solve the above problems.

[0004] In a first aspect, an embodiment of the present application provides a page testing method, which includes: obtaining a target test table for a target page, the target test table including a test case table and a test case step table for the test case table, the test case table including a target test case for the target page, and the test case step table including test content of each test step in the target test case; parsing the test case table and the test case step table through a preset test tool to obtain a test case data file and a test case file; and testing the target page according to the test case data file and the test case file to obtain a test result for the target page.

[0005] In a second aspect, an embodiment of the present application provides a page testing device, which includes: an obtaining module configured to obtain a target test table for a target page, the target test table including a test case table and a test case step table for the test case table, the test case table including a target test case for the target page, and the test case step table including test content of each test step in the target test case; a parsing module configured to parse the test case table and the test case step table through a preset test tool to obtain a test case data file and a test case file; and a testing module configured to test the target page according to the test case data file and the test case file to obtain a test result for the target page.

[0006] In a third aspect, an embodiment of the present application provides an electronic device, which includes:

[0007] one or more processors;

[0008] a memory;

[0009] one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the method of the first aspect.

[0010] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which program code is stored, wherein the above method is executed when the program code is run by a processor.

[0011] The embodiments of the present application provide a page testing method, device, electronic device and storage medium, which directly processes the use case table and use case step table through a preset test tool to obtain a use case data file and a test case file. There is no need for technicians to manually write test cases and use case data files, which saves the time for writing use case data files and test case files, improves the efficiency of obtaining use case data files and test case files, and thus improves the testing efficiency of the target page.

[0012] These and other aspects of the present application will become more readily apparent from the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0014] Figure 1 A flow chart of a page testing method proposed according to an embodiment of the present application is shown.

[0015] Figure 2 A schematic diagram of an environment information table in an embodiment of the present application is shown.

[0016] Figure 3 A flow chart of a page testing method proposed according to another embodiment of the present application is shown.

[0017] Figure 4 A schematic diagram of a use case table in an embodiment of the present application is shown.

[0018] Figure 5 A flow chart of a page testing method proposed according to another embodiment of the present application is shown.

[0019] Figure 6 A schematic diagram of a use case step table in an embodiment of the present application is shown.

[0020] Figure 7 A schematic diagram of a node information table in an embodiment of the present application is shown.

[0021] Figure 8 A flow chart of a page testing method proposed according to another embodiment of the present application is shown.

[0022] Figure 9 A schematic diagram of the page testing process in an embodiment of the present application is shown.

[0023] Figure 10 A structural block diagram of a page testing device proposed in one embodiment of the present application is shown.

[0024] Figure 11 A structural block diagram of an electronic device provided in an embodiment of the present application is shown.

[0025] Figure 12 A structural block diagram of a computer-readable storage medium provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0026] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of this application without making creative efforts are within the scope of protection of this application.

[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0028] Reference Figure 1 , Figure 1 A flow chart of a page testing method proposed according to one embodiment of the present application is shown. The method is used in an electronic device and includes:

[0029] S110. Obtain a target test table for a target page. The target test table includes a use case table and a use case step table corresponding to the use case table. The use case table includes target test cases for the target page. The use case step table includes test content of each test step in the target test case.

[0030] In this application, the target page may refer to the page to be tested. The target page may be a web page or an application page. For example, the target page may be the homepage of website a. Alternatively, the target page may be the search page in application b.

[0031] A target page may include one target page or multiple target pages. A target test table may refer to a test table for a target page. The target test table includes a use case table and a use case step table corresponding to the use case table. The use case table includes a target test case for the target page, and the use case step table includes the test content of each test step in the target test case. A target test case refers to a test case for a target page.

[0032] When there are multiple target pages, the use case table may include target test cases corresponding to each of the multiple target pages. The target test cases of different target pages are arranged in a specific order (for example, the order set by the user, or the order of the first letters of the use case names from A to Z, etc.), and the order of the target test cases under the same target page is arranged in another specific order (for example, the order set by the user, or the order of the first letters of the use case names from A to Z, etc.).

[0033] For example, the target pages include C1 page, C2 page and C3 page. The arrangement order of C1 page, C2 page and C3 page is C1, C3 and C2. The C1 page corresponds to 2 target test cases (az case and cz case), the C2 page includes 3 target test cases (my case, cy case and rh case), and the C3 page includes 2 target test cases (pz case and fy case). At this time, the arrangement order of the target test cases corresponding to each target page can be the order of the first letters from A to Z. The use case table for the target page includes 10 target test cases. The arrangement order of the 10 target test cases is: az case, cz case, fy case, pz case, my case, cy case and rh case.

[0034] Each target test case can correspond to a use case step table, or all target test cases on the target page can correspond to a use case step table. Each test step of each target test case corresponds to a test sequence, and each test step is arranged according to the test sequence.

[0035] For example, the target test case includes 4 test steps: D1 test step, D2 test step, D3 test step and D4 test step, wherein the test order of the four test steps is D1 test step, D4 test step, D2 test step and D3 test step. At this time, the arrangement order of the four test steps in the use case step table is D1 test step, D4 test step, D2 test step and D3 test step.

[0036] The test content of a test step may refer to the specific content of the test step. For example, if test step E is to click the G control on page F, then the test content of test step E is: click the G control on page F.

[0037] S120: parse the use case table and the use case step table using a preset test tool to obtain a use case data file and a test case file.

[0038] In this embodiment, the preset test tool may refer to a cypress framework, which may be installed in an electronic device. The cypress framework may be used to parse the use case table and the use case step table to obtain a use case data file and a test case file.

[0039] A test case file refers to a test case file corresponding to each of the target test cases described above. Each target test case can correspond to a test case file, and the specific content of a target test case is contained in a test case file. A test case data file can refer to a file that includes the data source for each target test case. The data source for each target test case can be contained in the same test case data file.

[0040] S130: Test the target page according to the use case data file and the test case file to obtain a test result for the target page.

[0041] Obtain a use case data file and a test case file, obtain use case data corresponding to each target test case from the use case data file, and obtain a test case file corresponding to each target test case from the test case file, use the use case data in the use case data file corresponding to each target test case as the data source of the test case file corresponding to the target test case, and test the target page using the test case file corresponding to the target test case to obtain a test result for the target page. The test result may refer to the test result for the target page.

[0042] When there are multiple target pages, the test result may include test results corresponding to each of the multiple target pages. The test result corresponding to each target page may also include test results corresponding to each target test case corresponding to the target page.

[0043] As an implementation method, the target test table also includes an environment information table, which includes the environment information of the target page; S130 may include: obtaining the environment information of the target page from the environment information table; accessing the target page according to the environment information of the target page; testing the target page according to the use case data file and the test case file to obtain the test results for the target page.

[0044] In this embodiment, the environment information of the target page may include various config and env information such as a test account for logging into the target page, a password for logging into the target page, a test address of the target page, cookies, and tokens.

[0045] The environment information table may include the specific value, key, and state of the environment information. Figure 2 As shown, isRun indicates the state of the environment information, yes indicates that the environment information needs to be adopted, and no indicates that the environment information is not adopted. Figure 2 The key in it refers to the key, which indicates the verification information corresponding to the environment information. Figure 2 The specific value in refers to the address information of the target page.

[0046] As an implementation method, the environment information table may be analyzed by a preset test tool to obtain the environment information of the target page, and then the target page may be accessed through the environment information of the target page.

[0047] In this embodiment, the use case table and the use case step table are directly processed by the preset test tool to obtain the use case data file and the test case file. There is no need for technical personnel to manually write the test case and the use case data file, which saves the time for writing the use case data file and the test case file, improves the efficiency of obtaining the use case data file and the test case file, and thus improves the testing efficiency of the target page.

[0048] Reference Figure 3 , Figure 3 A flow chart of a page testing method according to another embodiment of the present application is shown. The method is used in an electronic device and includes:

[0049] S210. Obtain a target test table for a target page. The target test table includes a use case table and a use case step table corresponding to the use case table. The use case table includes target test cases for the target page. The use case step table includes test content for each test step in the target test case.

[0050] The description of S210 refers to the description of S110 above and will not be repeated here.

[0051] S220 , obtaining the use case status of the target test case from the use case table; if the use case status of the target test case is executing test, determining the target test case as a selected test case.

[0052] The use case status of the target test case may refer to whether the target test case executes the test. If the use case status of the target test case is to execute the test, the target test case is determined as a selected test case. If the use case status of the target test case is not to execute the test, the target test case is determined as a discarded test case, and the test case file and use case data file acquisition process of the target test case is not performed.

[0053] If the target test cases include multiple target test cases, the multiple target test cases are arranged in a specific order (refer to the description above, which will not be repeated here), starting from the first target test case, for each target test case, the step of S220 is executed, if the case state of the current target test case is not to perform test, the current target test case is skipped, and the next target test case is judged.

[0054] The case table is used to manage the target test cases. The case table includes the case name, case state, method and method value of the multiple target test cases. As shown in Figure 4 , caseId represents the case name; Figure 4 isRun in the case table represents the case state, yes means to perform the test case, and no means not to perform the test case. In the 7 target test cases shown in Figure 4 , one target test case SOA interaction is not to perform test, Figure 4 method in the case table refers to the method, and the method of each target test case is toSheet, which means to point to the table; Figure 4 methodValue in the case table is the method value, which refers to the specific value corresponding to the method, that is, the name of the table pointed to by toSheet, for example, the method value of the SOA service is to point to the SOA service table.

[0055] S230, by means of the preset test tool, obtaining and analyzing the case step table corresponding to the selected test case to obtain the data analysis result and the case file corresponding to the selected test case.

[0056] Based on the description above, each target test case can correspond to a case step table, when the target test case is determined as the selected test case, the case step table of the selected test case is obtained by means of the preset test tool, and the case step table corresponding to the selected test case is analyzed to obtain the data analysis result and the case file corresponding to the selected test case.

[0057] S240, according to the data analysis result of the selected test case, obtaining the case data file; according to the case file of the selected test case, obtaining the test case file.

[0058] When the target test case includes one, and the target test case is determined as the selected test case, the case file of the selected test case is determined as the test case file, and the obtained test case file includes the case file corresponding to one target test case; at the same time, the data analysis result of the selected test case is written into the case data file.

[0059] When the target test cases include multiple and the number of selected test cases is also multiple, for each selected test case, the case file of the selected test case is determined as the test case file, and the obtained test case file includes the test case files corresponding to the multiple selected test cases; at the same time, the data parsing result of the selected test case is written into the case data file after the data parsing result of the previous selected test case, so as to supplement the data parsing result corresponding to the selected test case in the case data file.

[0060] The use case data file may be a json format file generated by an xlsxToJson.js conversion program developed based on a cypress framework, and the use case data files corresponding to each of the multiple selected test cases may be saved in the file.

[0061] Alternatively, the use case step table of each selected test case may be analyzed through an xlsxToJson.js conversion program developed based on the Cypress framework to obtain a use case file of each selected test case.

[0062] S250: Test the target page according to the use case data file and the test case file to obtain a test result for the target page.

[0063] The description of S250 refers to the description of S130 above and will not be repeated here.

[0064] In this embodiment, the use case status of each target test case can be directly configured in the use case table, and then whether the target test case needs to be executed can be directly determined by the use case status. There is no need to re-delete or configure the target test case, thereby improving the efficiency of obtaining use case data files and test case files.

[0065] Reference Figure 5 , Figure 5 A flow chart of a page testing method according to another embodiment of the present application is shown. The method is used in an electronic device and includes:

[0066] S310. Obtain a target test table for a target page. The target test table includes a use case table and a use case step table corresponding to the use case table. The use case table includes target test cases for the target page. The use case step table includes test content for each test step in the target test case.

[0067] S320 , obtaining the use case status of the target test case from the use case table; if the use case status of the target test case is executing test, determining the target test case as a selected test case.

[0068] The description of S310-S320 refers to the description of S210-S220 above and will not be repeated here.

[0069] S330. Obtain the test status of the mth test step under the selected test case from the use case step table corresponding to the selected test case, where m takes values ​​from 1 to M, and M is the total number of test steps of the selected test case; if the test status of the mth test step is to execute the test, determine the mth test step as the selected test step; obtain the test content of the selected test step from the use case step table corresponding to the selected test case through the preset test tool, and parse the test content of the selected test step to obtain the intermediate parsing result corresponding to the selected test step; after traversing the M test steps of the selected test case, obtain the data parsing result and use case file of the selected test case according to the intermediate parsing result of each selected test step under the selected test case.

[0070] The test status of a test step may refer to whether the test step executes the test. If the test status of the test step is to execute the test, the test step is determined as a selected test step. If the test status of the test step is not to execute the test, the test step is determined as a discarded test step, and the analysis process of the test step is not performed.

[0071] In this embodiment, when the selected test case includes a test step, if the test status of the test step is to execute the test, the test step is determined as the selected test step, and the test content of the selected test step is obtained from the use case step table corresponding to the selected test case through the preset test tool, and then the test content of the selected test step is parsed through the xlsxToJson.js conversion program developed based on the cypress framework to obtain the intermediate parsing result corresponding to the selected test step.

[0072] The selected test case includes multiple test steps arranged in sequence. The multiple test steps included in the selected test case are arranged in a test order. Please refer to the above description for details and will not be repeated here.

[0073] For each test step in the selected test case, if the test status of the current test step is to execute the test, the current test step is determined as the selected test step, and through the preset test tool, the test content of the selected test step is obtained from the use case step table corresponding to the selected test case, and the test content of the selected test step is parsed to obtain the intermediate parsing result corresponding to the selected test step; if the test status of the current test step is not to execute the test, skip the current test step, obtain the next test step as the new current test step, and continue to repeat the above steps.

[0074] After traversing all test steps of the selected test case, the intermediate parsing results of each selected test step are obtained, and then the intermediate parsing results of each selected test step of the selected test case are summarized to obtain the data parsing result and the case file of the selected test case.

[0075] As an implementation method, the target test table also includes a node information table, which includes node values ​​corresponding to different nodes; the test content of the selected test step is parsed to obtain an intermediate parsing result corresponding to the selected test step, including: determining a target node that matches the node in the selected test step in the node information table; processing the node in the selected test step that matches the target node according to the node value corresponding to the target node in the node information table to obtain an intermediate parsing result corresponding to the selected test step.

[0076] The nodes in the node information table may refer to elements or variables in the target page, etc. The target node that matches the node in the selected test step is determined in the node information table; according to the node value of the corresponding target node in the node information table, the node that matches the target node in the selected test step is processed (the processing may include operations such as element replacement, random number generation, and reference to temporary variables) to obtain the intermediate parsing result corresponding to the selected test step.

[0077] The node information table allows you to configure different node values ​​for the same node across multiple target test cases, enabling node reuse. This eliminates the need to configure the same node with different values ​​multiple times, improving configuration efficiency and, in turn, the efficiency of obtaining both use case data files and test case files. Furthermore, when modifying a node's value, you only need to modify the node information table, eliminating the need to modify other tables in the target test table. This improves modification efficiency and reduces the cost of test case modification.

[0078] As an implementation method, based on the intermediate parsing results of each selected test step under the selected test case, the data parsing results and the use case file of the selected test case are obtained, including: processing the intermediate parsing results of each selected test step under the selected test case through a preset conversion program to obtain the data parsing results in the target format corresponding to the selected test case; processing the intermediate parsing results of each selected test step under the selected test case through a preset conversion program and a preset file template to obtain the use case file corresponding to the selected test case.

[0079] The preset conversion program may be the xlsxToJson.js conversion program developed based on the Cypress framework, and the target format may be the JSON format. The preset conversion program processes the intermediate parsing results of each selected test step under the selected test case to obtain a data parsing result in the target format corresponding to the selected test case. The data parsing result of the currently selected test case is then written into the case data file after the data parsing result of the previously selected test case.

[0080] The preset file template can be a use case file template set based on requirements and actual test scenarios. The intermediate parsing results of each selected test step under the selected test case are analyzed through a preset conversion program, and the analysis results are written into the preset file template to obtain a use case file corresponding to the selected test case.

[0081] In this embodiment, the test step table may include the name of the test step, description information of the test step, test status of the test step, method, method value, action and assertion. Figure 6 As shown, Figure 6 This is the test case - the test step table corresponding to the SOA logical subsystem. caseId is the name of the test step, desc is the description information of the test step, method is the method, which indicates the specific method of the step, for example, get means get, method value refers to the specific element or variable pointed by the method (that is, the node mentioned above), action refers to the operation corresponding to the specific element or variable pointed by the method value, and assertion refers to assertion, which is used to assume that a certain condition will definitely be met. When the condition is not met, an error prompt will be displayed.

[0082] Correspondingly, the node information table may include group name, node name, and node value. Figure 7 As shown, Figure 7 It shows the node information table of multiple test nodes corresponding to the target page. GroupId is the group name, which represents the category name of nodes belonging to the same category. NodeId is the node name, which refers to the name of the specific node. NodeValue refers to the node value, which represents the specific content actually corresponding to each node.

[0083] S340. Obtain a test case data file based on the data analysis result of the selected test case; obtain a test case file based on the test case file of the selected test case.

[0084] S350: Test the target page according to the use case data file and the test case file to obtain a test result for the target page.

[0085] Among them, the description of S340-S350 refers to the description of S240-S250 above and will not be repeated here.

[0086] In this embodiment, the use case steps of each selected test case are analyzed through a preset test tool to obtain the data analysis results and use case files of each selected test case. Then, based on the data analysis results and use case files of each selected test case, the use case data files and test case files can be obtained. There is no need to manually configure the content of each test step, which improves the efficiency of obtaining use case data files and test case files, thereby improving the testing efficiency.

[0087] Reference Figure 8 , Figure 8 A flow chart of a page testing method according to another embodiment of the present application is shown. The method is used in an electronic device and includes:

[0088] S410. Obtain a target test table for a target page. The target test table includes a use case table and a use case step table corresponding to the use case table. The use case table includes target test cases for the target page. The use case step table includes test content of each test step in the target test case.

[0089] S420: parse the use case table and the use case step table using a preset test tool to obtain a use case data file and a test case file.

[0090] The description of S410-S420 refers to the description of S110-S120 above and will not be repeated here.

[0091] S430: Parse the use case data file to obtain the data source of each test step in the corresponding test case file.

[0092] For each test case file, the data of each test step in the test case file is obtained from the case data file as a data source.

[0093] S440: Test the target page using a preset regular expression according to the test case file and the data source of each test step in the corresponding test case file to obtain a test result for the target page.

[0094] In this embodiment, the preset regular expressions may include the following three types:

[0095] (1)cy.method(methodValue);

[0096] (2)cy.method(methodValue).action;

[0097] (3)cy.method(methodValue).assertion.

[0098] Among them, method refers to the internal or custom encapsulated method of Cypress, such as get, contains, wait, etc.; methodValue refers to the value of the above method, such as page elements, waiting time, etc.; action refers to the operation behavior, such as click, type, etc.; assertion refers to the assertion behavior to judge the test result.

[0099] According to the content of each test step in the test case file and the corresponding data source, and according to the content filled in each line in the use case step, through the preset rule expression, all types of operations on the target page, updates of environment configurations, modifications or use of intermediate variables, interface requests and other behaviors are completed, thereby testing the target page and obtaining test results for the target page.

[0100] In this embodiment, through preset rule expressions, the target page can be tested directly according to the test case file and the data source of each test step in the corresponding test case file to obtain the test results for the target page. It is not necessary to configure specific operation content for each test step to achieve the test of the target page, thereby improving the testing efficiency of the target page.

[0101] In order to more clearly understand the technical solution of the present application, the solution of the present application is explained below in conjunction with an exemplary scenario.

[0102] In this scenario, you first write a small amount of code to connect and execute the above processes. You then install Node.js and packages such as Cypress and node-xlsx through npm. You then create the target test tables (including a use case table, an environment information table, a node information table, and a use case step table) in Excel and store them in the fixtures directory. Each row in the use case table represents a use case, and each row in the use case step table represents a test step.

[0103] In this exemplary scenario, the process of the page testing method is as follows Figure 9 Shown, including:

[0104] S501, cpypress open or cypress run is started, and the "testfile" (xlsxTojson.js, test / *.js) in cypress.json is obtained to limit the test case file directory; xlsxToJson.js is executed, and the xlsxToJson method encapsulated in command.js is called to obtain the specified target test table (including the use case table, environment information table, node information table, and use case step table) through xlsx.

[0105] S502 . Obtain a node dictionary through the node information table in the target test table (the node dictionary stores the node value of each node in the form of “nodeId:nodeValue”).

[0106] S503: Obtain the content of each row in the use case table in the target test table, and parse the content of each row in sequence.

[0107] S504: Check whether all rows of the use case table have been parsed.

[0108] S505. If isRun of the current row in the use case table is yes, determine the target test case corresponding to the current row as the selected test case, and obtain the use case step table of the selected test case; if isRun of the current row in the use case table is no, return to the previous step S504.

[0109] S506: Whether all rows of the use case step table of the currently selected test case have been parsed.

[0110] S507. If isRun of the current row in the test step table of the selected test case is yes, determine the test step corresponding to the current row as the selected test step; if isRun of the current row in the test step table of the selected test case is no, return to the previous step S506.

[0111] S508. Determine the target node that matches the node in the selected test step in the node dictionary; process the node that matches the target node in the selected test step according to the node value of the corresponding target node in the node information table (which may include element replacement, random number generation, and reference to temporary variables, etc.) to obtain the intermediate parsing result corresponding to the selected test step.

[0112] S509. Process the intermediate parsing results of each selected test step under the selected test case to obtain the data parsing results in the target format corresponding to the selected test case, and append the data parsing results to xlsxData.json to obtain the use case data file; according to the preset file template, process the intermediate parsing results of each selected test step under the selected test case to obtain the use case file corresponding to the selected test case as the test case file of the selected test case.

[0113] S510. Before triggering the pre-operation, obtain the environment information table in the target test table, access the target page according to the environment information table, obtain the use case data file and the test case file in the directory, import xlsxData.json as the data source, find the corresponding use case step, and execute the operation through the preset rule expression to obtain the test result.

[0114] The exemplary pseudo code of the above S503-S508 is as follows:

[0115]

[0116]

[0117] In this scenario, you can specify an Excel table through -e case_file=xxx.xlsx, which is convenient for switching between multiple projects. During the parsing of the target test table in the configured Excel format, the node (page element or traversal) nodeId will be converted to the actual value nodeValue, and the parsed result will be saved as a use case data file, thereby reducing maintenance costs. It can also support custom methods and Cypress original syntax, encapsulating a series of high-frequency and complex test behaviors into keywords in commands.js for reuse, which is a better choice to replace PageObject. For example, to test the operation permissions of users with different identities, it is necessary to switch users: enter the user center, log out, enter the login page, enter the account and password, log in to the system, and return to the page before switching users. These repeated behaviors are encapsulated into a simple switchUser( user), all testers only need to fill in switchUser and user in the method and methodValue of the Execl table to complete the task quickly, avoiding repeated and inefficient testing work in the same scenario; during the execution of the JavaScript file, the parsed json format use case data file will be assembled and executed according to regular expressions such as cy.method(methodValue).action to improve test efficiency; the name of the use case, whether to execute, the specific content of each step, intermediate variable references, dynamic modification of environment variables, etc. are flexibly configured without rewriting the code; the pre-operation will set cookie and other project configuration information according to the environment information table Env, which can be dynamically updated during execution to achieve behaviors such as switching users.

[0118] Reference Figure 10 , Figure 10 The following is a block diagram of a page testing device according to an embodiment of the present application. The device 1000 is used in an electronic device and includes:

[0119] An acquisition module 1010 is configured to acquire a target test table for a target page, the target test table including a use case table and a use case step table corresponding to the use case table, the use case table including target test cases for the target page, the use case step table including test content for each test step in the target test case;

[0120] The parsing module 1020 is configured to parse the use case table and the use case step table using a preset test tool to obtain a use case data file and a test case file;

[0121] The testing module 1030 is configured to test the target page according to the use case data file and the test case file to obtain a test result for the target page.

[0122] Furthermore, the parsing module 1020 is also used to obtain the use case status of the target test case from the use case table; if the use case status of the target test case is to execute the test, the target test case is determined as the selected test case; through the preset test tool, the use case step table corresponding to the selected test case is obtained and parsed to obtain the data parsing results and use case file corresponding to the selected test case; according to the data parsing results of the selected test case, the use case data file is obtained; according to the use case file of the selected test case, the test case file is obtained.

[0123] Furthermore, the selected test case includes multiple test steps arranged in sequence; the parsing module 1020 is also used to obtain the test status of the mth test step under the selected test case from the use case step table corresponding to the selected test case, m takes values ​​from 1 to M in sequence, and M is the total number of test steps of the selected test case; if the test status of the mth test step is to execute the test, the mth test step is determined as the selected test step; through the preset test tool, the test content of the selected test step is obtained from the use case step table corresponding to the selected test case, and the test content of the selected test step is parsed to obtain the intermediate parsing result corresponding to the selected test step; after traversing the M test steps of the selected test case, the data parsing result and use case file of the selected test case are obtained according to the intermediate parsing result of each of the selected test steps under the selected test case.

[0124] Furthermore, the target test table also includes a node information table, which includes node values ​​corresponding to different nodes; the parsing module 1020 is also used to determine the target node that matches the node in the selected test step in the node information table; according to the node value corresponding to the target node in the node information table, the node that matches the target node in the selected test step is processed to obtain an intermediate parsing result corresponding to the selected test step.

[0125] Furthermore, the parsing module 1020 is also used to process the intermediate parsing results of each selected test step under the selected test case through a preset conversion program to obtain a data parsing result in the target format corresponding to the selected test case; and to process the intermediate parsing results of each selected test step under the selected test case through the preset conversion program and the preset file template to obtain a use case file corresponding to the selected test case.

[0126] Furthermore, the target test table also includes an environment information table, which includes the environment information of the target page; the test module 1030 is also used to obtain the environment information of the target page from the environment information table; access the target page according to the environment information of the target page; test the target page according to the use case data file and the test case file to obtain the test results for the target page.

[0127] Furthermore, the test module 1030 is also used to parse the use case data file to obtain the data source corresponding to each test step in the test case file; through a preset rule expression, according to the test case file and the data source corresponding to each test step in the test case file, the target page is tested to obtain the test result for the target page.

[0128] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0129] See also Figure 11 , which shows a structural block diagram of an electronic device 1100 provided in an embodiment of the present application. The electronic device 1100 can be a smart phone, a tablet computer, an e-book, a vehicle-mounted terminal, an aircraft, a wearable device terminal, a virtual reality device, a smart camera, and other electronic devices capable of running applications. The electronic device 1100 in the present application may include one or more of the following components: a processor 1110, a memory 1120, and one or more applications, wherein the one or more applications may be stored in the memory 1120 and configured to be executed by one or more processors 1110, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.

[0130] The processor 1110 may include one or more processing cores. The processor 1110 utilizes various interfaces and circuits to connect various components within the electronic device 1100. It executes instructions, programs, code sets, or instruction sets stored in the memory 1120, and accesses data stored in the memory 1120 to perform various functions and process data within the electronic device 1100. Optionally, the processor 1110 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 1110 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing displayed content; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 1110 and may be implemented separately via a communications chip.

[0131] The memory 1120 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat history data) created by the electronic device 1100 during use.

[0132] In several embodiments provided in this application, the coupling between modules may be electrical, mechanical or other forms of coupling.

[0133] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.

[0134] refer to Figure 12 , Figure 12 The computer-readable storage medium 1200 stores program code, which can be called by a processor to execute the method described in the above method embodiment.

[0135] Computer-readable storage medium 1200 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Alternatively, computer-readable storage medium 1200 may include a non-transitory computer-readable storage medium. Computer-readable storage medium 1200 may have storage space for program code 1210 for executing any of the method steps described above. This program code may be read from or written to one or more computer program products. Program code 1210 may be compressed, for example, in a suitable form.

[0136] In summary, the present application provides a calibration pattern generation method, calibration pattern registration method, apparatus, and electronic device. After acquiring a calibration scene, a pseudo-random array corresponding to the calibration scene is obtained, and a calibration pattern is generated based on the pseudo-random array and multiple graphic primitives. The pseudo-random array is used to determine the positions of the graphic primitives in the calibration pattern. This approach enables the generation of different pseudo-random arrays based on different calibration scenes, and thus enables the generation of different calibration patterns based on different pseudo-random arrays, thereby improving the accuracy of sensor calibration under different calibration scenes.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A page testing method, characterized in that: The method comprises: Obtain a target test table for a target page, the target test table including a use case table and a use case step table corresponding to the use case table, the use case table including a target test case for the target page, the use case step table including test content of each test step in the target test case; Obtain the use case status of the target test case from the use case table; If the case status of the target test case is executing test, determining the target test case as a selected test case; the selected test case includes a plurality of test steps arranged in sequence; Obtaining the test status of the mth test step under the selected test case from the use case step table corresponding to the selected test case, where m is a value ranging from 1 to M, and M is the total number of test steps of the selected test case; If the test status of the m-th test step is executing the test, determining the m-th test step as a selected test step; Obtaining, by means of a preset test tool, the test content of the selected test step from the use case step table corresponding to the selected test case, and parsing the test content of the selected test step to obtain an intermediate parsing result corresponding to the selected test step; After traversing the M test steps of the selected test case, obtaining a data parsing result and a case file of the selected test case according to the intermediate parsing result of each of the selected test steps under the selected test case; Obtaining a test case data file according to the data parsing result of the selected test case; Obtaining a test case file according to the case file of the selected test case; The target page is tested according to the use case data file and the test case file to obtain a test result for the target page.

2. The method according to claim 1, characterized in that The target test table further includes a node information table, wherein the node information table includes node values ​​corresponding to different nodes; the test content of the selected test step is parsed to obtain an intermediate parsing result corresponding to the selected test step, including: Determining a target node in the node information table that matches the node in the selected test step; The nodes matching the target node in the selected test step are processed according to the node value corresponding to the target node in the node information table to obtain an intermediate parsing result corresponding to the selected test step.

3. The method according to claim 1, characterized in that The step of obtaining the data parsing result and the use case file of the selected test case according to the intermediate parsing result of each selected test step under the selected test case includes: Processing the intermediate parsing result of each selected test step under the selected test case through a preset conversion program to obtain a data parsing result in a target format corresponding to the selected test case; The preset conversion program and the preset file template are used to process the intermediate parsing result of each selected test step under the selected test case to obtain a case file corresponding to the selected test case.

4. The method according to claim 1, wherein The target test table further includes an environment information table, wherein the environment information table includes environment information of the target page; and the target page is tested according to the use case data file and the test case file to obtain a test result for the target page, including: Acquire the environment information of the target page from the environment information table; Accessing the target page according to the environment information of the target page; The target page is tested according to the use case data file and the test case file to obtain a test result for the target page.

5. The method according to claim 1, wherein The step of testing the target page according to the use case data file and the test case file to obtain a test result for the target page includes: Parsing the test case data file to obtain a data source corresponding to each test step in the test case file; The target page is tested according to the test case file and the data source corresponding to each test step in the test case file through a preset regular expression to obtain a test result for the target page.

6. A page testing device, characterized in that: The device comprises: An acquisition module is used to acquire a target test table for a target page, wherein the target test table includes a use case table and a use case step table corresponding to the use case table, wherein the use case table includes a target test case for the target page, and the use case step table includes the test content of each test step in the target test case; a parsing module is used to acquire the use case status of the target test case from the use case table; if the use case status of the target test case is to execute the test, the target test case is determined as a selected test case; the selected test case includes a plurality of test steps arranged in sequence; the test status of the mth test step under the selected test case is acquired from the use case step table corresponding to the selected test case, where m takes values ​​from 1 to M, and M is the value of the selected test case. The total number of test steps of the case; if the test status of the m-th test step is to execute the test, the m-th test step is determined as the selected test step; through the preset test tool, the test content of the selected test step is obtained from the use case step table corresponding to the selected test case, and the test content of the selected test step is parsed to obtain the intermediate parsing result corresponding to the selected test step; after traversing the M test steps of the selected test case, according to the intermediate parsing result of each selected test step under the selected test case, the data parsing result and the use case file of the selected test case are obtained; according to the data parsing result of the selected test case, the use case data file is obtained; according to the use case file of the selected test case, the test case file is obtained; The testing module is used to test the target page according to the use case data file and the test case file to obtain a test result for the target page.

7. An electronic device, characterized in that: The electronic device comprises: one or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, which can be called by a processor to execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for realizing automatic software testing and electronic equipment

    CN106598869A

  • A case table driven satellite orbit computing software automated testing method and system

    CN109885488A