An automated testing method, system, electronic device and storage medium

The GAUGE-based automated testing method addresses inefficiencies and errors in manual testing by automating the execution of test cases and objects, enhancing testing efficiency and accuracy.

CN114817040BActive Publication Date: 2025-07-15AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210460667.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-28
Publication Date
2025-07-15
Estimated Expiration
2042-04-28

AI Technical Summary

Technical Problem

Existing software testing methods require significant manual effort, leading to inefficiencies and potential errors due to human intervention, which affects the accuracy of test results.

Method used

An automated testing method and system utilizing a GAUGE-based platform with a business logic layer and technical implementation layer, enabling the retrieval and execution of test cases and objects, and generating reports without human intervention.

Benefits of technology

Automates the testing process, reducing the need for manual effort and minimizing errors, thereby improving efficiency and accuracy of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114817040B_ABST
    Figure CN114817040B_ABST
Patent Text Reader

Abstract

The present application provides an automated testing method, system, electronic device and storage medium, which obtain and display target test cases of a target project from within the business logic layer for a user to write target test case code based on the target syntax rules in the target test cases; execute the target test cases to call and run the target test case code. During the process of running the target test case code, if there are target common test cases in the target test case code, obtain and execute the target common test cases from within the business logic layer to call and run the target common test case code corresponding to the target common test cases in the technology implementation layer; during the process of running the target common test case code, if there are target test objects, obtain and execute the target test objects in the business logic layer to call and run the target test object code of the target test objects in the technology implementation layer. If the obtained target test result passes the verification, generate a test report for the target project according to the target test result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automated testing, and more specifically, to an automated testing method, system, electronic device, and storage medium. Background Art

[0002] Software testing is a very important part of the software engineering system and is a key step in ensuring software quality. Different from product testing, the temporary nature of projects determines that most tests based on software projects have the characteristic of a short cycle. Therefore, there is rarely a large investment in the automated testing of a single project, and manual testing is mostly used.

[0003] However, the method of manual testing consumes a large amount of manpower, has low efficiency, and is also prone to misoperations, resulting in deviations in test results. Summary of the Invention

[0004] The present invention provides an automated testing method, system, electronic device, and storage medium to solve the problems of the existing testing methods, which consume a large amount of manpower, have low efficiency, and are also prone to misoperations, resulting in deviations in test results.

[0005] The first aspect of the present invention discloses an automated testing method applicable to an automated testing platform built based on GAUGE. The automated testing platform at least includes a business logic layer and a technical implementation layer. The method includes:

[0006] Obtain and display a target test case corresponding to a target project from each pre-stored test case in the business logic layer for a user to write corresponding target test case code based on the target syntax rules in the target test case, and store the target test case code in the technical implementation layer;

[0007] When it is detected that there is target test case code in the technical implementation layer, execute the target test case to call and run the target test case code;

[0008] During the process of running the target test case code, if there is a target common use case in the target test case code, obtain the target common use case from each pre-stored common use case in the business logic layer;

[0009] Execute the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the technical implementation layer;

[0010] During the process of running the target common use case code, if there is a target test object in the target common use case code, obtain the target test object from each pre-stored test object in the business logic layer;

[0011] Execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored within the technology implementation layer, and obtain a target test result;

[0012] Verify the target test result;

[0013] If the target test result passes the verification, generate a test report for the target project based on the target test result.

[0014] Optionally, the business logic layer includes a common business logic module, a common test object module, and use case modules for each project's business layer. The technology implementation layer includes a common business implementation module, a common test object code module, and code modules for each project's business layer. Obtaining and presenting a target test case corresponding to a target project from among the various pre-stored test cases within the business logic layer for a user to write corresponding target test case code based on the target syntax rules within the target test case includes:

[0015] Obtain and present a target test case corresponding to a target project from among the various pre-stored test cases within the use case modules for each project's business layer for a user to write corresponding target test case code based on the target syntax rules within the target test case, and store the target test case code in the code modules for each project's business layer within the technology implementation layer; wherein the target syntax rules are generated based on markdown syntax.

