CN115687116A - Method, device and equipment for automatically running test script - Google Patents

Method, device and equipment for automatically running test script Download PDF

Info

Publication number
CN115687116A
CN115687116A CN202211345346.6A CN202211345346A CN115687116A CN 115687116 A CN115687116 A CN 115687116A CN 202211345346 A CN202211345346 A CN 202211345346A CN 115687116 A CN115687116 A CN 115687116A
Authority
CN
China
Prior art keywords
test script
script
running
test
information
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
CN202211345346.6A
Other languages
Chinese (zh)
Inventor
王明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji Network Technology 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 Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202211345346.6A priority Critical patent/CN115687116A/en
Publication of CN115687116A publication Critical patent/CN115687116A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention relates to the technical field of automatic testing, in particular to a method, a device and equipment for automatically running a test script, wherein the method comprises the steps of firstly obtaining test script information, then configuring the test script according to the test script information, detecting whether the test script is started or not, inquiring a script container capable of running the test script in a system according to the information of the test script if the test script is started, and finally starting a script container environment and running the test script in the script container environment; according to the method and the device, the script container capable of running the test script is automatically inquired through the test script information, and the test script is run in the environment of the script container, so that the problem that the running container cannot be automatically configured by the existing automatic test script is solved.

Description

Method, device and equipment for automatically running test script
Technical Field
The invention relates to the technical field of automatic testing, in particular to a method, a device and equipment for automatically running a test script.
Background
Automated testing is a process that translates human-driven test behavior into machine execution. Typically, after a test case is designed and passes review, the test is performed step by a tester according to the procedures described in the test case, resulting in a comparison of the actual results with the expected results. In the process, in order to save manpower, time or hardware resources and improve the testing efficiency, the concept of automatic testing is introduced.
The scripts for automated testing, because of their platform dependencies, do not have a generic platform or tool, and each time different pipeline must be configured for different platforms.
In the prior art, the script for automatic test needs to be manually configured with an operation container, which wastes time and labor.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method, an apparatus, and a device for automatically running a test script, so as to overcome the problem that the current automated test script cannot automatically configure a running container.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present application provides a method for automatically running a test script, including:
acquiring test script information;
configuring the test script according to the test script information;
detecting whether the test script is started;
if the test script is started, inquiring a script container capable of running the test script in a system according to the information of the test script;
and starting the script container environment, and running the test script in the script container environment.
Further, the method described above, the obtaining test script information includes:
and acquiring the script address, the script type and the starting rule of the test script.
Further, the method described above, wherein the detecting whether the test script is started includes:
and detecting whether the test script reaches a starting state or not according to the starting rule of the test script.
Further, the method described above, where starting the script container environment and running the test script in the script container environment, includes:
and starting the script container environment through Jenkins, and running the test script in the script container environment.
Further, the method described above further includes:
and acquiring the running result of the test script, and displaying and storing the running result.
In a second aspect, the present application provides an apparatus for automatically running a test script, including:
the information acquisition module is used for acquiring test script information;
the script configuration module is used for configuring the test script according to the test script information;
the running state detection module is used for detecting whether the test script is started or not;
the running container determining module is used for inquiring a script container capable of running the test script in the system according to the information of the test script if the test script is started;
and the script running module is used for starting the script container environment and running the test script in the script container environment.
In a third aspect, the present application provides an automatic test script execution device, including a processor and a memory, where the processor is connected to the memory:
the processor is used for calling and executing the program stored in the memory;
the memory is used for storing the program, and the program is at least used for executing the automatic running method of the test script.
The invention has the beneficial effects that:
firstly, obtaining test script information, then configuring a test script according to the test script information, detecting whether the test script is started, inquiring a script container capable of running the test script in a system according to the test script information if the test script is started, and finally starting a script container environment and running the test script in the script container environment; according to the method and the device, the script container capable of running the test script is automatically inquired through the test script information, and the test script is run in the environment of the script container, so that the problem that the running container cannot be automatically configured by the existing automatic test script is solved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a method for automatically running a test script according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram provided by an embodiment of an apparatus for automatically running a test script according to the present invention;
fig. 3 is a schematic structural diagram provided by an embodiment of an automatic test script running device according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It should be apparent that the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without making any creative effort, shall fall within the protection scope of the present invention.
Automated testing is a process that translates human-driven test behavior into machine execution. Typically, after a test case is designed and passes review, the test is performed step by a tester according to the procedures described in the test case, resulting in a comparison of the actual results with the expected results. In the process, in order to save manpower, time or hardware resources and improve the testing efficiency, the concept of automatic testing is introduced.
The scripts for automated testing, because of their platform dependencies, do not have a generic platform or tool, and each time different pipeline must be configured for different platforms.
In the prior art, the script for automatic test needs to be manually configured with an operation container, which wastes time and labor.
In view of the above, an object of the present invention is to provide a method, an apparatus, and a device for automatically running a test script, so as to overcome the problem that the current automated test script cannot automatically configure a running container.
FIG. 1 is a flowchart provided by an embodiment of a method for automatically running a test script according to the present invention. Referring to fig. 1, the present embodiment may include the following steps:
s1, obtaining test script information.
And S2, configuring a test script according to the test script information.
And S3, detecting whether the test script is started or not.
And S4, if the test script is started, inquiring a script container capable of running the test script in the system according to the information of the test script.
And S5, starting a script container environment, and running a test script in the script container environment.
It can be understood that, in this embodiment, first, test script information is obtained, then, a test script is configured according to the test script information, and whether the test script is started is detected, if the test script is started, a script container capable of running the test script is queried in the system according to the test script information, and finally, a script container environment is started, and the test script is run in the script container environment; according to the method and the device, the script container capable of running the test script is automatically inquired through the test script information, and the test script is run in the script container environment, so that the problem that the running container cannot be automatically configured by the existing automatic test script is solved.
It should be noted that Jenkins uses a set of software system to run various scripts; the pipeline is a set of Jenkins plug-in units, and supports the realization and integration of continuous delivery pipelines to Jenkins; the automatic test script is a script (a code file) written for realizing unattended automatic test software; a Linux container is a process or set of processes that is isolated from the rest of the system. All files required to run these processes are provided by another image, which means that the Linux container has portability and consistency throughout the process from development to testing to production. Thus, containers are used much more quickly than development channels that rely on repeated traditional testing environments. Simply understood is a simplified system that can run the minimum software requirements required by a program. docker refers to containerization technology used to support the creation and use of Linux containers.
In some optional embodiments, the user further adds a running container of the test script by hand, specifically: and configuring the running container of the test script through the acquired user operation instruction and the input running container information.
Preferably, step S1 includes:
and acquiring the script address, the script type and the starting rule of the test script.
Preferably, step S3 includes:
and detecting whether the test script reaches a starting state or not according to a starting rule of the test script.
It can be understood that the start rule of the test script may be a timing start task set by the user, or may be a start sequence set by the user, for example, the user may set that the test script is first run after the device is powered on, or may start running after detecting that the user clicks a start button.
Preferably, step S5 includes:
and starting a script container environment through Jenkins, and running a test script in the script container environment.
Preferably, the method further comprises the following steps:
and acquiring the running result of the test script, and displaying, storing and running the result.
It can be understood that, in order to facilitate the user to check the test result, after the test script is run, the system may obtain the run result of the test script, display the run result to the user, and in order to facilitate the user to check the run result later, the run result may be stored in a specific database.
The invention also provides a device for automatically running the test script, which is used for realizing the embodiment of the method. Fig. 2 is a schematic structural diagram provided by an embodiment of an automatic test script running device according to the present invention. As shown in fig. 2, the apparatus includes:
the information acquisition module 1 is used for acquiring test script information;
the script configuration module 2 is used for configuring the test script according to the test script information;
the running state detection module 3 is used for detecting whether the test script is started or not;
the running container determining module 4 is used for inquiring a script container capable of running the test script in the system according to the information of the test script if the test script is started;
and the script running module 5 is used for starting the script container environment and running the test script in the script container environment.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The invention also provides automatic test script running equipment which is used for realizing the method embodiment. Fig. 3 is a schematic structural diagram provided by an embodiment of an automatic test script running device according to the present invention. As shown in fig. 3, the test script automatic execution apparatus of the present embodiment includes a processor 21 and a memory 22, and the processor 21 is connected to the memory 22. Wherein, the processor 21 is used for calling and executing the program stored in the memory 22; the memory 22 is used for storing the program at least for executing the test script automatic execution method in the above embodiment.
The specific implementation provided in the embodiment of the present application may refer to the implementation of the test script automatic operation method in any of the above embodiments, and details are not described here.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (7)

