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

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

Info

Publication number
CN111522748A
CN111522748A CN202010337865.2A CN202010337865A CN111522748A CN 111522748 A CN111522748 A CN 111522748A CN 202010337865 A CN202010337865 A CN 202010337865A CN 111522748 A CN111522748 A CN 111522748A
Authority
CN
China
Prior art keywords
test
information
generated
test object
project
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.)
Granted
Application number
CN202010337865.2A
Other languages
Chinese (zh)
Other versions
CN111522748B (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 a test requirement of a project to be generated is obtained, and the test object set is composed of test objects in a plurality of projects to be generated which are sequentially sequenced; determining object information of a test object preset based on the business requirements of the items to be generated, generating test information of the test object according to the object type indicated by the object information of the determined test object, and constructing an automatic test case based on the test information of each test object sequentially sequenced in a test object set. Based on the invention, 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 problems that the existing interface level automatic test tool script recording and maintenance time cost is high, and the quick response test delivery can not be realized only by being used for regression test are solved.

Description

Automatic test case generation method and device, server and storage medium
Technical Field
The invention relates to the technical field of computer testing, in particular to an automatic test case generation method, an automatic test case generation device, a server and a storage medium.
Background
With the popularization of automated testing technology, testing a User Interface (UI) of a device gradually changes from manual testing to UI automated testing. The UI automation test is that a machine simulates the operation of a user aiming at the UI so as to carry out automation test, and mainly comprises a webpage (Web) UI automation test and a local application UI automation test.
The test flow of the existing interface-level automatic test tool is 'interface forming-script recording-script debugging-case and object library generating-regression test', the test case generated by the method needs to depend on a developed forming interface, the time cost of script recording and maintenance is high, the test case can only be used for regression test, quick response test delivery cannot be realized, and the generation efficiency of the test case is reduced.
Disclosure of Invention
In view of the above, the present application provides an automatic test case generation method, an automatic test case generation device, a server, and a storage medium, which can generate an automatic test case before interface formation, shorten a generation period of the automatic test case, improve generation efficiency of the automatic test case, and solve the problems that an existing interface-level automatic test tool is high in script recording and maintenance time cost, and cannot achieve quick response test delivery only in a regression test. The technical scheme is as follows:
the first aspect of the invention discloses an automatic 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 sequenced;
determining object information of the test object preset based on the service 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 sequentially sequenced 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 project 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 includes an object library generating process, where the object library generating process includes:
determining object basic information of each object in the project to be generated based on the service requirement of the project to be generated, wherein the object basic information comprises an object name, an object type and an object identifier;
acquiring a preset positioning information generation template, filling an object identifier of the object to a preset position of the positioning information generation template, and generating positioning information of the object at the front end;
and constructing the object information of the object according to the object name, the object type and the positioning information of the object.
Optionally, the generating 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 on 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 in the plurality of operation types according to the priority of the plurality of acquired operation types relative to the object type indicated by the object information of the test object;
and generating the 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 the 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 sequentially ordered in the test object set includes:
and sequencing the test information of each test object in the test object set according to the sequence of the test objects in the test object set to generate an automatic test case.
The second aspect of the present invention discloses an automated test case generating apparatus, including:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a test object set related to a test requirement of a project to be generated, and the test object set consists of a plurality of test objects in the project to be generated which are sequentially sequenced;
the first determining unit is used for determining object information of the test object preset based on the service requirement of the project to be generated;
a first generating unit, configured to generate test information of the 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;
and the test case construction unit is used for constructing an automatic test case based on the test information of each test object sequentially sequenced in the test object set.
Optionally, the first determining unit includes:
a second determining unit, configured to determine an object library preset based on a service requirement of the item to be generated, where the object library includes object information of multiple objects;
and the query unit is used for querying the object library, and object information of the object with the same object name as the test object in the past is obtained from the object library, and 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 used 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 present invention discloses a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are used for executing the automated test case generating method disclosed in any one of the first aspects of the present 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 a test requirement of a project to be generated is obtained, and the test object set is composed of test objects in a plurality of projects to be generated which are sequentially sequenced; determining object information of a test object preset based on the business requirements of the items to be generated, generating test information of the test object according to the object type indicated by the object information of the determined test object, and constructing an automatic test case based on the test information of each test object sequentially sequenced in a test object set.
Based on the method and the device, 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 is determined to generate the test information of the test object, and then the automatic test case is constructed through the test information of each test object sequentially sequenced 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 testing and can not achieve 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 time cost of script recording and maintenance 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 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 a schematic flow chart of an automated test case generation method according to an embodiment of the present invention;
fig. 2 is a schematic 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;
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 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, 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.
It can be known from the above background art that the test flow of the existing interface-level automated test tool is interface forming, script recording, script debugging, case and object library generation, regression testing, the test case generated by using the method needs to depend on the developed forming interface, the time cost of script recording and maintenance is high, and the test case is only used for regression testing and cannot be delivered with quick response, 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, which are used for determining the object information of a test object preset based on the business requirement of a project to be generated, determining the object type indicated by the object information of the test object to generate the test information of the test object, further constructing the automatic test case through the test information of each test object sequentially sequenced in a test object set, generating the automatic test case before interface forming, shortening the generation period of the automatic test case, improving the generation efficiency of the automatic test case and solving the problem that the conventional interface-level automatic test tool can only be used for regression testing and can not rapidly respond to test delivery. 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 time cost of script recording and maintenance in the prior art.
Referring to fig. 1, a flowchart 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 requirement of the project to be generated, wherein the test object set is composed of a plurality of test objects in the project to be generated which are sequentially sequenced;
in this embodiment of the present application, the item to be generated may be an information system item to be generated, where one item to be generated may include multiple services, and one service includes multiple test objects. For example, a to-be-generated item may include a login service, a registration service, an upload service, and so on. If a certain service in a project to be generated is required to be tested, namely a 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 test objects in a plurality of projects to be generated which are sequentially sequenced.
In the embodiment of the application, for each service in a project to be generated, a test object set related to the test requirement of the service is preset. The preset process of the test object set related to the test requirement of the service may be: presetting an object library of the project to be generated based on the service requirement of the project to be generated, wherein the object library comprises object information of a plurality of objects; and carrying out standardization on each object contained in the service by adopting a preset standard format, and sequencing each object subjected to standardization according to the service requirement to generate a test object set related to the service test requirement.
It should be noted that the preset standard format may be "interface object + operation + data". The inventor can set the specific content related to the preset standard format according to his own needs, and the embodiment of the present application is not limited.
In this embodiment of the present application, the generation process of the object library preset based on the service requirement of the project 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 preset positioning information to generate a template, filling an object identifier of the object to a preset position of the positioning information generation template, and generating positioning information of the object at the front end; and finally, constructing the object information of the object according to the object name, the object type and the positioning information of the object. 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, and so on. Regarding the object name of the object and the object type of the object, the inventor can set the object according to his own needs, and the embodiment of the present application is not limited thereto.
It should be noted that, after the object basic information of each object in the project to be generated is arranged by the project developer according to the use development specification for formulating the object and based on the system UI design drawing related to the product manager or the interactive designer in the early stage, the object names and the object categories of all objects for designing the interactive operation are arranged, and then, according to the object categories of each object in the page object list and the related interactive operation requirements, unique object identifiers are formulated for each object.
It should be noted that, because the system pages with different development frames are adopted, the object implementation style and the interaction mode are different, and the specific actions to be executed when the object automation operation is performed according to the object also need to be adjusted in a targeted manner.
In the embodiment of the present application, for each object in each object library, a positioning information generation template corresponding to the object may be preset according to a usage development specification of an execution object.
S102: determining object information of a test object preset based on the test requirement of the item 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 a project 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 business requirement of the project to be generated, and the object library comprises object information of each object of the project to be generated.
S202: and querying an 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.
In the embodiment of the application, a plurality of test objects in a project to be generated are determined based on obtaining a test object set related to a test requirement of the project to be generated; for each of the determined test objects, the determined object library is queried to obtain object information of an object having the same object name as the test object from the object library.
In the embodiment of the application, after the business requirement of the project to be generated determines the preset object library, the determined object library is queried, so that the object information of the object with the same object name as the test object is obtained from the determined object library, that is, the object information of the test object is obtained from the object library, and the obtained object information comprises the positioning information of the object at the front end; furthermore, 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 the object information of the test object is determined, 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 sequentially sequenced in the test object set.
In the specific execution process 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 sorted according to the arrangement order 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 project to be generated is a user name test object, a password test object and a login test object; when the existing test requirement of the 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 sequenced. Inquiring an object library which is determined to be preset according to the login service requirement, and acquiring object information of an object with the same object name as the user name test object (namely, object information of the user name test object), object information of an object with the same object name as the password test object (namely, object information of the password test object) and object information of an object with the same object name as the login test object (namely, 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 the arrangement sequence of the user name test object, the password test object and 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 obtaining a test object set related to the test requirements of items to be generated, wherein the test object set consists of test objects in a plurality of items to be generated which are sequentially ordered; determining object information of a test object preset based on the business requirements of the items to be generated, generating test information of the test object according to the object type indicated by the object information of the determined test object, and constructing an automatic test case based on the test information of each test object sequentially sequenced in a test object set. Based on the method and the device, 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 is determined to generate the test information of the test object, and then the automatic test case is constructed through the test information of each test object sequentially sequenced 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 testing and can not achieve 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 time cost of script recording and maintenance 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, an object relationship between an object type and an operation type is preset, after object information of a test object preset based on a service requirement of a project to be generated is determined, a corresponding relationship between the preset object type and the operation type is inquired, and then the operation type corresponding to the object type indicated by the object information of the test object is acquired.
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, 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 in the corresponding relation between two different groups of object types and operation types are different; after object information of a test object preset based on business requirements of a project to be generated is determined, the corresponding relation between multiple groups of object types and operation types is inquired, and the operation type corresponding to the object type indicated by the object information of the test object is determined. 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, and the like. The specific content of the object type indicated by the object information of the test object and the specific content of the operation type of the object type may be set by the inventor according to his own needs, and the embodiment of the present application is not limited thereto.
S302: determining the operation type with the highest priority in the plurality of operation types according to the priority of the plurality of acquired operation types relative to the object type indicated by the object information of the test object;
in the specific process of executing step S302, priorities of a plurality of operation types corresponding to the object type indicated by the object information of the test object may be set in advance. After the plurality of operation types corresponding to the object information of the test object are acquired, the operation type with the highest priority in the plurality of operation types may be determined according to the priorities of the acquired plurality of operation types relative to the object type indicated by the object information of the test object.
In this embodiment of the application, the most frequently used operation type among a plurality of operation types corresponding to the object type indicated by the object information of the test object 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 operation type a, operation type B, and operation type C, if operation type a is the most frequently used operation type among the operation types corresponding to the object type, operation type a is set as the operation type with the highest priority among operation type a, operation type B, and operation type C, and then operation type a is taken as the operation type determined in step S302, and step S303 is executed based on 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 executed.
In the specific process of executing step S303, after determining an 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 an input identifier, generating test information of the test object according to the determined operation type; and if the determined operation type carries the input identification, acquiring a preset input information configuration table, and determining the input information matched with the operation type from the input information configuration table.
S304: generating test information of a test object according to the determined operation type;
in the specific process of executing 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 "button", and the operation type with the highest priority corresponding to the object type of the "button" is "click", since the "click" operation type does not carry an input identifier, the input information matched with the "click" operation type may be considered to be NULL, and then the test information of the test object generated according to the determined operation type is login + click + NULL, and NULL indicates that the input information matched with the operation type is NULL.
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 process of specifically executing 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 the input identifier, the preset input information configuration table is obtained, and according to the object name of the test object, the input information matching 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 specific execution process of step S306, after input information matching the operation type corresponding to the object type indicated by the determined object information of the test object is determined 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 corresponding to the object name of the test object, i.e., the user name 1; the method comprises the steps that input information corresponding to a user name 2 of a test object is 1234567, when the object name of the test object is user name 1, an object type indicated by object information of the test object is a text box, and an operation type with the 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 identifier, a preset input information configuration table is obtained, and input information matched with the operation type is determined to be 12345 from the input information configuration table according to the object name of the test object, namely according to the user name 1; and generating test information of the test object as a user name 1+ input +12345 according to the determined operation type and the input information.
Further, in the embodiment of the present application, an editing interface may be preset, and a user may modify the determined operation type and/or input information through the preset editing interface before generating the automated test case, and use the operation type and the input information modified by the user as the finally determined operation type and/or input information, and further generate test information according to the finally determined operation type input information, so that the automated test case is formed based on the test information of each test object sequentially ordered in the test object set.
In the embodiment of the application, each operation type corresponding to the object type indicated by the object information of the test object is obtained by searching the preset corresponding relation between the object type and the operation type, the operation type with the highest priority relative to the operation type is taken as the finally determined operation type, and if the determined operation type does not carry an input identifier, the test information of the test object is directly generated 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; furthermore, an automatic test case can be directly constructed according to the test information of each test object sequentially sequenced in the test object set, the automatic test case is generated before the interface is formed, 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 automatic test case disclosed by the embodiment of the invention, the embodiment of the invention also correspondingly discloses an automatic test case generating device, and as shown in fig. 4, the automatic test case generating device 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 formed by test objects in a plurality of to-be-generated items that are 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 the test object according to the object type indicated by the object information of the test object, the test information indicating operation information on the test object;
and the test case construction unit 44 is used for constructing an automatic test case based on the test information of each test object sequentially ordered in the test object set.
The specific principle and the execution process of each unit in the automatic test case generation device disclosed in the embodiment of the present invention are the same as those of the automatic test case generation method disclosed in the embodiment of the present invention, and reference may be made to corresponding parts in the automatic test case generation method disclosed in the embodiment of the present invention, which are not described herein again.
The invention provides an automatic test case generation device, which is characterized in that a test object set related to the test requirements of items to be generated is obtained, wherein the test object set is composed of test objects in a plurality of items to be generated which are sequentially ordered; determining object information of a test object preset based on the business requirements of the items to be generated, generating test information of the test object according to the object type indicated by the object information of the determined test object, and constructing an automatic test case based on the test information of each test object sequentially sequenced in a test object set. Based on the method and the device, 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 is determined to generate the test information of the test object, and then the automatic test case is constructed through the test information of each test object sequentially sequenced 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 testing and can not achieve 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 time cost of script recording and maintenance in the prior art.
In an embodiment of the present application, the first determining unit includes:
the second determining unit is used for determining an object library preset based on the business requirement of the project to be generated, and the object library comprises object information of a plurality of objects;
and the query unit is used for querying the object library, and object information of the object which is the same as the object name of the test object in the past is obtained from the object library, and the object information comprises positioning information of the object at the front end.
The automated test case generation device provided by the embodiment of the application further comprises an object library generation process, and specifically comprises the following steps:
the second generating unit is used for determining the object basic information of each object in the project to be generated based on the service requirement of the project to be generated, and the object basic information comprises an object name, an object type and an object identifier;
the second acquisition unit is used for acquiring a preset positioning information generation template, filling the object identification of the object to the preset position of the positioning information generation template, and generating the positioning information of the object at the front end;
and the constructing unit is used for constructing the 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 generation unit includes:
the searching unit is used for searching the 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;
a third determining unit, configured to determine, according to priorities of the obtained multiple operation types relative to an object type indicated by the object information of the test object, an operation type with a highest priority among the multiple operation types;
and a third generating unit for generating 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, if the determined operation type carries an input identifier, obtain a preset input information configuration table, and determine, from the input information configuration table, input information that matches the operation type;
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, the test case constructing unit includes:
and the test case constructing 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 the 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 applied, by taking the application of the automated test case generation method to the server as an example.
The automatic test case generation method provided by the embodiment of the application can be applied to a server, and the server can be a service device which provides service for a user on a network side, can be a server cluster formed by a plurality of servers, and can also be a single server.
Optionally, fig. 5 is a block diagram illustrating a hardware structure of a server to which an automated test case generation method provided in the embodiment of the present application is applied, 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 an application specific Integrated circuit asic, or one or more Integrated circuits configured to implement embodiments of the present invention, or the like;
the memory 52 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory) or the like, such as at least one disk memory;
wherein the memory stores a program, the processor may invoke the program stored in the memory, and the program is operable to:
acquiring a test object set related to the test requirement of the project to be generated, wherein the test object set is composed of a plurality of test objects in the project to be generated which are sequentially sequenced;
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 sequentially sequenced in the test object set.
For the functions of the program, reference may be made to the above detailed description of an automated test case generation method provided in the embodiments of the present application, which is not described herein again.
Further, an embodiment of the present application further provides a computer storage medium, where computer-executable instructions are stored in the computer storage medium, and the computer-executable instructions are used to execute the automated test case generation method.
For specific contents of the computer executable instructions, reference may be made to the above detailed description of an automated test case generation method provided in the embodiments of the present application, which is not described herein again.
The method, the device, the server and the storage medium for generating the automatic test case provided by the invention are described in detail, a specific example is applied in the text to explain the principle and the implementation mode of the invention, and the description of the embodiment is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
It is further noted that, herein, 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 or 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.
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 (10)

1. An automated test case generation method is characterized by comprising 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 sequenced;
determining object information of the test object preset based on the service 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 sequentially sequenced in the test object set.
2. The method according to claim 1, wherein the determining the object information of the test object preset based on the business requirement of the item to be generated comprises:
determining an object library preset based on the business requirement of the project 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.
3. The method of claim 2, further comprising an object library generation process, the object library generation process comprising:
determining object basic information of each object in the project to be generated based on the service requirement of the project to be generated, wherein the object basic information comprises an object name, an object type and an object identifier;
acquiring a preset positioning information generation template, filling an object identifier of the object to a preset position of the positioning information generation template, and generating positioning information of the object at the front end;
and constructing the object information of the object according to the object name, the object type and the positioning information of the object.
4. The method of claim 2, wherein the generating test information of the test object according to the object type indicated by the object information of the test object, the test information indicating operation information on the test object, comprises:
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 in the plurality of operation types according to the priority of the plurality of acquired operation types relative to the object type indicated by the object information of the test object;
and generating the test information of the test object according to the determined operation type.
5. The method of claim 4, 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 the test information of the test object according to the determined operation type and the input information.
6. 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 sequence of the test objects in the test object set to generate an automatic test case.
7. An automated test case generation apparatus, comprising:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a test object set related to a test requirement of a project to be generated, and the test object set consists of a plurality of test objects in the project to be generated which are sequentially sequenced;
the first determining unit is used for determining object information of the test object preset based on the service requirement of the project to be generated;
a first generating unit, configured to generate test information of the 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;
and the test case construction unit is used for constructing an automatic test case based on the test information of each test object sequentially sequenced in the test object set.
8. The apparatus of claim 7, wherein the first determining unit comprises:
a second determining unit, configured to determine an object library preset based on a service requirement of the item to be generated, where the object library includes object information of multiple objects;
and the query unit is used for querying the object library, and object information of the object with the same object name as the test object in the past is obtained from the object library, and the object information comprises positioning information of the object at the front end.
9. A server, comprising: at least one memory and at least one processor; the memory stores a program that the processor invokes, the program stored by the memory implementing the automated test case generation method of any one of claims 1-7.
10. A computer-readable storage medium having computer-executable instructions stored thereon for performing the automated test case generation method of any one of claims 1-7.
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 true CN111522748A (en) 2020-08-11
CN111522748B 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)

