CN111522748B - Automatic test case generation method, device, server and storage medium - Google Patents

Automatic test case generation method, device, server and storage medium Download PDF

Info

Publication number
CN111522748B
CN111522748B CN202010337865.2A CN202010337865A CN111522748B CN 111522748 B CN111522748 B CN 111522748B CN 202010337865 A CN202010337865 A CN 202010337865A CN 111522748 B CN111522748 B CN 111522748B
Authority
CN
China
Prior art keywords
test
information
generated
test object
type
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.)
Active
Application number
CN202010337865.2A
Other languages
Chinese (zh)
Other versions
CN111522748A (en
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 CN202010337865.2A priority Critical patent/CN111522748B/en
Publication of CN111522748A publication Critical patent/CN111522748A/en
Application granted granted Critical
Publication of CN111522748B publication Critical patent/CN111522748B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/3684Test management for test design, e.g. generating new test cases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

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)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides an automatic test case generation method, an automatic test case generation device, a server and a storage medium, wherein a test object set related to test requirements of items to be generated is obtained, and the test object set is composed of a plurality of test objects in the items to be generated, which are sequentially ordered; object information of a test object is preset based on business requirements of items to be generated, test information of the test object is generated according to object types indicated by the object information of the test object, and an automatic test case is built based on the test information of each test object sequenced in sequence in a test object set. Based on the method and the device, the automatic test cases can be generated before interface molding, the generation period of the automatic test cases is shortened, the generation efficiency of the automatic test cases is improved, and the problems that the script recording and maintenance time cost of the conventional interface-level automatic test tool is high, and the conventional interface-level automatic test tool can only be used for regression testing and cannot realize quick response test delivery are solved.

Description

