CN114218097A - Test case generation method and device, computer equipment and storage medium - Google Patents

Test case generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114218097A
CN114218097A CN202111520627.6A CN202111520627A CN114218097A CN 114218097 A CN114218097 A CN 114218097A CN 202111520627 A CN202111520627 A CN 202111520627A CN 114218097 A CN114218097 A CN 114218097A
Authority
CN
China
Prior art keywords
action
information
test
test case
user
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111520627.6A
Other languages
Chinese (zh)
Inventor
宋鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Securities Co Ltd
Original Assignee
Ping An Securities Co Ltd
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 Ping An Securities Co Ltd filed Critical Ping An Securities Co Ltd
Priority to CN202111520627.6A priority Critical patent/CN114218097A/en
Publication of CN114218097A publication Critical patent/CN114218097A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Abstract

The application relates to the technical field of artificial intelligence, and provides a test case generation method, a test case generation device, computer equipment and a storage medium, wherein the method comprises the following steps: after the user successfully logs in, judging whether a test case generation request triggered by the user is received or not; if a test case generation request is received, acquiring service case information input by a user from the test case generation request; screening out actions corresponding to the service use case information from an action library of a preset RPA tool; sequentially recording action information based on the sequence of actions selected by a user from all actions; after the recording of the action information is finished, converting each action information into a corresponding action icon; and connecting all the action icons according to the recording sequence of the action information to obtain the test case. The method and the device can improve the intelligence and the efficiency of generation of the test cases. The method and the device can also be applied to the field of block chains, and the data such as the test cases can be stored on the block chains.

Description