Cited By (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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150278075A1 (en) * 2014-03-26 2015-10-01 Mckesson Financial Holdings Apparatuses, methods, and computer program products for conducting automated tests
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150278075A1 (en) * 2014-03-26 2015-10-01 Mckesson Financial Holdings Apparatuses, methods, and computer program products for conducting automated tests
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
王哲煊;: "设计自动化和零编码测试开发解决方案" *

Cited By (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

Also Published As

Publication number Publication date
CN111522748B (en) 2023-06-13

Similar Documents

Publication Publication Date Title
CN110968309B (en) Template generation method and device, electronic equipment and storage medium
CN108446190B (en) Interface test method and device
CN108874558B (en) Message subscription method of distributed transaction, electronic device and readable storage medium
US20090235172A1 (en) Method, apparatus, and computer program for providing web service testing
CN110716783A (en) Front-end page generation and deployment method and device, storage medium and equipment
CN108399072B (en) Application page updating method and device
CN101193007A (en) Testing method, scenario testing method and corresponding device for URL command
CN110955409B (en) Method and device for creating resources on cloud platform
CN104657274A (en) Method and device for testing software interface
CN114594927A (en) Low code development method, device, system, server and storage medium
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN111522748B (en) Automatic test case generation method, device, server and storage medium
CN114266539A (en) File flow processing method, system, device and computer readable storage medium
CN110825638B (en) Test case generation method, device, server and storage medium
CN116225690A (en) Memory multidimensional database calculation load balancing method and system based on docker
CN113434119B (en) Service processing method and device based on flow control
CN115146581A (en) Project management method, defect analysis method, related device and readable storage medium
CN112328680B (en) Electronic component data processing method, data interface and management system
CN113867778A (en) Method and device for generating mirror image file, electronic equipment and storage medium
CN112765188A (en) Configuration information processing method, configuration management system, electronic device, and storage medium
CN112597036A (en) Universal baffle testing method and device
CN112307736A (en) Application project creating method, device, equipment and storage medium
CN111367703A (en) Troubleshooting method and device
CN111030874B (en) Service arranging method, equipment, storage medium and device
CN114448848B (en) Switch testing method and device, electronic 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