[0016] When it is detected that there is target test case code within the technology implementation layer, execute the target test case to call and run the target test code, including:

[0017] Continuously detect whether the target test code exists within the code modules for each project's business layer;

[0018] When it is detected that the target test code exists within the code modules for each project's business layer, execute the target test case to call and run the target test code.

[0019] Optionally, during the process of running the target test code, if the target test code has target common use cases, obtaining the target common use cases from within the business logic layer includes:

[0020] During the process of running the target test code, if the target test code has target common use cases, obtain the target common use cases from within the common business logic module;

[0021] Execute the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored within the technology implementation layer, including:

[0022] Execute the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored within the common service implementation module; wherein, the common use case code stored within the common service implementation module is written in Python.

[0023] Optionally, during the process of running the target common use case code, if there is a target test object in the target common use case code, obtaining the target test object from the business logic layer includes:

[0024] During the process of running the target common use case code, if there is a target test object in the target common use case code, obtain the target test object from the common test object module.

[0025] Execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored within the technology implementation layer to obtain a target test result, including:

[0026] Execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored within the common test object code module to obtain a target test result.

[0027] Optionally, validating the target test result includes:

[0028] Compare the target test result with the standard test result of the target test case.

[0029] A second aspect of the present invention discloses an automated testing system applicable to an automated testing platform built based on GAUGE. The automated testing platform includes at least a business logic layer and a technology implementation layer. The system includes:

[0030] A target test case acquisition unit for obtaining and presenting a target test case corresponding to a target project from each of the preselected stored test cases within the business logic layer for a user to write corresponding target test case code based on the target syntax rules in the target test case and storing the target test case code in the technology implementation layer;

[0031] A target test case execution unit for executing the target test case to call and run the target test case code when detecting that there is target test case code in the technology implementation layer;

[0032] A target common use case acquisition unit, configured to, during the process of running the target test case code, if there is a target common use case in the target test case code, acquire the target common use case from each of the common use cases prestored in the business logic layer;

[0033] A target common use case execution unit, configured to execute the target common use case, so as to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the technical implementation layer;

[0034] A target test object acquisition unit, configured to, during the process of running the target common use case code, if there is a target test object in the target common use case code, acquire the target test object from each of the test objects prestored in the business logic layer;

[0035] A target test object execution unit, configured to execute the target test object, so as to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer, and obtain a target test result;

[0036] A target test result verification unit, configured to verify the target test result;

[0037] A test report generation unit, configured to, if the verification of the target test result passes, generate a test report for the target project according to the target test result.

[0038] Optionally, the business logic layer includes a common business logic module, a common test object module, and a use case module for each project business layer, and the technical implementation layer includes a common business implementation module, a common test object code module, and a code module for each project business layer. The target test case acquisition unit includes:

[0039] A target test case acquisition subunit, configured to acquire and display a target test case corresponding to a target project from each of the test cases prestored in the use case module for each project business layer, so that a user can write a corresponding target test case code based on a target syntax rule in the target test case, and store the target test case code into the code module for each project business layer in the technical implementation layer; wherein, the target syntax rule is generated based on the markdown syntax;

[0040] The target test case execution unit is further configured to detect in real time whether the target test code exists in the code module for each project business layer; when it is detected that the target test code exists in the code module for each project business layer, execute the target test case, so as to call and run the target test code.

[0041] Optionally, the target common use case obtaining unit includes:

[0042] A target common use case obtaining subunit, configured to, during the execution of the target test code, if there is a target common use case in the target test code, obtain the target common use case from the common business logic module;

[0043] The target common use case execution unit is further configured to execute the target common use case, so as to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the common business implementation module; wherein, the common use case code stored in the common business implementation module is written in Python.

[0044] A third aspect of the present invention discloses an electronic device, which includes a processor and a memory. The memory is used to store program codes and data for automated testing, and the processor is used to call the program instructions in the memory to execute an automated testing method as disclosed in the first aspect of the present invention above.