Test case generation method and device, computer equipment and storage medium
Technical Field
The application relates to the technical field of artificial intelligence, in particular to a test case generation method and device, computer equipment and a storage medium.
Background
With the continuous development of the software industry, newly developed software is more and more complex, and functions are more and more, so that software testing is more and more complex. In the software testing process, in order to ensure the testing quality, a large number of test cases are generally required to be designed and written. However, the design of the test cases requires a higher technical level and rich working experience, and writing and modifying the test cases often requires a lot of time and more manpower of related personnel, so that the generation cost of the test cases is higher, and the generation efficiency is low. On the other hand, because modules with similar functions often exist in a plurality of software to be tested, corresponding test cases are also similar, if the test cases are rewritten every time, the generation efficiency of the test cases is greatly reduced, and the generation of the test cases is lack of intelligence.
Disclosure of Invention
The application mainly aims to provide a test case generation method, a test case generation device, computer equipment and a storage medium, and aims to solve the technical problems that the existing test case generation mode easily causes high test case generation cost, low test case generation efficiency and lack of intelligence in test case generation.
The application provides a test case generation method, which comprises the following steps:
after the user successfully logs in, judging whether a test case generation request triggered by the user is received or not;
if the test case generation request is received, acquiring the service case information input by the user from the test case generation request;
screening out actions corresponding to the service case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
sequentially recording action information based on the sequence of actions selected by the user from all the actions;
after the recording of the action information is finished, converting each action information into a corresponding action icon;
and connecting all the action icons according to the recording sequence of the action information to obtain the test case.
Optionally, the sequentially recording the motion information based on the sequence of the user selecting the motion from all the motions includes:
judging whether a first instruction triggered by the user is received; wherein, the first instruction is an instruction for starting recording;
if the first instruction is received, acquiring an action name of a specified action selected from all the actions by the user, and acquiring ID information of an operation element corresponding to the specified action;
generating a parameter form corresponding to the specified action based on the action name and the ID information, and obtaining action information corresponding to the specified action based on the parameter form so as to record the specified action;
recording the next action until a second instruction triggered by the user is received, and stopping recording; and the second instruction is an instruction for finishing recording.
Optionally, the generating a parameter form corresponding to the specified action based on the action name and the ID information, and obtaining action information corresponding to the specified action based on the parameter form to complete recording of the specified action includes:
acquiring an action type corresponding to the specified action based on the action name; the action types comprise a first preset action type and a second preset action type;
if the action type is the first preset action type, generating a first form for inputting element ID information through a preset rendering tool, and filling the ID information in the first form to obtain a parameter form corresponding to the specified action;
if the action type is the second preset action type, generating a second form for inputting element ID information and text information through the rendering tool, filling the ID information into the second form, and filling the received target text information input by the user into the second form to obtain a parameter form corresponding to the specified action;
and generating action information corresponding to the specified action according to the parameter form package so as to record the specified action.
Optionally, after the connecting all the action icons according to the recording sequence of the action information to obtain the test case, the method includes:
acquiring an occupied memory value corresponding to the test case;
judging whether the occupied memory value is larger than a preset occupied memory threshold value or not;
if the memory occupation threshold value is larger than the memory occupation threshold value, storing the test case into a block chain;
and if the test case is not larger than the occupied memory threshold, storing the test case to a local preset database.
Optionally, after the connecting all the action icons according to the recording sequence of the action information to obtain the test case, the method includes:
acquiring the connection sequence of each action icon;
generating an automatic test script corresponding to the test case based on the connection sequence;
running the automatic test script to obtain a corresponding test result;
and displaying the test result.
Optionally, the generating an automated test script corresponding to the test case based on the connection order includes:
acquiring action functions corresponding to the action icons one to one;
respectively creating corresponding function scripts for each action function;
generating function calling statements corresponding to the function scripts one by one;
sequentially connecting the function call statements in series based on the connection sequence to obtain statement data after series connection;
and taking the sentence data after the serial connection as the automatic test script.
Optionally, the running the automated test script to obtain a corresponding test result includes:
performing running processing on the automatic test script for preset times to obtain a plurality of corresponding specified test results;
analyzing and processing all the specified test results, and judging whether test failure results exist in all the specified test results;
if the test failure result exists, generating a first test result of the test failure corresponding to the automatic test script;
and if the test failure result does not exist, generating a second test result which is successfully tested and corresponds to the automatic test script.
The present application further provides a test case generating device, including:
the first judgment module is used for judging whether a test case generation request triggered by a user is received or not after the user successfully logs in;
the first obtaining module is used for obtaining the service case information input by the user from the test case generation request if the test case generation request is received;
the screening module is used for screening out actions corresponding to the service use case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
the recording module is used for sequentially recording action information based on the sequence of actions selected by the user from all the actions;
the conversion module is used for converting each piece of action information into a corresponding action icon after the recording of the action information is finished;
and the first generation module is used for connecting all the action icons according to the recording sequence of the action information to obtain the test case.
The present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method.
The test case generation method, the test case generation device, the computer equipment and the storage medium have the following beneficial effects:
according to the test case generation method, the test case generation device, the computer equipment and the storage medium, after a user successfully logs in and receives a test case generation request input by the user, business case information input by the user is firstly obtained, then actions corresponding to the business case information are screened out from an action library of a preset RPA tool, then action information is sequentially recorded according to the sequence of the actions selected by the user from all the actions, after the recording of the action information is finished, each action information is converted into the corresponding action icon, and finally all the action icons are connected according to the recording sequence of the action information to obtain the corresponding test case. By the method and the device, the corresponding test cases can be generated quickly and intelligently, manpower consumed for generating the test cases is reduced, time consumed for manual writing is reduced, a user does not need to select all actions in an action library, and the user does not need to sequentially configure each obtained action icon, so that a creation threshold of an automatic case is reduced, the intelligence and the efficiency of generation of the test cases are effectively improved, and the use experience of the user is improved.
Drawings
FIG. 1 is a flowchart illustrating a test case generation method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a test case generation apparatus according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
Referring to fig. 1, a test case generation method according to an embodiment of the present application includes:
s10: after the user successfully logs in, judging whether a test case generation request triggered by the user is received or not;
s20: if the test case generation request is received, acquiring the service case information input by the user from the test case generation request;
s30: screening out actions corresponding to the service case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
s40: sequentially recording action information based on the sequence of actions selected by the user from all the actions;
s50: after the recording of the action information is finished, converting each action information into a corresponding action icon;
s60: and connecting all the action icons according to the recording sequence of the action information to obtain the test case.
As described in the foregoing steps S10 to S60, the execution subject of the embodiment of the method is a test case generation apparatus, which may be an automated test platform, or referred to as a QA platform. In practical applications, the test case generation device may be implemented by a virtual device, such as a software code, or by an entity device in which a relevant execution code is written or integrated, and may perform human-computer interaction with a user through a keyboard, a mouse, a remote controller, a touch panel, or a voice control device. The test case generation device in the embodiment can reduce the creation threshold of the automatic case, effectively improve the intelligence and the efficiency of generation of the test case, and further improve the use experience of a user. Specifically, after the user successfully logs in, it is first determined whether a test case generation request triggered by the user is received. Wherein, the successful login means that the user successfully completes the login of the automated testing platform. In addition, the test case generation request can also carry user information and service case information. The test case generation request is a request which is triggered by a user and is used for generating a test case corresponding to the service case information input by the user.
And if the test case generation request is received, acquiring the service case information input by the user from the test case generation request. The service case information may be data information carried in the test case generation request. The service case information is a case which is generated by a user according to actual use requirements and is in a text form, and the service case information describes service processing logic corresponding to the test case which needs to be generated. And then screening out the action corresponding to the service use case information from an action library of a preset RPA tool. Wherein the number of actions comprises a plurality. RPA (robot Process Automation), also known as software robot or virtual worker, refers to a way of using software Automation technology to replace manual operation to complete computer operation. The RPA tool is specifically an RPA designer. The action library is a database which is created in advance and is used for storing various actions, hundreds of actions are built in the action library and are used for supporting operation of various types of software systems, and the actions belong to different categories and are dispersed in different action groups. In the action library, common actions include mouse actions and keyboard actions. The mouse actions can comprise a single click action, a double click action, a left click action, a right click action, a continuous click action and a hovering action of the mouse; the keyboard actions include an enter text action. The actions are common to daily operating software and have universality. In addition, the service case information can be subjected to keyword analysis or word segmentation processing to obtain corresponding keywords, actions corresponding to the keywords in the service case information are screened out from all actions contained in the action library of all RPA tools, and the keywords in the service case information can include verbs. All actions in the action library are screened based on the service case information to obtain the required actions, so that developers do not need to search specific actions from a huge action library, convenience and rapidness are achieved, and the creation efficiency of test cases is improved.
And then recording the action information in sequence based on the sequence of the actions selected by the user from all the actions. For the specific implementation process of sequentially recording the action information based on the sequence of the user selecting the actions from all the actions, the present application will further describe this in detail in the following specific embodiments, which are not set forth herein too much. And subsequently, after the recording of the action information is finished, converting each piece of action information into a corresponding action icon. And finally, connecting all the action icons according to the recording sequence of the action information to obtain the test case. And the test case belongs to a flow type test case. The test case can be composed of action information corresponding to a series of actions of software operation, when a user selects an action from an action library, the corresponding action information is recorded for each action, and then each action information is converted into a corresponding action icon. The corresponding action information is automatically assigned in the action icon, so the test case can also be formed by connecting the action icons corresponding to the actions of a series of software operations in sequence (the recording sequence of the action information). Specifically, after the recording of the action information is finished, the process of converting each piece of action information into a corresponding action icon, and performing connection processing on all the action icons according to the recording sequence of the action information to obtain the test case may include: defining a template of an action icon; and when an instruction of finishing recording by the user is received, triggering to render the action information by adopting an MVVM mode to generate a corresponding action icon, and simultaneously automatically connecting the action icons according to the recording sequence to obtain a corresponding test case. In addition, after all actions are recorded, all action information is automatically and correspondingly converted into action icons which are connected in sequence, wherein the action icons are automatically assigned with the corresponding action information, so that a large number of action icons do not need to be sequenced and connected manually, repeated configuration of each action icon is not needed after the action icons are obtained, the creation process of the test case is simplified, and the creation process of the test case is more visual and convenient. In addition, the template of the action icon can be defined according to personal preference of developers, and specific operations such as defining uniform styles such as triggers, graphs, sizes, text box positions and text sizes for the action icon; the MVVM mode originates from a WPF technology of a NET platform, is applied to the field of Web front ends, is a design mode for separating view UI (user interface) from service logic, separates the UI logic from the service logic through a data binding and command technology, and achieves the effect of driving the UI by data.
In this embodiment, after a user successfully logs in and receives a test case generation request input by the user, service case information input by the user is acquired first, then actions corresponding to the service case information are screened out from an action library of a preset RPA tool, then action information is recorded in sequence based on the sequence of actions selected by the user from all the actions, after the recording of the action information is finished, each action information is converted into a corresponding action icon, and finally all the action icons are connected according to the recording sequence of the action information to obtain a corresponding test case. According to the embodiment, the corresponding test cases can be generated rapidly and intelligently, manpower consumed for generating the test cases is reduced, time consumed for manual writing is reduced, a user does not need to select all actions in an action library, the user does not need to sequentially configure each obtained action icon, the creation threshold of an automatic case is reduced, the intelligence and the efficiency of generation of the test cases are effectively improved, and the use experience of the user is improved.
Further, in an embodiment of the present application, the step S40 includes:
s400: judging whether a first instruction triggered by the user is received; wherein, the first instruction is an instruction for starting recording;
s401: if the first instruction is received, acquiring an action name of a specified action selected from all the actions by the user, and acquiring ID information of an operation element corresponding to the specified action;
s402: generating a parameter form corresponding to the specified action based on the action name and the ID information, and obtaining action information corresponding to the specified action based on the parameter form so as to record the specified action;
s403: recording the next action until a second instruction triggered by the user is received, and stopping recording; and the second instruction is an instruction for finishing recording.
As described in steps S400 to S403, the step of sequentially recording the motion information based on the sequence of the motion selected by the user from all the motions may specifically include: firstly, whether a first instruction triggered by the user is received is judged. The first instruction is an instruction for starting recording. And if the first instruction is received, acquiring the action name of a specified action selected from all the actions by the user, and acquiring the ID information of an operation element corresponding to the specified action. Wherein the process of acquiring the ID information of the operation element corresponding to the specified action may include: receiving a designated action selected by the user; entering an operation interface and starting a positioning and picking function, wherein the positioning and picking function is used for positioning the position of a cursor on the operation interface in real time; and moving the cursor to the operation target area of the specified action and clicking to select to acquire ID information of the operation element, wherein the ID information can also be called element ID information. Generally, each operation element is an object, and there is corresponding element ID information in the operating system, and the element ID is unique. For example, a certain software, such as a browser L, is opened, first, the browser L is "clicked", the action option of "clicking" is selected, the operation interface is entered, the positioning and picking function is started, and then, a software icon of a selected operation target, that is, the browser L, is clicked on the operation interface, so that the ID information of the software icon can be acquired. And then generating a parameter form corresponding to the specified action based on the action name and the ID information, and obtaining action information corresponding to the specified action based on the parameter form so as to complete recording of the specified action. For the specific implementation process that the parameter form corresponding to the specified action is generated based on the action name and the ID information, and the action information corresponding to the specified action is obtained based on the parameter form, this will be described in further detail in the following specific embodiments, which will not be elaborated herein. And then recording the next action until a second instruction triggered by the user is received, and stopping recording. And the second instruction is an instruction for finishing recording. In the embodiment, the action information is sequentially recorded according to the sequence of the action selected by the user from all the actions, so that the obtained action information can be converted into the corresponding action icons in the follow-up process, and then all the action icons are connected according to the recording sequence of the action information, so that the required test case is rapidly and intelligently and automatically generated, the intelligence and the efficiency of generating the test case are effectively improved, and the use experience of the user is improved.
Further, in an embodiment of the application, the step S402 includes:
s4020: acquiring an action type corresponding to the specified action based on the action name; the action types comprise a first preset action type and a second preset action type;
s4021: if the action type is the first preset action type, generating a first form for inputting element ID information through a preset rendering tool, and filling the ID information in the first form to obtain a parameter form corresponding to the specified action;
s4022: if the action type is the second preset action type, generating a second form for inputting element ID information and text information through the rendering tool, filling the ID information into the second form, and filling the received target text information input by the user into the second form to obtain a parameter form corresponding to the specified action;
s4023: and generating action information corresponding to the specified action according to the parameter form package so as to record the specified action.
As described in the foregoing steps S4020 to S4023, the step of generating the parameter table corresponding to the specified action based on the action name and the ID information, and obtaining the action information corresponding to the specified action based on the parameter table to complete the recording of the specified action may specifically include: firstly, an action type corresponding to the specified action is obtained based on the action name. The action types comprise a first preset action type and a second preset action type. Specifically, the first preset action type is a mouse action, and the second preset action type is a keyboard action. If the action type is the first preset action type, generating a first form for inputting element ID information through a preset rendering tool, and filling the ID information in the first form to obtain a parameter form corresponding to the specified action. And if the action type is the second preset action type, generating a second form for inputting element ID information and text information through the rendering tool, filling the ID information into the second form, and filling the received target text information input by the user into the second form to obtain a parameter form corresponding to the specified action. And subsequently generating action information corresponding to the specified action according to the parameter form package so as to record the specified action. The rendering tool is a tool for generating a parameter form based on MVVM mode rendering, and the rendering tool can also be called a parameter form rendering tool. And if the action type is a mouse action, the finally recorded and generated action information comprises an action name and element ID information of the operation element. And if the action type is a keyboard action, the finally recorded and generated action information comprises an action name, an element ID of the operation element and text information needing to be input to the operation element. Specifically, the actions are recorded according to the sequence of the actions selected by the user, the action names and the element ID information of the operation elements are obtained in the process of recording each step of the actions, and when the element ID information of the operation elements is obtained, that is, when the user selects the operation elements, an action intercepting function can be triggered in an event mode, the action intercepting function is used for intercepting the action names and the element ID information and transmitting the action names and the element ID information to a parameter form rendering tool, and the parameter form rendering tool automatically pops up a parameter form for automatically and/or manually filling in the parameter information so as to configure complete action information corresponding to each action. The embodiment can generate the parameter form corresponding to the specified action based on the action name and the ID information based on the use of the rendering tool, and can obtain the action information corresponding to the specified action based on the parameter form, so that the recording of the specified action can be completed quickly and conveniently. By configuring the action information in the action recording process, a subsequent process developer only needs to operate the target software according to actual steps, and can realize the creation of the test case without repeatedly configuring each action icon after obtaining the action icon, so that the creation process of the test case is more visual and convenient, the creation process of the test case is simplified, the workload of the process developer is reduced, and the creation efficiency of the test case is improved.
Further, in an embodiment of the present application, after the step S60, the method includes:
s600: acquiring an occupied memory value corresponding to the test case;
s601: judging whether the occupied memory value is larger than a preset occupied memory threshold value or not;
s602: if the memory occupation threshold value is larger than the memory occupation threshold value, storing the test case into a block chain;
s603: and if the test case is not larger than the occupied memory threshold, storing the test case to a local preset database.
As described in the foregoing steps S600 to S603, after the execution of the connection processing of all the action icons according to the recording sequence of the action information is completed, a test case may be obtained, and then an intelligent storage process for the test case may be further included. Specifically, first, an occupied memory value corresponding to the test case is obtained. And then judging whether the occupied memory value is larger than a preset occupied memory threshold value. The specific value of the occupied memory threshold can be set according to actual requirements. If the occupied memory value of the test case is larger than the occupied memory threshold value, the test case is considered to be stored locally, so that the normal operation of the device is influenced, and the test case is further stored to the block chain, and the storage intelligence and the storage safety of the target log are improved. And if the memory occupation threshold value is larger than the memory occupation threshold value, storing the test case into a block chain. And if the test case is not larger than the occupied memory threshold, storing the test case to a local preset database. In the embodiment, after the test case is generated and the occupied memory value of the test case is obtained, the test case can be intelligently and correspondingly stored in the local database or the block chain according to the comparison result between the occupied memory value of the test case and the preset occupied memory threshold value, the test case is stored in the corresponding storage position through the occupied memory value, the subsequent management and the obtaining can be facilitated, and the storage intelligence of the test case is effectively improved.
Further, in an embodiment of the present application, after the step S60, the method includes:
s610: acquiring the connection sequence of each action icon;
s611: generating an automatic test script corresponding to the test case based on the connection sequence;
s612: running the automatic test script to obtain a corresponding test result;
s613: and displaying the test result.
As described in the foregoing steps S610 to S613, after the step of performing connection processing on all the action icons according to the recording sequence of the action information to obtain the test case, the method may further include a process of generating an automated test script according to the test case and testing the automated test script: first, the connection order of each action icon is obtained. And then generating an automatic test script corresponding to the test case based on the connection sequence. The script corresponding to the test case can be composed of a series of basic actions of software operation, each basic action is realized by a section of script codes in Python format, and the script corresponding to a complete test case is formed by splicing the script codes corresponding to the series of basic actions. Each action icon corresponds to an action function in a Python format, and the corresponding action function is searched according to the component ID of the action icon; the basic actions are assembled in the mode of action icons and then action functions are correspondingly obtained, and then the robot test case script in the executable Python format can be generated in a translation mode, so that the development difficulty of constructing the automatic test script corresponding to the test case is greatly reduced. And then running the automatic test script to obtain a corresponding test result. After the automatic test script is obtained, a corresponding execution result is generated by executing the automatic test script, that is, the test result may include a test success or a test failure. And finally, displaying the test result. The display mode of the test result is not limited, and may be set according to actual requirements, for example, the display mode may adopt an information form, or a voice form, and the like. In the embodiment, after the test case is generated, the automatic test script corresponding to the test case can be quickly and conveniently generated based on the connection sequence of the action icons, so that the generation efficiency of the automatic test script is effectively improved. In addition, after the automatic test script is generated, the automatic test script can be further run and tested to generate and display a corresponding test result, a relevant user can timely know the test condition of the generated automatic test script according to the displayed test result, and then the automatic test script can be correspondingly subjected to subsequent processing according to the test condition, so that the use experience of the user is improved.
Further, in an embodiment of the present application, the step S611 includes:
s6110: acquiring action functions corresponding to the action icons one to one;
s6111: respectively creating corresponding function scripts for each action function;
s6112: generating function calling statements corresponding to the function scripts one by one;
s6113: sequentially connecting the function call statements in series based on the connection sequence to obtain statement data after series connection;
s6114: and taking the sentence data after the serial connection as the automatic test script.
As described in the foregoing steps S6110 to S6114, the step of generating the automated test script corresponding to the test case based on the connection sequence may specifically include: firstly, acquiring action functions corresponding to the action icons one to one; wherein the action function is in Python format. In addition, each action icon corresponds to an action function in a Python format, and the corresponding action function can be found according to the component ID of the action icon. The basic action can be assembled in advance in the form of an action icon, and then an action function corresponding to the basic action is obtained. And then respectively creating corresponding function scripts for the action functions. The function script created based on the action function is also in the Python format. And then generating function call statements corresponding to the function scripts one by one. And the function calling statement is used for calling the corresponding action function. Specifically, a function call statement in Python format corresponding to each action function may be generated according to the action name corresponding to the action function, the parameter table, and the parameter information input by the user in the parameter table. And finally, sequentially connecting the function call statements in series based on the connection sequence to obtain statement data after series connection, and taking the statement data after series connection as the automatic test script. The test script corresponding to the test case can be composed of function call statements corresponding to a series of basic actions of software operation, that is, a complete test script of the test case is formed by splicing script codes corresponding to a series of basic actions. In addition, the automated test script is an executable script. In the embodiment, the executable automatic test script is translated and generated by using the action functions corresponding to the action icons one to one, the function scripts corresponding to the action functions and the function calling sentences corresponding to the function scripts based on the connection sequence of the action icons, so that the development difficulty of the automatic test script corresponding to the constructed test case is greatly reduced, and the intelligence and the efficiency of the generation of the automatic test script are improved.
Further, in an embodiment of the application, the step S612 includes:
s6120: performing running processing on the automatic test script for preset times to obtain a plurality of corresponding specified test results;
s6121: analyzing and processing all the specified test results, and judging whether test failure results exist in all the specified test results;
s6122: if the test failure result exists, generating a first test result of the test failure corresponding to the automatic test script;
s6123: and if the test failure result does not exist, generating a second test result which is successfully tested and corresponds to the automatic test script.
As described in the foregoing steps S6120 to S6123, the step of running the automated test script to obtain the corresponding test result may specifically include: firstly, the automatic test script is operated for preset times to obtain a plurality of corresponding specified test results. The value of the preset times is not limited, and may be set according to actual requirements, for example, may be set to 5 times. And then analyzing and processing all the specified test results, and judging whether the specified test results have test failure results. Wherein, the content of the test result comprises test success or test failure. And if the test failure result exists, generating a first test result of the test failure corresponding to the automatic test script. If the obtained final test result is test failure, corresponding early warning information can be further generated and displayed, so that the user can be reminded of timely carrying out corresponding repairing treatment on the obtained automatic test script through the early warning information. And if the test failure result does not exist, generating a second test result which is successfully tested and corresponds to the automatic test script. In the embodiment, the automatic test script is operated for the preset times to obtain a plurality of corresponding specified test results, and then the final test result of the automatic test script is determined according to each obtained specified test result, and the final test result is determined to be successful only when each obtained specified test result is a successful test result, so that the condition that the obtained test result is not rigorous due to the fact that the test result is obtained only by performing the test script once at present is avoided, the accuracy of the generated test result is effectively guaranteed, and the standardization and the accuracy of the test on the automatic test script are improved.
The test case generation method in the embodiment of the present application may also be applied to the field of a block chain, for example, data such as the test case is stored on the block chain. By using the block chain to store and manage the test case, the safety and the non-tamper property of the test case can be effectively ensured.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like, and under the authorization condition, the user management module supervises and audits the transaction condition of certain real identities and provides rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node equipment and used for verifying the validity of the service request, recording the service request to storage after consensus on the valid request is completed, for a new service request, the basic service firstly performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts service information (consensus management) through a consensus algorithm, transmits the service information to a shared account (network communication) completely and consistently after encryption, and performs recording and storage; the intelligent contract module is responsible for registering and issuing contracts, triggering the contracts and executing the contracts, developers can define contract logics through a certain programming language, issue the contract logics to a block chain (contract registration), call keys or other event triggering and executing according to the logics of contract clauses, complete the contract logics and simultaneously provide the function of upgrading and canceling the contracts; the operation monitoring module is mainly responsible for deployment, configuration modification, contract setting, cloud adaptation in the product release process and visual output of real-time states in product operation, such as: alarm, monitoring network conditions, monitoring node equipment health status, and the like.
Referring to fig. 2, an embodiment of the present application further provides a test case generation apparatus, including:
the first judgment module 1 is used for judging whether a test case generation request triggered by a user is received or not after the user successfully logs in;
the first obtaining module 2 is configured to obtain service case information input by the user from the test case generation request if the test case generation request is received;
the screening module 3 is used for screening out actions corresponding to the service case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
the recording module 4 is used for sequentially recording action information based on the sequence of actions selected by the user from all the actions;
the conversion module 5 is configured to convert each piece of motion information into a corresponding motion icon after the recording of the motion information is finished;
and the first generating module 6 is used for connecting all the action icons according to the recording sequence of the action information to obtain a test case.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
Further, in an embodiment of the present application, the recording module 4 includes:
the judging unit is used for judging whether a first instruction triggered by the user is received or not; wherein, the first instruction is an instruction for starting recording;
a first obtaining unit, configured to obtain, if the first instruction is received, an action name of a specified action selected by the user from all the actions, and obtain ID information of an operation element corresponding to the specified action;
a first generating unit, configured to generate a parameter form corresponding to the specified action based on the action name and the ID information, and obtain action information corresponding to the specified action based on the parameter form, so as to complete recording of the specified action;
the stopping unit is used for recording the next action until a second instruction triggered by the user is received and stopping recording; and the second instruction is an instruction for finishing recording.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
Further, in an embodiment of the present application, the first generating unit includes:
an obtaining subunit, configured to obtain, based on the action name, an action type corresponding to the specified action; the action types comprise a first preset action type and a second preset action type;
a first generating subunit, configured to generate, by using a preset rendering tool, a first form for inputting element ID information if the action type is the first preset action type, and fill the ID information in the first form to obtain a parameter form corresponding to the specified action;
a second generating subunit, configured to generate, if the action type is the second preset action type, a second form for inputting element ID information and text information through the rendering tool, fill the second form with the ID information, and fill the second form with the received target text information input by the user, to obtain a parameter form corresponding to the specified action;
and the packaging subunit is used for generating action information corresponding to the specified action according to the parameter form package so as to record the specified action.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
Further, in an embodiment of the present application, the test case generating apparatus includes:
the second acquisition module is used for acquiring the memory occupied value corresponding to the test case;
the second judgment module is used for judging whether the occupied memory value is larger than a preset occupied memory threshold value or not;
the first storage module is used for storing the test case into a block chain if the test case is larger than the occupied memory threshold;
and the second storage module is used for storing the test case to a local preset database if the test case is not greater than the occupied memory threshold.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
Further, in an embodiment of the present application, the test case generating apparatus includes:
the third acquisition module is used for acquiring the connection sequence of each action icon;
the second generation module is used for generating an automatic test script corresponding to the test case based on the connection sequence;
the third generation module is used for running the automatic test script to obtain a corresponding test result;
and the display module is used for displaying the test result.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
Further, in an embodiment of the application, the second generating module includes:
the second acquisition unit is used for acquiring action functions corresponding to the action icons one to one;
the creating unit is used for creating corresponding function scripts for the action functions respectively;
the second generation unit is used for generating function call statements corresponding to the function scripts one by one;
the series unit is used for sequentially connecting the function call statements in series based on the connection sequence to obtain statement data after series connection;
and the determining unit is used for taking the sentence data after the serial connection as the automatic test script.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
Further, in an embodiment of the present application, the third generating module includes:
the running unit is used for carrying out running processing on the automatic test script for preset times to obtain a plurality of corresponding specified test results;
the analysis unit is used for analyzing and processing all the specified test results and judging whether the specified test results have test failure results;
the third generation unit is used for generating a first test result of test failure corresponding to the automatic test script if the test failure result exists;
and the fourth generating unit is used for generating a second test result which is successful in test and corresponds to the automatic test script if no test failure result exists.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
Referring to fig. 3, a computer device, which may be a server and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer device comprises a processor, a memory, a network interface, a display screen, an input device and a database which are connected through a system bus. Wherein the processor of the computer device is designed to provide computing and control capabilities. The memory of the computer device comprises a storage medium and an internal memory. The storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and computer programs in the storage medium to run. The database of the computer device is used for storing service case information, RPA tools, action information, action icons and test cases. The network interface of the computer device is used for communicating with an external terminal through a network connection. The display screen of the computer equipment is an indispensable image-text output equipment in the computer, and is used for converting digital signals into optical signals so that characters and figures are displayed on the screen of the display screen. The input device of the computer equipment is the main device for information exchange between the computer and the user or other equipment, and is used for transmitting data, instructions, some mark information and the like to the computer. The computer program is executed by a processor to implement a test case generation method.
The processor executes the steps of the test case generation method:
after the user successfully logs in, judging whether a test case generation request triggered by the user is received or not;
if the test case generation request is received, acquiring the service case information input by the user from the test case generation request;
screening out actions corresponding to the service case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
sequentially recording action information based on the sequence of actions selected by the user from all the actions;
after the recording of the action information is finished, converting each action information into a corresponding action icon;
and connecting all the action icons according to the recording sequence of the action information to obtain the test case.
Those skilled in the art will appreciate that the structure shown in fig. 3 is only a block diagram of a part of the structure related to the present application, and does not constitute a limitation to the apparatus and the computer device to which the present application is applied.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where when the computer program is executed by a processor, the computer program implements a test case generation method, and specifically includes:
after the user successfully logs in, judging whether a test case generation request triggered by the user is received or not;
if the test case generation request is received, acquiring the service case information input by the user from the test case generation request;
screening out actions corresponding to the service case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
sequentially recording action information based on the sequence of actions selected by the user from all the actions;
after the recording of the action information is finished, converting each action information into a corresponding action icon;
and connecting all the action icons according to the recording sequence of the action information to obtain the test case.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method 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, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A test case generation method is characterized by comprising the following steps:
after the user successfully logs in, judging whether a test case generation request triggered by the user is received or not;
if the test case generation request is received, acquiring the service case information input by the user from the test case generation request;
screening out actions corresponding to the service case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
sequentially recording action information based on the sequence of actions selected by the user from all the actions;
after the recording of the action information is finished, converting each action information into a corresponding action icon;
and connecting all the action icons according to the recording sequence of the action information to obtain the test case.
2. The method for generating test cases according to claim 1, wherein the sequentially recording the action information based on the sequence in which the user selects the actions from all the actions comprises:
judging whether a first instruction triggered by the user is received; wherein, the first instruction is an instruction for starting recording;
if the first instruction is received, acquiring an action name of a specified action selected from all the actions by the user, and acquiring ID information of an operation element corresponding to the specified action;
generating a parameter form corresponding to the specified action based on the action name and the ID information, and obtaining action information corresponding to the specified action based on the parameter form so as to record the specified action;
recording the next action until a second instruction triggered by the user is received, and stopping recording; and the second instruction is an instruction for finishing recording.
3. The method for generating test cases according to claim 2, wherein the generating a parameter form corresponding to the specified action based on the action name and the ID information, and obtaining action information corresponding to the specified action based on the parameter form to complete recording of the specified action includes:
acquiring an action type corresponding to the specified action based on the action name; the action types comprise a first preset action type and a second preset action type;
if the action type is the first preset action type, generating a first form for inputting element ID information through a preset rendering tool, and filling the ID information in the first form to obtain a parameter form corresponding to the specified action;
if the action type is the second preset action type, generating a second form for inputting element ID information and text information through the rendering tool, filling the ID information into the second form, and filling the received target text information input by the user into the second form to obtain a parameter form corresponding to the specified action;
and generating action information corresponding to the specified action according to the parameter form package so as to record the specified action.
4. The method for generating the test case according to claim 1, wherein after the connecting all the action icons according to the recording sequence of the action information to obtain the test case, the method comprises:
acquiring an occupied memory value corresponding to the test case;
judging whether the occupied memory value is larger than a preset occupied memory threshold value or not;
if the memory occupation threshold value is larger than the memory occupation threshold value, storing the test case into a block chain;
and if the test case is not larger than the occupied memory threshold, storing the test case to a local preset database.
5. The method for generating the test case according to claim 1, wherein after the connecting all the action icons according to the recording sequence of the action information to obtain the test case, the method comprises:
acquiring the connection sequence of each action icon;
generating an automatic test script corresponding to the test case based on the connection sequence;
running the automatic test script to obtain a corresponding test result;
and displaying the test result.
6. The method according to claim 5, wherein the generating an automated test script corresponding to the test case based on the connection order comprises:
acquiring action functions corresponding to the action icons one to one;
respectively creating corresponding function scripts for each action function;
generating function calling statements corresponding to the function scripts one by one;
sequentially connecting the function call statements in series based on the connection sequence to obtain statement data after series connection;
and taking the sentence data after the serial connection as the automatic test script.
7. The method for generating test cases according to claim 5, wherein the running the automated test script to obtain the corresponding test result comprises:
performing running processing on the automatic test script for preset times to obtain a plurality of corresponding specified test results;
analyzing and processing all the specified test results, and judging whether test failure results exist in all the specified test results;
if the test failure result exists, generating a first test result of the test failure corresponding to the automatic test script;
and if the test failure result does not exist, generating a second test result which is successfully tested and corresponds to the automatic test script.
8. A test case generation apparatus, comprising:
the first judgment module is used for judging whether a test case generation request triggered by a user is received or not after the user successfully logs in;
the first obtaining module is used for obtaining the service case information input by the user from the test case generation request if the test case generation request is received;
the screening module is used for screening out actions corresponding to the service use case information from an action library of a preset RPA tool; wherein the number of actions comprises a plurality;
the recording module is used for sequentially recording action information based on the sequence of actions selected by the user from all the actions;
the conversion module is used for converting each piece of action information into a corresponding action icon after the recording of the action information is finished;
and the first generation module is used for connecting all the action icons according to the recording sequence of the action information to obtain the test case.
9. A computer device comprising a memory and a processor, the memory having stored therein a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202111520627.6A 2021-12-13 2021-12-13 Test case generation method and device, computer equipment and storage medium Pending CN114218097A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111520627.6A CN114218097A (en) 2021-12-13 2021-12-13 Test case generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111520627.6A CN114218097A (en) 2021-12-13 2021-12-13 Test case generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114218097A true CN114218097A (en) 2022-03-22

