CN116166525A - Method and device for generating test script - Google Patents

Method and device for generating test script Download PDF

Info

Publication number
CN116166525A
CN116166525A CN202211436814.0A CN202211436814A CN116166525A CN 116166525 A CN116166525 A CN 116166525A CN 202211436814 A CN202211436814 A CN 202211436814A CN 116166525 A CN116166525 A CN 116166525A
Authority
CN
China
Prior art keywords
test
operation function
target
script
generating
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
CN202211436814.0A
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.)
XFusion Digital Technologies Co Ltd
Original Assignee
XFusion Digital Technologies 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 XFusion Digital Technologies Co Ltd filed Critical XFusion Digital Technologies Co Ltd
Priority to CN202211436814.0A priority Critical patent/CN116166525A/en
Publication of CN116166525A publication Critical patent/CN116166525A/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/3664Environments for testing or debugging software
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application discloses a method and a device for generating a test script, which relate to the technical field of automatic testing, do not need to write the test script manually, and can generate the test script more conveniently and rapidly. The method comprises the following steps: extracting test step information of a target test task from a test case of the target test task according to the target test task of the subsystem to be tested of the server; acquiring a target operation function corresponding to the test step information from an operation function library; the operation function library comprises operation functions executable by all subsystems in the server, and the target operation functions comprise one or more operation functions for executing target test tasks on the subsystem to be tested of the server; and generating an automatic test script based on the target operation function, wherein the automatic test script is used for executing a target test task on the subsystem to be tested.

Description