[0045] A fourth aspect of the present invention discloses a storage medium, which includes a stored program. When the program runs, it controls the device where the storage medium is located to execute an automated testing method as disclosed in the first aspect of the present invention above.

[0046] The present invention provides an automated testing method, system, electronic device and storage medium, which are applicable to an automated testing platform built based on GAUGE. The automated testing platform at least includes a business logic layer and a technical implementation layer. By obtaining and displaying a target test case corresponding to a target project from each test case pre-stored in the business logic layer, so that a user can write corresponding target test case code according to the target syntax rules in the displayed target test case, and store the written target test case code in the technical implementation layer; when it is detected that there is target test case code in the technical implementation layer, execute the target test case to call and run the target test case code in the technical implementation layer. During the process of running the target test case code, if there is a target common use case in the target test case code, obtain the target common use case from each common use case pre-stored in the business logic layer, and execute the target common use case to call and run the target common use case code of the target common use case object from the common use case code stored in the technical implementation; during the process of running the target common use case code, if there is a target test object in the target common use case code, obtain the target test object from each test object pre-stored in the business logic layer; execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer, and obtain a target test result; verify the target test result; if the target test result passes the verification, generate a test report for the target project according to the target test result. The automated testing technical solution provided by the present invention can automatically complete the test without manual intervention, solving the problems of the existing testing methods, which require a large amount of manpower, low efficiency, and deviation of test results due to manual operation errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0048] Figure 1 It is an architecture diagram of an automated testing platform built based on GAUGE provided by an embodiment of the present invention;

[0049] Figure 2 It is an example diagram of the program file structure of an automated testing platform provided by an embodiment of the present invention;

[0050] Figure 3 It is an example diagram of a specs folder provided by an embodiment of the present invention;

[0051] Figure 4 An example diagram of a step_impl folder provided by an embodiment of the present invention;

[0052] Figure 5 A flowchart example of an automated testing method provided by an embodiment of the present invention;

[0053] Figure 6 A structural example diagram of an automated testing system provided by an embodiment of the present invention;

[0054] Figure 7 A structural example diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0055] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0056] In this application, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.

[0057] GAUGE: A lightweight cross-platform test automation tool with the ability to write test cases in different languages. It is essentially a BDD (Behavior Driven Development) test framework that describes behaviors through Markdown.

[0058] BDD: (Behavior Driven Development), which uses a unified domain-specific language (DSL) to describe business scenarios and user behaviors. It consists of two parts, one is the description of software behaviors, and the other is writing test code for the description.

[0059] Specification file: Written in business language, the spec or specification describes the characteristics of the project under test. The tags of this file are based on Markdown syntax.

[0060] Selenium WebDriver: A driver for web applications, which provides a set of object-oriented APIs. It can use various scripting languages on local or remote computers to drive browsers and simulate some functions of manual browser operations, including mouse clicks, double-clicks, drags, file uploads, file downloads, and keyboard operations such as space, enter, backspace, ctrl, alt, and shift. The functional operations are converted into machine-readable operation codes for use in test case development.

[0061] See Figure 1 , which shows the architecture diagram of an automated testing platform built based on GAUGE provided by an embodiment of the present invention. This automated testing platform is jointly built based on GAUGE and Selenium WebDriver.

[0062] This automated testing platform at least includes a business logic layer and a technical implementation layer. Among them, the business logic layer includes a common business logic module, a common test object module, and use case modules for each project's business layer. The technical implementation layer includes a common business implementation module, a common test object code module, and code modules for each project's business layer. Among them, GAUGE is a GAUGE framework based on BDD (Behavior Driven Development).

[0063] It should be noted that the program file structure of the automated testing platform is as Figure 2 shown. Among them, the specs folder is the program file structure of the business logic layer, and the step_impl folder is the program file structure of the technical implementation layer.

[0064] It should also be noted that the specs folder at least includes a concepts subfolder, a porject1 subfolder, a porject2 subfolder, and a common subfile, as Figure 3 shown. Among them, the common subfile is the program file structure including the common business logic module, the porjectX subfolder is the program file structure of the use case modules for each project's business layer, and the concepts subfolder is the program file structure of the common test object module; the concepts subfolder includes Concept.cpt, and Concept.cpt is a test case, and the test case uses the.cpt file format.