Automatic test case generation method, device, server and storage medium
Technical Field
The present invention relates to the field of computer testing technology, and more particularly, to an automated test case generation method, an apparatus, a server, and a storage medium.
Background
With the popularity of automated testing techniques, testing of a user interface (UI, userInterface) of a device is gradually changed from manual testing to UI automated testing. UI automation testing, i.e., simulating user operations on the UI by a machine, thereby performing automation testing, mainly includes Web page (Web) UI automation testing and local application UI automation testing.
The test flow of the conventional interface-level automatic test tool is interface molding, script recording, script debugging, case and object library generation and regression test, the test case generation by the method is required to depend on the developed molding interface, the time cost of script recording and maintenance is high, the test tool can only be used for regression test, quick response test delivery can not be performed, and the generation efficiency of the test case is reduced.
Disclosure of Invention
In view of this, the present application provides a method, an apparatus, a server, and a storage medium for generating an automated test case, which can generate an automated test case before interface molding, shorten a generation period of the automated test case, improve a generation efficiency of the automated test case, and solve the problem that the existing interface-level automated test tool script has high recording and maintenance time costs, and can only be used for regression testing, so that quick response test delivery cannot be achieved. The technical proposal is as follows:
The first aspect of the invention discloses an automated test case generation method, which comprises the following steps:
acquiring a test object set related to the test requirement of a project to be generated, wherein the test object set consists of a plurality of test objects in the project to be generated, which are sequentially ordered;
determining object information of the test object preset based on the business requirement of the project to be generated;
generating test information of the test object according to the object type indicated by the object information of the test object, wherein the test information indicates operation information of the test object;
and constructing an automatic test case based on the test information of each test object sequenced in turn in the test object set.
Optionally, the determining the object information of the test object preset based on the service requirement of the item to be generated includes:
determining an object library preset based on the business requirement of the item to be generated, wherein the object library comprises object information of a plurality of objects;
and querying the object library, and acquiring object information of the object with the same object name as the test object from the object library, wherein the object information comprises positioning information of the object at the front end.
Optionally, the method further comprises an object library generation process, wherein the object library generation process comprises the following steps:
determining object basic information of each object in the to-be-generated item based on the business requirement of the to-be-generated item, wherein the object basic information comprises an object name, an object type and an object identification;
acquiring a preset positioning information generation template, filling an object identifier of the object into a preset position of the positioning information generation template, and generating positioning information of the object at the front end;
and constructing object information of the object according to the object name, the object type and the positioning information of the object.
Optionally, the generating the test information of the test object according to the object type indicated by the object information of the test object, where the test information indicates operation information of the test object includes:
searching a preset corresponding relation between the object type and the operation type, and acquiring a plurality of operation types corresponding to the object type indicated by the object information of the test object;
determining the operation type with the highest priority among the operation types according to the acquired priority of the operation types relative to the object type indicated by the object information of the test object;
And generating test information of the test object according to the determined operation type.
Optionally, the generating test information of the test object according to the determined operation type includes:
judging whether the determined operation type carries an input identifier or not;
if the determined operation type does not carry the input identification, generating test information of the test object according to the determined operation type;
if the determined operation type carries an input identifier, acquiring a preset input information configuration table, and determining input information matched with the operation type from the input information configuration table;
and generating test information of the test object according to the determined operation type and the input information.
Optionally, the constructing an automated test case based on the test information of each test object sequenced in turn in the test object set includes:
and sequencing the test information of each test object in the test object set according to the arrangement sequence of the test objects in the test object set to generate an automatic test case.
In a second aspect, the invention discloses an automated test case generation apparatus comprising:
the first acquisition unit is used for acquiring a test object set related to the test requirement of the item to be generated, wherein the test object set consists of a plurality of test objects in the item to be generated, which are sequentially ordered;
A first determining unit, configured to determine object information of the test object preset based on a service requirement of the item to be generated;
the first generation unit is used for generating test information of the test object according to the object type indicated by the object information of the test object, wherein the test information indicates operation information of the test object;
and the test case construction unit is used for constructing an automatic test case based on the test information of each test object in the test object set, wherein the test information is sequentially ordered.
Optionally, the first determining unit includes:
a second determining unit configured to determine an object library preset based on a business requirement of the item to be generated, the object library including object information of a plurality of objects;
and the query unit is used for querying the object library, and obtaining object information of the object with the same object name as the test object in the past from the object library, wherein the object information comprises positioning information of the object at the front end.
A third aspect of the present invention discloses a server comprising: at least one memory and at least one processor; the memory stores a program, and the processor invokes the program stored in the memory, where the program is configured to implement the automated test case generation method disclosed in any one of the first aspects of the present invention.
A fourth aspect of the invention discloses a computer-readable storage medium having stored therein computer-executable instructions for performing the automated test case generation method as disclosed in any of the above-described first aspects of the invention.
The invention provides an automatic test case generation method, an automatic test case generation device, a server and a storage medium, wherein a test object set related to test requirements of items to be generated is obtained, and the test object set is composed of a plurality of test objects in the items to be generated, which are sequentially ordered; object information of a test object is preset based on business requirements of items to be generated, test information of the test object is generated according to object types indicated by the object information of the test object, and an automatic test case is built based on the test information of each test object sequenced in sequence in a test object set.
Based on the invention, the object information of the test object can be preset based on the service requirement of the project to be generated, the object type indicated by the object information of the test object can be determined to generate the test information of the test object, and then the automatic test case is constructed by the test information of each test object sequenced in sequence in the test object set, so that the automatic test case can be generated before the interface is formed, the generation period of the automatic test case is shortened, the generation efficiency of the automatic test case is improved, and the problem that the conventional interface-level automatic test tool can only be used for regression test and can not realize quick response test delivery is solved. In addition, the invention does not need to record the script in the process of generating the automatic test case, thereby solving the problem of high script recording and maintenance time cost in the prior art.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of an automated test case generation method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for determining object information of a test object preset based on a business requirement of a project to be generated according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for generating test information of a test object according to an object type indicated by object information of the test object according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an automated test case generating apparatus according to an embodiment of the present invention;
fig. 5 is a block diagram of a server according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In this application, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
According to the background technology, the test flow of the conventional interface-level automatic test tool is interface molding-script recording-script debugging-case and object library generation-regression test, the test case generation by the method is required to depend on the developed molding interface, the time cost of script recording and maintenance is high, and the test tool is only used for regression test and cannot be used for quick response test delivery, so that the generation efficiency of the test case is reduced.
Therefore, the invention provides an automatic test case generation method, an automatic test case generation device, a server and a storage medium, wherein object information of a test object is preset based on service requirements of a project to be generated, the object type indicated by the object information of the test object is determined to generate test information of the test object, and further, an automatic test case is constructed through the test information of each test object sequenced in sequence in a test object set, so that the automatic test case can be generated before interface forming, the generation period of the automatic test case is shortened, the generation efficiency of the automatic test case is improved, and the problem that the conventional interface-level automatic test tool can only be used for regression test and can not realize quick response test delivery is solved. In addition, the invention does not need to record the script in the process of generating the automatic test case, thereby solving the problem of high script recording and maintenance time cost in the prior art.
Referring to fig. 1, a flow chart of an automated test case generation method according to an embodiment of the present invention is shown. The automatic test case generation method specifically comprises the following steps:
s101: acquiring a test object set related to the test requirements of the items to be generated, wherein the test object set consists of a plurality of test objects in the items to be generated, which are sequenced in sequence;
in the embodiment of the application, the to-be-generated item may be an information system to-be-generated item, where one to-be-generated item may include multiple services, and one service includes multiple test objects. For example, an item to be generated may include a login service, a registration service, an upload service, and so on. If a certain service in the project to be generated is required to be tested, namely, when the test requirement of the project to be generated exists, a test object set related to the test requirement of the project to be generated is obtained, wherein the test object set is composed of a plurality of test objects in the project to be generated, which are sequentially ordered.
In the embodiment of the application, for each service in the items to be generated, a test object set related to the test requirement of the service is preset. The process of the preset test object set related to the test requirement of the service can be as follows: presetting an object library of the item to be generated based on the business requirement of the item to be generated, wherein the object library comprises object information of a plurality of objects; and carrying out standardization and standardization on each object contained in the service by adopting a preset standard format, and sequencing each object subjected to standardization and standardization according to service requirements to generate a test object set related to the test requirements of the service.
It should be noted that, the preset standard format may be "interface object+operation+data". The inventor can set specific content related to the preset standard format according to his own requirements, and the embodiments of the present application are not limited.
In the embodiment of the present application, the generating process of the object library preset based on the service requirement of the item to be generated may be: firstly, determining object basic information of each object in a project to be generated based on the business requirement of the project to be generated; secondly, acquiring a preset positioning information generation template, filling object identifiers of the objects into preset positions of the positioning information generation template, and generating positioning information of the objects at the front end; finally, object information of the object is constructed according to the object name, the object type and the positioning information of the object. Wherein the basic information of the object comprises an object name, an object type and an object identification.
In the embodiment of the present application, the object name of the object may be a user name, a password, a login, and the like. The object type of the object may be a button, a text box, a drop down box, a table, a check box, or the like. Regarding the object name of the object and the object type of the object, the inventor can set according to his own requirements, and the embodiments of the present application are not limited.
It should be noted that, after object basic information of each object in the project to be generated is processed by project developers according to the usage development specification of formulated objects and the object names and object categories of all objects designed for interactive operation based on the system UI design diagram related in advance by a product manager or an interactive designer, unique object identifications are formulated for each object according to the object category of each object in the page object list and related interactive operation requirements.
It should be further noted that, because of adopting the system pages of different development frameworks, the object implementation style and interaction mode are different, and specific actions to be executed when the object automation operation is performed according to the object need to be adjusted specifically.
In the embodiment of the present application, for each object in each object library, the positioning information generation template corresponding to the object may be preset according to the usage development specification of the execution object.
S102: determining object information of a test object preset based on the test requirement of a project to be generated;
referring to fig. 2, a flowchart of a method for determining object information of a test object preset based on a service requirement of a project to be generated according to an embodiment of the present invention is shown, where the method specifically includes the following steps:
S201: determining an object library preset based on the business requirement of the item to be generated, wherein the object library comprises object information of a plurality of objects;
in the embodiment of the application, an object library is preset according to the service requirement of the item to be generated, and the object library comprises object information of each object of the item to be generated.
S202: and querying an object library, and acquiring object information of an object with the same object name as the test object from the object library, wherein the object information comprises positioning information of the object at the front end.
In the embodiment of the application, a plurality of test objects in a project to be generated are determined based on the acquired test object set related to the test requirement of the project to be generated; for each of the determined test objects, object information of an object having the same object name as the test object is acquired from the object library by querying the determined object library.
In the embodiment of the application, after the service requirement of the item to be generated determines a preset object library, the determined object library is queried so as to acquire the object information of the object with the same object name as that of the test object from the determined object library, namely, the object information of the test object is acquired from the object library, and the acquired object information comprises the positioning information of the object at the front end; and the object can be positioned and captured based on the positioning information of the object, so that the constraint of an interface is eliminated, and an automatic test case can be generated before the interface is formed.
S103: generating test information of the test object according to the object type indicated by the object information of the test object, wherein the test information indicates operation information of the test object;
in the embodiment of the application, the object information of the test object comprises an object name, an object type and positioning information of the object at the front end; after determining the object information of the test object, the test information of the test object can be generated according to the object type indicated by the object information of the test object.
S104: and constructing an automatic test case based on the test information of each test object sequenced in sequence in the test object set.
In the specific execution of step S104, after each test object in the test object set generates corresponding test information based on the object type indicated by the respective object information, the test information of each test object in the test object set is ordered according to the arrangement sequence of the test objects in the test object set to generate an automated test case.
For example, the test object set related to the test requirement of the login service in the item to be generated is a user name test object, a password test object and a login test object; when the test requirement of the existing project to be generated is to test the login service in the project to be generated, a test object set related to the test requirement of the login service is obtained, and the test object set is composed of a user name test object, a password test object and a login test object which are sequentially ordered. Inquiring an object library which is determined in advance according to the login service requirement, and acquiring object information of an object with the same object name as a user name test object (namely, the object information of the user name test object), object information of an object with the same object name as a password test object (namely, the object information of the password test object) and object information of an object with the same object name as a login test object (namely, the object information of the login test object) from the object library; generating test information of the user name test object according to the object type indicated by the object information of the user name test object, generating test information of the password test object according to the object type indicated by the object information of the password test object, and generating test information of the login test object according to the object type indicated by the object information of the login test object; and sequencing the test information of the user name test object, the test information of the password test object and the test information of the login test object according to the arrangement sequence of each test object in the test object set, namely according to the arrangement sequence of the user name test object, the password test object and the test information of the login test object to obtain the test information of the user name test object, the test information of the password test object and the test information of the login test object, and further constructing an automatic test case according to the test information of the user name test object, the test information of the password test object and the test information of the login test object.
The invention provides an automatic test case generation method, which comprises the steps of acquiring a test object set related to test requirements of items to be generated, wherein the test object set consists of a plurality of test objects in the items to be generated, which are sequenced in sequence; object information of a test object is preset based on business requirements of items to be generated, test information of the test object is generated according to object types indicated by the object information of the test object, and an automatic test case is built based on the test information of each test object sequenced in sequence in a test object set. Based on the invention, the object information of the test object can be preset based on the business requirement of the project to be generated, the object type indicated by the object information of the test object can be determined to generate the test information of the test object, and then the automatic test case is constructed by the test information of each test object sequenced in sequence in the test object set, so that the automatic test case can be generated before the interface is formed, the generation period of the automatic test case is shortened, the generation efficiency of the automatic test case is improved, and the problem that the conventional interface-level automatic test tool can only be used for regression test and can not realize quick response test delivery is solved. In addition, the invention does not need to record the script in the process of generating the automatic test case, thereby solving the problem of high script recording and maintenance time cost in the prior art.
Referring to fig. 3, a flowchart of a method for generating test information of a test object according to an object type indicated by object information of the test object according to an embodiment of the present invention is shown, where the method specifically includes the following steps:
s301: searching a preset corresponding relation between the object type and the operation type, and acquiring a plurality of operation types corresponding to the object type indicated by the object information of the test object;
in the embodiment of the application, the object relationship between the object type and the operation type is preset, after the object information of the test object preset based on the service requirement of the item to be generated is determined, the corresponding relationship between the preset object type and the operation type is queried, and then the operation type corresponding to the object type indicated by the object information of the test object is obtained.
In the embodiment of the present application, the object type indicated by the object information of the test object may be a button, a text box, a drop-down box, a table, a check box, or the like.
The corresponding relation between a plurality of groups of object types and operation types can be preset, wherein the corresponding relation between each group of object types and operation types comprises one object type and one or more operation types corresponding to the object type, and the object types included in the corresponding relation between two different groups of object types and operation types are different; after determining object information of a test object preset based on the business requirement of an item to be generated, inquiring the corresponding relation between a plurality of groups of object types and operation types, and determining the operation type corresponding to the object type indicated by the object information of the test object. For example, the object type indicated by the object information of the test object is a text box, and the operation type corresponding to the object type may be input or the like. The inventor can set the specific content of the object type indicated by the object information about the test object and the specific content of the operation type of the object type according to his own requirements, and the embodiment of the application is not limited.
S302: determining the operation type with the highest priority among the operation types according to the acquired priority of the operation types relative to the object type indicated by the object information of the test object;
in the process of specifically executing step S302, priorities of a plurality of operation types corresponding to the object types indicated by the object information of the test object may be preset. After the plurality of operation types corresponding to the object information of the test object are acquired, an operation type with the highest priority among the plurality of operation types may be determined according to the acquired priority of the plurality of operation types with respect to the object type indicated by the object information of the test object.
In the embodiment of the present application, among a plurality of operation types corresponding to the object type indicated by the object information of the test object, the most commonly used operation type may be set as the operation type with the highest priority among the plurality of operation types. For example, when the object type indicated by the object information of the test object is a check box and the operation type corresponding to the object type includes an operation type a, an operation type B and an operation type C, if the operation type a is the most used operation type among the plurality of operation types corresponding to the object type, the operation type a is set as the operation type with the highest priority among the operation type a, the operation type B and the operation type C, and then the operation type a is used as the operation type determined in step S302, and step S303 is executed based on the operation type a.
S303: judging whether the determined operation type carries an input identifier or not; if the determined operation type does not carry the input identifier, executing step S304; if the determined operation type carries the input identifier, step S305 is performed.
In the specific execution of step S303, after determining the operation type with the highest priority among the plurality of operation types, determining whether the determined operation type carries an input identifier, and if the determined operation type does not carry the input identifier, generating test information of the test object according to the determined operation type; if the determined operation type carries the input identification, acquiring a preset input information configuration table, and determining input information matched with the operation type from the input information configuration table.
S304: generating test information of the test object according to the determined operation type;
in the specific execution process of step S304, if the determined operation type does not carry the input identifier, test information of the test object is generated according to the determined operation type.
For example, when the object name of the test object is login, the object type indicated by the object information of the test object is a "button", and the operation type with the highest priority corresponding to the "button" object type is a "click", since the "click" operation type does not carry the input identifier, the input information matched with the "click" operation type can be considered to be empty, and further the test information of the test object is generated according to the determined operation type to be login+click+null, and NULL indicates that the input information matched with the operation type is empty.
S305: and acquiring a preset input information configuration table, and determining input information matched with the operation type from the input information configuration table.
In the specific execution of step S305, an input information configuration table is preset, if the operation type corresponding to the object type indicated by the determined object information of the test object carries an input identifier, the preset input information configuration table is obtained, and according to the object name of the test object, the input information matched with the operation type is determined from the preset input information configuration table.
S306: and generating test information of the test object according to the determined operation type and the input information.
In the process of specifically executing step S306, after determining input information matching the operation type corresponding to the object type indicated by the object information of the determined test object from the input information configuration table, test information of the test object is generated according to the determined operation type and the input information.
For example, the preset input information configuration table includes 12345 as input information corresponding to the object name of the test object being user name 1; when the object name of the test object is 1234567 and the object name of the test object is user name 1, the object type indicated by the object information of the test object is a text box, and the operation type with highest priority corresponding to the operation type corresponding to the object type is an input operation type, the operation type can be determined to carry an input identification, a preset input information configuration table is obtained, and according to the object name of the test object, namely, according to user name 1, the input information matched with the operation type is determined to be 12345 from the input information configuration table; and further generating test information of the test object as user name 1+ input +12345 according to the determined operation type and the input information.
Further, in this embodiment of the present application, an editing interface may be preset, and before the automatic test case is generated, the user may modify the determined operation type and/or input information through the preset editing interface, and use the operation type and input information modified by the user as the finally determined operation type and/or input information, so as to generate test information according to the finally determined operation type input information, so as to form the automatic test case based on the test information of each test object in the test object set, where the test information is sequentially ordered.
In the embodiment of the application, through searching a preset corresponding relation between the object type and the operation type, acquiring each operation type corresponding to the object type indicated by the object information of the test object, taking the operation type with the highest priority of each acquired operation type relative to the operation type as the finally determined operation type, and if the determined operation type does not carry an input identifier, directly generating the test information of the test object according to the determined operation type; if the determined operation type carries an input identifier, determining input information matched with the operation type from a preset input information configuration table, and further generating object information of the test object according to the determined operation type and the input information; and then, an automatic test case can be directly constructed according to the test information of each test object sequenced in sequence in the test object set, and the automatic test case is generated before interface molding, so that the generation period of the automatic test case is shortened, and the generation efficiency of the automatic test case is improved.
Based on the method for generating the automated test case disclosed by the embodiment of the invention, the embodiment of the invention correspondingly discloses an apparatus for generating the automated test case, as shown in fig. 4, the apparatus for generating the automated test case comprises:
a first obtaining unit 41, configured to obtain a test object set related to a test requirement of a to-be-generated item, where the test object set is composed of test objects in a plurality of to-be-generated items sequentially ordered;
a first determining unit 42 for determining object information of a test object preset based on a business requirement of a project to be generated;
a first generating unit 43, configured to generate test information of a test object according to an object type indicated by object information of the test object, where the test information indicates operation information on the test object;
a test case construction unit 44 for constructing an automated test case based on the test information of each test object in the test object set ordered in turn.
The specific principle and the execution process of each unit in the automatic test case generating device disclosed in the embodiment of the present invention are the same as those of the automatic test case generating method disclosed in the embodiment of the present invention, and reference may be made to corresponding parts in the automatic test case generating method disclosed in the embodiment of the present invention, so that no redundant description is given here.
The invention provides an automatic test case generation device, which is characterized in that a test object set related to test requirements of items to be generated is obtained, wherein the test object set consists of a plurality of test objects in the items to be generated, which are sequentially ordered; object information of a test object is preset based on business requirements of items to be generated, test information of the test object is generated according to object types indicated by the object information of the test object, and an automatic test case is built based on the test information of each test object sequenced in sequence in a test object set. Based on the invention, the object information of the test object can be preset based on the service requirement of the project to be generated, the object type indicated by the object information of the test object can be determined to generate the test information of the test object, and then the automatic test case is constructed by the test information of each test object sequenced in sequence in the test object set, so that the automatic test case can be generated before the interface is formed, the generation period of the automatic test case is shortened, the generation efficiency of the automatic test case is improved, and the problem that the conventional interface-level automatic test tool can only be used for regression test and can not realize quick response test delivery is solved. In addition, the invention does not need to record the script in the process of generating the automatic test case, thereby solving the problem of high script recording and maintenance time cost in the prior art.
In an embodiment of the present application, the first determining unit includes:
a second determining unit configured to determine an object library preset based on a business requirement of an item to be generated, the object library including object information of a plurality of objects;
and the query unit is used for querying an object library, and object information of an object with the same object name as the tested object in the past is included in the object library, wherein the object information comprises positioning information of the object at the front end.
The embodiment of the application provides an automatic test case generation device, which further comprises an object library generation process, and specifically comprises the following steps:
the second generation unit is used for determining object basic information of each object in the to-be-generated project based on the business requirement of the to-be-generated project, wherein the object basic information comprises an object name, an object type and an object identification;
the second acquisition unit is used for acquiring a preset positioning information generation template, filling the object identifier of the object into a preset position of the positioning information generation template, and generating positioning information of the object at the front end;
and the construction unit is used for constructing object information of the object according to the object name, the object type and the positioning information of the object.
In an embodiment of the present application, the first generating unit includes:
The searching unit is used for searching the corresponding relation between the preset object type and the operation type and acquiring a plurality of operation types corresponding to the object type indicated by the object information of the test object;
a third determining unit configured to determine an operation type with the highest priority among the plurality of operation types according to the acquired priorities of the plurality of operation types with respect to the object type indicated by the object information of the test object;
and the third generating unit is used for generating the test information of the test object according to the determined operation type.
In an embodiment of the present application, the third generating unit includes:
the judging unit is used for judging whether the determined operation type carries an input identifier or not;
a fourth generating unit, configured to generate test information of the test object according to the determined operation type if the determined operation type does not carry the input identifier;
a fourth determining unit, configured to obtain a preset input information configuration table if the determined operation type carries an input identifier, and determine input information matched with the operation type from the input information configuration table;
and a fifth generating unit for generating test information of the test object according to the determined operation type and the input information.
In an embodiment of the present application, a test case construction unit includes:
the test case construction subunit is used for sequencing the test information of each test object in the test object set according to the arrangement sequence of the test objects in the test object set to generate an automatic test case.
The following describes in detail a hardware structure of a server to which the automated test case generation method provided in the embodiment of the present application is applicable, taking an example in which the automated test case generation method is applied to the server.
The method for generating the automatic test cases can be applied to a server, wherein the server can be a service device for providing services for users on a network side, and the server can be a server cluster formed by a plurality of servers or a single server.
Optionally, fig. 5 shows a block diagram of a hardware structure of a server to which the method for generating an automated test case according to the embodiment of the present application is applicable, and referring to fig. 5, the hardware structure of the server may include: a processor 51, a memory 52, a communication interface 53 and a communication bus 54;
in the embodiment of the present invention, the number of the processor 51, the memory 52, the communication interface 53 and the communication bus 54 may be at least one, and the processor 51, the memory 52 and the communication interface 53 complete communication with each other through the communication bus 54;
The processor 51 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention, etc.;
the memory 52 may comprise a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory;
wherein the memory stores a program, and the processor is operable to invoke the program stored in the memory, the program being operable to:
acquiring a test object set related to the test requirements of the items to be generated, wherein the test object set consists of a plurality of test objects in the items to be generated, which are sequenced in sequence;
determining object information of a test object preset based on the business requirement of a project to be generated;
generating test information of the test object according to the object type indicated by the object information of the test object, wherein the test information indicates operation information of the test object;
and constructing an automatic test case based on the test information of each test object sequenced in sequence in the test object set.
For the function of the program, reference is made to the above detailed description of an automated test case generation method provided in the embodiments of the present application, which is not repeated here.
Further, embodiments of the present application also provide a computer storage medium having stored therein computer-executable instructions for performing the automated test case generation method described above.
For details of the computer-executable instructions, reference is made to the above detailed description of an automated test case generation method provided in the embodiments of the present application, which is not repeated here.
The foregoing has described in detail the method, apparatus, server and storage medium for automated test case generation provided by the present invention, and specific examples have been applied herein to illustrate the principles and embodiments of the present invention, the description of the foregoing examples being merely intended to facilitate the understanding of the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
It is further noted that relational terms such as first and second, and the like are 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. Moreover, 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, or is intended to include, elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
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.