Method and device for generating test script
Technical Field
The present disclosure relates to the field of automated testing technologies, and in particular, to a method and an apparatus for generating a test script.
Background
A server is a whole of various subsystems, including hardware and software, combined together. Server testing is testing for various subsystems, and the current trend is to replace manual testing with automated testing.
Server automated testing relies on automated test scripts. The method for developing the automated test script in the related art comprises the following steps: and the tester writes a new automatic test script according to the test case of the tested object. It can be seen that the following problems exist in the automated test script development method provided by the related art: the code writing level requirement of writing test scripts to testers is high, so that the entry threshold of script development is high, and the speed of manually writing the test scripts is low, so that the development speed of the test scripts is low.
Disclosure of Invention
The method and the device for generating the test script can generate the test script more conveniently and rapidly without manually writing the test script.
In a first aspect, the present application provides a method for generating a test script, including: extracting test step information of a target test task from a test case of the target test task according to the target test task of the subsystem to be tested of the server; acquiring a target operation function corresponding to the test step information from an operation function library; the operation function library comprises operation functions executable by all subsystems in the server, and the target operation functions comprise one or more operation functions for executing target test tasks on the subsystem to be tested of the server; and generating an automatic test script based on the target operation function, wherein the automatic test script is used for executing a target test task on the subsystem to be tested.
It can be understood that in the method for generating the test script provided by the application, the test step information of the target test task can be obtained according to the test case of the target test task, further, the target operation function is obtained from the operation function library according to the test step information of the target test task, and finally, the automatic test script is automatically generated according to the target operation function. It can be seen that, based on the method for generating the test script provided by the embodiment of the application, a user only needs to select a corresponding operation function from the operation function library according to the test step information of the target test task, and does not need to write the test script manually, so that the threshold for developing the automatic test script is reduced, and the development speed of the automatic test script is improved.
In one possible implementation manner, the obtaining, from the operation function library, the target operation function corresponding to the test step information includes: responding to the selected operation of the target operation function in the operation function library, and acquiring the target operation function corresponding to the test step information; the target operating function is determined based on the test step information.
It can be understood that, based on the method provided by the application, a user can determine a target operation function according to the test step information of the target test task, and then search the target operation function in the operation function library, so as to select the target operation function; correspondingly, the processor responds to the selected operation of the target operation function in the operation function library to acquire the target operation function corresponding to the test step information.
In another possible implementation manner, the operation function library further includes description information of operation functions executable by each subsystem in the server; the method further comprises the following steps: extracting description information of an operation function from the test step information; screening one or more candidate operation functions from the operation function library according to the extracted description information of the operation functions; the step of obtaining the target operation function corresponding to the test step information in response to the selected operation of the target operation function in the operation function library comprises the following steps: and responding to the selected operation of the target operation function in the one or more candidate operation functions, and acquiring the target operation function corresponding to the test step information.
It can be understood that the operation function library provided by the application further comprises description information of the operation functions, so that the processor can screen one or more candidate operation functions from the operation function library according to the extracted description information of the operation functions; and further determining a target operating function from the one or more candidate operating functions. Therefore, compared with the method in the related art, which can only screen according to the content of the operation function, the method provided by the application can screen according to the description information of the operation function, so that the screening precision is improved, the screening omission is avoided, the screening precision of the operation function is effectively improved, and a user can be assisted to acquire the target operation function rapidly and accurately.
In another possible implementation manner, the target operation function includes an operation function for performing a test step; the generating an automated test script based on the target operation function includes: an automated test script is generated based on the operating functions for performing the test steps.
It can be appreciated that, according to the method provided by the application, the operation function for executing the test step can be determined according to the test step information of the target test task; and further generating an automated test script according to the operating functions for executing the test steps. In this manner, the automated test script may be used to perform a target test task on a subsystem under test of a server.
In another possible implementation manner, the objective operation function further includes: an operating function for restoring the test environment; the generating an automated test script based on the target operation function includes: an automated test script is generated based on the operating functions for performing the test steps and the operating functions for restoring the test environment.
It can be understood that, according to the method provided by the application, the operation function for recovering the test environment can be determined according to the test environment of the server; and further generating an automated test script based on the operating functions for performing the testing steps and the operating functions for restoring the testing environment. Thus, the automated test script can be used to execute a target test task on a subsystem to be tested of the server, and restore the test environment of the server after the target test task is executed.
In another possible implementation manner, the method further includes: generating a test file; the test file includes: a test sleeve file and a test bed file; the test set file is used for recording codes of the automatic test script; the test bed file is used for recording test environment information.
It can be understood that, because the test bed file is used for recording the test environment information of the server corresponding to the automated test script, the automated test platform can acquire the test environment of the target test task according to the test bed file, establish connection with the test object (i.e. the subsystem to be tested) of the target test task, and establish connection with the server where the subsystem to be tested is located. Because the test suite file is used for recording codes in the automatic test script, the automatic test platform can acquire the codes in the automatic test script of the target test task according to the test suite file, and then execute the target test task to the subsystem to be tested according to the codes in the automatic test script.
In another possible implementation manner, the description information of the operation function includes one or more of the following: the name of the operation function, the function description of the operation function, the class to which the operation function belongs, the input variable of the operation function, the output variable of the operation function or the calling example of the operation function.
It can be understood that the operation function library provided by the embodiment of the application further includes description information of the operation function, so that when the operation function is selected, screening can be performed according to the description information of the operation function, screening precision is improved, and screening omission is avoided. In addition, the user can know the information such as the function, the calling method and the like of the operation function according to the description information of the operation function, so that even if the user does not know programming, the user can select a proper operation function according to the description information of the operation function, and the entry threshold for developing the test script is reduced.
In a second aspect, the present application provides a script generating apparatus, including: the extraction module is used for extracting the testing step information of the target testing task from the testing case of the target testing task according to the target testing task of the subsystem to be tested of the server; the acquisition module is used for acquiring a target operation function corresponding to the test step information from the operation function library; the operation function library comprises operation functions executable by all subsystems in the server, and the target operation functions comprise one or more operation functions for executing target test tasks on the subsystem to be tested of the server; the generation module is used for generating an automatic test script based on the target operation function, wherein the automatic test script is used for executing a target test task on the subsystem to be tested.
In one possible implementation manner, the obtaining module is specifically configured to obtain a target operation function corresponding to the test step information in response to a selected operation on the target operation function in the operation function library; the target operating function is determined based on the test step information.
In another possible implementation manner, the operation function library further includes description information of operation functions executable by each subsystem in the server; the extraction module is also used for extracting description information of the operation function from the test step information; the script generating device further includes: the screening module is used for screening one or more candidate operation functions from the operation function library according to the extracted description information of the operation functions; the acquiring module is specifically configured to respond to a selected operation on a target operation function in the one or more candidate operation functions, and acquire a target operation function corresponding to the test step information.
In another possible implementation manner, the target operation function includes an operation function for performing a test step; the generation module is specifically configured to generate an automated test script according to an operation function for executing the test step.
In another possible implementation manner, the objective operation function further includes: an operating function for restoring the test environment; the generation module is specifically configured to generate an automated test script according to an operation function for executing the test step and an operation function for recovering the test environment.
In another possible implementation manner, the generating module is further configured to generate a test file; the test file includes: a test sleeve file and a test bed file; the test set file is used for recording codes of the automatic test script; the test bed file is used for recording test environment information.
In another possible implementation manner, the description information of the operation function includes one or more of the following: the name of the operation function, the function description of the operation function, the class to which the operation function belongs, the input variable of the operation function, the output variable of the operation function or the calling example of the operation function.
In a third aspect, the present application provides a script generating apparatus, including: the interface and the logic circuit are used for executing any one of the test script generation methods provided in the first aspect.
In a fourth aspect, the present application provides a computing device comprising a processor and a memory; the processor is coupled with the memory; the memory is used to store computer instructions that are loaded and executed by the processor to cause the computing device to implement any of the methods of generating test scripts provided in the first aspect above.
In a fifth aspect, the present application provides a computer-readable storage medium storing computer-executable instructions that, when executed on a computer, cause the computer to perform any one of the methods of generating test scripts provided in the first aspect.
In a sixth aspect, the present application provides a computer program product comprising computer instructions which, when run on a computer, cause the computer to perform the method of generating a test script as any one of the first aspects provided above.
For a detailed description of the second aspect and various implementations thereof in this application, reference may be made to the detailed description of the first aspect and various implementations thereof; moreover, the advantages of the second aspect and the various implementations thereof may be referred to as analyzing the advantages of the first aspect and the various implementations thereof, and will not be described herein.
These and other aspects of the present application will be more readily apparent from the following description.
Drawings
Fig. 1 is a schematic diagram of a system architecture involved in a method for generating a test script according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a computing device according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an automated test framework according to an embodiment of the present application;
FIG. 4 is a schematic diagram I of a user interface provided in an embodiment of the present application;
FIG. 5 is a workflow diagram of a script generation tool provided by embodiments of the present application;
FIG. 6 is a flowchart of a method for generating test scripts according to an embodiment of the present application;
FIG. 7 is a second schematic diagram of a user interface according to an embodiment of the present disclosure;
FIG. 8 is a third schematic illustration of a user interface provided in an embodiment of the present application;
FIG. 9 is a fourth schematic diagram of a user interface according to an embodiment of the present disclosure;
FIG. 10 is a fifth schematic diagram of a user interface provided in an embodiment of the present application;
FIG. 11 is a diagram six of a user interface according to an embodiment of the present application;
FIG. 12 is a schematic diagram seventh of a user interface provided in an embodiment of the present application;
FIG. 13 is a schematic illustration eight of a user interface provided in an embodiment of the present application;
FIG. 14 is a diagram nine of a user interface provided in an embodiment of the present application;
fig. 15 is a schematic structural diagram of a script generating apparatus according to an embodiment of the present application.
Detailed Description
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone.
The terms "first" and "second" and the like in the description and in the drawings are used for distinguishing between different objects or for distinguishing between different processes of the same object and not for describing a particular sequential order of objects.
Furthermore, references to the terms "comprising" and "having" and any variations thereof in the description of the present application are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed but may optionally include other steps or elements not listed or inherent to such process, method, article, or apparatus.
It should be noted that, in the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
In the description of the present application, unless otherwise indicated, the meaning of "a plurality" means two or more.
Aiming at the technical problems in the related art, the application provides a method for generating a test script, which has the following ideas: according to the test cases of the target test tasks, the test step information of the target test tasks is obtained, further, the target operation functions are obtained from the operation function library according to the test step information of the target test tasks, and finally, an automatic test script is automatically generated according to the target operation functions. It can be seen that, based on the method for generating the test script provided by the embodiment of the application, a user only needs to select a corresponding operation function from the operation function library according to the test step information of the target test task, and does not need to write the test script manually, so that the threshold for developing the automatic test script is reduced, and the development speed of the automatic test script is improved.
The embodiments provided in the present application are specifically described below with reference to the drawings attached to the specification.
Referring to fig. 1, a schematic diagram of a system architecture involved in a test script generating method according to an embodiment of the present application is shown. As shown in fig. 1, the hardware running environment includes: computing device 100 and server 200.
In the present embodiment, the computing device 100 is used to perform automated testing on the server 200.
In some embodiments, computing device 100 includes: script generation tools and automated test platforms. The script generation tool and the automated test platform are both in a software form.
Wherein the script generation tool is used to generate an automated test script for the server 200. Specifically, the script generation tool includes a User Interface (UI) capable of interacting with a user, and generates an automated test script based on data generated during the interaction with the user.
In some embodiments, the script generation tool is further for generating a test file; the test file comprises codes of an automatic test script; the test file is used for automated testing of the server 200 by an automated test platform.
The automated test platform is used for automatically testing the server 200 according to the test file generated by the script generating tool. The automated test platform may be an automated test platform constructed by an automated test tool such as uniAutos or Selenium, which is not limited in the embodiments of the present application.
Alternatively, the computing device 100 may be a tablet, desktop, laptop, handheld computer, notebook, ultra-mobile personal computer (UMPC), netbook, cell phone, personal digital assistant (personal digital assistant, PDA), augmented reality (augmented reality, AR) \virtual reality (VR) device, or the like. The embodiments of the present application are not particularly limited to the specific form of the computing device 100.
Referring to fig. 2, a schematic structural diagram of a computing device 100 is provided in an embodiment of the present application. As shown in fig. 2, the computing device 100 includes: a processor, a memory, and a communication interface.
Wherein the processor is the operation and control core of the computing device 100. In the alternative, the processor may be implemented or realized with the various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein. The processor may also be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. A processor may also be a combination that performs computing functions, e.g., including one or more microprocessors, digital signal processing (digital signal processing, DSP) and microprocessor combinations, and the like.
In an embodiment of the present application, the processor is configured to run a script generation tool and an automated test platform.
The memory is used for storing data such as instructions or program codes. By way of example, and not limitation, the memory may be a read-only memory (ROM) or other type of static storage device that may store static information and instructions, a random access memory (random access memory, RAM) or other type of dynamic storage device that may store information and instructions, or an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), magnetic disk storage or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
In the embodiment of the application, the memory is used for storing software programs of the script generating tool and the automated testing platform, and files required by the automated testing script and other automated tests generated by the script generating tool, for example: test files, test cases, etc.
As a possible implementation, the memory may exist separately from the processor, and the memory may be connected to the processor for storing instructions or program code. When the processor calls and executes the instructions or the program codes stored in the memory, the method for generating the test script can be realized.
In another possible implementation, the memory may also be integrated with the processor.
The communication interface is used for connecting with other devices through a communication network. The communication network may be an ethernet, a radio access network, a wireless local area network (wireless local area networks, WLAN), etc.
In some embodiments, as shown in FIG. 2, the computing device 100 described above may also be connected to an input-output device. Wherein the input-output device is used to interact with the computing device 100, enabling the computing device 100 to communicate with a user or other device. Illustratively, the input output device includes one or more of the following: a keyboard, a mouse, a tablet, a microphone, a sound or a display, etc.
The server 200 is a test object for automated testing, and is configured to receive an operation instruction sent by the computing device 100, and execute an automated operation according to the operation instruction, so as to implement automated testing of the server 200.
In some embodiments, multiple subsystems are included in server 200. Wherein the plurality of subsystems may be hardware or software, for example: a basic input output system (basic input output system, BIOS), a baseboard management controller (baseboard management controller, BMC), an Operating System (OS), a hard disk, a disk array (redundant arrays of independent disks, RAID), a network card, a Floppy Disk (FD), network management software (eSight), a network file system (network file system, NFS), and the like.
In some embodiments, the computing device 100 performs automated testing of the server 200, including automated testing of multiple subsystems in the server 200. For example, computing device 100 performs an automated test of OS restart (Reboot) to the OS of server 200; alternatively, the computing device 100 performs an automated test on the BMC of the server 200 that controls BMC reboots.
It should be noted that, the system architecture described in the embodiments of the present application is for more clearly describing the technical solution of the embodiments of the present application, and does not constitute a limitation on the technical solution provided in the embodiments of the present application, and those skilled in the art can know that, with the evolution of the system architecture, the technical solution provided in the embodiments of the present application is equally applicable to similar technical problems.
The following specifically describes a script generating tool provided in an embodiment of the present application.
The script generation tool provided by the embodiment of the application is used for automatically generating the test script. The script generation tool may include a plurality of functional modules, such as: the system comprises a test case extraction module, an operation function library, a script generation module and a test file generation module. The following describes each module in the script generation tool.
1. Test case extraction module
And the test case extraction module is used for extracting the information of the test task from the test case. The test case is descriptive text of test tasks of the subsystem.
In some embodiments, the test case extraction module includes a UI interface capable of interacting with a user, so that the user may learn, on the UI interface of the test case extraction module, information of a test task extracted from the test case.
2. Operation function library
An operation function library includes operation functions executable by each subsystem in the server.
Wherein, the executable operation function of each subsystem refers to the operation that can be executed by each subsystem of the server, and the operation function is written in the form of codes. It can be understood that the operation function implemented by the codes replaces the manual operation of the subsystem, so that the manpower input can be reduced.
By way of example, assuming that the subsystem may perform operations of adding users, deleting users, and modifying users, the operational functions that the subsystem may perform include: adding an operation function of a user, deleting an operation function of a user, and modifying an operation function of a user.
In some embodiments, the operating functions include UI interfaces that enable interaction with a user, such that the user may find the operating functions in the operating function library on the UI interfaces of the operating function library.
In some embodiments, the library of operating functions described above may be built based on an automated test framework component of a server.
Wherein, as shown in fig. 3, the automated test framework component of the server may package the various subsystems of the server into classes (i.e., package the various attributes of the various subsystems into classes, e.g., version information, interface information, etc. of the subsystems); writing executable operations of all subsystems of the server into codes to realize automatic operation functions; and encapsulating the operation function, belonging to the class of each subsystem, and calling the operation function of the subsystem through the class of the subsystem.
Thus, the server-based automation test framework component constructs an operation function library, including: the operating functions of the subsystems in the automated test framework assembly of the server are imported into an operating function library.
The operation functions in the operation function library provided by the embodiment of the application are stored in a classified mode. Alternatively, the operation functions in the operation function library may be classified according to the class of each subsystem in the server, that is, all the operation functions of one subsystem are classified into one class, and the name of the class is the name of the subsystem.
Exemplary, referring to fig. 4, a UI interface schematic diagram of an operation function is provided in an embodiment of the present application. As shown in fig. 4, it is assumed that each subsystem in the server includes: BIOS, BMC, OS, etc., wherein the operating function of the BIOS is under the class of the BIOS; the operation function of the BMC belongs to the class of the BMC; the operating functions of the OS are under the class of the OS.
3. Script generation module
And the script generation module is used for generating an automatic test script according to the selected operation function.
In some embodiments, the script generation module includes a UI interface capable of interacting with a user, such that the user can configure information of the operating functions (e.g., configuring input variables of the operating functions) and information of the automated test scripts (e.g., configuring a storage location of the automated test scripts) on the UI interface of the script generation module.
4. Test file generation module
The test file generation module is used for generating a test file; the test file is used for testing the server by the automatic test platform.
In some embodiments, the test file generation module includes a UI interface capable of interacting with a user, such that the user may configure information of the test file on the UI interface of the test file generation module.
In the foregoing, for the script generating tool provided in the embodiments of the present application, it can be seen that, the script generating tool provided in the embodiments of the present application is software including a UI interface, and is capable of generating an automated test script according to interaction with a user.
In some embodiments, as shown in FIG. 5, the process of generating an automated test script based on the script generation tool described above includes:
and 1, a script generating tool acquires the operation functions of all subsystems of the server packaged by the automatic test framework component of the server to construct an operation function library.
In some embodiments, the automation test framework of the server may also store the classes of the individual subsystems of the packaged server, as well as the operating functions of the individual subsystems, in a code hosting center (CodeHub).
And 2, acquiring the test case by the script generating tool.
After the script generating tool acquires the test case, the test case extracting module extracts the information of the test task from the test case.
And 3, generating an automatic test script by the script generating tool.
The script generation module in the script generation tool selects a target operation function according to the test task information, and further generates an automatic test script according to the target operation function.
It can be seen that, based on the script generation tool provided by the embodiment of the application, the test script does not need to be written manually, so that the entry threshold for the development of the automatic test script is reduced, and the development speed of the automatic test script is improved.
The following specifically describes a method for generating a test script provided in the embodiment of the present application.
The method for generating the test script is applied to a scene of automatically generating the automatic test script, for example, in a scene of each subsystem of a test server, the automatic test script of the test task of each subsystem is automatically generated according to the test cases of the test tasks of each subsystem. Optionally, the method for generating the test script provided by the application can also be applied to other scenes, for example, scenes of test cases are automatically generated according to test objects and test tasks of the test objects. And will not be illustrated herein.
It should be noted that, an execution subject of the test script generating method provided in the embodiments of the present application is a processor in a computing device.
As shown in fig. 6, the method for generating a test script according to the embodiment of the present application is applied to the above-mentioned script generating tool. Specifically, the method comprises the following steps:
s301, extracting testing step information of a target testing task from a testing case of the target testing task according to the target testing task of the subsystem to be tested of the server.
The subsystem to be tested may be any one of a plurality of subsystems of the server. The target test task is any one of a plurality of test tasks performed on the subsystem to be tested. It will be appreciated that the subsystem to be tested may have multiple functions, and thus, when the subsystem to be tested is tested, the multiple functions of the subsystem to be tested need to be tested respectively, so that the test tasks of the subsystem to be tested have multiple tasks. For example, assuming that the subsystem under test is an OS, the test tasks of the subsystem under test may include: the OS controls the test task of the Reboot, the test task of the in-band power-down of the OS, the test task of the power-up and power-down operation of the OS, and the like; the target test task may be any one of the test tasks of the OS described above.
The test case of the target test task is a description text of the target test task of the subsystem to be tested. Optionally, the description text of the test case may include: case number, case name, case level, preset condition, test procedure, expected result, etc. Wherein the case number is the character identification of the test case. The case name is the literal identification of the test case. The case level is used for representing the importance degree of the target test task described by the test case. For example, assuming that the case Level of the test case is Level1, it indicates that the target test task tests the basic function of the subsystem to be tested; assuming that the case Level of the test case is Level2, the general function of the subsystem to be tested is tested by the target test task; assuming that the case Level of the test case is Level3, the important function of the subsystem to be tested is represented by the target test task. The preset condition, also called as a pre-condition, refers to a condition that needs to be satisfied in order to execute a target test task; for example, if the target test task described by the test case is a task for testing a login operation, the preset conditions are: a user account is provided that is available for login. The test step refers to a specific step of performing a target test task. The expected results refer to the results that are expected to be achieved by performing the target test task.
In some embodiments, the above-mentioned extracting the test step information of the target test task from the test case of the target test task may be implemented as the following steps:
and a1, determining the position of a test step of the target test task in a test case of the target test task.
As one possible implementation, the processor may locate the location of the test steps of the target test task in the test case based on the keywords of the target test task. For example, the keywords may be an execution action of the target test task, an execution object of the action, and the like, which is not limited in the embodiment of the present application.
And a2, extracting the testing step information of the target testing task from the testing case of the target testing task according to the position of the testing step of the target testing task.
It can be understood that the test step information of the target test task defines the operation to be executed of the target test task, so in the process of generating the automation test script of the target test task, the test step information of the target test task needs to be acquired first.
In some embodiments, the above method further comprises: and extracting preset condition information, expected result information and the like of the target test task from the test case of the target test task according to the target test task of the subsystem to be tested of the server. The preset condition information is used for determining conditions which need to be met for executing the target test task; the expected result information is used to determine a return value for the automated test script for the target test task. It can be appreciated that the user may determine, according to actual usage requirements, information extracted from the test case of the target test task, which is not limited in the embodiment of the present application.
Exemplary, referring to fig. 7, a UI interface schematic diagram of a test case extracting module of a script generating tool according to an embodiment of the present application is provided. Assuming that the target test task is an OS control Reboot, as shown in fig. 7, information extracted from a test case of the target test task includes: preset condition information, test step information and expected result information of a target test task.
S302, acquiring a target operation function corresponding to the test step information from an operation function library.
In some embodiments, the objective function includes one or more functions for performing objective test tasks on a subsystem under test of the server.
As a possible implementation manner, the step S302 may be implemented as follows: and responding to the selected operation of the target operation function in the operation function library, and acquiring the target operation function corresponding to the test step information.
The target operation function is determined based on the test step information of the target test task. For example, as shown in fig. 7, assuming that the target test task is an OS control Reboot, the test step information of the target test task includes:
and (1) normally powering on to enter the OS, and checking whether the system BMC log, the messages log under the OS and the dmesy log are abnormal or not.
And (2) controlling the system to reset under the OS, and entering the OS again.
Step 3, collecting BMC logs, message logs under the OS and dmesy logs, and confirming whether abnormal logs are generated.
And (4) repeatedly executing the steps (1) to (3), wherein the times meet the stability test requirement.
For example, the target operation function determined according to the test step information of the target test task may include:
1. the BMC controls in-band power-up.
2. And obtaining a BMC log.
3. A messages log is obtained.
4. A dmesy log was obtained.
5. Judging whether the BMC log, the messages log and the dmesy log are abnormal or not.
6. The OS controls Reboot.
7. And obtaining a BMC log.
8. A messages log is obtained.
9. A dmesy log was obtained.
10. Judging whether the BMC log, the messages log and the dmesy log are abnormal or not.
11. Judging whether the OS is powered down; 12. and judging whether the OS is powered on.
Then, as shown in fig. 8, the user may find the target operation function from the operation function library and select the target operation function; correspondingly, the processor responds to the selected operation of the target operation function to acquire the target operation function.
In some embodiments, the user may search the target operation function in the operation functions according to the class to which the target operation function belongs, and then select the target operation function. For example, assume that the target operational function includes: the OS controls the Reboot, and the operation function is assigned to the OS class, so that the user can search the OS class of the operation function library for the operation function.
It can be understood that, in the embodiment of the present application, the operation functions in the operation function library are classified (for example, all the operation functions of one subsystem are classified into one class, and the class name is the name of the subsystem), so that when a user searches for the operation function, the user can quickly search for the operation function according to the class to which the operation function belongs, and further select the operation function.
In some embodiments, the operation function library further includes description information of operation functions executable by the respective subsystems in the server. Wherein the description information of the operation function is used for introducing and explaining the operation function. Optionally, the description information of the operation function includes one or more of the following: the name of the operation function, the description of the operation function, the class to which the operation function belongs, the input variable of the operation function, the return value of the operation function or the calling example of the operation function. For example, as shown in fig. 9, taking the operation function of "BMC restart" as an example, it can be seen that the description information of the operation function of "BMC restart" may include: the classes to which the "BMC restart" belongs are: BMC. The function of "BMC restart" is described as: the BMC is restarted, and the in-band OS normally operates and is not affected. The parameter name of the input variable of "BMC restart" is: wait (representing waiting duration), timeout (representing interrupt duration), and allController (representing all controllers); the parameter value of the input variable may be a default value or may be set by the user. The return value of "BMC restart" may be "r0, r1"; wherein r0 represents a "BMC restart" failure; r1 indicates that "BMC restart" was successful. Examples of calls for "BMC restart": self.bmgcontroller.reboot (wait=wire).
As another possible implementation manner, the step S302 may be further implemented as the following steps:
and b1, extracting description information of the operation function from the test step information.
Alternatively, the description information of the operation function extracted from the test step information may include one or more of the following: the name of the operation function, the description of the operation function, the class to which the operation function belongs, the input variable of the operation function, the return value of the operation function or the calling example of the operation function.
Illustratively, the hypothetical test step information includes: resetting the control system under the OS, and entering the OS again; the description information of the operation function extracted from the test step information may be: name of the operation function: the OS controls the Reboot; and/or class to which the operating function belongs: an OS; and/or, call examples of the operation function: self.host.reboot ().
And b2, screening one or more candidate operation functions from the operation function library according to the extracted description information of the operation functions.
Alternatively, the processor may screen one or more candidate operation functions from the operation function library based on all or part of the extracted description information of the operation function. It can be understood that the more the description information of the operation functions used for screening is, the fewer the number of candidate operation functions are screened from the operation function library, that is, the more accurate the screening result is.
Exemplary, referring to fig. 10, a UI interface schematic diagram of an operation function library of a script generating tool according to an embodiment of the present application is provided. Assuming that the description of the operation function is "restart," the one or more candidate operation functions screened from the operation function library may be in the form as shown in fig. 10.
And b3, responding to the selected operation of the target operation function in the one or more candidate operation functions, and acquiring the target operation function corresponding to the test step information.
Specifically, one or more candidate operation functions selected from the operation function library include a target operation function, and then the user can select the target operation function; correspondingly, the processor responds to the selected operation of the target operation function in the one or more candidate operation functions, and the target operation function corresponding to the test step information is obtained.
Illustratively, according to the screening result shown in fig. 10, assuming that the target operation function is an OS control Reboot, the processor acquires the target operation function in response to a selected operation of the target operation function among the one or more candidate operation functions as shown in fig. 11: the OS controls Reboot.
In some embodiments, in the case that there are a plurality of candidate operation functions, the user may view description information of the plurality of candidate operation functions, respectively, to find a target operation function from the plurality of candidate operation functions.
It can be understood that in the method provided by the embodiment of the application, the processor can extract the description information of the operation function from the test step information, and further screen one or more candidate operation functions from the operation function library according to the description information of the operation function, and further obtain the target operation function from the one or more candidate operation functions in response to the selected operation of the user.
As yet another possible implementation manner, the step S302 may be further implemented as the following steps:
and c1, searching one or more candidate operation functions from the search function library in response to the search operation on the operation function library.
The above operation of searching the operation function library refers to the operation of inputting keywords in a search box of the search function library by a user and searching. The keywords may be description information of an operation function extracted from the test step information by the user.
And c2, responding to the selected operation of the target operation function in the one or more candidate operation functions, and acquiring the target operation function corresponding to the test step information.
Specifically, one or more candidate operation functions selected from the operation function library include a target operation function, and then the user can select the target operation function; correspondingly, the processor responds to the selected operation of the target operation function in the one or more candidate operation functions, and the target operation function corresponding to the test step information is obtained.
It can be understood that in the method provided by the embodiment of the application, the processor may search one or more candidate operation functions from the operation function library in response to the search operation of the user, and further obtain the target operation function from the one or more candidate operation functions in response to the selected operation of the user, so that the method can assist the user to quickly and accurately obtain the target operation function.
As yet another possible implementation manner, the above step S302 may be implemented as: the processor determines a target operation function according to the test step information of the target test task; and the processor acquires the target operation function from the operation function library. For example, the processor may input test step information of the target test task into the operation function determination model, and determine the target operation function according to an output result of the operation function determination model. The operation function determination model may be trained by using the test step information of the calibrated operation function as a training sample.
It may be understood that the operation function library provided in the embodiments of the present application further includes description information of operation functions, so that the processor may screen one or more candidate operation functions from the operation function library according to the extracted description information of operation functions; and further determining a target operating function from the one or more candidate operating functions. Therefore, compared with the method in the related art, which can only screen according to the content of the operation function, the method provided by the embodiment of the application can screen according to the description information of the operation function, so that the screening precision is improved, and the screening omission is avoided; and after screening one or more candidate functions, the target operation function can be determined according to the description information of the one or more candidate operation functions, so that the accuracy of operation function screening is effectively improved.
In addition, the user can also know the information such as the function, the calling method and the like of the operation function according to the description information of the operation function, so that even if the user does not know programming, the user can select a proper operation function according to the description information of the operation function, and the entry threshold for developing the test script is reduced.
S303, generating an automatic test script based on the target operation function.
The automatic test script is used for executing a target test task on the subsystem to be tested.
In some embodiments, the step S303 may be implemented as: receiving setting operation of a user on input variables of a target operation function; after the user's input variable setting of the objective function is completed, an automated test tool is generated based on the objective operating function. The setting operation may be to set a parameter value of an input variable of the target operation function as the target value. It can be appreciated that the user can modify the input variables of the target operation function according to the actual use requirement, so that the target automation test script generated according to the target operation function can meet different test scenarios.
In some embodiments, in generating the automated test script based on the target operating function, the method further comprises: the instantiated test object is added before the code of the target operating function in the automation test script. Wherein the test object comprises: and the subsystem to be tested in the server. Illustratively, the operational functions of the BMC restart are: reboot (wait=true), the operating function does not include test objects, so when generating an automation test script, it is necessary to add instantiated test objects before the code of the operating function: self.bmgcontroller.reboot (wait=true). It can be understood that the operation functions in the operation function library are all methods and do not include test objects of the functions, so that the method provided by the embodiment of the application further includes adding the instantiated test objects before the code of the target operation function in the automation test script.
In some embodiments, the objective function comprises a function for performing a test step; the operation function for executing the test step is an operation function corresponding to the test step information of the target test task. The above step S303 may be implemented as: an automated test script is generated based on the operating functions for performing the test steps.
It can be appreciated that the embodiment of the application may determine the operation function for executing the test step according to the test step information of the target test task; and further generating an automated test script according to the operating functions for executing the test steps. In this manner, the automated test script may be used to perform a target test task on a subsystem under test of a server.
Exemplary, referring to fig. 12, a UI interface schematic diagram of a script generating module in a script generating tool provided in an embodiment of the present application is provided. Assuming that the target test task is an OS control Reboot, when generating a test script, an automated test script may be generated according to an operation function for executing a test step as shown in fig. 12.
In other embodiments, the objective function further includes: an operating function for restoring the test environment; wherein, the operation function for restoring the test environment refers to restoring the test environment of the server after the operation function for executing the test step is executed. Specifically, after the execution of the operation function for executing the test step is completed, whether the current environment of the server meets the test environment is judged, and if not, the operation function for recovering the test environment is obtained from the operation function library.
Alternatively, the operating function for restoring the test environment may be determined according to the test environment of the server. Illustratively, assume that the test environment of the server includes: the BMC is powered on, and the operation functions for recovering the test environment include: and judging whether the BMC is powered on or not and controlling the BMC to be powered on.
Thus, the step S303 may be implemented as: an automated test script is generated based on the operating functions for performing the test steps and the operating functions for restoring the test environment.
It can be understood that, according to the embodiment of the application, the operating function for restoring the test environment can be determined according to the test environment of the server; and further generating an automated test script based on the operating functions for performing the testing steps and the operating functions for restoring the testing environment. Thus, the automated test script can be used to execute a target test task on a subsystem to be tested of the server, and restore the test environment of the server after the target test task is executed.
Exemplary, referring to fig. 13, a UI interface schematic diagram of a script generating module in a script generating tool provided in an embodiment of the present application is provided. Assuming that the target test task is an OS control Reboot, when generating the test script, an automated test script may be generated according to an operation function for executing a test step and an operation function for restoring a test environment as shown in fig. 13.
In some embodiments, the above method further comprises: and storing the generated automatic test script in a designated storage space. Optionally, the UI interface of the generated automation test script includes a control (for example, a browse control as shown in fig. 13) for selecting a storage space of the automation test script, where the user may select the storage space of the automation test script by clicking the control, so that the processor stores the generated automation test script in the storage space.
It can be understood that, according to the method for generating the test script according to the embodiment of the present application, the test step information of the target test task may be obtained according to the test case of the target test task, further, the target operation function may be obtained from the operation function library according to the test step information of the target test task, and finally, the automatic test script may be automatically generated according to the target operation function. It can be seen that, based on the method for generating the test script provided by the embodiment of the application, a user only needs to select a corresponding operation function from the operation function library according to the test step information of the target test task, and does not need to write the test script manually, so that the threshold for developing the automatic test script is reduced, and the development speed of the automatic test script is improved.
In some embodiments, after the step S303, the method further includes: generating a test file; the test file includes: a test sleeve file and a test bed file; the test set file is used for recording codes of the automatic test script; the test bed file is used for recording test environment information.
Illustratively, the generating a test file may be implemented as the following steps:
and d1, generating a test sleeve file according to codes in the automatic test script.
In some embodiments, the step d1 may be implemented to obtain the automation test script according to the storage path of the automation test script, and further generate the test suite file according to the code in the automation test script.
In some embodiments, the above method further comprises: acquiring a target test case according to a storage path of the target test case; the step d1 may also be implemented as: and generating a test suite file according to the target test case and the automatic test script.
Exemplary, referring to fig. 14, a UI interface schematic diagram of a test file generating module in a script generating tool according to an embodiment of the present application is provided. The user can select the storage path of the target test case by clicking a control for browsing the storage path of the test case on the interface for setting the test sleeve information as shown in fig. 14, so as to obtain the target test case; and selecting the storage path of the automatic test script by clicking a control for browsing the storage path of the automatic test script, so as to obtain the automatic test script.
In some embodiments, the above method further comprises: and storing the generated test suite file in a designated storage space. Optionally, the UI interface for generating the test file includes a control (for example, a browse control as shown in fig. 14) for selecting a storage location of the test suite file, and the user may select the storage space of the test suite file by clicking the control, so that the processor stores the generated test suite file in the storage space.
And d2, generating a test bed file according to the test environment information of the server corresponding to the automatic test script.
In some embodiments, the test environment of the server includes: interface information of each subsystem in the server, for example, interface information of the BMC, interface information of the OS, interface information of the esiht, interface information of the FD, interface information of the NFS, and the like in the server. Thus, the above step d2 can be implemented as: and generating a test bed file according to the interface information of each subsystem in the server corresponding to the automatic test script.
In some embodiments, prior to step d2, the method further comprises: and acquiring the test environment information. For example, the user may set test bed information (i.e., test environment information) at a test bed information setting interface as shown in fig. 14 so that the processor acquires the test environment information. The test environment information may include a BMC Internet protocol (internet protocol, IP) of the server, a BMC user name, and a BMC password; the OS IP, OS user name and OS password of the server; the eSimight IP, eSimight user name, eSimight password of the server; FD IP, FD username, FD password of the server; NFSIP, NFS username, NFS password of the server; and a graphical user interface (graphical user interface, GUI) of the server executing IP of the machine.
In some embodiments, the above method further comprises: and storing the generated test bed file in a designated storage space. Optionally, the UI interface for generating the test file includes a control (for example, a browse control as shown in fig. 14) for selecting a storage location of the test bed file, and the user may select the storage space of the test bed file by clicking the control, so that the processor stores the generated test bed file in the storage space.
It can be understood that, because the test bed file is used for recording the test environment information of the server corresponding to the automated test script, the automated test platform can acquire the test environment of the target test task according to the test bed file, establish connection with the test object (i.e. the subsystem to be tested) of the target test task, and establish connection with the server where the subsystem to be tested is located. Because the test suite file is used for recording codes in the automatic test script, the automatic test platform can acquire the codes in the automatic test script of the target test task according to the test suite file, and then execute the target test task to the subsystem to be tested according to the codes in the automatic test script.
The foregoing description of the embodiments of the present application has been presented primarily from a method perspective. It will be appreciated that the script generating means comprises, in order to implement the above-described functions, at least one of a hardware structure and a software module for performing the respective functions. Those of skill in the art will readily appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the present application may divide the functional units of the script generating apparatus according to the above method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated in one processing unit. The integrated units may be implemented in hardware or in software functional units. It should be noted that, in the embodiment of the present application, the division of the units is schematic, which is merely a logic function division, and other division manners may be implemented in actual practice.
As shown in fig. 15, an embodiment of the present application provides a script generating apparatus for executing the generating method of the test script shown in fig. 6. The script generating apparatus 400 includes: an extraction module 401, an acquisition module 402, and a generation module 403. In other embodiments, the script generating apparatus 400 may further include: a screening module 404.
The extracting module 401 is configured to extract, according to a target test task of a subsystem to be tested of the server, test step information of the target test task from a test case of the target test task.
An obtaining module 402, configured to obtain a target operation function corresponding to the test step information from the operation function library; the operation function library comprises operation functions executable by all subsystems in the server, and the target operation functions comprise one or more operation functions for executing target test tasks on the subsystem to be tested of the server.
The generating module 403 is configured to generate an automation test script based on the target operation function, where the automation test script is configured to execute a target test task on the subsystem to be tested.
In one possible implementation manner, the obtaining module 402 is specifically configured to obtain, in response to a selected operation on the target operation function in the operation function library, a target operation function corresponding to the test step information; the target operating function is determined based on the test step information.
In another possible implementation manner, the operation function library further includes description information of operation functions executable by each subsystem in the server; the extracting module 401 is further configured to extract description information of the operation function from the test step information; the screening module 404 is configured to screen one or more candidate operation functions from the operation function library according to the extracted description information of the operation functions; the obtaining module 402 is specifically configured to obtain, in response to a selected operation on a target operation function of the one or more candidate operation functions, a target operation function corresponding to the test step information.
In another possible implementation manner, the target operation function includes an operation function for performing a test step; the generating module 403 is specifically configured to generate an automated test script according to an operation function for executing a test step.
In another possible implementation manner, the objective operation function further includes: an operating function for restoring the test environment; the generating module 403 is specifically configured to generate an automation test script according to the operation function for executing the test step and the operation function for recovering the test environment.
In another possible implementation manner, the generating module 403 is further configured to generate a test file; the test file includes: a test sleeve file and a test bed file; the test set file is used for recording codes of the automatic test script; the test bed file is used for recording test environment information.
In another possible implementation manner, the description information of the operation function includes one or more of the following: the name of the operation function, the function description of the operation function, the class to which the operation function belongs, the input variable of the operation function, the output variable of the operation function or the calling example of the operation function.
From the foregoing description of the embodiments, it will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e., the internal structure of the script generating device is divided into different functional modules, so as to perform all or part of the functions described above.
Embodiments of the present application also provide a computer-readable storage medium. All or part of the flow in the above method embodiments may be implemented by computer instructions to instruct related hardware, and the program may be stored in the above computer readable storage medium, and the program may include the flow in the above method embodiments when executed. The computer readable storage medium may be any of the foregoing embodiments or memory. The computer readable storage medium may also be an external storage device of the computing device, such as a plug-in hard disk provided on the computing device, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card, or the like. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the computing device. The computer readable storage medium is used to store the computer program and other programs and data required by the computing device. The above-described computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Embodiments of the present application also provide a computer program product, which contains a computer program, which when run on a computer causes the computer to perform the method for generating a test script according to any one of the above embodiments.
Although the present application has been described herein in connection with various embodiments, other variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed application, from a review of the figures, the disclosure, and the appended claims. In the claims, the word "Comprising" does not exclude other elements or steps, and the "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.
Although the present application has been described in connection with specific features and embodiments thereof, it will be apparent that various modifications and combinations can be made without departing from the spirit and scope of the application. Accordingly, the specification and drawings are merely exemplary illustrations of the present application as defined in the appended claims and are considered to cover any and all modifications, variations, combinations, or equivalents that fall within the scope of the present application. It will be apparent to those skilled in the art that various modifications and variations can be made in the present application without departing from the spirit or scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims and the equivalents thereof, the present application is intended to cover such modifications and variations.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for generating a test script, comprising:
extracting testing step information of a target testing task from a testing case of the target testing task according to the target testing task of a subsystem to be tested of a server;
acquiring a target operation function corresponding to the test step information from an operation function library; the operation function library comprises operation functions executable by all subsystems in the server, and the target operation functions comprise one or more operation functions used for executing the target test task on the subsystem to be tested of the server;
and generating an automatic test script based on the target operation function, wherein the automatic test script is used for executing the target test task on the subsystem to be tested.
2. The method according to claim 1, wherein the obtaining the target operation function corresponding to the test step information from the operation function library includes:
Responding to the selected operation of the target operation function in the operation function library, and acquiring a target operation function corresponding to the test step information; the target operating function is determined based on the test step information.
3. The method of claim 2, wherein the library of operating functions further comprises descriptive information of operating functions executable by respective subsystems in the server; the method further comprises the steps of:
extracting description information of an operation function from the test step information;
screening one or more candidate operation functions from the operation function library according to the extracted description information of the operation functions;
the responding to the selected operation of the target operation function in the operation function library, obtaining the target operation function corresponding to the test step information, includes:
and responding to the selected operation of the target operation function in the one or more candidate operation functions, and acquiring the target operation function corresponding to the test step information.
4. A method according to any one of claims 1 to 3, wherein the target operating function comprises an operating function for performing a test step;
The generating an automated test script based on the target operation function comprises the following steps:
and generating the automatic test script according to the operation function for executing the test step.
5. The method of claim 4, wherein the target operating function further comprises: an operating function for restoring the test environment; the generating an automated test script based on the target operation function comprises the following steps:
and generating the automatic test script according to the operation function for executing the test step and the operation function for recovering the test environment.
6. The method according to any one of claims 1 to 5, further comprising:
generating a test file; the test file includes: a test sleeve file and a test bed file; the test suite file is used for recording codes of the automatic test script; the test bed file is used for recording test environment information.
7. A method according to any one of claims 3 to 6, wherein the description of the operating function includes one or more of the following: the name of the operation function, the function description of the operation function, the class to which the operation function belongs, the input variable of the operation function, the output variable of the operation function or the calling example of the operation function.
8. A script generating apparatus, comprising: the extraction module is used for extracting the test step information of the target test task from the test case of the target test task according to the target test task of the subsystem to be tested of the server; the acquisition module is used for acquiring a target operation function corresponding to the test step information from an operation function library; the operation function library comprises operation functions executable by all subsystems in the server, and the target operation functions comprise one or more operation functions used for executing the target test task on the subsystem to be tested of the server; and the generation module is used for generating an automatic test script based on the target operation function, and the automatic test script is used for executing the target test task on the subsystem to be tested.
9. A script generating apparatus, comprising: interface and logic for performing the method of generating a test script according to any of claims 1 to 7.
10. A computing device, the computing device comprising a processor and a memory; the processor is coupled with the memory; the memory is used to store computer instructions that are loaded and executed by the processor to cause a computing device to implement the method of generating a test script as claimed in any of claims 1 to 7.
CN202211436814.0A 2022-11-16 2022-11-16 Method and device for generating test script Pending CN116166525A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211436814.0A CN116166525A (en) 2022-11-16 2022-11-16 Method and device for generating test script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211436814.0A CN116166525A (en) 2022-11-16 2022-11-16 Method and device for generating test script

