CN115617462A - Test script generation method, device, equipment and storage medium - Google Patents

Test script generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN115617462A
CN115617462A CN202211404034.8A CN202211404034A CN115617462A CN 115617462 A CN115617462 A CN 115617462A CN 202211404034 A CN202211404034 A CN 202211404034A CN 115617462 A CN115617462 A CN 115617462A
Authority
CN
China
Prior art keywords
test script
expression
test
generating
service
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
CN202211404034.8A
Other languages
Chinese (zh)
Inventor
侯健琦
曹祯
谢彬
王晓昕
孙辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202211404034.8A priority Critical patent/CN115617462A/en
Publication of CN115617462A publication Critical patent/CN115617462A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • G06F9/45512Command shells
    • 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/368Test management for test version control, e.g. updating test cases to a new software version

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a test script generation method, a test script generation device, test script generation equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: constructing a forward test script associated with the function to be tested; extracting a test object from the forward test script, and generating a service rule expression based on the service rule associated with the forward test script and the object value associated with the test object; and generating a test script corresponding to the function to be tested based on the forward test script and the service rule expression. According to the technical scheme of the embodiment of the invention, a plurality of test scripts can be generated only through the pre-maintained service rule and one forward test script, so that the cost for generating the test scripts is greatly reduced.

Description