Claims (7)

1. An automated test case generation method, comprising:
acquiring a test object set related to the test requirement of a project to be generated, wherein the test object set consists of a plurality of test objects in the project to be generated, which are sequentially ordered;
determining object information of the test object preset based on the business requirement of the project to be generated;
generating test information of the test object according to the object type indicated by the object information of the test object, wherein the test information indicates operation information of the test object;
constructing an automatic test case based on the test information of each test object sequenced in sequence in the test object set; the determining the object information of the test object preset based on the service requirement of the item to be generated comprises the following steps:
determining an object library preset based on the business requirement of the item to be generated, wherein the object library comprises object information of a plurality of objects;
querying the object library, and acquiring object information of an object with the same object name as the test object from the object library, wherein the object information comprises positioning information of the object at the front end;
The generating test information of the test object according to the object type indicated by the object information of the test object, wherein the test information indicates operation information of the test object, and the method comprises the following steps:
searching a preset corresponding relation between the object type and the operation type, and acquiring a plurality of operation types corresponding to the object type indicated by the object information of the test object;
determining the operation type with the highest priority among the operation types according to the acquired priority of the operation types relative to the object type indicated by the object information of the test object;
and generating test information of the test object according to the determined operation type.
2. The method of claim 1, further comprising an object library generation process comprising:
determining object basic information of each object in the to-be-generated item based on the business requirement of the to-be-generated item, wherein the object basic information comprises an object name, an object type and an object identification;
acquiring a preset positioning information generation template, filling an object identifier of the object into a preset position of the positioning information generation template, and generating positioning information of the object at the front end;
And constructing object information of the object according to the object name, the object type and the positioning information of the object.
3. The method of claim 1, wherein generating test information for the test object according to the determined operation type comprises:
judging whether the determined operation type carries an input identifier or not;
if the determined operation type does not carry the input identification, generating test information of the test object according to the determined operation type;
if the determined operation type carries an input identifier, acquiring a preset input information configuration table, and determining input information matched with the operation type from the input information configuration table;
and generating test information of the test object according to the determined operation type and the input information.
4. The method of claim 1, wherein the constructing an automated test case based on the test information of each of the test objects in the set of test objects ordered in turn comprises:
and sequencing the test information of each test object in the test object set according to the arrangement sequence of the test objects in the test object set to generate an automatic test case.
5. An automated test case generation apparatus, comprising:
the first acquisition unit is used for acquiring a test object set related to the test requirement of the item to be generated, wherein the test object set consists of a plurality of test objects in the item to be generated, which are sequentially ordered;
a first determining unit, configured to determine object information of the test object preset based on a service requirement of the item to be generated;
the first generation unit is used for generating test information of the test object according to the object type indicated by the object information of the test object, wherein the test information indicates operation information of the test object;
the test case construction unit is used for constructing an automatic test case based on the test information of each test object sequenced in sequence in the test object set; the first determination unit includes:
a second determining unit configured to determine an object library preset based on a business requirement of the item to be generated, the object library including object information of a plurality of objects;
a query unit, configured to query the object library, and from the object library, object information of an object having the same object name as the test object in the past, where the object information includes positioning information of the object at a front end;
The first generation unit includes:
the searching unit is used for searching the corresponding relation between the preset object type and the operation type and acquiring a plurality of operation types corresponding to the object type indicated by the object information of the test object;
a third determining unit configured to determine an operation type with the highest priority among the plurality of operation types according to the acquired priorities of the plurality of operation types with respect to the object type indicated by the object information of the test object;
and the third generating unit is used for generating the test information of the test object according to the determined operation type.
6. A server, comprising: at least one memory and at least one processor; the memory stores a program, and the processor invokes the program stored in the memory, the program being configured to implement the automated test case generation method of any of claims 1-4.
7. A computer readable storage medium having stored therein computer executable instructions for performing the automated test case generation method of any of claims 1-4.
CN202010337865.2A 2020-04-26 2020-04-26 Automatic test case generation method, device, server and storage medium Active CN111522748B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010337865.2A CN111522748B (en) 2020-04-26 2020-04-26 Automatic test case generation method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010337865.2A CN111522748B (en) 2020-04-26 2020-04-26 Automatic test case generation method, device, server and storage medium