Publications (1)

Publication Number Publication Date
CN116166525A true CN116166525A (en) 2023-05-26

Family

ID=86417077

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211436814.0A Pending CN116166525A (en) 2022-11-16 2022-11-16 Method and device for generating test script

Country Status (1)

Country Link
CN (1) CN116166525A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112450A (en) * 2023-10-24 2023-11-24 卡斯柯信号(北京)有限公司 Method and device for testing temporary speed limiting server
CN117472785A (en) * 2023-12-25 2024-01-30 银河麒麟软件(长沙)有限公司 Openstack test method and system under Linux system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112450A (en) * 2023-10-24 2023-11-24 卡斯柯信号(北京)有限公司 Method and device for testing temporary speed limiting server
CN117112450B (en) * 2023-10-24 2024-03-26 卡斯柯信号(北京)有限公司 Method and device for testing temporary speed limiting server
CN117472785A (en) * 2023-12-25 2024-01-30 银河麒麟软件(长沙)有限公司 Openstack test method and system under Linux system
CN117472785B (en) * 2023-12-25 2024-04-16 银河麒麟软件(长沙)有限公司 Openstack test method and system under Linux system

Similar Documents

Publication Publication Date Title
US9069903B2 (en) Multi-platform test automation enhancement
CN110765026B (en) Automatic test method, device, storage medium and equipment
CN116166525A (en) Method and device for generating test script
CN111124919A (en) User interface testing method, device, equipment and storage medium
CN114546738B (en) Universal test method, system, terminal and storage medium for server
CN108874649B (en) Method and device for generating automatic test script and computer equipment thereof
CN111462811A (en) Automatic testing method and device, storage medium and electronic equipment
CN113590454A (en) Test method, test device, computer equipment and storage medium
EP3413149B1 (en) Field device commissioning system and field device commissioning method
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN111475412B (en) Software testing method, device, electronic equipment and computer readable storage medium
CN109614325B (en) Method and device for determining control attribute, electronic equipment and storage medium
CN112860587A (en) UI automatic test method and device
CN114201382A (en) Test case generation method and device, storage medium and electronic equipment
CN111813648A (en) Automatic testing method and device applied to App, storage medium and electronic equipment
CN115237441A (en) Upgrade test method, device and medium based on cloud platform
CN116775202A (en) Fuzzy test method, device, medium, electronic equipment and computer program product
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
CN114143235A (en) NFV automatic test method, device, equipment and storage medium
US20180011784A1 (en) Method for Testing a Graphical Interface and Corresponding Test System
Subramanian et al. Class coverage GUI testing for Android applications
CN112231207A (en) Multi-machine testing method for application program testing, computer readable storage medium and testing platform
CN117009250A (en) Automatic GRUB test method and system for Linux operating system
CN117407258A (en) Initialization process time consumption statistical method and device, electronic equipment and storage medium
CN116974826A (en) Information processing method, device, equipment and medium for configuration items

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