Automated testing method, apparatus, electronic device, storage medium, and program product
Patent Information
- Application Number
- CN202210205658.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-03
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-03-03
AI Technical Summary
[0002]在多步骤复杂业务场景的自动化测试领域,自动化测试一般采用编写大量复杂的脚本来完成测试步骤,其对脚本编写人员的编码能力要求比较高,需要具备一定编码能力的测试开发工程师才能编写出复杂业务场景的脚本,很难满足普通测试人员对快捷性和重用性方面的要求
[0016] This disclosure provides an automated testing method, apparatus, electronic device, computer-readable storage medium, and computer program product. In this automated testing method, test engineers can pre-establish configuration files mapping various class methods to atomic transaction steps corresponding to business processes and store these in a test framework. During automated testing of test cases, the method obtains the test case file and retrieves the Java atomic class methods corresponding to each atomic transaction step in the test case based on the test configuration file. It then executes the Java atomic classes through reflection to complete the atomic transaction steps corresponding to each test case, thereby completing the automated testing of each test case in the test case file. This method is suitable for multi-business process scenarios, avoiding testers repeatedly writing large amounts of script code, saving testers' time and effort, and improving testing efficiency.
Smart Images

Figure CN114579444B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of automated testing technology, specifically to an automated testing method, apparatus, electronic device, storage medium, and program product. Background Technology
[0002] In the field of automated testing for complex business scenarios with multiple steps, automated testing generally involves writing a large number of complex scripts to complete the testing steps. This requires high coding skills from the script writers, and test development engineers with certain coding abilities are needed to write scripts for complex business scenarios. It is difficult to meet the requirements of ordinary testers for speed and reusability. Summary of the Invention
[0003] To address the problems existing in the prior art, embodiments of this disclosure provide an automated testing method, apparatus, electronic device, storage medium, and program product, which enables automated testing of complex multi-step business scenarios without the need to write test scripts.
[0004] The first aspect of this disclosure provides an automated testing method, comprising: obtaining a test case file and a test configuration file; wherein the test case file includes multiple test data items and atomic transaction steps corresponding to each test data item, and the test configuration file includes a mapping relationship between atomic transaction steps and Java atomic classes, wherein the Java atomic classes are used to execute the corresponding atomic transaction steps; parsing the test case file to obtain multiple test data items and atomic transaction steps corresponding to each test data item; obtaining a set of atomic transaction steps based on the atomic transaction steps obtained from the data parsing; and sequentially executing the Java atomic classes corresponding to each atomic transaction step in the set of atomic transaction steps based on the set of atomic transaction steps, the test configuration file, and the multiple test data items to complete the automated testing of each test case in the test case file.
[0005] Furthermore, based on the set of atomic transaction steps, the test configuration file, and multiple test data sets, the Java atomic classes corresponding to each atomic transaction step in the set of atomic transaction steps are executed sequentially. This includes: obtaining the Java atomic class corresponding to each atomic transaction step in the set of atomic transaction steps based on the test configuration file; executing the Java atomic classes sequentially through reflection based on multiple test data sets to complete the business process corresponding to each test data set; determining whether all atomic transaction steps in the set of atomic transaction steps have been completed; and if so, completing the automated testing of each test case in the test case file.
[0006] Furthermore, based on multiple test data, Java atomic classes are executed sequentially via reflection, including: executing the corresponding Java atomic classes sequentially according to the order of each test data and the atomic transaction steps corresponding to each test data; after the execution of the Java atomic class corresponding to the current atomic transaction step is completed, the result of the execution of that step is stored in a local thread variable for use in the next step corresponding to the current atomic transaction step.
[0007] Furthermore, the method also includes: adding one or more test cases to the test case file; and adding Java atomic classes corresponding to the atomic transaction steps in one or more test cases in the test configuration file, based on the atomic transaction steps in one or more test cases.
[0008] Furthermore, multiple test data entries are stored in local thread variables for use in passing data during the execution of atomic transaction steps.
[0009] Furthermore, the test case file is parsed to obtain multiple test data and the atomic transaction steps corresponding to each test data. This includes: parsing the test case file based on keywords to obtain multiple test data and the atomic transaction steps corresponding to each test data.
[0010] Furthermore, the method also includes: after executing the atomic transaction steps corresponding to each test case, asserting the execution result of the test case and generating test results.
[0011] Furthermore, this method is applied to multi-business process scenarios, where each piece of test data corresponds to at least two atomic transaction steps.
[0012] The second aspect of this disclosure provides an automated testing apparatus, comprising: an acquisition module for acquiring a test case file and a test configuration file; wherein the test case file includes multiple test data items and atomic transaction steps corresponding to each test data item, and the test configuration file includes a mapping relationship between atomic transaction steps and Java atomic classes, wherein the Java atomic classes are used to execute the corresponding atomic transaction steps; a data parsing module for parsing the test case file to obtain multiple test data items and atomic transaction steps corresponding to each test data item; a generation module for obtaining a set of atomic transaction steps based on the atomic transaction steps obtained from the data parsing; and a testing module for sequentially executing the Java atomic classes corresponding to each atomic transaction step in the set of atomic transaction steps, the test configuration file, and the multiple test data items, thereby completing the automated testing of each test case in the test case file.
[0013] A third aspect of this disclosure provides an electronic device including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the automated testing method provided in the first aspect of this disclosure.
[0014] A fourth aspect of this disclosure provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the automated testing method provided in the first aspect of this disclosure.
[0015] A fifth aspect of this disclosure provides a computer program product including a computer program that, when executed by a processor, implements the diagnostics of the service job log provided in the first aspect of this disclosure.
[0016] This disclosure provides an automated testing method, apparatus, electronic device, computer-readable storage medium, and computer program product. In this automated testing method, test engineers can pre-establish configuration files mapping various class methods to atomic transaction steps corresponding to business processes and store these in a test framework. During automated testing of test cases, the method obtains the test case file and retrieves the Java atomic class methods corresponding to each atomic transaction step in the test case based on the test configuration file. It then executes the Java atomic classes through reflection to complete the atomic transaction steps corresponding to each test case, thereby completing the automated testing of each test case in the test case file. This method is suitable for multi-business process scenarios, avoiding testers repeatedly writing large amounts of script code, saving testers' time and effort, and improving testing efficiency. Attached Figure Description
[0017] To gain a more complete understanding of this disclosure and its advantages, reference will now be made to the following description taken in conjunction with the accompanying drawings, wherein:
[0018] Figure 1 This diagram illustrates an application scenario of an automated testing method according to an embodiment of the present disclosure.
[0019] Figure 2 A flowchart illustrating an automated testing method according to an embodiment of the present disclosure is shown schematically;
[0020] Figure 3 A flowchart illustrating the execution of Java atomic classes corresponding to each atomic transaction step according to an embodiment of the present disclosure is shown.
[0021] Figure 4 A flowchart illustrating an automated result assertion according to an embodiment of the present disclosure is shown schematically;
[0022] Figure 5A block diagram of an automated testing apparatus according to an embodiment of the present disclosure is shown schematically;
[0023] Figure 6 A block diagram of an automated testing apparatus according to another embodiment of the present disclosure is shown schematically;
[0024] Figure 7 A block diagram schematically illustrates an electronic device suitable for implementing the methods described above, according to an embodiment of the present disclosure. Detailed Implementation
[0025] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0026] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0027] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0028] When using expressions such as "at least one of A, B, and C," the expression should generally be interpreted in accordance with the meaning commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, systems having A alone, having B alone, having C alone, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.). Similarly, when using expressions such as "at least one of A, B, or C," the expression should generally be interpreted in accordance with the meaning commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, or C" should include, but is not limited to, systems having A alone, having B alone, having C alone, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0029] The accompanying drawings illustrate several block diagrams and / or flowcharts. It should be understood that some blocks, or combinations thereof, in the block diagrams and / or flowcharts 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, or other programmable data processing device, such that, when executed by the processor, these instructions can create means for implementing the functions / operations described in these block diagrams and / or flowcharts. The technology of this disclosure can be implemented in hardware and / or software (including firmware, microcode, etc.). Alternatively, the technology of this disclosure can take the form of a computer program product stored on a computer-readable storage medium, which is available for use by or in conjunction with an instruction execution system.
[0030] This disclosure provides an automated testing method, comprising: obtaining a test case file and a test configuration file; wherein the test case file includes multiple test data sets and atomic transaction steps corresponding to each test data set, and the test configuration file includes a mapping relationship between atomic transaction steps and Java atomic classes, wherein the Java atomic classes are used to execute the corresponding atomic transaction steps; parsing the test case file to obtain multiple test data sets and atomic transaction steps corresponding to each test data set; obtaining a set of atomic transaction steps based on the atomic transaction steps obtained from the data parsing; and sequentially executing the Java atomic classes corresponding to each atomic transaction step in the set of atomic transaction steps based on the set of atomic transaction steps, the test configuration file, and the multiple test data sets, thereby completing the automated testing of each test case in the test case file.
[0031] This disclosure provides an automated testing method in which test engineers can pre-create configuration files mapping various class methods to corresponding atomic transaction steps in business processes and store these files in a test framework. During automated testing of test cases, the method obtains the test case file and retrieves the Java atomic class methods corresponding to each atomic transaction step in the test case based on the test configuration file. It then executes the Java atomic classes via reflection to complete the atomic transaction steps for each test case, thereby completing the automated testing of each test case in the test case file. This method is suitable for multi-business process scenarios, avoiding testers repeatedly writing large amounts of script code, saving testers' time and effort, and improving testing efficiency.
[0032] Figure 1 An exemplary system architecture 100, applicable to automated testing methods according to embodiments of this disclosure, is illustrated schematically. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0033] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0034] Users (such as maintenance personnel) can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as programming systems in various languages, testing systems, web browser applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0035] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing. Terminal devices 101, 102, and 103 provide an operating platform for upstream users, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0036] Server 105 can be a server that provides various services, and it can serve as the deployment server for this method, such as a backend management server that supports the applications installed by users using terminal devices 101, 102, and 103 (for example only). The backend management server can process received user requests and other data, and feed back the processing results (such as log information and diagnostic results) to the terminal devices.
[0037] It should be noted that the automated testing method provided in this disclosure embodiment can generally be executed by server 105. Correspondingly, the automated testing device provided in this disclosure embodiment can generally be deployed in server 105. The automated testing method provided in this disclosure embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the automated testing device provided in this disclosure embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105.
[0038] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0039] Figure 2 A flowchart illustrating an automated testing method according to an embodiment of this disclosure is shown schematically. Figure 2 As shown, this automated testing method is mainly applied to multi-business process scenarios, including steps S201 to S204.
[0040] In operation S201, the test case file and test configuration file are obtained; the test case file includes multiple test data and atomic transaction steps corresponding to each test data, and the test configuration file includes the mapping relationship between the atomic transaction steps and Java atomic classes, and the Java atomic classes are used to execute the corresponding atomic transaction steps.
[0041] In the embodiments of this disclosure, test engineers can write or update test case files and test configuration files through terminal devices 101, 102, and 103, or access server 105 through terminal devices 101, 102, and 103 to write and update test case files and test configuration files, and then store the written or updated test case files and test configuration files on server 105.
[0042] The test case file includes multiple test cases, each containing at least test data and the corresponding atomic transaction steps. This data can be compiled in an Excel file or other format. Specifically, the test data can be data generated during business process processing, such as the location, status, and type of the business process. Atomic transaction steps represent the sequential order of business process processing and the corresponding business step information. This business step information has a one-to-one mapping with Java atomic classes, allowing the retrieval of the corresponding Java atomic class based on the business step information to execute the atomic transaction step. This mapping relationship is stored in the test configuration file.
[0043] In embodiments of this disclosure, for example, the test case file may include, but is not limited to, the contents shown in Table 1:
[0044] Table 1 Examples of Test Cases
[0045]
[0046] As shown in Table 1 above, the test data includes, but is not limited to, the remitting region, remitting branch, remittance status, and account status, which are related to the transaction type. The embodiments of this disclosure do not limit these parameters. The corresponding atomic transaction steps also include, but are not limited to, cross-border remittance entry, review, and authorization steps, which are also related to the transaction type and the specific process of multiple transactions. Furthermore, the specific values for each data item can be set according to actual development needs, and the order of atomic transaction steps is also related to the transaction type. The embodiments of this disclosure do not limit this order.
[0047] In embodiments of this disclosure, for example, the mapping relationship between atomic transaction steps and Java atomic classes in the test configuration file may include, but is not limited to, the contents shown in Table 2, which correspond to the atomic transaction steps in the test cases shown in Table 1 as follows:
[0048] Table 2 Example of Test Configuration File
[0049]
[0050]
[0051] As shown in Table 2, the test configuration file includes at least a one-to-one mapping between the atomic transaction steps and Java atomic classes corresponding to each piece of test data. When the test framework executes automated test steps, it finds the corresponding class name from the test configuration file based on the atomic transaction step name, and executes the Operate method in the Java atomic class through Java reflection to complete the test of the test data.
[0052] In the embodiments of this disclosure, Java atomic classes such as FCInput inherit from the abstract class AbsComInterface. The abstract class AbsComInterface inherits from the general interface (ComInterface). The specific Java atomic classes implement the OperationAgetNextMap method. The Operate method in AbsComInterface calls the OperationAgetNextMap method and saves the thread-local variable value. Test engineers only need to write the OperationAgetNextMap method, which is related to the business steps. The corresponding atomic transaction steps can be automatically implemented through each Java atomic class.
[0053] It should be noted that the contents of Tables 1 and 2 and Java atomic classes above are merely illustrative examples and do not constitute a limitation of the embodiments disclosed herein.
[0054] In operation S202, the test case file is parsed to obtain multiple test data and the atomic transaction steps corresponding to each test data.
[0055] In the embodiments of this disclosure, the test case file obtained in step S101 is parsed. Specifically, based on the keyword parsing of each test case in the test case file, the corresponding test data and atomic transaction steps can be obtained. For example, based on the keywords such as the column name steps in the cross-border foreign exchange remittance business process case 1 in Table 1, atomic transaction steps can be parsed. A subset of atomic transaction steps with execution order is generated sequentially according to the number or column name order of the atomic transaction steps. All data other than the atomic transaction steps are test data.
[0056] Specifically, the obtained test data is stored in a local thread variable (contextData) for passing data during the execution of atomic transaction steps. Passing parameters through this local thread variable avoids problems such as data conflicts or tampering that can occur during multi-threaded execution.
[0057] Following the above embodiment, data parsing based on the test cases described in Table 1 yields the atomic transaction steps: A1-A2-A3. Similarly, data parsing based on multiple test cases yields multiple corresponding atomic transaction steps, such as: B1-B2, C1-C2-C3-C4, ..., N1-N2-N3-..., and the Java atomic class corresponding to each atomic transaction step can be obtained from the test configuration file.
[0058] It should be noted that A, B, C, and N are merely illustrative examples to distinguish the atomic transaction steps obtained after parsing each test data. The numbers 1, 2, 3, 4, etc., represent the execution order of the atomic transaction steps.
[0059] In operation S203, the atomic transaction steps obtained from data parsing are used to obtain a set of atomic transaction steps.
[0060] In the embodiments of this disclosure, a corresponding set of atomic transaction steps can be generated based on the atomic transaction steps parsed in step S102. Following the above embodiments, parsing multiple test cases yields a set of atomic transaction steps that can be represented as {{A1, A2, A3}, {B1, B2}, {C1, C2, C3, C4}, ..., {N1, N2, N3, ...}}, where each subset of atomic transaction steps corresponds to the atomic transaction steps of each test case. The order of A, B, C, and N can be set according to the order of the test cases in the test case file or other methods; this disclosure does not limit this.
[0061] In operation S204, based on the set of atomic transaction steps, the test configuration file, and multiple test data, the Java atomic classes corresponding to each atomic transaction step in the set of atomic transaction steps are executed sequentially to complete the automated testing of each test case in the test case file.
[0062] In the embodiments of this disclosure, each atomic transaction step subset is obtained from the atomic transaction step set, and then the corresponding Java atomic class in the test configuration file is obtained according to the atomic transaction step name in the atomic transaction step subset. Following the above embodiments, in the atomic transaction step subset {A1, A2, A3}, A1 represents cross-border remittance entry, and its corresponding Java atomic class, common.zh2.flowConfig.enhanced.demo.RFCInput, can be obtained from the test configuration file; A2 represents cross-border remittance review, and its corresponding Java atomic class, common.zh2.flowConfig.enhanced.demo.RFCReview, can be obtained from the test configuration file; A3 represents cross-border remittance authorization, and its corresponding Java atomic class, common.zh2.flowConfig.enhanced.demo.RFCAuthorization, can be obtained from the test configuration file. Executing these Java classes sequentially completes the testing of the test cases corresponding to the atomic transaction step subset. Each test data item is used to transmit data during the execution of atomic transaction steps, and new data generated after each atomic transaction step is stored in a local thread variable for use in the next step corresponding to the current atomic transaction step.
[0063] According to embodiments of this disclosure, such as Figure 3 As shown, when executing step S204, according to the atomic transaction step set, the test configuration file and the multiple test data, the Java atomic classes corresponding to each atomic transaction step in the atomic transaction step set are executed sequentially to complete the automated testing of each test case in the test case file, specifically including steps S300 to S304.
[0064] In operation S300, obtain the set of atomic transaction steps generated in step S203.
[0065] In the embodiments of this disclosure, a subset of atomic transaction steps may be obtained from the set of atomic transaction steps generated in step S203.
[0066] In operation S301, based on the test configuration file, the Java atomic class corresponding to each atomic transaction step in the atomic transaction step set obtained in step S300 is obtained.
[0067] In the embodiments of this disclosure, each atomic transaction step or its corresponding Java atomic class in the atomic transaction step set is obtained based on the atomic transaction step names and test configuration files of some or all of the atomic transaction step subsets in the atomic transaction step subset.
[0068] When operating S302, based on multiple test data, Java atomic classes are executed sequentially through reflection to complete the business process corresponding to each test data.
[0069] In the embodiments of this disclosure, the corresponding Java atomic classes are executed sequentially according to the order of each test data and the atomic transaction steps corresponding to each test data. After the Java atomic class corresponding to the current atomic transaction step is executed, the result of the execution of that step is stored in a local thread variable for use in the next step corresponding to the current atomic transaction step.
[0070] Specifically, reflection is used to execute the methods in the Java atomic classes sequentially according to the order in each subset of atomic transaction steps, in order to complete the business process corresponding to each test data. For example, the Java atomic classes corresponding to atomic transaction steps A1, A2, and A3 are executed sequentially according to the order A1-A2-A3 in {A1, A2, A3}, in order to complete the test of Case 1 of the cross-border foreign exchange remittance business process.
[0071] In operation S303, determine whether all atomic transaction steps in the atomic transaction step set have been executed; if so, complete the automated testing of each test case in the test case file.
[0072] In the embodiments of this disclosure, after the test cases in the test case file are executed, it can be determined whether each atomic transaction step subset has finished executing based on the test results. For example, for the atomic transaction step subset {A1, A2, A3}, the execution results could be: successful data entry, failed data entry, successful review, failed review, successful authorization, and failed authorization, etc. The execution results are used to determine whether each atomic transaction step subset has been completed. Similarly, the number of generated execution results is compared with the number of measurement cases or the number of atomic transaction step subsets to determine whether all atomic transaction step subsets in the atomic transaction step subset have been completed. If so, the automated testing of each test case in the test case file is completed.
[0073] In the embodiments of this disclosure, in operation S304, if it is determined that the automated testing of each test case in the test case file has not been completed, the atomic transaction steps corresponding to the incomplete test cases are obtained, and the Java atomic classes corresponding to the incomplete atomic transaction steps are executed in sequence. Then, it is determined whether all atomic transaction steps in the atomic transaction step set have been completed, and so on, until all atomic transaction steps are completed.
[0074] In the embodiments of this disclosure, the automated testing method is mainly applied to multi-business process scenarios, i.e., complex business scenarios or cross-business systems, etc., and each test data corresponds to at least two atomic transaction steps. When there are fewer atomic transaction steps, it may correspond to the implementation of a certain sub-step, rather than a complete transaction process implementation, such as only testing and verifying the remittance entry step.
[0075] According to embodiments of this disclosure, after the execution of the subset of atomic transaction steps corresponding to each test case is completed, the method further includes: asserting the execution result of each test case and generating a test result.
[0076] In the embodiments of this disclosure, the assertion of the execution result of each test case is performed after the execution of each test case is completed, so as to generate the test result of each test case.
[0077] Specifically, such as Figure 4 As shown, an assertion is made on the execution result of each test case. This primarily involves analyzing whether the execution result meets the test expectations to obtain the execution result for each test case. The assertion result mainly includes success or failure. Success means that the test case executed successfully and meets the expected result; otherwise, it fails. Regardless of whether the execution result is successful or not, the corresponding test result is generated and stored to facilitate analysis by test engineers, especially for diagnosing and analyzing errors when they occur, in order to optimize the testing process or the implementation of functions during development.
[0078] In the embodiments of this disclosure, the generated test results can be sent to user terminals 101, 102, and 103 via server 105 to facilitate test engineers in diagnosing and analyzing the test results.
[0079] According to embodiments of this disclosure, to enable business testing for more application scenarios, the method further includes: adding one or more test cases to the test case file; and adding Java atomic classes corresponding to the atomic transaction steps in the one or more test cases in the test configuration file, based on the atomic transaction steps in the one or more test cases. This test configuration file is configurable, allowing for real-time updates and optimizations as needed to complete the execution of more or more comprehensive test cases. Furthermore, during changes to business logic, the mapping relationship between execution methods or atomic transaction steps within certain Java atomic classes and the Java atomic classes can also be updated to meet different testing requirements.
[0080] It should be noted that the above embodiments are merely illustrative examples and do not constitute a limitation on the embodiments of this disclosure.
[0081] Figure 5 A block diagram of an automated testing apparatus according to an embodiment of the present disclosure is shown schematically.
[0082] like Figure 5 As shown, the automated testing device 500 includes: an acquisition module 510, a data parsing module 520, a generation module 530, and a testing module 540. This system 500 can be used to implement reference... Figure 2 The described automated testing method.
[0083] The acquisition module 510 is used to acquire a test case file and a test configuration file; wherein, the test case file includes multiple test data items and atomic transaction steps corresponding to each test data item, and the test configuration file includes a mapping relationship between the atomic transaction steps and Java atomic classes, wherein the Java atomic classes are used to execute the corresponding atomic transaction steps. According to embodiments of this disclosure, the acquisition module 510 can, for example, be used to execute the above-mentioned references. Figure 2 The steps described in S201 will not be elaborated upon here.
[0084] The data parsing module 520 is used to parse the test case file to obtain multiple test data items and the atomic transaction steps corresponding to each test data item. According to embodiments of this disclosure, the data parsing module 520 can, for example, be used to execute the above-mentioned references. Figure 2 The steps described in S202 will not be elaborated upon here.
[0085] The generation module 530 is used to obtain a set of atomic transaction steps based on the atomic transaction steps obtained from data parsing. According to embodiments of this disclosure, the generation module 530 can, for example, be used to execute the above-mentioned references. Figure 2 The steps described in S203 will not be elaborated upon here.
[0086] The testing module 540 is configured to sequentially execute the Java atomic classes corresponding to each atomic transaction step in the atomic transaction step set, based on the atomic transaction step set, the test configuration file, and the multiple test data sets, to complete the automated testing of each test case in the test case file. According to embodiments of this disclosure, the testing module 540 can, for example, be used to execute the above-mentioned references. Figure 2 The steps described in S204 will not be elaborated upon here.
[0087] According to embodiments of this disclosure, such as Figure 6 As shown, the device also includes an assertion module 550 and a data update module 560.
[0088] The assertion module 550 is used to assert the execution result of each test case after executing the atomic transaction steps corresponding to each test case, and generate test results.
[0089] The data update module 560 is used to add one or more test cases to the test case file; and to add Java atomic classes corresponding to the atomic transaction steps in the one or more test cases in the test configuration file according to the atomic transaction steps in the one or more test cases.
[0090] Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as hardware circuitry, such as Field Programmable Gate Arrays (FPGAs), Programmable Logic Arrays (PLAs), Systems-on-Chip, Systems-on-Substrate, Systems-on-Package, Application-Specific Integrated Circuits (ASICs), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.
[0091] For example, any and more of the acquisition module 510, data parsing module 520, generation module 530, testing module 540, assertion module 550, and data update module 560 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the acquisition module 510, data parsing module 520, generation module 530, testing module 540, assertion module 550, and data update module 560 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the acquisition module 510, data parsing module 520, generation module 530, testing module 540, assertion module 550, and data update module 560 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0092] The automated testing method and system disclosed herein can be used in the financial field or other fields. It should be noted that the automated testing method and device disclosed herein can be used in the financial field, such as business process testing of various business systems in the financial field, and can also be used in other fields besides the financial field. The application field of the automated testing method and device disclosed herein is not limited.
[0093] This disclosure provides an automated testing method and apparatus. Based on this method, test engineers can pre-establish configuration files mapping various class methods to atomic transaction steps corresponding to business processes, and store these in a test framework. During automated testing of test cases, the method obtains the test case file and retrieves the Java atomic class methods corresponding to each atomic transaction step in the test case from the test configuration file. It then executes the Java atomic classes through reflection to complete the atomic transaction steps for each test case, thereby completing the automated testing of each test case in the test case file. This method is suitable for multi-business process scenarios, avoiding testers repeatedly writing large amounts of script code, saving testers' time and effort, and improving testing efficiency.
[0094] Figure 7 A block diagram schematically illustrates an electronic device suitable for implementing the methods described above, according to embodiments of the present disclosure. Figure 7The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0095] like Figure 7 As shown, the electronic device 700 described in this embodiment includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage portion 708 into a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to embodiments of this disclosure.
[0096] RAM 903 stores various programs and data required for the operation of electronic device 700. Processor 701, ROM 702, and RAM 703 are interconnected via bus 704. Processor 701 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 702 and / or RAM 703. It should be noted that the programs may also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0097] According to embodiments of this disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to a bus 704. The electronic device 700 may also include one or more of the following components connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.
[0098] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by processor 701, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0099] This invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the automated testing method according to the embodiments of this disclosure.
[0100] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In embodiments of this disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 702 and / or RAM 703 and / or one or more memories other than ROM 702 and RAM 703 described above.
[0101] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the automated testing methods provided in the embodiments of this disclosure.
[0102] When the computer program is executed by the processor 701, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0103] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 709, and / or installed from a removable medium 711. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0104] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0105] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0106] It should be noted that the functional modules in the various embodiments of this disclosure can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product.
[0107] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0108] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0109] Although this disclosure has been shown and described with reference to specific exemplary embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made to this disclosure without departing from the spirit and scope of the disclosure as defined by the appended claims and their equivalents. Therefore, the scope of this disclosure should not be limited to the above embodiments, but should be defined not only by the appended claims, but also by their equivalents.
Claims
1. An automated testing method, characterized in that, include: Obtain the test case file and test configuration file; wherein, the test case file includes multiple test data and atomic transaction steps corresponding to each test data, and the test configuration file includes the mapping relationship between the atomic transaction steps and Java atomic classes, and the Java atomic classes are used to execute the corresponding atomic transaction steps; The test case file is parsed to obtain multiple test data sets and the atomic transaction steps corresponding to each test data set; Based on the atomic transaction steps obtained from data parsing, a set of atomic transaction steps is obtained; Based on the set of atomic transaction steps, the test configuration file, and the multiple test data, the Java atomic classes corresponding to each atomic transaction step in the set of atomic transaction steps are executed sequentially to complete the automated testing of each test case in the test case file. The step of sequentially executing the Java atomic classes corresponding to each atomic transaction step in the atomic transaction step set, based on the atomic transaction step set, the test configuration file, and the multiple test data, includes: Based on the test configuration file, obtain the Java atomic class corresponding to each atomic transaction step in the atomic transaction step set; Based on the multiple test data, the Java atomic classes are executed sequentially using reflection to complete the business process corresponding to each test data. Determine whether all atomic transaction steps in the set of atomic transaction steps have been completed; If so, complete the automated testing of each test case in the test case file; The atomic transaction steps represent the sequential order of the business process and the corresponding business step information. The business step information has a one-to-one mapping relationship with the Java atomic classes, and the mapping relationship is stored in the test configuration file. The step of sequentially executing the Java atomic classes through reflection based on the multiple test data includes: Based on the order of each test data point and the corresponding atomic transaction steps in the multiple test data points, the corresponding Java atomic classes are executed sequentially. After the Java atomic class corresponding to the current atomic transaction step has been executed, the result is stored in a local thread variable for use in the next step corresponding to the current atomic transaction step. The multiple test data are stored in local thread variables for use in passing data during the execution of atomic transaction steps; In this way, passing parameters through the local thread variable avoids data conflicts or tampering during multi-threaded execution.
2. The automated testing method according to claim 1, characterized in that, The method also includes: Add one or more test cases to the test case file; Based on the atomic transaction steps in one or more test cases, add a Java atomic class corresponding to the atomic transaction steps in the test configuration file.
3. The automated testing method according to claim 1, characterized in that, The test case file is parsed to obtain multiple test data sets and the atomic transaction steps corresponding to each test data set, including: The test case file is parsed based on keywords to obtain multiple test data and the atomic transaction steps corresponding to each test data.
4. The automated testing method according to claim 1, characterized in that, The method also includes: After executing the atomic transaction steps corresponding to each test case, an assertion is made on the execution result of that test case to generate the test result.
5. The automated testing method according to claim 1, characterized in that, This method is applied to multi-business process scenarios, where each piece of test data corresponds to at least two atomic transaction steps.
6. An automated testing device, characterized in that, The apparatus for implementing the automated testing method as described in any one of claims 1 to 5 includes: The acquisition module is used to acquire the test case file and the test configuration file; wherein, the test case file includes multiple test data and atomic transaction steps corresponding to each test data, and the test configuration file includes the mapping relationship between the atomic transaction steps and Java atomic classes, and the Java atomic classes are used to execute the corresponding atomic transaction steps; The data parsing module is used to parse the test case files to obtain multiple test data and the atomic transaction steps corresponding to each test data. The generation module is used to obtain a set of atomic transaction steps based on the atomic transaction steps obtained from data parsing; The testing module is used to execute the Java atomic classes corresponding to each atomic transaction step in the atomic transaction step set in sequence, based on the atomic transaction step set, the test configuration file, and the multiple test data, to complete the automated testing of each test case in the test case file.
7. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the automated testing method as described in any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the automated testing method as described in any one of claims 1 to 5.
9. A computer program product comprising a computer program that, when executed by a processor, implements the automated testing method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Web application system automatized test method and apparatus
CN101339532A