CN114817040A - Automatic testing method, system, electronic equipment and storage medium - Google Patents

Automatic testing method, system, electronic equipment and storage medium Download PDF

Info

Publication number
CN114817040A
CN114817040A CN202210460667.4A CN202210460667A CN114817040A CN 114817040 A CN114817040 A CN 114817040A CN 202210460667 A CN202210460667 A CN 202210460667A CN 114817040 A CN114817040 A CN 114817040A
Authority
CN
China
Prior art keywords
target
case
target test
code
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210460667.4A
Other languages
Chinese (zh)
Inventor
张少辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210460667.4A priority Critical patent/CN114817040A/en
Publication of CN114817040A publication Critical patent/CN114817040A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application provides an automatic testing method, a system, electronic equipment and a storage medium, a target test case of a target project is obtained and displayed from a business logic layer, so that a user can compile a target test case code based on a target grammatical rule in the target test case; executing the target test case to call and run the target test case code, and in the process of running the target test case code, if the target test case code has the target common case, acquiring and executing the target common case from the business logic layer to call and run the target common case code corresponding to the target common case in the layer by the technology; in the process of running the target common case code, if a target test object exists, the target test object in the service logic layer is obtained and executed to call and run the technology to realize the target test object code of the target test object in the layer, and if the obtained target test result passes the verification, a test report of the target project is generated according to the target test result.

Description