[0065] The step_impl folder includes at least a concepts subfolder, a porject1 subfolder, a porject2 subfolder, and a common subfile, as Figure 4 shown. Among them, the common subfile is the program file structure including the public service implementation module, the porjectX subfolder is the program file structure of the business layer code module for each project, and the concepts subfolder is the program file structure of the public test object code module; the concepts subfolder includes Concept.cpt, and Concept.py is the test case code, and the test case code uses the.py file format.

[0066] Based on Figure 1 the shown automated test platform, correspondingly, the embodiment of the present invention provides an automated test method, as Figure 5 shown, applied to Figure 1 the shown automated test platform, and the automated test method specifically includes the following steps:

[0067] S501: From each of the pre-stored test cases in the business logic layer, obtain and display the target test case corresponding to the target project, so that the user can write the corresponding target test case code based on the target syntax rule in the target test case, and store the target test case code in the technology implementation layer.

[0068] In the embodiment of the present application, for each project, the syntax rule corresponding to the project can be pre-written based on the markdown syntax, and the characteristics of the project can be described according to the spec or specification. Finally, the test cases for the project are generated according to the written syntax rule and characteristics, and the generated test cases are stored in the use case module of the business layer of each project in the business logic layer.

[0069] During the specific execution of step S501, after initializing the test platform, when it is detected that the user wants to perform an automated test, the target test case corresponding to the target project can be obtained and displayed from each of the pre-stored test cases in the use case module of the business layer of each project in the business logic layer. Among them, the target project is the project to be subjected to automated test.

[0070] After seeing the expanded target test case, the user can write the target test case code corresponding to the target test case according to the characteristics of the project described by the spec or specification and the target syntax rule, and store the written target test case code in the folder corresponding to the target project in the business code module of each project in the technology implementation layer.

[0071] S502: When it is detected that there is target test case code in the technology implementation layer, execute the target test case to call and run the target test code.

[0072] During the specific execution of step S502, after presenting the target test cases corresponding to the target project, it is possible to detect in real time whether there is target test case code of the target test case in the folder corresponding to the target project in each project business code module of the technology implementation layer; when it is detected that there is target test case code of the target test case in the folder corresponding to the target project in each project business code module of the technology implementation layer, execute the target test case to call and run the target test case code in this folder.

[0073] S503: During the process of running the target test case code, if there is a target common use case in the target test case code, obtain the target common use case from each of the common use cases pre-stored in the business logic layer.

[0074] In the embodiments of the present application, multiple common use cases and the common use case code corresponding to each common use case are preset; each of the preset common use cases is stored in the common business logic module of the business logic layer, and the common use case code corresponding to each common use case is stored in the common business implementation module of the technology implementation layer.

[0075] During the specific execution of step S503, during the process of running the target test case code, detect in real time whether there is a common use case in the target test case code (for the sake of distinction, the common use case existing in the target test case code is called the target common use case); if it is detected that there is a target common use case in the target test case code, obtain the target common use case from each of the common use cases pre-stored in the common business logic module of the business logic layer.

[0076] It should be noted that there may be multiple target common use cases in the target test case. Specifically, how many target common use cases there are can be set by the inventor according to the actual application, and the embodiments of the present application do not limit this.

[0077] In the embodiments of the present application, if it is detected that there is no target common test case in the target test case code, when the target test case code is executed, a target test result is generated.

[0078] S504: Execute the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the technology implementation layer.

[0079] In the process of specifically executing step S504, after obtaining the target common use case, the obtained target common use case can be executed to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the common service implementation module at the technical implementation layer.

[0080] It should be noted that when multiple target common use cases are obtained, each target common use case can be executed in the order of each target common use case to call and run the target common use case code corresponding to each target common use case from the common use case code stored in the common service implementation module at the technical implementation layer.

[0081] S505: In the process of running the target common use case code, if there is a target test object in the target common use case code, obtain the target test object from each test object pre-stored in the business logic layer.

[0082] In the embodiments of the present application, multiple test objects and the test object code corresponding to each test object are preset; each preset test object is stored in the common test object module of the business logic layer, and the test object code corresponding to each test object is stored in the common test object code module of the technical implementation layer.

[0083] In the process of specifically executing step S505, in the process of running the target common use case code, it is detected in real time whether there is a test object in the target common use case code (for the sake of distinction, if there is a test object in the target common use case code, it is called a target test object); if it is detected that there is a target test object in the target common use case code, obtain the target test object from each test object stored in the common test object module of the business logic layer.

[0084] It should be noted that there can be multiple target test objects in the target common use case. Specifically, how many target test objects there are can be set by the inventor according to the actual application, and the embodiments of the present application do not limit it.

[0085] In the embodiments of the present application, if it is detected that there is no target test object in the target common use case code, when the target common use case code is executed, a target test result is generated.

[0086] S506: Execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result.

[0087] In the specific process of executing step S506, after obtaining the target test object, the obtained target test object can be executed to call and run the target test object code corresponding to the target test object from the test object code stored in the public test object code module at the technical implementation layer. When running to the target test object code of the target test object, the target test result corresponding to the target project is generated.

[0088] It should be noted that when multiple target test objects are obtained, each target test object can be executed in the order of the target test objects to call and run the target test object code corresponding to each target test object from the test object code stored in the public test object code module at the technical implementation layer. When running through the target test object code of each target test object, the target test result corresponding to the target project is generated.

[0089] S507: Verify the target test result. If the target test result passes the verification, execute step S508.

[0090] In the specific process of executing step S507, after generating the target test result of the target project, the standard test result of the target project can be obtained, and the target project result and the standard test result of the target project can be compared; if the target test result and the standard test result of the target project are consistent, it is determined that the target test result passes the verification and step S508 is executed; if the target test result and the standard test result of the target project are inconsistent, it is determined that the target test result fails the verification and the corresponding alarm information is output.

[0091] S508: Generate a test report for the target project based on the target test result.

[0092] In the specific process of executing step S508, a test report for the target project is generated according to the target test result in the case where it is determined that the target test result of the target project passes the verification.

[0093] The present invention provides an automated testing method, which is applicable to an automated testing platform built based on GAUGE. The automated testing platform at least includes a business logic layer and a technical implementation layer. By obtaining and displaying a target test case corresponding to a target project from each test case pre-stored in the business logic layer, so that a user can write a corresponding target test case code according to the target syntax rules in the displayed target test case, and store the written target test case code in the technical implementation layer; when it is detected that there is a target test case code in the technical implementation layer, execute the target test case to call and run the target test case code in the technical implementation layer. During the process of running the target test case code, if there is a target common use case in the target test case code, obtain the target common use case from each common use case pre-stored in the business logic layer, and execute the target common use case to call and run the target common use case code of the target common use case object from the common use case code stored in the technical implementation; during the process of running the target common use case code, if there is a target test object in the target common use case code, obtain the target test object from each test object pre-stored in the business logic layer; execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result; verify the target test result; if the target test result passes the verification, generate a test report for the target project according to the target test result. The automated testing technical solution provided by the present invention can automatically complete the test without manual intervention, solving the problems of the existing testing methods, which require a large amount of manpower, low efficiency, and deviation of test results due to manual operation errors.

[0094] Based on the automated testing method disclosed in the embodiments of the present invention, the embodiments of the present invention also correspondingly disclose an automated testing system, as Figure 6 shown, which is applicable to an automated testing platform built based on GAUGE. The automated testing platform at least includes a business logic layer and a technical implementation layer. The automated testing system includes:

[0095] A target test case acquisition unit 61, configured to obtain and display a target test case corresponding to a target project from each test case pre-stored in the business logic layer, for a user to write a corresponding target test case code based on the target syntax rules in the target test case, and store the target test case code in the technical implementation layer;

[0096] A target test case execution unit 62, configured to execute the target test case to call and run the target test case code when it is detected that there is a target test case code in the technical implementation layer;

[0097] A target common use case acquisition unit 63, configured to, during the process of running target test case code, if there is a target common use case in the target test case code, acquire the target common use case from each of the common use cases pre-stored in the business logic layer;

[0098] A target common use case execution unit 64, configured to execute the target common use case, so as to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the technical implementation layer;

[0099] A target test object acquisition unit 65, configured to, during the process of running the target common use case code, if there is a target test object in the target common use case code, acquire the target test object from each of the test objects pre-stored in the business logic layer;

[0100] A target test object execution unit 66, configured to execute the target test object, so as to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result;

[0101] A target test result verification unit 67, configured to verify the target test result;

[0102] A test report generation unit 68, configured to, if the target test result verification is passed, generate a test report for the target project according to the target test result.

[0103] The specific principles and execution processes of each unit in the automated test system disclosed in the above embodiments of the present invention are the same as those of the automated test method disclosed in the above embodiments of the present invention. Figure 5 Reference may be made to the corresponding parts of the automated test method disclosed in the above embodiments of the present invention, and details are not described herein again. Figure 5

[0104] ​The present invention provides an automated testing system applicable to an automated testing platform built based on GAUGE. The automated testing platform at least includes a business logic layer and a technical implementation layer. By obtaining and displaying a target test case corresponding to a target project from each of the test cases pre-stored in the business logic layer, so that a user can write a corresponding target test case code according to the target syntax rules in the displayed target test case, and store the written target test case code in the technical implementation layer; when it is detected that there is a target test case code in the technical implementation layer, execute the target test case to call and run the target test case code in the technical implementation layer. During the process of running the target test case code, if there is a target common use case in the target test case code, obtain the target common use case from each of the common use cases pre-stored in the business logic layer, and execute the target common use case to call and run the target common use case code of the target common use case object from the common use case code stored in the technical implementation; during the process of running the target common use case code, if there is a target test object in the target common use case code, obtain the target test object from each of the test objects pre-stored in the business logic layer; execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result; verify the target test result; if the target test result passes the verification, generate a test report for the target project according to the target test result. The automated testing technical solution provided by the present invention can automatically complete the test without manual intervention, solving the problems of the existing testing methods, which require a large amount of manpower, low efficiency, and deviation of the test result due to manual operation errors.

[0105] Optionally, the business logic layer includes a common business logic module, a common test object module, and a use case module for each project business layer. The technical implementation layer includes a common business implementation module, a common test object code module, and a code module for each project business layer. The target test case acquisition unit includes:

[0106] A target test case acquisition subunit, configured to obtain and display a target test case corresponding to a target project from each of the test cases pre-stored in the use case module for each project business layer, for a user to write a corresponding target test case code based on the target syntax rules in the target test case, and store the target test case code in the code module for each project business layer in the technical implementation layer; wherein, the target syntax rules are generated based on the markdown syntax;

[0107] A target test case execution unit is further configured to detect in real time whether there is a target test code in the code module for each project business layer; when it is detected that there is a target test code in the code module for each project business layer, execute the target test case to call and run the target test code.

[0108] Optionally, the target common use case acquisition unit includes:

[0109] A target common use case acquisition subunit, configured to, during the execution of the target test code, if there is a target common use case in the target test code, acquire the target common use case from the common business logic module;

[0110] A target common use case execution unit, further configured to execute the target common use case, so as to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the common business implementation module; wherein, the common use case code stored in the common business implementation module is written in Python.

[0111] Optionally, the target test object acquisition unit includes:

[0112] A target test object acquisition subunit, configured to, during the execution of the target common use case code, if there is a target test object in the target common use case code, acquire the target test object from the common test object module;

[0113] A target test object execution unit, further configured to execute the target test object, so as to call and run the target test object code corresponding to the target test object from the test object code stored in the common test object code module, and obtain a target test result.

[0114] Optionally, the target test result verification unit includes:

[0115] A target test result verification subunit, configured to compare the target test result with the standard test result of the target test case.