Publications (2)

Publication Number Publication Date
CN111522748A CN111522748A (en) 2020-08-11
CN111522748B true CN111522748B (en) 2023-06-13

Family

ID=71904592

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010337865.2A Active CN111522748B (en) 2020-04-26 2020-04-26 Automatic test case generation method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN111522748B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597025A (en) * 2020-12-25 2021-04-02 中国农业银行股份有限公司 Test case generation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345532A (en) * 2017-01-23 2018-07-31 ***通信集团浙江有限公司 A kind of automatic test cases generation method and device
CN108710569A (en) * 2018-05-09 2018-10-26 深圳壹账通智能科技有限公司 Test cases generation method, data creation method, device, equipment and medium
WO2019165691A1 (en) * 2018-02-28 2019-09-06 平安科技(深圳)有限公司 Method, apparatus and device for automatically generating test case, and readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9396098B2 (en) * 2014-03-26 2016-07-19 Mckesson Financial Holdings Apparatuses, methods, and computer program products for conducting automated tests

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345532A (en) * 2017-01-23 2018-07-31 ***通信集团浙江有限公司 A kind of automatic test cases generation method and device
WO2019165691A1 (en) * 2018-02-28 2019-09-06 平安科技(深圳)有限公司 Method, apparatus and device for automatically generating test case, and readable storage medium
CN108710569A (en) * 2018-05-09 2018-10-26 深圳壹账通智能科技有限公司 Test cases generation method, data creation method, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王哲煊.设计自动化和零编码测试开发解决方案.电脑编程技巧与维护.2019,(12),全文. *

Also Published As

Publication number Publication date
CN111522748A (en) 2020-08-11

Similar Documents

Publication Publication Date Title
CN108958736B (en) Page generation method and device, electronic equipment and computer readable medium
CN110968309B (en) Template generation method and device, electronic equipment and storage medium
CN111506444A (en) Form approval method and device, storage medium and electronic equipment
CN107423070B (en) Page generation method and device
CN110716783A (en) Front-end page generation and deployment method and device, storage medium and equipment
CN101193007A (en) Testing method, scenario testing method and corresponding device for URL command
CN110908890A (en) Automatic test method and device for interface
US20220350857A1 (en) Methods and systems for browser extension used to generate relative xpath, absolute xpath and/or css selectors
CN114594927A (en) Low code development method, device, system, server and storage medium
EP3968145A1 (en) Apparatus and method for executing customized artificial intelligence production line, and device and medium
CN110990126A (en) Method and device for realizing shortcut front-end service page based on js
CN111522748B (en) Automatic test case generation method, device, server and storage medium
CN112965912B (en) Interface test case generation method and device and electronic equipment
CN112365192A (en) Method for establishing flow model in manufacturing execution system, electronic device and method for analyzing flow model
CN116166533A (en) Interface testing method, device, terminal equipment and storage medium
CN116225690A (en) Memory multidimensional database calculation load balancing method and system based on docker
CN112328680B (en) Electronic component data processing method, data interface and management system
CN113434119A (en) Business processing method and device based on process control
CN113867778A (en) Method and device for generating mirror image file, electronic equipment and storage medium
CN112699251A (en) Data aggregation method and device, electronic equipment and storage medium
CN112307736A (en) Application project creating method, device, equipment and storage medium
Coleman Data flow sequences: A revision of data flow diagrams for modelling applications using XML.
CN117472372B (en) Responsive form construction method and system
CN113704672B (en) Comment method based on browser plug-in, browser plug-in and readable storage medium
CN113986305B (en) B/S model upgrade detection method, device, equipment and storage 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
GR01 Patent grant
GR01 Patent grant