Automatic testing method, system, electronic equipment and storage medium
Technical Field
The present invention relates to the field of automated testing technologies, and in particular, to an automated testing method, an automated testing system, an electronic device, and a storage medium.
Background
Software testing is a very important component in a software engineering system and is a key step for ensuring the quality of software. Unlike product testing, the temporary nature of the project dictates that most software project-based tests have a short cycle time, so there is little investment in automated testing of individual projects, and manual testing is often employed.
However, the manual testing method is labor-intensive, inefficient, and prone to error operation, which may result in deviation of the test results.
Disclosure of Invention
The invention provides an automatic testing method, an automatic testing system, electronic equipment and a storage medium, and aims to solve the problems that a large amount of labor is required to be consumed, the efficiency is low, and error operation is easy to occur in the existing testing mode, so that the testing result is deviated.
The invention discloses an automatic test method, which is suitable for an automatic test platform built based on GAUGE (generic object oriented analysis), wherein the automatic test platform at least comprises a service logic layer and a technology implementation layer, and the method comprises the following steps:
acquiring and displaying a target test case corresponding to a target project from each test case pre-selected and stored in the service logic layer, so that a user can write corresponding target test case codes based on target grammatical rules in the target test case, and storing the target test case codes to the technology implementation layer;
when detecting that a target test case code exists in the technical implementation layer, executing the target test case to call and run the target test case code;
in the process of running the target test case codes, if the target test case codes have target common cases, acquiring the target common cases from all the common cases pre-stored in the business logic layer;
executing the target common use case to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the technical implementation layer;
in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from each test object pre-stored in the business logic layer;
executing the target test object to call and run a 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;
verifying the target test result;
and if the target test result passes the verification, generating a test report of the target project according to the target test result.
Optionally, the service logic layer includes a common service logic module, a common test object module, and each item service layer case module, the technology implementation layer includes a common service implementation module, a common test object code module, and each item service layer code module, and the target test case corresponding to the target item is obtained and displayed from each test case pre-selected and stored in the service logic layer, so that a user can write a corresponding target test case code based on a target syntax rule in the target test case, including:
obtaining and displaying a target test case corresponding to a target project from each test case pre-selected and stored in each project service layer case module, so that a user can compile corresponding target test case codes based on target grammatical rules in the target test case, and store the target test case codes to each project service code module of the technology implementation layer; wherein the target grammar rule is generated based on a markdown grammar;
when detecting that the target test case code exists in the technology implementation layer, executing the target test case to call and run the target test code, including:
detecting whether the target test code exists in each project service layer code module in real time;
and when the target test code exists in each project service layer code module, executing the target test case to call and run the target test code.
Optionally, in the process of running the target test code, if the target test code has a target common use case, acquiring the target common use case from the service logic layer includes:
in the process of running the target test code, if the target test code has a target common use case, acquiring the target common use case from the common service logic module;
the 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:
executing the target public use case to call and run a target public use case code corresponding to the target public use case from the public use case code stored in the public service implementation module; and the common use case code stored in the common service implementation module is written based on python.
Optionally, in the process of running the target common use case code, if a target test object exists in the target common use case code, acquiring the target test object from the service logic layer includes:
in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from the common test object module;
the executing the target test object to call and run a target test object code corresponding to the target test object from the test object code stored in the technology implementation layer to obtain a target test result includes:
and executing 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 to obtain a target test result.
Optionally, the verifying the target test result includes:
and comparing the target test result with the standard test result of the target test case.
The second aspect of the present invention discloses an automated testing system, which is suitable for an automated testing platform built based on the GAUGE, wherein the automated testing platform at least comprises a service logic layer and a technology implementation layer, and the system comprises:
the target test case acquisition unit is used for acquiring and displaying a target test case corresponding to a target project from each test case pre-selected and stored in the business logic layer, so that a user can compile corresponding target test case codes based on target grammatical rules in the target test case, and the target test case codes are stored in the technology implementation layer;
the target test case execution unit is used for executing the target test case to call and run the target test case codes when detecting that the target test case codes exist in the technical implementation layer;
a target common use case obtaining unit, configured to, in a process of running the target test use case code, obtain, if the target test use case code has a target common use case, the target common use case from each common use case pre-stored in the service logic layer;
the target common use case execution unit is used for executing the target common use case so as to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the technical implementation layer;
a target test object obtaining unit, configured to, in a process of running the target common use case code, obtain a target test object from each test object pre-stored in the business logic layer if the target common use case code includes the target test object;
the target test object execution unit is used for executing the target test object so as to call and run a target test object code corresponding to the target test object from the test object codes stored in the technical implementation layer to obtain a target test result;
the target test result verifying unit is used for verifying the target test result;
and the test report generating unit is used for generating a test report of the target item according to the target test result if the target test result passes the verification.
Optionally, the service logic layer includes a common service logic module, a common test object module, and each project service layer case module, the technology implementation layer includes a common service implementation module, a common test object code module, and each project service layer code module, and the target test case obtaining unit includes:
the target test case obtaining subunit is used for obtaining and displaying a target test case corresponding to a target project from each test case pre-selected and stored in each project service layer case module, so that a user can compile corresponding target test case codes based on target grammar rules in the target test case, and store the target test case codes to each project service code module of the technical implementation layer; wherein the target grammar rule is generated based on a markdown grammar;
the target test case execution unit is also used for detecting whether the target test code exists in each project service layer code module in real time; and when the target test code exists in each project service layer code module, executing the target test case to call and run the target test code.
Optionally, the target common use case obtaining unit includes:
the target common use case obtaining subunit is used for obtaining the target common use case from the common service logic module in the process of running the target test code if the target test code has the target common use case;
the target common use case execution unit is further used for executing the target common use case so as to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the common service implementation module; and the common use case code stored in the common service implementation module is written based on python.
In a third aspect, the present invention discloses an electronic device, which includes a processor and a memory, wherein the memory is used for storing program codes and data of an automated test, and the processor is used for calling program instructions in the memory to execute an automated test method as disclosed in the first aspect of the present invention.
In a fourth aspect of the present invention, a storage medium is disclosed, where the storage medium includes a storage program, and when the program runs, a device on which the storage medium is located is controlled to execute an automated testing method as disclosed in the first aspect of the present invention.
The invention provides an automatic test method, a system, electronic equipment and a storage medium, which are suitable for an automatic test platform built based on GAUGE (generic object oriented testing) and at least comprise a business logic layer and a technology implementation layer, wherein a target test case corresponding to a target project is obtained and displayed from each test case pre-stored in the business logic layer, so that a user can compile a corresponding target test case code according to a target grammatical rule in the displayed target test case and store the compiled target test case code to the technology implementation layer; when detecting that the target test case codes exist in the technical implementation layer, executing the target test case to call and run the target test case codes in the technical implementation layer, in the process of running the target test case codes, if the target common cases exist in the target test case codes, acquiring the target common cases from all the common cases stored in advance in the business logic layer, and executing the target common cases to call and run the target common case codes of target common case objects from the common case codes stored in the technical implementation layer; in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from each test object prestored in the service logic layer; executing the target test object to call and run a 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; verifying the target test result; and if the target test result passes the verification, generating a test report of the target project according to the target test result. The automatic testing technical scheme provided by the invention can automatically complete the test without manual intervention, and solves the problems that the existing testing mode needs a large amount of manpower, the efficiency is low, and the testing result has deviation due to manual operation errors.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is an architecture diagram of an automated testing platform constructed based on GAUGE according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an exemplary program file structure of an automated test platform according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating examples of specs folders according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a step _ impl folder according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating an automated testing method according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating an exemplary structure of an automated testing system according to an embodiment of the present invention;
fig. 7 is a diagram illustrating a structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
And (3) GAUGE: a lightweight cross-platform test automation tool has the capability of writing test cases by using different languages, and is essentially a BDD (behavior driven development) test framework, and behaviors are described through Markdown.
BDD: (behaviordrivenddevelopment) describes service scenarios and user behavior using a uniform Domain Specific Language (DSL), which contains two parts, one part is software behavior description and the other part is writing test code for the description.
specification file: the business language is written, spec or specification describes the characteristics of the tested item, and the mark of the file is based on markdown syntax.
Selenium WebDriver: the Web application program driver is used for providing a set of object-oriented API (application program interface), driving a browser by using a plurality of scripting languages on a local or remote computer, and simulating some functions of manually operating the browser, including mouse clicking, double clicking, dragging, file uploading, file downloading, blank space, carriage return, backspacing, ctrl, alt and shift of a keyboard; the operation codes are converted into computer readable operation codes through functional operations and are provided for test case development and use.
Referring to fig. 1, an architecture diagram of an automated testing platform built based on the GAUGE according to an embodiment of the present invention is shown, where the automated testing platform is built based on the GAUGE in combination with the Selenium WebDriver.
The automatic test platform at least comprises a business logic layer and a technical implementation layer. The service logic layer comprises a common service logic module, a common test object module and each project service layer case module, and the technical implementation layer comprises a common service implementation module, a common test object code module and each project service layer code module. The GAUGE is based on BDD (Behavior drive development), namely a GAUGE framework of behavior Driven development.
It should be noted that the program file structure of the automated testing platform is shown in fig. 2, where the specs folder is the program file structure of the business logic layer, and the step _ impr folder is the program file structure of the technology implementation layer.
It should be noted that the specs folder at least includes a concepts subfolder, a porject1 subfolder, a porject2 subfolder, and a common subfolder, as shown in fig. 3. The common subfolder is a program file structure comprising a common service logic module, the porjectX subfolder is a program file structure of each project service layer case module, and the contexts subfolder is a program file structure of a common test object module; the concepts subfolder includes concept.
The step _ imprl folder includes at least a concepts subfolder, a porject1 subfolder, a porject2 subfolder, and a common subfolder, as shown in FIG. 4. The common subfolder is a program file structure comprising a common service implementation module, the porjectX subfolder is a program file structure of each project service layer code module, and the contexts subfolder is a program file structure of a common test object code module; the concepts subfolder includes concept.
Based on the automated testing platform shown in fig. 1, correspondingly, an embodiment of the present invention provides an automated testing method, as shown in fig. 5, which is applied to the automated testing platform shown in fig. 1, and the automated testing method specifically includes the following steps:
s501: and acquiring and displaying the target test case corresponding to the target project from all the test cases pre-selected and stored in the service logic layer, so that a user can write corresponding target test case codes based on target grammatical rules in the target test case, and the target test case codes are stored in the technical implementation layer.
In the embodiment of the application, for each project, a grammar rule corresponding to the project may be written in advance based on a markdown grammar, a feature of the project may be described according to spec or specification, finally, a test case of the project may be generated according to the written grammar rule and the feature, and the generated test case may be stored in each project service layer case module of the service logic layer.
In the process of specifically executing step S501, after the test platform is initialized, when it is detected that the user is to perform the automated test, a target test case corresponding to the target project may be acquired and displayed from each test case pre-stored in each project service layer case module of the service logic layer. The target item is an item to be subjected to an automatic test.
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 features of the project and the target grammar rules described by spec or specification, and the written target test case code is stored in the folder corresponding to the target project in each project service code module of the technical implementation layer of the target test case code.
S502: and when detecting that the target test case code exists in the technical implementation layer, executing the target test case to call and run the target test code.
In the process of specifically executing step S502, after the target test case corresponding to the target project is displayed, whether the target test case code of the target test case exists in the folder corresponding to the target project in each project service code module of the technology implementation layer may be detected in real time; when detecting that the target test case codes of the target test cases exist in the folders corresponding to the target projects in the project service code modules of the technical implementation layer, executing the target test cases to call and run the target test case codes in the folders.
S503: in the process of running the target test case code, if the target test case code has the target common case, the target common case is obtained from each common case pre-stored in the business logic layer.
In the embodiment of the application, a plurality of public use cases and a public use case code corresponding to each public use case are preset; and storing each preset public use case into a public service logic module of a service logic layer, and storing a public use case code corresponding to each public use case into a public service implementation module of a technical implementation layer.
In the process of specifically executing step S503, in the process of running the target test case code, detecting whether a common case exists in the target test case code in real time (for convenience of distinguishing, the common case existing in the target test case code is referred to as a target common case); and if the target common use case is detected to exist in the target test case code, acquiring the target common use case from each common use case pre-stored in a common service logic module of the service logic layer.
It should be noted that a plurality of target common cases may exist in the target test case, specifically, how many target common cases exist, and the inventor may set the target test case according to practical application, which is not limited in the embodiment of the present application.
In the embodiment of the application, if the target common test case does not exist in the target test case code, the target test result is generated when the target test case code is executed.
S504: and executing 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.
In the specific process of executing step S504, after the target common use case is acquired, the acquired target common use case may be executed, so as to call and run the target common use case code corresponding to the target common use case from the common use case codes stored in the common service implementation module of the technology implementation layer.
It should be noted that, when a plurality of target common use cases are obtained, each target common use case may be executed according to the sequence of each target common use case, so as to call and run the target common use case code corresponding to each target common use case from the common use case codes stored in the common service implementation module of the technology implementation layer.
S505: in the process of running the target common case code, if the target test object exists in the target common case code, the target test object is obtained from each test object pre-stored in the business logic layer.
In the embodiment of the application, a plurality of test objects and test object codes corresponding to the test objects are preset; and storing each preset test object into a common test object module of the service logic layer, and storing a test object code corresponding to each test object into a common test object code module of the technical implementation layer.
In the specific execution process of step S505, in the process of running the target common use case code, detecting whether a test object exists in the target common use case code in real time (for convenience of distinguishing, the test object existing in the target common use case code is called a target test object); and if the target test object exists in the target common case code, acquiring the target test object from each test object stored in the common test object module of the business logic layer.
It should be noted that a plurality of target test objects may exist in the target common use case, specifically, how many target test objects exist, and the inventor may set the target common use case according to practical applications, which is not limited in the embodiment of the present application.
In the embodiment of the application, if the target test object does not exist in the target common case code, the target test result is generated when the target common case code is executed.
S506: and 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.
In the specific execution process of step S506, after the target test object is acquired, the acquired target test object may be executed, so as to call and run the target test object code corresponding to the target test object from the test object codes stored in the common test object code module of the technology implementation layer, and when the target test object code of the target test object is run, the target test result corresponding to the target item is generated.
It should be noted that, when a plurality of target test objects are obtained, each target test object may be executed according to the sequence of each target test object, so as to call and run the target test object code corresponding to each target test object from the test object codes stored in the common test object code module of the technical implementation layer, and when the target test object code of each target test object is run, generate the target test result corresponding to the target item.
S507: and verifying the target test result. If the target test result passes the verification, step S508 is executed.
In the specific execution process of step S507, after the target test result of the target item is generated, a standard test result of the target item may be obtained, and the target item result of the target item and the standard test result are compared; if the target test result of the target item is consistent with the standard test result, determining that the target test result passes verification, and executing step S508; and if the target test result of the target project is inconsistent with the standard test result, determining that the target test result fails to be verified, and outputting corresponding alarm information.
S508: and generating a test report of the target item according to the target test result.
In the specific process of executing step S508, a test report of the target item is generated according to the target test result when it is determined that the target test result of the target item passes the verification.
The invention provides an automatic test method, which is suitable for an automatic test platform built based on GAUGE (generic object oriented testing) and at least comprises a business logic layer and a technical implementation layer, wherein a target test case corresponding to a target project is obtained and displayed from each test case pre-stored in the business logic layer, so that a user can compile a corresponding target test case code according to a target grammatical rule in the displayed target test case, and the compiled target test case code is stored to the technical implementation layer; when detecting that the target test case codes exist in the technical implementation layer, executing the target test case to call and run the target test case codes in the technical implementation layer, in the process of running the target test case codes, if the target common cases exist in the target test case codes, acquiring the target common cases from all the common cases stored in advance in the business logic layer, and executing the target common cases to call and run the target common case codes of target common case objects from the common case codes stored in the technical implementation layer; in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from each test object prestored in the business logic layer; executing the target test object to call and run a 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; checking a target test result; and if the target test result passes the verification, generating a test report of the target project according to the target test result. The automatic testing technical scheme provided by the invention can automatically complete the test without manual intervention, and solves the problems that the existing testing mode needs a large amount of manpower, the efficiency is low, and the testing result has deviation due to manual operation errors.
Based on the automated testing method disclosed by the embodiment of the invention, the embodiment of the invention also correspondingly discloses an automated testing system, as shown in fig. 6, the automated testing system is suitable for an automated testing platform constructed based on the GAUGE, the automated testing platform at least comprises a service logic layer and a technology implementation layer, and the automated testing system comprises:
the target test case obtaining unit 61 is configured to obtain and display a target test case corresponding to the target item from each test case pre-selected and stored in the service logic layer, so that a user can compile a corresponding target test case code based on a target grammar rule in the target test case, and store the target test case code to the technology implementation layer;
the target test case execution unit 62 is configured to execute the target test case to call and run the target test case code when it is detected that the target test case code exists in the technology implementation layer;
a target common use case obtaining unit 63, configured to, in the process of running the target test use case code, obtain a target common use case from each common use case pre-stored in the business logic layer if the target test use case code has the target common use case;
a target common use case execution unit 64, configured to execute the target common use case, so as to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the technical implementation layer;
a target test object obtaining unit 65, configured to, in the process of running the target common case code, if a target test object exists in the target common case code, obtain the target test object from each test object pre-stored in the business logic layer;
a target test object execution unit 66, configured to execute the target test object, so as to call and run a target test object code corresponding to the target test object from the test object codes stored in the technology implementation layer, and obtain a target test result;
a target test result verification unit 67 for verifying the target test result;
and the test report generating unit 68 is configured to generate a test report of the target item according to the target test result if the target test result passes the verification.
The specific principle and the implementation process of each unit in the automated testing system disclosed in the embodiment of the present invention are the same as those of the automated testing method disclosed in fig. 5 in the embodiment of the present invention, and reference may be made to corresponding parts in the automated testing method disclosed in fig. 5 in the embodiment of the present invention, which are not described herein again.
The invention provides an automatic test system, which is suitable for an automatic test platform built based on GAUGE (generic object oriented testing) and at least comprises a business logic layer and a technical implementation layer, wherein a target test case corresponding to a target project is obtained and displayed from each test case pre-stored in the business logic layer, so that a user can compile a corresponding target test case code according to a target grammatical rule in the displayed target test case, and the compiled target test case code is stored to the technical implementation layer; when detecting that the target test case codes exist in the technical implementation layer, executing the target test case to call and run the target test case codes in the technical implementation layer, in the process of running the target test case codes, if the target common cases exist in the target test case codes, acquiring the target common cases from all the common cases stored in advance in the business logic layer, and executing the target common cases to call and run the target common case codes of target common case objects from the common case codes stored in the technical implementation layer; in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from each test object prestored in the business logic layer; executing the target test object to call and run a 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; checking a target test result; and if the target test result passes the verification, generating a test report of the target project according to the target test result. The automatic testing technical scheme provided by the invention can automatically complete the test without manual intervention, and solves the problems that the existing testing mode needs a large amount of manpower, the efficiency is low, and the testing result has deviation due to manual operation errors.
Optionally, the service logic layer includes a common service logic module, a common test object module and each project service layer case module, the technology implementation layer includes a common service implementation module, a common test object code module and each project service layer code module, and the target test case obtaining unit includes:
the target test case obtaining subunit is used for obtaining and displaying a target test case corresponding to the target project from each test case pre-selected and stored in each project service layer case module, so that a user can compile corresponding target test case codes based on target grammar rules in the target test case, and store the target test case codes to each project service code module of the technical implementation layer; wherein the target grammar rule is generated based on a markdown grammar;
the target test case execution unit is also used for detecting whether a target test code exists in each project service layer code module in real time; and when detecting that the target test code exists in the code module of each project service layer, executing the target test case to call and run the target test code.
Optionally, the target common use case obtaining unit includes:
the target common use case obtaining subunit is used for obtaining the target common use case from the common service logic module in the process of running the target test code if the target test code has the target common use case;
the target public use case execution unit is also used for executing the target public use case so as to call and run a target public use case code corresponding to the target public use case from the public use case code stored in the public service implementation module; the common use case code stored in the common service implementation module is written based on python.
Optionally, the target test object obtaining unit includes:
the target test object obtaining subunit is used for obtaining a target test object from the common test object module in the process of running the target common case code if the target test object exists in the target common case code;
and the target test object execution unit is further used for executing 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 to obtain a target test result.
Optionally, the target test result verification unit includes:
and the target test result verifying subunit is used for comparing the target test result with the standard test result of the target test case.
An embodiment of the present application further provides an electronic device, which includes: the system comprises a processor and a memory, wherein the processor and the memory are connected through a communication bus; the processor is used for calling and executing the program stored in the memory; the memory is used for storing a program, and the program is used for realizing an automatic test method.
Referring now to FIG. 7, a block diagram of an electronic device suitable for use in implementing the disclosed embodiments of the invention is shown. The electronic devices in the disclosed embodiments of the present invention may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the disclosed embodiments of the present invention.
As shown in fig. 7, the electronic device may include a processing device (e.g., central processing unit, graphics processor, 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 necessary for the operation of the electronic apparatus are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Generally, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 7 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program containing program code for performing the automated testing method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication means 709, or may be installed from the storage means 708, or may be installed from the ROM 702. The computer program, when executed by the processing device 701, performs the above-described functions defined in the automated testing method of the disclosed embodiment of the invention.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used for executing an automated testing method.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring and displaying a target test case corresponding to a target project from each test case pre-selected and stored in the service logic layer, so that a user can write corresponding target test case codes based on target grammatical rules in the target test case, and storing the target test case codes to the technology implementation layer;
when detecting that a target test case code exists in the technical implementation layer, executing the target test case to call and run the target test case code; in the process of running the target test case codes, if the target test case codes have target common cases, acquiring the target common cases from all the common cases pre-stored in the business logic layer; executing the target common use case to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the technical implementation layer; in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from each test object pre-stored in the business logic layer; executing the target test object to call and run a 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; verifying the target test result; and if the target test result passes the verification, generating a test report of the target project according to the target test result.
In the context of this 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. The 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, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, 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 diskette, 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.
It should be noted that the computer readable medium mentioned above in the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are merely illustrative, wherein units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that it is obvious to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements should also be considered as the protection scope of the present invention.

Claims (10)

1. An automatic testing method is characterized by being suitable for an automatic testing platform built based on GAUGE, wherein the automatic testing platform at least comprises a business logic layer and a technology implementation layer, and the method comprises the following steps:
acquiring and displaying a target test case corresponding to a target project from each test case pre-selected and stored in the service logic layer, so that a user can write corresponding target test case codes based on target grammatical rules in the target test case, and storing the target test case codes to the technology implementation layer;
when detecting that a target test case code exists in the technical implementation layer, executing the target test case to call and run the target test case code;
in the process of running the target test case codes, if the target test case codes have target common cases, acquiring the target common cases from all the common cases pre-stored in the business logic layer;
executing the target common use case to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the technical implementation layer;
in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from each test object pre-stored in the business logic layer;
executing the target test object to call and run a 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;
verifying the target test result;
and if the target test result passes the verification, generating a test report of the target project according to the target test result.
2. The method according to claim 1, wherein the service logic layer includes a common service logic module, a common test object module and each project service layer case module, the technology implementation layer includes a common service implementation module, a common test object code module and each project service layer code module, and the obtaining and displaying a target test case corresponding to a target project from each test case pre-selected and stored in the service logic layer for a user to write a corresponding target test case code based on a target grammatical rule in the target test case includes:
obtaining and displaying a target test case corresponding to a target project from each test case pre-selected and stored in each project service layer case module, so that a user can compile corresponding target test case codes based on target grammatical rules in the target test case, and store the target test case codes to each project service code module of the technology implementation layer; wherein the target grammar rule is generated based on a markdown grammar;
when detecting that the target test case code exists in the technology implementation layer, executing the target test case to call and run the target test code, including:
detecting whether the target test code exists in each project service layer code module in real time;
and when the target test code exists in each project service layer code module, executing the target test case to call and run the target test code.
3. The method according to claim 2, wherein in the process of running the target test code, if a target common use case exists in the target test code, acquiring the target common use case from the business logic layer comprises:
in the process of running the target test code, if the target test code has a target common use case, acquiring the target common use case from the common service logic module;
the 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:
executing the target public use case to call and run a target public use case code corresponding to the target public use case from the public use case code stored in the public service implementation module; and the common use case code stored in the common service implementation module is written based on python.
4. The method according to claim 3, wherein the obtaining a target test object from the business logic layer if the target test object exists in the target common use case code during the running of the target common use case code comprises:
in the process of running the target common case code, if a target test object exists in the target common case code, acquiring the target test object from the common test object module;
the executing the target test object to call and run a target test object code corresponding to the target test object from the test object code stored in the technology implementation layer to obtain a target test result includes:
and executing 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 to obtain a target test result.
5. The method of claim 1, wherein said verifying said target test result comprises:
and comparing the target test result with the standard test result of the target test case.
6. The utility model provides an automatic test system which characterized in that is applicable to the automatic test platform based on GAUGE builds, automatic test platform includes business logic layer and technical implementation layer at least, the system includes:
the target test case acquisition unit is used for acquiring and displaying a target test case corresponding to a target project from each test case pre-selected and stored in the business logic layer, so that a user can compile corresponding target test case codes based on a target grammatical rule in the target test case, and the target test case codes are stored to the technology implementation layer;
the target test case execution unit is used for executing the target test case to call and run the target test case codes when detecting that the target test case codes exist in the technical implementation layer;
a target common use case obtaining unit, configured to, in a process of running the target test use case code, obtain, if the target test use case code has a target common use case, the target common use case from each common use case pre-stored in the business logic layer;
the target common use case execution unit is used for executing the target common use case so as to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the technical implementation layer;
a target test object obtaining unit, configured to, in a process of running the target common use case code, obtain a target test object from each test object pre-stored in the service logic layer if the target test object exists in the target common use case code;
the target test object execution unit is used for executing the target test object so as to call and run a target test object code corresponding to the target test object from the test object codes stored in the technical implementation layer to obtain a target test result;
the target test result verifying unit is used for verifying the target test result;
and the test report generating unit is used for generating a test report of the target item according to the target test result if the target test result passes the verification.
7. The system according to claim 6, wherein the service logic layer includes a common service logic module, a common test object module and each project service layer case module, the technology implementation layer includes a common service implementation module, a common test object code module and each project service layer code module, and the target test case obtaining unit includes:
the target test case obtaining subunit is used for obtaining and displaying a target test case corresponding to a target project from each test case pre-selected and stored in each project service layer case module, so that a user can compile corresponding target test case codes based on target grammar rules in the target test case, and store the target test case codes to each project service code module of the technical implementation layer; wherein the target grammar rule is generated based on a markdown grammar;
the target test case execution unit is also used for detecting whether the target test codes exist in the project service layer code modules in real time; and when the target test code exists in each project service layer code module, executing the target test case to call and run the target test code.
8. The system according to claim 7, wherein the target common use case obtaining unit comprises:
the target common use case obtaining subunit is used for obtaining the target common use case from the common service logic module in the process of running the target test code if the target test code has the target common use case;
the target common use case execution unit is further used for executing the target common use case so as to call and run a target common use case code corresponding to the target common use case from the common use case codes stored in the common service implementation module; and the common use case code stored in the common service implementation module is written based on python.
9. An electronic device comprising a processor and a memory, the memory storing program code and data for automated testing, the processor being configured to invoke program instructions in the memory to perform an automated testing method according to any of claims 1-5.
10. A storage medium, comprising a stored program, wherein the program, when executed, controls a device on which the storage medium is located to perform an automated testing method according to any one of claims 1-5.
CN202210460667.4A 2022-04-28 2022-04-28 Automatic testing method, system, electronic equipment and storage medium Pending CN114817040A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210460667.4A CN114817040A (en) 2022-04-28 2022-04-28 Automatic testing method, system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210460667.4A CN114817040A (en) 2022-04-28 2022-04-28 Automatic testing method, system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114817040A true CN114817040A (en) 2022-07-29

Family

ID=82509755

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210460667.4A Pending CN114817040A (en) 2022-04-28 2022-04-28 Automatic testing method, system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114817040A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117909246A (en) * 2024-03-06 2024-04-19 广东保伦电子股份有限公司 Automatic testing method and platform for front-end webpage interface

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117909246A (en) * 2024-03-06 2024-04-19 广东保伦电子股份有限公司 Automatic testing method and platform for front-end webpage interface

Similar Documents

Publication Publication Date Title
CN110018955B (en) Generating automated test scripts by transforming manual test cases
US8291408B1 (en) Visual programming environment for mobile device applications
CN104199767B (en) Test method and device
CN113742153A (en) Equipment testing method and device, readable medium and electronic equipment
CN110674047A (en) Software testing method and device and electronic equipment
CN107391362A (en) Application testing method, mobile terminal and storage medium
CN113535567B (en) Software testing method, device, equipment and medium
CN111258998A (en) Data verification method, device, medium and electronic equipment
US20230185702A1 (en) Method and Apparatus for Generating and Applying Deep Learning Model based on Deep Learning Framework
CN112395188A (en) Test-oriented software project development method and device, electronic equipment and storage medium
CN111506904B (en) Method and device for online bug repair
CN114817040A (en) Automatic testing method, system, electronic equipment and storage medium
CN107133169B (en) Application test packet generation method and generation device
CN111625291A (en) Automatic iteration method and device of data processing model and electronic equipment
CN109408387B (en) Page testing method and device
CN113656050A (en) Method and device for generating version number
CN114328215A (en) Test data deployment method, device, equipment, readable storage medium and product
CN113849416A (en) Test method, test device, storage medium and electronic equipment
CN114185805A (en) Embedded point verification method, device, equipment and storage medium
CN116089251A (en) Interface test method, device, storage medium, and program product
CN114168485A (en) Test method, device, equipment and medium
CN114595154A (en) Test method and device for XTS failure item, electronic equipment and storage medium
CN114546850A (en) Automatic testing method, system and device for embedded point and storage medium
CN112068814A (en) Method, device, system and medium for generating executable file
CN116561015B (en) Map application testing method, electronic device and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination