Test script generation method, electronic equipment, storage medium and program product
By analyzing test cases, extracting objects to be verified and value methods, and generating automated test scripts, the complex problems of writing and maintaining automated test scripts in the existing technology are solved, and a more accurate and efficient testing process is achieved.
Patent Information
- Application Number
- CN202510192049.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, the writing and maintenance process of automated test scripts is complicated and cumbersome, resulting in inaccurate test results and affecting the normal operation of the system.
By analyzing the test cases, extracting the verification content of the verification point, obtaining the value method of the object to be checked and its associated verification variables, code the value method and generate a test script, and configuring the global execution order to generate an automated test method.
Simplifies the generation and maintenance process of automated test scripts, improves the accuracy of test results, reduces dependence on test developers, and ensures the normal operation of the system.
Smart Images

Figure CN120104494A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to technical fields such as data verification, and in particular to a test script generation method, an automated testing method, an electronic device, a storage medium, and a program product. Background Art
[0002] Traditional methods of data consistency verification usually rely on automated testing. Automated testing simulates user operations and system behaviors by writing scripts to verify the data consistency of the system in various situations. However, writing these automated test scripts often takes a lot of time and effort. Test developers not only need to have a deep understanding of business logic, but also need to master the use of test frameworks and tools. This makes the process of writing automated test scripts complicated and tedious.
[0003] In practical applications, the maintenance of automated test scripts is also a major challenge. The business logic and data structure of the system may continue to evolve as requirements change, which means that test scripts need to be frequently updated and adjusted. Improperly maintained test scripts may lead to inaccurate test results and even affect the normal operation of the system. Summary of the invention
[0004] The present disclosure provides a test script generation method, an automated testing method, an electronic device, a storage medium, and a program product.
[0005] According to one aspect of the present disclosure, a test script generation method is provided, comprising: Parsing the test case to obtain verification content of at least one verification point in the test case; Extracting an object to be verified from the verification content of each verification point, obtaining at least one object to be verified and at least one variable to be verified associated with the object to be verified for each verification point; A method for obtaining the value of the variable to be checked associated with each object to be checked; Codify the value-taking method of each variable to be checked and generate a code block; A test script corresponding to the test case is generated based on the code block.
[0006] According to the test script generation method of at least one embodiment of the present disclosure, after obtaining the value of the variable to be verified associated with each object to be verified, the test script generation method further includes: A global execution order is configured for the value-taking method of each variable to be checked associated with each object to be checked, so that the test script can be generated based on the global execution order.
[0007] According to the test script generation method of at least one embodiment of the present disclosure, the method of obtaining the value of each variable to be checked of each object to be checked configures the global execution order, including: Determine whether the value-taking method of each variable to be checked has a dependent object; If there is a dependent object, determining that there is a characteristic dependency relationship between the variable to be verified and the dependent object; A global execution order is configured for value-taking methods of each to-be-checked variable associated with the test case based on at least one of the determined feature dependencies.
[0008] According to the test script generation method of at least one embodiment of the present disclosure, the dependent object is any variable to be checked associated with any object to be checked of any checkpoint in the test case.
[0009] According to at least one embodiment of the present disclosure, a test script generation method generates a test script corresponding to the test case based on the code block, including: A test script corresponding to the test case is generated based on the code block and the global execution order.
[0010] According to the test script generation method of at least one embodiment of the present disclosure, the parsing of the test case to obtain the verification content of the verification point in the test case includes: Performing structured processing on the test case to obtain a structured test case; The content of at least one characteristic field is extracted from the test case after the structured processing as the verification content.
[0011] According to the test script generation method of at least one embodiment of the present disclosure, extracting the object to be verified from the verification content of each verification point, obtaining at least one object to be verified for each verification point and at least one variable to be verified associated with the object to be verified, includes: The object to be verified and the variable to be verified associated with the object to be verified are extracted from the content of the at least one characteristic field.
[0012] According to the test script generation method of at least one embodiment of the present disclosure, the method of obtaining the value of the variable to be verified associated with each object to be verified includes: Provides a value-taking method configuration interface; The value-taking method configuration interface receives the value-taking method input by the user; In response to the value obtaining method configuration interface receiving a save operation from the user, the value obtaining method is obtained.
[0013] According to the test script generation method of at least one embodiment of the present disclosure, the method for obtaining the value of the variable to be verified associated with each object to be verified further includes: In response to the value-taking method interface receiving a synchronization operation from the user, the value-taking method input by the user or the obtained value-taking method is stored as a configured value-taking method of the variable to be verified.
[0014] According to the test script generation method of at least one embodiment of the present disclosure, the configured value acquisition method is stored in a target database or a target server.
[0015] According to the test script generation method of at least one embodiment of the present disclosure, the method of obtaining the value of the variable to be verified associated with each object to be verified includes: Provides a value-taking method configuration interface; In response to the value obtaining method configuration interface receiving a call operation from a user, the configured value obtaining method of the variable to be verified is called to the value obtaining method configuration interface; In response to the value obtaining method configuration interface receiving a save operation from the user, the value obtaining method is obtained.
[0016] According to the test script generation method of at least one embodiment of the present disclosure, the method of obtaining the value of each variable to be checked is coded and a code block is generated, including: The value obtaining method of the variable to be checked is converted into a code block of the target type code based on the code specification of the target type code.
[0017] According to another aspect of the present disclosure, the present disclosure also provides an automated testing method, comprising: An automated test interface is provided, wherein the automated test interface is configured with a first control, a second control, and a third control, wherein the first control can select a test script based on a received operation, the second control can select an execution environment based on the received operation, the execution environment is configured with at least one object to be verified, and the third control can trigger an automated test based on the received operation; Receive the user's operation on the first control, select a test script, receive the user's operation on the second control, and select an execution environment; receiving a user's operation on the third control, and performing an automated test on the at least one object to be verified in the selected execution environment based on the selected test script; The test script is a test script generated according to the test script generation method of any embodiment of the present disclosure.
[0018] According to the automated testing method of at least one embodiment of the present disclosure, the automated testing interface is further configured with a fourth control, and the fourth control is capable of determining a range of a variable to be verified based on a received operation; The automated testing method further comprises: receiving a user's operation on the fourth control, and determining a range of the variable to be verified; The receiving the user's operation on the third control, and performing an automated test on the at least one object to be verified in the selected execution environment based on the selected test script, comprises: An operation of the user on the third control is received, and an automated test is performed on the variables to be checked within the range of the at least one object to be checked in the selected execution environment based on the selected test script.
[0019] According to another aspect of the present disclosure, an electronic device is provided, comprising: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, so that the processor executes the test script generation method of any embodiment of the present disclosure and / or the automated testing method of any embodiment of the present disclosure.
[0020] According to another aspect of the present disclosure, a readable storage medium is provided, in which execution instructions are stored. When the execution instructions are executed by a processor, they are used to implement the test script generation method of any embodiment of the present disclosure and / or the automated testing method of any embodiment of the present disclosure.
[0021] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the test script generation method of any embodiment of the present disclosure and / or the automated testing method of any embodiment of the present disclosure is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0023] Figure 1 The figure shows an overall flow chart of a test script generation method according to an embodiment of the present disclosure.
[0024] Figure 2 It is a schematic diagram of a test case of the present invention.
[0025] Figure 3 It is a flowchart of a test script generation method according to another embodiment of the present invention.
[0026] Figure 4 It is a flowchart of a method for obtaining a global execution order according to an embodiment of the present disclosure.
[0027] Figure 5 It is a flowchart of a method for obtaining a value of a variable to be verified according to an embodiment of the present invention.
[0028] Figure 6 The value acquisition method configuration interface of one embodiment of the present disclosure is exemplarily shown.
[0029] Figure 7 It is a flowchart of a method for obtaining a value of a variable to be verified according to an embodiment of the present invention.
[0030] Figure 8 It is a flowchart of an automated testing method according to a preferred embodiment of the present invention.
[0031] Fig. 9 is a schematic diagram of an automated testing interface according to an embodiment of the present disclosure.
[0032] Fig.10 A schematic flow chart of an automated testing method according to another embodiment of the present disclosure is shown.
[0033] Fig.11 It is a schematic block diagram of the structure of a test script generating device according to an embodiment of the present invention.
[0034] Fig.12 The present invention is a block diagram showing a structure of an electronic device equipped with a test script generating device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The present disclosure is further described in detail below in conjunction with the accompanying drawings and examples. It is understood that the specific examples described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.
[0036] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0037] Automated testing is generally performed based on test cases. Users can first write test cases, and test developers then write test scripts based on the test cases and their understanding of business logic, and then perform automated testing on business processing systems based on the test scripts. This process requires test developers to understand test cases and business logic, which makes the testing process complex and tedious. If there are errors in the above understanding, the test results will be inaccurate, affecting the normal operation of the tested system, such as the business processing system.
[0038] To this end, the present disclosure proposes a test script generation method.
[0039] The test script generation method disclosed in the present invention can be implemented on electronic devices such as desktop computers, portable computers, and mobile phones.
[0040] Figure 1 FIG. 1 is a schematic diagram showing the overall flow of a test script generation method M100 according to an embodiment of the present disclosure. Figure 1 The method shown includes steps S110 to S140.
[0041] Specifically, Figure 1 The test script generation method shown includes: S110: parse the test case to obtain verification content of at least one verification point in the test case.
[0042] The test case is a description of a test task for a specific software product, and its content may include test objectives, test environment, input data, test steps, expected results, test scripts, etc., and its form may be a document. The test script generation method disclosed in the present invention can parse various types of test cases.
[0043] A test case checkpoint is a point or location during the test process where a specific output or state is verified. It can include the following elements: Verification path: describes how to reach a specific location or state that needs to be verified. For example, it may be an element on a page or a record in a database.
[0044] Checkpoint name: The name of the checkpoint, used to distinguish different checkpoints. For example, "Login Success Tips", "Order Total Price", etc.
[0045] Operator: An operator used to compare the actual result with the expected result. Common operators include equal to (=), not equal to (!=), greater than (>), less than (<), etc.
[0046] Checkpoint actual value: The output or state actually produced by the system when the test is executed. This is the value obtained dynamically during the test.
[0047] Checkpoint requirement value: expected output or state. It can be a pre-defined value in the test case for comparison with the actual value.
[0048] The verification content described above in the present disclosure may include one or more of the above elements.
[0049] Figure 2 It is a schematic diagram of a test case of the present invention.
[0050] Table 1 is Figure 2 The two checkpoints of the test case shown are parsed to obtain the check contents.
[0051] Table 1 refer to Figure 2 As shown in Table 1, the checkpoint paths of the two checkpoints of the test case are both "after data synchronization", for example, the checkpoint or test is performed after the data of the two databases are synchronized, and for another example, the checkpoint or test is performed after the data of the two data tables (such as Table A and Table B) are synchronized.
[0052] As shown in Table 1, Figure 2 The names of the two checkpoints in the test case can be parsed as "B table.order_money = A table.order_price" and "A table.order_price + B table.sign_money = B table.deal_money".
[0053] It should be noted that the above test cases and the verification contents of the test cases are exemplary.
[0054] Based on the above step S110, the verification content of the verification point is obtained by parsing the test case.
[0055] In some preferred embodiments of the present disclosure, the test case may be parsed based on the following method: Structuring the test cases to obtain structured test cases; The content of at least one characteristic field is extracted from the structured test case as verification content.
[0056] Among them, test cases can be written through use case templates or the written test cases can be structured using use case templates. Both can achieve structured processing of test cases based on use case templates, and then extract the content of feature fields from the structured test cases (multiple feature fields can be configured on the use case template: checkpoint path, checkpoint name, etc.).
[0057] Inspired by the technical solution of the present disclosure, the selection or adjustment of the test case parsing method made by those skilled in the art (such as using a keyword-driven method to write test cases for structured processing) all falls within the protection scope of the present disclosure.
[0058] After the verification content of the verification point is obtained based on step S110, step S120 is executed.
[0059] S120: extracting an object to be verified from the verification content of each verification point, and obtaining at least one object to be verified and at least one variable to be verified associated with the object to be verified for each verification point.
[0060] by Figure 2 The test cases shown are examples, see Figure 1 ,This test case includes two checkpoints, each of which includes two objects to be checked, namely table A and table B.
[0061] In some embodiments of the present disclosure, the object to be verified may also be a database, a function of a software product, etc.
[0062] In some embodiments of the present disclosure, a test case may include one checkpoint or more checkpoints. Each checkpoint may include only one object to be checked (such as table A) or more objects to be checked, all of which fall within the protection scope of the present disclosure.
[0063] In other words, the number of checkpoints in a test case may be one or more, and the number of objects to be checked at each checkpoint may be one or more.
[0064] Each object to be verified may be associated with one or more variables to be verified. For example, in Table 1, the variables to be verified associated with table A include table A.order_price, and the variables to be verified associated with table B include table B.deal_money, table B.sign_money, and table B.order_money.
[0065] Since the content of the characteristic field described above can be used as verification content, in some embodiments of the present disclosure, step S120 may preferably include: extracting the object to be verified and the variable to be verified associated with the object to be verified from the content of the at least one characteristic field.
[0066] After extracting the object to be verified and the variable to be verified associated with the object to be verified from the verification content of the verification point in step S120, the test script generation method of the present disclosure executes step S130.
[0067] S130: Obtain the value of the variable to be checked associated with each object to be checked (eg, table A).
[0068] Please continue to refer to Table 1. Taking Table A as an example of the object to be verified, its associated variables to be verified include Table A.order_price. Taking Table B as an example of the object to be verified, its associated variables to be verified include Table B.order_money, Table B.sign_money, and Table B.deal_money.
[0069] In the test process based on the test script, it is necessary to take values for each variable to be verified. Therefore, the test script generation method disclosed in the present invention needs to obtain the value taking method of the variable to be verified associated with each object to be verified.
[0070] Among them, the method for obtaining the value of the variable to be verified can be in the form of a query statement (such as a SQL query statement), or in the form of an API request, a file reading form, etc., all of which fall within the protection scope of this disclosure.
[0071] It should be noted that, in some embodiments, the method for obtaining the value of the variable to be verified associated with the object to be verified can be executed based on the data of the object to be verified. In other embodiments of the present disclosure, the method for obtaining the value of the variable to be verified associated with the object to be verified can be executed based on data other than the object to be verified (for example, the value of a variable to be verified associated with table A may require data in table C), all of which fall within the protection scope of the present disclosure.
[0072] In the present disclosure, the number of variables to be verified associated with each object to be verified may be one or more.
[0073] After obtaining the value-taking method of the variable to be checked associated with the object to be checked through step S130, the test script generation method of the present disclosure executes step S140.
[0074] Step S140: Encode the value-taking method of each variable to be checked and generate a code block.
[0075] In some implementations of the present disclosure, the value obtaining method of the check variable may be coded and a code block may be generated based on the following method: The value obtaining method of the variable to be checked is converted into a code block of the target type code (eg, Python code) based on the code specification of the target type code.
[0076] In light of the technical solution disclosed herein, the selection or adjustment of the coding method by those skilled in the art shall fall within the protection scope of the present disclosure.
[0077] After the code block of the value-taking method of each variable to be checked is obtained (that is, the code block of the value-taking method of each variable to be checked associated with the test case is obtained), step S150 is executed.
[0078] S150. Generate a test script corresponding to the test case based on the code block.
[0079] In this step, all code blocks associated with the obtained test case may be encapsulated to obtain a test script corresponding to the test case.
[0080] From the above description of steps S110 to S150, it can be seen that the test script generation method of the present disclosure can obtain the test script corresponding to the test case through a series of processing of the test case, without the need for the test developer to develop the test script based on the traditional method.
[0081] Figure 3 It is a flowchart of a test script generating method M300 according to another embodiment of the present disclosure.
[0082] refer to Figure 3 The test script generation method M300 of this embodiment includes: S310, parsing the test case to obtain verification content of at least one verification point in the test case; S320, extracting an object to be verified from the verification content of each verification point, and obtaining at least one object to be verified and a variable to be verified associated with the object to be verified for each verification point; S330, obtaining a value-taking method of a variable to be checked associated with each object to be checked, and configuring a global execution order for each obtained value-taking method of the variable to be checked; S340, coding the value-taking method of each variable to be checked and generating a code block; S350. Generate a test script corresponding to the test case based on the code block and the feature execution order.
[0083] Taking into account that the value-taking method of the variable to be checked obtained by the present invention may have dependent objects (the dependent object may be the values of one or more other variables to be checked associated with a certain object to be checked at a certain check point in the test case), the present invention configures a global execution order (i.e., a feature execution order) for the value-taking method of each variable to be checked of each object to be checked of the test case through the above-mentioned step S330, so that the value-taking method of each variable to be checked associated with the test case can be effectively executed.
[0084] In some implementations of the present disclosure, the global execution order may be obtained by topologically sorting the execution order of the value-taking methods of the variables to be checked.
[0085] Figure 4 It is a flowchart of a method for obtaining a global execution order according to an embodiment of the present disclosure.
[0086] refer to Figure 4 Preferably, the above global execution order is obtained by the following steps: S3302, determine whether the value-taking method of each variable to be checked has a dependent object; S3304: If a dependent object exists, determine whether there is a characteristic dependency relationship between the variable to be verified and the dependent object; S3306. Obtain the above-mentioned global execution order based on at least one of the determined feature dependencies.
[0087] The dependent object described above may be any variable to be checked associated with any object to be checked at any checkpoint in the test case.
[0088] pass Figure 4 The acquisition method shown can obtain the above-mentioned global execution order. Under the inspiration of the technical solution disclosed in this disclosure, those skilled in the art can select or adjust the above-mentioned method for obtaining the global execution order or the above-mentioned specific method of topologically sorting the execution order of the method for taking the values of each variable to be checked, which all fall within the protection scope of this disclosure.
[0089] The following is an explanation of the method for obtaining the value of the variable to be verified described above in the present disclosure.
[0090] Figure 5 It is a flowchart of a method for obtaining a value of a variable to be verified according to an embodiment of the present invention.
[0091] refer to Figure 5 , the method for obtaining the value of the variable to be verified in this embodiment includes: S501, providing a value acquisition method configuration interface; S502, the value-taking method configuration interface receives a value-taking method input by a user; S503: In response to the value obtaining method configuration interface receiving a save operation from the user (eg, a click operation on a save control), the value obtaining method is obtained.
[0092] Figure 6 The value acquisition method configuration interface of one embodiment of the present disclosure is exemplarily shown.
[0093] Figure 6Two configuration areas are shown in the figure, one configuration area is used to configure the value-taking method of the variable to be checked associated with table A (i.e., one object to be checked), and the other configuration area is used to configure the value-taking method of the variable to be checked associated with table B (i.e., another object to be checked).
[0094] In some embodiments of the present disclosure, S501, providing a value-taking method configuration interface, including: providing a value-taking method configuration area for each object to be verified. This process can automatically provide a value-taking method configuration area based on each object to be verified extracted above, and can also provide an add control (not shown) on the value-taking method configuration interface, so that the user can add a value-taking method configuration area by operating the add control, all of which fall within the protection scope of the present disclosure.
[0095] like Figure 6 As shown, the identifier of the object to be verified (Table A, Table B) can be extracted as the "alias (or other expressions)" in the value method configuration area. In other implementations, the identifier of the object to be verified can also be input by the user.
[0096] Continue to refer Figure 6 , the user can enter the data server where the object to be verified is stored in the "Data Server" input box, and can enter one or more variables to be verified associated with the object to be verified in the "Variable Name" input box. If multiple variables to be verified are entered, they can be separated by delimiters (such as ";"). One or more value-taking methods of the variables to be verified can be entered in the "Query Statement" input box (such as query statements, which can be SQL query statements). Different value-taking methods can be separated by delimiters.
[0097] In some implementations of the present disclosure, a value-taking method configuration area may also be provided for each variable to be checked, which is more conducive to obtaining the global execution order described above.
[0098] Under the guidance of the technical solution disclosed in this disclosure, those skilled in the art can Figure 6 The selection or adjustment of the input boxes, controls, layout methods, etc. on the value-taking method configuration interface shown in the figure all fall within the protection scope of the present disclosure.
[0099] In some embodiments of the present disclosure, a delete control and a save control may be configured for each value-taking method configuration area. By operating the delete control, the corresponding value-taking method configuration area may be deleted, and by operating the save control, the configuration of the corresponding value-taking method configuration area may be saved.
[0100] In some preferred embodiments of the present disclosure, continue to refer to Figure 6 , the test script generation method disclosed in the present invention may also include: In response to the value-taking method interface receiving a synchronization operation from the user, the value-taking method input by the user or the obtained value-taking method is stored as the configured value-taking method of the variable to be verified.
[0101] The configured value acquisition method is stored in a target database or a target data server, which may be a dedicated database or server.
[0102] The above synchronization operation can be, for example, Figure 6 Sync to Common Configuration control click action shown in .
[0103] The value-taking method obtained above may be a value-taking method input by the user obtained by clicking a “save” control on the value-taking method configuration area.
[0104] Figure 7 It is a flowchart of a method for obtaining a value of a variable to be verified according to an embodiment of the present invention.
[0105] refer to Figure 7 , the method for obtaining the value of the variable to be verified in this embodiment includes: S701, providing a value acquisition method configuration interface; S702: in response to the value obtaining method configuration interface receiving a user's call operation, the configured value obtaining method of the variable to be verified is called to the value obtaining method configuration interface; S703: In response to the value obtaining method configuration interface receiving a save operation from the user, the value obtaining method is obtained.
[0106] Continue to refer Figure 6 , you can configure the "Call Configuration" control in the Value Method Configuration Area. By clicking the "Call Configuration" control, the user can call the configured value method described above (for example, the configured value method stored in the target database or target data server) to the corresponding value method configuration area, so that the user can modify, save, delete, and other operations on the value method called to the corresponding value method configuration area.
[0107] Based on the test script generation method of any one of the embodiments described above, the present disclosure also provides an automated testing method.
[0108] Figure 8 It is a flowchart of an automated testing method according to a preferred embodiment of the present invention.
[0109] refer to Figure 8 , the automated testing method M800 of this embodiment includes: S810, providing an automated test interface, wherein the automated test interface is configured with a first control, a second control, and a third control, wherein the first control can select a test script based on a received operation, the second control can select an execution environment based on the received operation, the execution environment is configured with at least one object to be verified (e.g., table A and table B), and the third control can trigger an automated test based on the received operation; S820, receiving an operation of the user on the first control, selecting a test script, receiving an operation of the user on the second control, and selecting an execution environment; S830: Receive an operation of the user on the third control, and perform an automated test on the at least one object to be verified in the selected execution environment based on the selected test script.
[0110] The objects to be verified described in this embodiment are the objects to be verified described above (eg, Table A and Table B).
[0111] Among them, in S820, the operation sequence of the first control and the second control is not particularly limited.
[0112] The test script in this embodiment is preferably a test script generated according to the test script generation method of any embodiment of the present disclosure.
[0113] Fig. 9 is a schematic diagram of an automated testing interface according to an embodiment of the present disclosure.
[0114] Fig. 9 An example of the first control is shown: a scenario selection control (i.e., a test script selection control), which may be in the form of a drop-down box. Through the first control, a generated test script may be selected. The generated test script may be stored locally or in a remote database or remote server. The present disclosure does not specifically limit this.
[0115] Fig. 9 In the example, the second control is used to select an execution environment, where the execution environment is a test environment for performing automated testing, such as a first execution environment and a second execution environment. Exemplarily, the first execution environment may store Table A and Table B described above, and the second execution environment may store Table A, Table B, Table C, and Table D. The above-mentioned different execution environments are exemplary and should not be construed as limitations on the execution environment of the present disclosure.
[0116] In some implementations of the present disclosure, only one execution environment may be configured as a default execution environment, so that the user does not need to select an execution environment.
[0117] Fig. 9 An example of a third control, an "Execute Now" control, is shown in FIG. 4 . When the control is clicked, an automated test can be triggered.
[0118] Continue to refer Fig. 9 In some embodiments of the present disclosure, the automated testing interface is further configured with a fourth control, and the fourth control can determine the range of the variable to be verified based on the received operation.
[0119] Fig. 9 An example of the fourth control is shown in: "uk_id (or other expressions)" input control, based on which the range of the variable to be verified (e.g., one or more rows, one or more columns) can be input, for example, the 10th row can be input, then the 10th row of Table A and Table B can be automatically tested, or the row range can be input, for example, the 10th to 100th row, then the 10th to 100th row of Table A and Table B can be automatically tested. Under the inspiration of the technical solution of the present disclosure, those skilled in the art can select or adjust the input format of the fourth control, etc., all of which fall within the protection scope of the present disclosure.
[0120] Fig.10 A schematic flow chart of an automated testing method M1000 according to another embodiment of the present disclosure is shown.
[0121] S1010, providing an automated test interface, wherein the automated test interface is configured with a first control, a second control, a third control, and a fourth control; S1020, receiving an operation of the user on the first control, selecting a test script, receiving an operation of the user on the second control, selecting an execution environment, receiving an operation of the user on the fourth control, and determining a range of the variable to be verified; S1030. Receive a user operation on the third control, and perform an automated test on the variables to be checked within the range of the at least one object to be checked in the selected execution environment based on the selected test script.
[0122] Among them, in S1020, the operation sequence of the first control, the second control, and the fourth control is not particularly limited.
[0123] Based on the test script generating method of any one of the above embodiments, the present disclosure also provides a test script generating device.
[0124] Fig.11 It is a schematic block diagram of the structure of a test script generating device according to an embodiment of the present invention.
[0125] like Fig.11 As shown, the test script generating device includes: A test case analysis module 110, which analyzes the test case to obtain the verification content of at least one verification point in the test case; A logic processing module 120, wherein the logic processing module 120 extracts an object to be verified from the verification content of each verification point, and obtains at least one object to be verified and a variable to be verified associated with the object to be verified for each verification point; Configuration module 130, configuration module 130 obtains a value-taking method of at least one variable to be checked associated with each object to be checked, and logic processing module 120 codes the value-taking method of each variable to be checked and generates a code block; The script encapsulation module 140 generates a test script corresponding to the test case based on the code block.
[0126] The above modules can be implemented by computer program modules.
[0127] The implementation process of the functions and effects of each module in the above-mentioned test script generation device is specifically described in the implementation process of the corresponding steps in the above-mentioned test script generation method, which will not be repeated here.
[0128] Based on the automated testing method of any of the above embodiments, the present disclosure also provides an automated testing device.
[0129] An automated testing device according to an embodiment of the present disclosure may include: An automated test interface providing module, wherein the automated test interface providing module provides an automated test interface, wherein the automated test interface is configured with a first control, a second control, and a third control, wherein the first control can select a test script based on a received operation, the second control can select an execution environment based on a received operation, the execution environment is configured with at least one object to be verified, and the third control can trigger an automated test based on a received operation; An operation receiving module, the operation receiving module receives the user's operation on the first control and selects a test script, and the operation receiving module receives the user's operation on the second control and selects an execution environment; The automated test execution module executes automated testing on at least one object to be verified in the selected execution environment based on the user's operation on the third control received by the operation receiving module and based on the selected test script.
[0130] The above modules can also be implemented through computer program modules.
[0131] The execution subject of the test script generation method and the automated testing method in the specific implementation manner of the present disclosure may be a mobile phone, a tablet computer, a desktop computer, or other electronic device.
[0132] Therefore, based on any of the above-mentioned embodiments, the present disclosure also provides an electronic device, which can execute the test script generation method and / or automated testing method of any of the embodiments described above in the present disclosure, and the test script generation device and / or automated testing device of any of the embodiments described above can be configured on the electronic device.
[0133] Fig.12 It is a schematic block diagram of the structure of an electronic device 1000 equipped with a test script generating device according to an embodiment of the present disclosure.
[0134] The hardware structure of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300 and / or hardware modules together. The bus 1100 can also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc.
[0135] The bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the figure only uses one connecting line, but does not mean that there is only one bus or one type of bus.
[0136] The present disclosure also provides a readable storage medium, in which a computer program is stored, and the computer program is used to implement the above method when executed by a processor. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use in an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.
[0137] The present disclosure also provides a computer program product. The method of the present disclosure can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed, the process or function of the present disclosure is executed in whole or in part.
[0138] The computer program or instructions may be stored in a readable storage medium or transmitted from one readable storage medium to another readable storage medium, for example, the computer program or instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The readable storage medium may be any available medium that can be accessed or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disk; it may also be a semiconductor medium, such as a solid state drive. The computer readable storage medium may be a volatile or non-volatile storage medium, or may include both volatile and non-volatile types of storage media.
[0139] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0140] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0141] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0143] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and features of different embodiments / methods or examples, unless they are contradictory.
[0144] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0145] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.
Claims
1. A test script generation method, characterized in that: include: Parsing the test case to obtain verification content of at least one verification point in the test case; Extracting an object to be verified from the verification content of each verification point, obtaining at least one object to be verified and at least one variable to be verified associated with the object to be verified for each verification point; A method for obtaining the value of the variable to be checked associated with each object to be checked; Codify the value-taking method of each variable to be checked and generate a code block; as well as A test script corresponding to the test case is generated based on the code block.
2. The test script generation method according to claim 1, characterized in that: After obtaining the value of the variable to be checked associated with each object to be checked, the test script generation method further includes: A global execution order is configured for the value-taking method of each variable to be checked associated with each object to be checked, so that the test script can be generated based on the global execution order.
3. The test script generation method according to claim 2, characterized in that: The method for obtaining the value of each variable to be checked of each object to be checked configures the global execution order, including: Determine whether the value-taking method of each variable to be checked has a dependent object; If a dependent object exists, determining that there is a feature dependency relationship between the variable to be verified and the dependent object; and A global execution order is configured for value-taking methods of each to-be-checked variable associated with the test case based on at least one of the determined feature dependencies.
4. The test script generation method according to claim 1 or 2, characterized in that: The parsing of the test case to obtain the verification content of the verification point in the test case includes: Structuring the test case to obtain a structured test case; and The content of at least one characteristic field is extracted from the test case after the structured processing as the verification content.
5. The test script generation method according to claim 4, characterized in that: The extracting the object to be verified from the verification content of each verification point to obtain at least one object to be verified and at least one variable to be verified associated with the object to be verified for each verification point includes: The object to be verified and the variable to be verified associated with the object to be verified are extracted from the content of the at least one characteristic field.
6. The test script generation method according to claim 1 or 2, characterized in that: The method for obtaining the value of the variable to be verified associated with each object to be verified includes: Provides a value-taking method configuration interface; The value-taking method configuration interface receives the value-taking method input by the user; and In response to the value obtaining method configuration interface receiving a save operation from the user, the value obtaining method is obtained.
7. The test script generation method according to claim 6, characterized in that: The method for obtaining the value of the variable to be verified associated with each object to be verified also includes: In response to the value-taking method interface receiving a synchronization operation from the user, the value-taking method input by the user or the obtained value-taking method is stored as a configured value-taking method of the variable to be verified.
8. An automated testing method, characterized in that: include: An automated test interface is provided, wherein the automated test interface is configured with a first control, a second control, and a third control, wherein the first control can select a test script based on a received operation, the second control can select an execution environment based on the received operation, the execution environment is configured with at least one object to be verified, and the third control can trigger an automated test based on the received operation; Receive the user's operation on the first control, select a test script, receive the user's operation on the second control, and select an execution environment; as well as receiving a user's operation on the third control, and performing an automated test on the at least one object to be verified in the selected execution environment based on the selected test script; The test script is a test script generated by the test script generation method according to any one of claims 1 to 7.
9. An electronic device, characterized in that: include: A memory storing execution instructions; as well as A processor, wherein the processor executes the execution instructions stored in the memory, so that the processor executes the test script generation method according to any one of claims 1 to 7 and / or the automated testing method according to claim 8.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the test script generation method according to any one of claims 1 to 7 and / or the automated testing method according to claim 8 are implemented.