Family

ID=80701538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111520627.6A Pending CN114218097A (en) 2021-12-13 2021-12-13 Test case generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114218097A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115827480A (en) * 2022-12-20 2023-03-21 中船重工奥蓝托无锡软件技术有限公司 Automatic testing method, device and system for ship performance prediction APP
CN116383095A (en) * 2023-06-05 2023-07-04 南方电网数字电网研究院有限公司 Smoking test method and system based on RPA robot and readable storage medium
CN117234950A (en) * 2023-11-13 2023-12-15 广州品唯软件有限公司 Test case recording method and device, storage medium and computer equipment
CN117149820B (en) * 2023-09-25 2024-05-14 湖南长银五八消费金融股份有限公司 Borrowing operation detection method, device, equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115827480A (en) * 2022-12-20 2023-03-21 中船重工奥蓝托无锡软件技术有限公司 Automatic testing method, device and system for ship performance prediction APP
CN116383095A (en) * 2023-06-05 2023-07-04 南方电网数字电网研究院有限公司 Smoking test method and system based on RPA robot and readable storage medium
CN116383095B (en) * 2023-06-05 2023-11-24 南方电网数字电网研究院有限公司 Smoking test method and system based on RPA robot and readable storage medium
CN117149820B (en) * 2023-09-25 2024-05-14 湖南长银五八消费金融股份有限公司 Borrowing operation detection method, device, equipment and storage medium
CN117234950A (en) * 2023-11-13 2023-12-15 广州品唯软件有限公司 Test case recording method and device, storage medium and computer equipment
CN117234950B (en) * 2023-11-13 2024-03-19 广州品唯软件有限公司 Test case recording method and device, storage medium and computer equipment