[0116] An embodiment of the present application further provides an electronic device, which includes: a processor and a memory, and the processor and the memory are connected through a communication bus; wherein, the processor is configured to call and execute a program stored in the memory; the memory is configured to store a program, and this program is used to implement the automated test method.

[0117] The following refers to Figure 7 , which shows a schematic structural diagram of an electronic device suitable for implementing the disclosed embodiments of the present invention. The electronic device in the disclosed embodiments of the present invention may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example, and should not impose any limitations on the functions and usage scope of the disclosed embodiments of the present invention.

[0118] As shown Figure 7 in the figure, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 701, which may 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 device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0119] Generally, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device to communicate with other devices wirelessly or wirelessly to exchange data. Although Figure 7 an electronic device with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. More or fewer devices may be implemented or had alternatively.

[0120] Specifically, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart may be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for executing the automated test method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network through the communication device 709, or installed from the storage device 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above functions defined in the automated test method of the embodiments disclosed in the present invention are executed.

[0121] Furthermore, the embodiments of the present invention also provide a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are used to execute the automated test method.

[0122] The above computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: obtain and display a target test case corresponding to a target project from each of the pre-stored test cases in the business logic layer, for a user to write corresponding target test case code based on the target syntax rules in the target test case, and store the target test case code in the technical implementation layer;

[0123] When it is detected that there is target test case code in the technical implementation layer, execute the target test case to call and run the target test case code; during the process of running the target test case code, if there is a target common case in the target test case code, obtain the target common case from each of the pre-stored common cases in the business logic layer; execute the target common case to call and run the target common case code corresponding to the target common case from the common case code stored in the technical implementation layer; during the process of running the target common case code, if there is a target test object in the target common case code, obtain the target test object from each of the pre-stored test objects in the business logic layer; execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result; verify the target test result; if the verification of the target test result passes, generate a test report for the target project according to the target test result.

[0124] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0125] It should be noted that the computer-readable medium disclosed in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the disclosure of the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the disclosure of the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0126] The above computer-readable medium can be included in the above electronic device; or it can exist separately without being assembled into the electronic device.

[0127] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for a system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, reference can be made to the partial description of the method embodiment. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative work.

[0128] Those skilled in the art may further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0129] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0130] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. An automated testing method, characterized in that, Applicable to an automated testing platform built based on GAUGE. The automated testing platform at least includes a business logic layer and a technical implementation layer. The method includes: Obtain and display target test cases corresponding to a target project from each pre-stored test case in the business logic layer, for a user to write corresponding target test case code based on the target syntax rules in the target test cases, and store the target test case code in the technical implementation layer; wherein, the test cases are generated according to the syntax rules corresponding to the project and the characteristics of the project; When it is detected that there is target test case code in the technical implementation layer, execute the target test case to call and run the target test case code; During the process of running the target test case code, if there is a target common case in the target test case code, obtain the target common case from each pre-stored common case in the business logic layer; Execute the target common case to call and run the target common case code corresponding to the target common case from the common case code stored in the technical implementation layer; During the process of running the target common case code, if there is a target test object in the target common case code, obtain the target test object from each pre-stored test object in the business logic layer; Execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result; Verify the target test result; If the verification of the target test result passes, generate a test report for the target project according to the target test result.

2. The method according to claim 1, wherein The business logic layer includes a common business logic module, a common test object module, and use case modules for each project business layer. The technical implementation layer includes a common business implementation module, a common test object code module, and code modules for each project business layer. The obtaining and displaying target test cases corresponding to a target project from each pre-stored test case in the business logic layer for a user to write corresponding target test case code based on the target syntax rules in the target test cases includes: Obtain and display target test cases corresponding to a target project from each pre-stored test case in the use case modules for each project business layer, for a user to write corresponding target test case code based on the target syntax rules in the target test cases, and store the target test case code in the code modules for each project business layer of the technical implementation layer; wherein, the target syntax rules are generated based on markdown syntax; The when it is detected that there is target test case code in the technical implementation layer, execute the target test case to call and run the target test case code includes: Real-time detect whether there is the target test case code in the code modules for each project business layer; When the target test case code is detected in each of the project business layer code modules, execute the target test case to call and run the target test case code.