Test script generation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a test script.
Background
Test scripts are an important asset in automated testing processes and are the most basic unit of testing operations. When testing some important business logic, a combination of a plurality of forward and reverse cases is often needed to perform deep testing. At this time, a plurality of automatic test scripts need to be designed for one service logic.
In the prior art, a tester often generates a test script by manually writing, recording by using an automatic test tool, or converting a flow chart. When the important service logic is automatically tested, a plurality of test scripts need to be generated aiming at one service logic, and when the test scripts are generated by adopting the three modes, the requirement on the professional skills of testers is high, and the workload for generating and maintaining the test scripts is large.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for generating a test script, which aim to solve the problem of large workload of generation and maintenance of the test script in an important logic test process.
According to an aspect of the present invention, there is provided a method for generating a test script, including:
constructing a forward test script associated with the function to be tested;
extracting a test object from the forward test script, and generating a service rule expression based on the service rule associated with the forward test script and the object value associated with the test object;
and generating a test script corresponding to the function to be tested based on the forward test script and the service rule expression.
According to another aspect of the present invention, there is provided a test script generating apparatus, including:
the forward test script building module is used for building a forward test script associated with the function to be tested;
a service rule expression generation module, configured to extract a test object from the forward test script, and generate a service rule expression based on a service rule associated with the forward test script and an object value associated with the test object;
and the test script generating module is used for generating a test script corresponding to the function to be tested based on the forward test script and the service rule expression.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform a method of generating a test script according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the method for generating a test script according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, the forward test script associated with the function to be tested is constructed, the test object is further extracted from the forward test script, the service rule expression is generated based on the service rule associated with the forward test script and the object value associated with the test object, and finally the test script corresponding to the function to be tested is generated based on the forward test script and the service rule expression.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1a is a flowchart of a method for generating a test script according to an embodiment of the present invention;
FIG. 1b is a schematic diagram of a script configuration of a test script provided according to an embodiment of the present invention;
FIG. 1c is a schematic diagram of a hierarchical structure of a system for providing services according to an embodiment of the present invention;
FIG. 2 is a flowchart of a test script generation method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a test script generation apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device implementing the test script generation method according to the embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1a is a flowchart of a method for generating a test script according to an embodiment of the present invention, where the method is applicable to a case where multiple test scripts are generated based on a pre-maintained business rule and a forward test script, and the method may be executed by a test script generation apparatus, where the test script generation apparatus may be implemented in a hardware and/or software form, and the test script generation apparatus may be configured in various general-purpose computing devices. As shown in fig. 1a, the method comprises:
and S110, constructing a forward test script associated with the function to be tested.
The function to be tested refers to a function that needs to be tested in an application system, for example, a teller withdrawal function. The withdrawal function and the account number or account balance and other information related to the withdrawal function in this embodiment are virtual data used for software function testing, and are not real user data.
In the embodiment of the invention, in order to test whether the function to be tested can normally run or not, a forward test script associated with the function to be tested is firstly established. Specifically, the forward test script in the interface form may be generated through a script recording function, or may be a forward test script in a configuration interface form.
In a specific example, the function to be tested is a teller withdrawal function, and the teller needs to perform actions of signing in, inquiring balance, withdrawing money and inquiring balance again in sequence so as to record a forward test script in the form of a forward passing interface.
Optionally, the forward test script is an interface test script or an interface test script.
In this alternative embodiment, the forward test script may be an interface test script or an interface test script. Taking the teller withdrawing function as an example, the teller needs to perform the actions of sign-in, balance inquiry, withdrawal and balance inquiry again in sequence, and the process is recorded by the script recording tool, so that the interface forward test script is obtained as follows:
1. sign-in interface, username + enter + [ common manual teller, teller number ];
2. sign-in interface, password + input + [ common manual teller, password ];
3. sign-in interface, login and click;
4. a combination step (combination-inquiry; card number = [ normal debit card, card number ]; balance- > [ balance before withdrawal ]);
5. drawing interface, card number + input + [ step 4, card number ];
6. money withdrawal interface, amount + input +1000.00;
7. a withdrawal interface is determined and clicked;
8. check point (object exists: withdrawal interface. Withdrawal success dialog box);
9. a combination step (combination-query; card number = [ step 4. Card number ]; balance- > [ balance after withdrawal ]);
10. checking points (digital logic: [ balance before withdrawal ] -1000.00= [ balance after withdrawal ]).
In this example, the check point is set as a subtraction of a balance before withdrawal and a withdrawal amount, so as to obtain a balance after withdrawal. The combination step is to combine a plurality of atomic steps together to form a reusable structure and realize flexible calling through parameter configuration in order to improve the reusability of the test script step.
In agile mode, the above process can be synchronized with the development process: after the developer locally runs the code in the Debug mode, the tester can be connected with a server running in the Debug mode to quickly record a forward test script.
In the embodiment of the present invention, an interface automation test script corresponding to the teller withdrawal function may also be constructed, specifically as follows:
transaction 1: the user formally checks in.
The user formal check-in transaction comprises a plurality of input and output fields such as a transaction code, request time, user identification, password ciphertext, user name and the like.
Transaction 2: the debit card balance is queried.
The debit card balance query includes a plurality of input and output fields including user identification, transaction device, card number, currency, account amount, expiration date, etc.
Transaction 3: the bank card account withdraws cash.
The cash withdrawal of the bank card account comprises a plurality of input and output fields such as a transaction code, request time, transaction amount, a merchant number, account balance, handling fee and the like.
Transaction 4: the debit card balance is queried.
The debit card balance query includes a plurality of input and output fields including user identification, transaction device, card number, currency, account amount, expiration date, etc.
Equation 1: transaction 4 output-1000 = transaction 2 output.
The formula has the same function as the detection points in the interface test script, and is used for verifying the data correctness before and after withdrawal.
The script configuration diagram is shown in fig. 1b, where each field is followed by a domain identifier of an interface, and the method specifically includes: the first bit of I/O represents input/output, the second bit is the transaction serial number, the third bit of the plus-minus sign represents the public domain or the private domain, the public domain is positive, the private domain is negative, and the fourth bit is the field serial number. For example, the request time is I1-3, the 3 rd field representing the public entry for transaction 1.
S120, extracting a test object from the forward test script, and generating a service rule expression based on the service rule associated with the forward test script and the object value associated with the test object.
The test object refers to an input or output element included in the forward test script, and taking a withdrawal function as an example, the test object may be a teller number, a card number, a password, a withdrawal amount, and the like of a teller performing a withdrawal operation. The object value may be a forward or reverse value provided by the user for testing, for example, the card number may be card number 1 or card number 2, and the withdrawal amount may be 50000, 50001 or-1. Wherein, the forward value refers to a value which can pass forward, and the reverse value refers to a value which can not finish a round of withdrawal operation.
The business rule is a rule which is maintained by the user in advance and is related to the business, for example, the withdrawal amount should not exceed 50000 or the withdrawal amount should not be negative. The service rule expression is an expression generated according to the service rule and the value of the test object, and the service rule expression can be divided into a forward service rule expression and a reverse service rule expression.
In the embodiment of the invention, after the forward test script associated with the function to be tested is established, the test object is extracted from the forward test script, and further, the service rule expression is generated based on the service rule associated with the forward test script and the object value associated with the test object. Specifically, the test object is extracted from the forward test script, then the service rule associated with the forward test script is read from the service rule base, and at least one object value associated with each test object provided by the user is obtained. And finally, establishing a forward business rule expression and a reverse business rule expression according to the business rule and the object value.
In one specific example, the test objects extracted from the forward test script are a card number and a withdrawal amount. The business rule is that the withdrawal amount does not exceed 50000 or the withdrawal amount does not have to be a negative number, the object values related to the card numbers provided by the users are card number 1 and card number 2, and the object values related to the withdrawal amount provided by the users are 50000, 50001 and-1. Then, according to the service rule and the object value provided by the user, a forward service rule expression can be established as follows:
([ card number ] is "card number 1" or [ card number ] is "card number 2") And ([ amount ] is "50000").
The reverse business rule expression may also be established as follows:
([ card number ] is "card number 1" or [ card number ] is "card number 2") And ([ amount ] is "50001" or [ amount ] is "-1").
Optionally, before constructing the forward test script associated with the function to be tested, the method further includes:
determining a target business rule base based on a rule base version provided by a user;
before extracting the test object in the forward test script, the method further comprises the following steps:
and responding to the rule binding operation of the user, and binding the forward test script with at least one business rule in the target business rule asset library.
The business rule base is constructed according to the test requirement and the business hierarchical structure, and the business rule base comprises a plurality of business rules related to one business system. The hierarchical structure of the business system is shown in fig. 1c, one business system includes a plurality of modules, each module may include a plurality of transactions, each transaction may involve an input item and an output item, and a rule expression may be constructed according to the values of the input item and the output item (i.e., the above-mentioned test object) and the business rules.
In this optional embodiment, before the forward test script associated with the function to be tested is constructed, a target business rule base matched with the version selected by the user is further selected from the multiple business rule bases based on the version of the rule base selected by the user. Illustratively, the business rule base may be divided into test versions, production versions, and so on. The user can select the business rule base with the corresponding version according to requirements before generating the test script.
A tester can maintain a set of complete service rule base, when different versions are generated, only the service rules of the rule base need to be inherited, changed information is maintained in the inherited rule base according to the change of the versions, namely, the switching of the versions of the rule base is controlled through the attribute of ' whether the current version ' is available ', the flexible updating and the rollback of the versions are realized, and the maintenance cost of the service rule base is reduced.
S130, generating a test script corresponding to the function to be tested based on the forward test script and the business rule expression.
In the embodiment of the invention, after the business rule expression is constructed, a plurality of test scripts associated with the functions to be tested can be generated based on the forward test script and the business rule expression, the test scripts do not need to be written manually one by one, the test density is improved, and meanwhile, the labor cost is reduced. Specifically, the service rule expression may be split to obtain a plurality of service scenario expressions, and finally, a corresponding test scenario is generated based on the service scenario expressions and the forward test scenario obtained by the splitting.
In a specific example, the forward business rule expression is ([ card number ] is "card number 1" or [ card number ] is "card number 2") And ([ amount ] is "50000"). The forward business rule expression may be split to obtain two business scenario expressions, which are ([ card number ] is "card number 1") And ([ amount ] is "50000") And ([ card number ] is "card number 2") And ([ amount ] is "50000"). And then generating two corresponding forward test scripts according to the service scene expression and the forward test scripts obtained by splitting.
According to the technical scheme of the embodiment of the invention, the forward test script associated with the function to be tested is constructed, the test object is further extracted from the forward test script, the service rule expression is generated based on the service rule associated with the forward test script and the object value associated with the test object, and finally the test script corresponding to the function to be tested is generated based on the forward test script and the service rule expression.
Example two
Fig. 2 is a flowchart of a method for generating a test script according to a second embodiment of the present invention, which is further detailed based on the second embodiment of the present invention, and provides a specific step of generating a service rule expression based on a service rule associated with a forward test script and an object value associated with a test object, and a specific step of generating a test script corresponding to a function to be tested based on the forward test script and the service rule expression. As shown in fig. 2, the method includes:
s210, constructing a forward test script associated with the function to be tested.
S220, extracting a test object from the forward test script, reading a service rule associated with the forward test script from a target service rule base, and acquiring an object value provided by a user for the test object.
In the embodiment of the invention, in order to generate the test script, after the forward test script associated with the function to be tested is constructed, the test object needs to be extracted from the forward test script, and the object value provided by the user for the test object is obtained according to the service rule associated with the forward test script in the target service rule base.
In a specific example, after a forward test script for drawing money by a teller is generated, a card number and a drawing money amount are extracted from the forward test script to be used as test objects. Furthermore, the business rule associated with the current forward test script is read from a target business rule base selected by the user in advance. After the user generates the forward test script, the association relationship between the forward test script and at least one service rule in the target service rule base needs to be established. Further, the user needs to obtain an object value provided by the user for the test object. For example, the withdrawal amount includes values of 50000, 50001, and-1.
And S230, generating a business rule expression according to the object value associated with the test object based on the business rule.
In the embodiment of the invention, based on the business rule associated with the forward test script, the business rule expression is generated according to the object value associated with the test object. For example, the test object is a card number and a withdrawal amount, wherein the object value of the card number comprises the card number 1 and the card number 2, and the withdrawal amount comprises values of 50000, 50001 and-1. A forward business rule expression ([ card number ] is "card number 1" or [ card number ] is "card number 2") And ([ amount ] is "50000") And a reverse business rule expression ([ card number ] is "card number 1" or [ card number ] is "card number 2") And ([ amount ] is "50001" or [ amount ] is "-1") may be generated based on the business rules And the above object values. Card number 1, card number 2 and 50000 are object values meeting the business rule, and 50001 and-1 belong to object values not meeting the business rule.
S240, splitting the business rule expression to obtain at least one business scene expression contained in the business rule expression.
In the embodiment of the present invention, since one service rule expression may include one or more service scenarios, before generating the test script based on the service rule expression, the service rule expression needs to be split to obtain at least one service scenario expression included in the service rule expression.
In a specific example, the forward business rule expression is ([ card number ] is "card number 1" or [ card number ] is "card number 2") And ([ amount ] is "50000"), which contains two forward business scenarios, and thus can be split into two business scenario expressions, namely ([ card number ] is "card number 1") And ([ amount ] is "50000") And ([ card number ] is "card number 2") And ([ amount ] is "50000"). When the interface test script is generated currently, the check point of the service scene is digital logic ([ balance before withdrawal ] -50000.00= [ balance after withdrawal ]). When generating the interface test script, the verification formula of the service scenario is-50000 = output of the balance inquiry transaction before drawing.
In another specific example, the reverse business rule expression is ([ card number ] is "card number 1" or [ card number ] is "card number 2") And ([ amount ] is "50001" or [ amount ] is "-1"). The 4 reverse business scenarios are included, so that the system can be divided into 4 business scenario expressions, namely ([ card number ] is "card number 1") And ([ amount ] is "50001"), ([ card number ] is "card number 2") And ([ amount ] is "50001"), ([ card number ] is "card number 1") And ([ amount ] is "-1"), ([ card number ] is "card number 2") And ([ amount ] is "-1"). Under the scene of generating the interface test script, the check points corresponding to the first two reverse service regular expressions display an over-limit dialog box for the withdrawal interface, and the verification formulas corresponding to the second two reverse service regular expressions display an illegal dialog box for the withdrawal interface. Under the scene of generating the interface test script, the check points corresponding to the first two reverse service rule expressions are output amount overrun word samples in the withdrawal transaction process, and the verification formulas corresponding to the second two reverse service scene expressions are output amount illegal word samples in the withdrawal transaction process.
And S250, generating a corresponding test script based on each service scene expression and the forward test script.
In the embodiment of the invention, after the business rule expression is split to obtain a plurality of business scene expressions, the value of the test object in the forward test script is changed based on each business scene expression to generate the test script corresponding to each business scene expression.
Optionally, the service scene expression includes a forward scene expression and a reverse scene expression;
generating a corresponding test script based on each service scene expression and the forward test script, wherein the test script comprises:
changing the object value in the forward test script based on the forward scene expression to generate at least one forward test script;
and changing the object value in the forward test script based on the reverse scene expression to generate at least one reverse test script.
In this optional embodiment, the service scene expression is also divided into a forward scene expression and a reverse scene expression. And changing the object value in the forward test script based on the forward scene expression to generate at least one forward test script. And changing the object value of the test object in the forward test script based on the reverse scene expression to generate at least one reverse test script. The forward test script and the reverse test script can be interface-type test scripts or interface-type test scripts.
In a specific example, for a forward business scenario expression ([ card number ] is "card number 1") And ([ amount ] is "50000"), a forward test script may be generated as follows:
1. sign-in interface, username + enter + [ common manual teller, teller number ];
2. sign-in interface, password + input + [ common manual teller, password ];
3. sign-in interface, login and click;
4. a combination step (combination-query; card number = card number 1; balance- > [ balance before withdrawal ]);
5. the card number + input + card number 1;
6. money sum + input +50000;
7. a withdrawal interface is determined and clicked;
8. check point (object exists: withdrawal interface. Withdrawal success dialog box);
9. a combination step (combination-query; card number = card number 1; balance- > [ balance after withdrawal ]);
10. checking points (digital logic: [ balance before withdrawal ] -50000= [ balance after withdrawal ]).
In another specific example, for a reverse business scenario expression ([ card number ] is "card number 1") And ([ amount ] is "50001"), a reverse test script may be generated as follows:
1. sign-in interface, username + enter + [ common manual teller, teller number ];
2. sign-in interface, password + input + [ common manual teller, password ];
3. sign-in interface, login and click;
4. a combination step (combination-query; card number = card number 1; balance- > [ balance before withdrawal ]);
5. the card number + input + card number 1;
6. withdraw interface, amount + input +50001;
7. the withdrawal interface is determined and clicked;
8. check point (object exists: withdrawal interface. Withdrawal success dialog box);
9. a combination step (combination-query; card number = card number 1; balance- > [ balance after withdrawal ]);
10. checkpoint (object existence: withdrawal interface. Amount overrun dialog).
According to the technical scheme of the embodiment of the invention, the forward test script associated with the function to be tested is constructed, the test object is further extracted from the forward test script, the service rule expression is generated based on the service rule associated with the forward test script and the object value associated with the test object, and finally the test script corresponding to the function to be tested is generated based on the forward test script and the service rule expression.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a device for generating a test script according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes:
a forward test script construction module 310, configured to construct a forward test script associated with a function to be tested;
a service rule expression generating module 320, configured to extract a test object from the forward test script, and generate a service rule expression based on a service rule associated with the forward test script and an object value associated with the test object;
the test script generating module 330 is configured to generate a test script corresponding to the function to be tested based on the forward test script and the service rule expression.
According to the technical scheme of the embodiment of the invention, the forward test script associated with the function to be tested is constructed, the test object is further extracted from the forward test script, the service rule expression is generated based on the service rule associated with the forward test script and the object value associated with the test object, and finally the test script corresponding to the function to be tested is generated based on the forward test script and the service rule expression.
Optionally, the business rule expression generating module 320 is specifically configured to:
reading the service rule associated with the forward test script in a target service rule base, and acquiring an object value provided by a user for the test object;
and generating a service rule expression according to the object value associated with the test object based on the service rule.
Optionally, the test script generating module 330 includes:
the expression splitting unit is used for splitting the service rule expression to obtain at least one service scene expression contained in the service rule expression;
and the test script generating unit is used for generating a corresponding test script based on each service scene expression and the forward test script.
Optionally, the service scene expression includes a forward scene expression and a reverse scene expression;
the test script generating unit is specifically configured to:
changing the object value in the forward test script based on a forward scene expression to generate at least one forward test script;
and changing the object value in the forward test script based on the reverse scene expression to generate at least one reverse test script.
Optionally, the forward test script is an interface test script or an interface test script.
Optionally, the device for generating a test script further includes:
the service rule base determining module is used for determining a target service rule base based on a rule base version provided by a user before a forward test script associated with a function to be tested is established;
and the business rule binding module is used for binding the forward test script with at least one business rule in the target business rule asset library in response to the rule binding operation of a user before the test object is extracted from the forward test script.
The test script generation device provided by the embodiment of the invention can execute the test script generation method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
In the technical scheme of the disclosure, the processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the related user all accord with the regulations of related laws and regulations, and do not violate the common customs of public order.
Example four
FIG. 4 shows a schematic block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as the generation method of the test script.
In some embodiments, the method of generating the test script may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method of generating a test script described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the test script generation method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for generating a test script, comprising:
constructing a forward test script associated with the function to be tested;
extracting a test object from the forward test script, and generating a service rule expression based on the service rule associated with the forward test script and the object value associated with the test object;
and generating a test script corresponding to the function to be tested based on the forward test script and the service rule expression.
2. The method of claim 1, wherein generating a business rule expression based on the business rule associated with the forward test script and the object value associated with the test object comprises:
reading the service rule associated with the forward test script in a target service rule base, and acquiring an object value provided by a user for the test object;
and generating a service rule expression according to the object value associated with the test object based on the service rule.
3. The method of claim 1, wherein generating a test script corresponding to the function to be tested based on the forward test script and the business rule expression comprises:
splitting the service rule expression to obtain at least one service scene expression contained in the service rule expression;
and generating a corresponding test script based on each service scene expression and the forward test script.
4. The method of claim 3, wherein the service scene expression comprises a forward scene expression and a reverse scene expression;
generating a corresponding test script based on each service scene expression and the forward test script, wherein the test script comprises:
changing the object value in the forward test script based on a forward scene expression to generate at least one forward test script;
and changing the object value in the forward test script based on the reverse scene expression to generate at least one reverse test script.
5. The method of claim 1, wherein the forward test script is an interface test script or an interface test script.
6. The method of claim 2, prior to constructing the forward test script associated with the function under test, further comprising:
determining a target business rule base based on a rule base version provided by a user;
before extracting the test object in the forward test script, the method further comprises:
and responding to the rule binding operation of the user, and binding the forward test script with at least one business rule in the target business rule asset library.
7. An apparatus for generating a test script, comprising:
the forward test script building module is used for building a forward test script associated with the function to be tested;
a service rule expression generation module, configured to extract a test object from the forward test script, and generate a service rule expression based on a service rule associated with the forward test script and an object value associated with the test object;
and the test script generating module is used for generating a test script corresponding to the function to be tested based on the forward test script and the service rule expression.
8. The apparatus of claim 7, wherein the business rule expression generating module is specifically configured to:
reading the service rule associated with the forward test script in a target service rule base, and acquiring an object value provided by a user for the test object;
and generating a service rule expression according to the object value associated with the test object based on the service rule.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of generating a test script of any one of claims 1-6.
10. A computer-readable storage medium storing computer instructions for causing a processor to implement the method of generating a test script according to any one of claims 1 to 6 when executed.
CN202211404034.8A 2022-11-10 2022-11-10 Test script generation method, device, equipment and storage medium Pending CN115617462A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211404034.8A CN115617462A (en) 2022-11-10 2022-11-10 Test script generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211404034.8A CN115617462A (en) 2022-11-10 2022-11-10 Test script generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115617462A true CN115617462A (en) 2023-01-17