1. A method for automatically running a test script is characterized by comprising the following steps:
acquiring test script information;
configuring the test script according to the test script information;
detecting whether the test script is started;
if the test script is started, inquiring a script container capable of running the test script in a system according to the information of the test script;
and starting the script container environment, and running the test script in the script container environment.
2. The method of claim 1, wherein obtaining test script information comprises:
and acquiring the script address, the script type and the starting rule of the test script.
3. The method of claim 2, wherein said detecting whether the test script is launched comprises:
and detecting whether the test script reaches a starting state or not according to the starting rule of the test script.
4. The method of claim 3, wherein the launching the script container environment and running the test script in the script container environment comprises:
and starting the script container environment through Jenkins, and running the test script in the script container environment.
5. The method of claim 1, further comprising:
and acquiring the running result of the test script, and displaying and storing the running result.
6. An automatic test script execution apparatus, comprising:
the information acquisition module is used for acquiring test script information;
the script configuration module is used for configuring the test script according to the test script information;
the running state detection module is used for detecting whether the test script is started or not;
the running container determining module is used for inquiring a script container capable of running the test script in the system according to the information of the test script if the test script is started;
and the script running module is used for starting the script container environment and running the test script in the script container environment.
7. The automatic test script running device is characterized by comprising a processor and a memory, wherein the processor is connected with the memory:
the processor is used for calling and executing the program stored in the memory;
the memory for storing the program for executing at least the test script automatic execution method of any one of claims 1-5.
CN202211345346.6A 2022-10-31 2022-10-31 Method, device and equipment for automatically running test script Pending CN115687116A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211345346.6A CN115687116A (en) 2022-10-31 2022-10-31 Method, device and equipment for automatically running test script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211345346.6A CN115687116A (en) 2022-10-31 2022-10-31 Method, device and equipment for automatically running test script