3. The method according to claim 2, characterized in that, During the process of running the target test case code, if the target test case code has a target common use case, obtaining the target common use case from the business logic layer includes: During the process of running the target test case code, if the target test case code has a target common use case, obtain the target common use case from the common business logic module; Executing the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the technical implementation layer includes: Execute the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the common business implementation module; wherein, the common use case code stored in the common business implementation module is written in Python.

4. The method according to claim 3, characterized in that During the process of running the target common use case code, if there is a target test object in the target common use case code, obtaining the target test object from the business logic layer includes: During the process of running the target common use case code, if there is a target test object in the target common use case code, obtain the target test object from the common test object module; Executing the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result includes: Execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the common test object code module to obtain a target test result.

5. The method according to claim 1, characterized in that, Verifying the target test result includes: Compare the target test result with the standard test result of the target test case.

6. An automated testing system, characterized in that, Applicable to an automated testing platform built based on GAUGE, the automated testing platform at least includes a business logic layer and a technical implementation layer, and the system includes: A target test case acquisition unit, configured to obtain and display a target test case corresponding to a target project from each of the preselected test cases stored in the business logic layer for a user to write a corresponding target test case code based on the target syntax rules in the target test case, and store the target test case code in the technical implementation layer; wherein, the test case is a test case generated according to the syntax rules corresponding to the project and the characteristics of the project; A target test case execution unit, configured to execute the target test case to call and run the target test case code when it is detected that there is target test case code in the technical implementation layer; A target common use case acquisition unit, configured to, during the execution of the target test case code, if there is a target common use case in the target test case code, acquire the target common use case from each pre-stored common use case in the business logic layer; A target common use case execution unit, configured to execute the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the technical implementation layer; A target test object acquisition unit, configured to, during the execution of the target common use case code, if there is a target test object in the target common use case code, acquire the target test object from each pre-stored test object in the business logic layer; A target test object execution unit, configured to execute the target test object to call and run the target test object code corresponding to the target test object from the test object code stored in the technical implementation layer to obtain a target test result; A target test result verification unit, configured to verify the target test result; A test report generation unit, configured to, if the target test result verification is passed, generate a test report for the target project according to the target test result.

7. The system according to claim 6, characterized in that, The business logic layer includes a common business logic module, a common test object module, and a use case module for each project business layer. The technical implementation layer includes a common business implementation module, a common test object code module, and a code module for each project business layer. The target test case acquisition unit includes: A target test case acquisition subunit, configured to acquire and display a target test case corresponding to a target project from each pre-stored test case in the use case module for each project business layer for a user to write a corresponding target test case code based on the target syntax rule in the target test case and store the target test case code in the code module for each project business layer in the technical implementation layer; wherein the target syntax rule is generated based on the markdown syntax; The target test case execution unit is further configured to detect in real time whether there is the target test case code in the code module for each project business layer; when it is detected that there is the target test case code in the code module for each project business layer, execute the target test case to call and run the target test case code.

8. The system according to claim 7, wherein, The target common use case acquisition unit includes: A target common use case acquisition subunit, configured to, during the execution of the target test case code, if there is a target common use case in the target test case code, acquire the target common use case from the common business logic module; The target common use case execution unit is further configured to execute the target common use case to call and run the target common use case code corresponding to the target common use case from the common use case code stored in the common business implementation module; wherein the common use case code stored in the common business implementation module is written in python.

9. An electronic device, characterized in that The electronic device includes a processor and a memory. The memory is used to store program codes and data for automated testing. The processor is used to call program instructions in the memory to execute an automated testing method as described in any one of claims 1-5.

10. A storage medium, characterized in that, The storage medium includes a stored program. When the program runs, it controls the device where the storage medium is located to execute an automated testing method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Method and device for testing scene data

    CN102890651A

  • Test case generation method, execution method and device

    CN109117369A