Family

ID=84878386

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211404034.8A Pending CN115617462A (en) 2022-11-10 2022-11-10 Test script generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115617462A (en)

Similar Documents

Publication Publication Date Title
CN113360580B (en) Abnormal event detection method, device, equipment and medium based on knowledge graph
WO2022198835A1 (en) Method and apparatus for testing electronic map, and electronic device and storage medium
CN114443493A (en) Test case generation method and device, electronic equipment and storage medium
CN115599679A (en) Test rule base updating method and device, electronic equipment and storage medium
CN114444087A (en) Unauthorized vulnerability detection method and device, electronic equipment and storage medium
CN115617462A (en) Test script generation method, device, equipment and storage medium
CN114443802A (en) Interface document processing method and device, electronic equipment and storage medium
CN114116688A (en) Data processing and data quality inspection method, device and readable storage medium
CN111489101A (en) Order auditing method, device, equipment and medium based on big data
CN111859985A (en) AI customer service model testing method, device, electronic equipment and storage medium
Ecar et al. AutoCosmic: COSMIC automated estimation and management tool
CN117806981B (en) CFD software automatic testing method and system
CN113961518B (en) Log visual display method and device, electronic equipment and storage medium
CN113704103B (en) Test case recommendation method and device, medium and electronic equipment
CN110414186B (en) Data asset segmentation verification method and device
CN114579438A (en) Interface information detection method, device, equipment and storage medium
Ramadhani Design and Implementation of Mobile Native Application
CN114879947A (en) Method, device, equipment and medium for field configuration
CN115599689A (en) Test logic display method, device, equipment and storage medium
CN117632741A (en) Determination method and device of regression test case library, electronic equipment and storage medium
CN114627410A (en) Video verification method and related device for obtaining service
CN115617680A (en) User experience test case generation method, device, equipment and storage medium
CN114492409A (en) Method and device for evaluating file content, electronic equipment and program product
CN115865409A (en) Code risk detection method, device, equipment and medium
CN115658612A (en) Object renaming 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