Similar Documents

Publication Publication Date Title
CN114218097A (en) Test case generation method and device, computer equipment and storage medium
CN102411503B (en) A kind of method and system of the dry running performing business process model when design in environment
CN111737963B (en) Configuration file based form filling method and device and computer equipment
Alvarez et al. A methodological approach to model-driven design and development of automation systems
CN111861020A (en) Model deployment method, device, equipment and storage medium
JPH06103046A (en) System design method
US20140046457A1 (en) System and related method to facilitate process control
CN105930344B (en) A kind of database application system quick development platform based on product development process
Lettner et al. Feature modeling of two large-scale industrial software systems: Experiences and lessons learned
CN113642039A (en) Configuration method and device of document template, computer equipment and storage medium
CN112328482A (en) Test method and device based on script template, computer equipment and storage medium
CN111880921A (en) Job processing method and device based on rule engine and computer equipment
CN114817055A (en) Regression testing method and device based on interface, computer equipment and storage medium
CN113626285A (en) Model-based job monitoring method and device, computer equipment and storage medium
WO2023155274A1 (en) Recruitment information publishing method and apparatus based on rpa and ai
CN112650659B (en) Buried point setting method and device, computer equipment and storage medium
CN114625621A (en) Performance test method and device, computer equipment and storage medium
CN114547053A (en) System-based data processing method and device, computer equipment and storage medium
CN113050927A (en) Permission control method and device based on user-defined instruction and computer equipment
Bünder et al. Towards behavior-driven graphical user interface testing
Bishung et al. A critical analysis of topics in software architecture and design
CN104765608A (en) Implementation method and device of audio and video workflow application system
Batista et al. The conception of a large-scale Systems Engineering environment
CN114090548A (en) Database-based data processing method, database-based data processing device, database-based data processing equipment and storage medium
Pereira et al. Development of self-diagnosis tests system using a DSL for creating new test suites for integration in a cyber-physical system

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