Publications (1)

Publication Number Publication Date
CN115687116A true CN115687116A (en) 2023-02-03

Family

ID=85046211

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211345346.6A Pending CN115687116A (en) 2022-10-31 2022-10-31 Method, device and equipment for automatically running test script

Country Status (1)

Country Link
CN (1) CN115687116A (en)

Similar Documents

Publication Publication Date Title
CN107193750B (en) Script recording method and device
US20100031248A1 (en) Installation Sequence Manager
CN107729255B (en) Software testing method, device and system
CN104317712A (en) Linux-based storage server fatigue testing method
CN105302687A (en) Hard disk sequence detection method based on linux
CN108241560B (en) Memory test method and device and electronic equipment
CN104809054B (en) Realize the method and system of program test
CN111309602A (en) Software testing method, device and system
CN105468507B (en) Branch standard reaching detection method and device
CN114049911A (en) Solid state disk stability test method and system
CN115687116A (en) Method, device and equipment for automatically running test script
CN111128139B (en) Non-invasive voice test method and device
CN112269707A (en) USB enumeration detection method, USB host device and storage medium
CN109309748B (en) Cloud mobile phone hardware quality batch test method and system
CN112596750B (en) Application testing method and device, electronic equipment and computer readable storage medium
CN111400245B (en) Art resource migration method and device
CN114218072A (en) Test script generation method and device, storage medium and computer equipment
CN112015427A (en) Method and device for building multiple compiling environments and electronic equipment
CN111581088A (en) Spark-based SQL program debugging method, device, equipment and storage medium
CN111858208B (en) Standby function testing method, device, equipment and medium of processor chip
CN111966394B (en) ETL-based data analysis method, device, equipment and storage medium
CN116546551B (en) Wireless network equipment detection method, device and system
CN114116033B (en) Method and device for modifying server configuration
CN115640204A (en) Page compatibility testing method and device, electronic equipment and storage medium
CN116303074A (en) Server testing method, device, equipment and 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