CN114116491A - Webpage program testing method and device, electronic equipment and storage medium - Google Patents

Webpage program testing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114116491A
CN114116491A CN202111439274.7A CN202111439274A CN114116491A CN 114116491 A CN114116491 A CN 114116491A CN 202111439274 A CN202111439274 A CN 202111439274A CN 114116491 A CN114116491 A CN 114116491A
Authority
CN
China
Prior art keywords
container
target container
port
test
target
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
CN202111439274.7A
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.)
Winning Health Technology Group Co Ltd
Original Assignee
Winning Health Technology Group 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 Winning Health Technology Group Co Ltd filed Critical Winning Health Technology Group Co Ltd
Priority to CN202111439274.7A priority Critical patent/CN114116491A/en
Publication of CN114116491A publication Critical patent/CN114116491A/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/3688Test management for test execution, e.g. scheduling of test suites

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 provides a webpage program testing method and device, electronic equipment and a storage medium, and relates to the technical field of automatic testing. The webpage program testing method comprises the following steps: the method comprises the steps of obtaining a test starting command of an automatic test task aiming at a target webpage program, adopting a first mapping relation according to a host port in the test starting command and the name of a target container, and mapping an automatic script of the automatic test task to the target container through a port of the target container so as to execute the automatic script in the target container. The target container constructed according to the virtual desktop and the virtual network console has the functions of virtual desktop and remote access. On one hand, the automatic test task can be simulated in the virtual desktop to run under the condition of a graphical interface; on the other hand, the virtual network console can realize remote access to the virtual desktop, and further can display a graphical interface running in the virtual desktop.

Description

Webpage program testing method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of automatic testing, in particular to a webpage program testing method and device, electronic equipment and a storage medium.
Background
With the rapid development of the information-based modern internet, the demand for automatically testing the network program is increasing.
The existing network automation test mode of a single computing device mainly utilizes a containerization technology, namely, a plurality of containers are started through the computing device, different test sets are distributed to different containers, and concurrent tests are realized.
However, in the testing method, the container cannot provide a visual interface, so that the actual testing process cannot be seen in the automatic testing process, the testing reliability cannot be ensured, and the testing experience is poor.
Disclosure of Invention
The present invention is directed to provide a method, an apparatus, an electronic device, and a storage medium for testing a web page program, so as to implement a container-based visual web page program test.
In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
in a first aspect, an embodiment of the present application provides a method for testing a web page program, including:
acquiring a test starting command of an automatic test task for a target webpage program, wherein the test starting command comprises: a first mapping relation between a host port and a container port and a name of a target container; the host port is an access port corresponding to a host where a target container corresponding to the automated test task is located, and the container port is an access port of the target container; the target container is a container constructed in advance according to the virtual desktop and the virtual network console;
and mapping the automation script of the automation test task to the target container through the port of the target container by adopting the first mapping relation according to the names of the host port and the target container so as to execute the automation script in the target container.
Optionally, the test starting command further includes: a second mapping relation between a host directory and a container directory, wherein the host directory is a test directory of the automated test task, and the container directory is a test directory of the target container; the container directory stores therein: the target container executes a test report obtained by the automation script;
the method further comprises the following steps:
and acquiring the test report from the container directory by adopting the second mapping relation according to the names of the host directory and the target container.
Optionally, the test starting command further includes: a delete instruction of the target container; the method further comprises the following steps:
and controlling the target container to be automatically deleted after the execution is finished through the port of the target container by adopting the first mapping relation according to the host port, the name of the target container and the deletion instruction.
Optionally, the test starting command further includes: an access parameter of the target container; the mapping, according to the host port and the name of the target container, an automation script of the automation test task to the target container through the port of the target container by using the first mapping relationship to execute the automation script in the target container includes:
and mapping an automation script of the automation test task to the target container through the port of the target container by adopting the first mapping relation according to the host port, the name of the target container and the access parameter so as to execute the automation script in the target container.
Optionally, before the test start command for the automated test task of the target web page program is obtained, the method further includes:
according to the identification of the automatic test task, determining an automatic script of the automatic test task from a plurality of preset automatic test sets, wherein the plurality of automatic test sets store: a test script for a plurality of automated test tasks.
Optionally, before the test start command for the automated test task of the target web page program is obtained, the method further includes:
and according to the identification of the automatic test task, applying for the host port for the automatic test task by adopting a preset host port program.
Optionally, before the test start command for the automated test task of the target web page program is obtained, the method further includes:
on the basis of a browser-free container mirror image in a container warehouse, installing the virtual desktop, the virtual network console, a development kit and a webpage driver corresponding to a target browser to obtain a target container mirror image;
generating the target container based on the target container mirror.
In a second aspect, an embodiment of the present application further provides a device for testing a web page program, including: the acquisition module and the processing module;
the acquisition module is used for acquiring a test starting command of an automatic test task for a target webpage program, and the test starting command comprises: a first mapping relation between a host port and a container port and a name of a target container; the host port is an access port corresponding to a host where a target container corresponding to the automated test task is located, and the container port is an access port of the target container; the target container is a container constructed in advance according to the virtual desktop and the virtual network console;
the processing module is configured to map an automation script of the automation test task to the target container through the port of the target container by using the first mapping relationship according to the host port and the name of the target container, so as to execute the automation script in the target container.
In a third aspect, an embodiment of the present application further provides an electronic device, including: the system comprises a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, when an electronic device runs, the processor and the storage medium communicate through the bus, and the processor executes the program instructions to execute the steps of the webpage program testing method according to any one of the first aspect.
In a fourth aspect, the present application further provides a computer-readable storage medium, where the storage medium stores a computer program, and the computer program is executed by a processor to perform the steps of the web page program testing method according to any one of the first aspects.
The beneficial effect of this application is: the embodiment of the application provides a webpage program testing method, which includes the steps of obtaining a test starting command of an automatic test task aiming at a target webpage program, adopting a first mapping relation according to names of a host port and a target container in the test starting command, and mapping an automatic script of the automatic test task to the target container through a port of the target container so as to execute the automatic script in the target container. The target container constructed according to the virtual desktop and the virtual network console has the functions of virtual desktop and remote access. On one hand, the automatic test task can be simulated in the virtual desktop to run under the condition of a graphical interface; on the other hand, the virtual network console can realize remote access to the virtual desktop, so that a graphical interface running in the virtual desktop can be displayed, and the problem that a container cannot provide a visual interface and cannot observe a short board in the actual execution process of an automatic test task is well solved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a method for testing a web page program according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating a target container generation in a web page program testing method according to another embodiment of the present application;
fig. 3 is a schematic diagram of a web page program testing apparatus according to an embodiment of the present application;
fig. 4 is a schematic view of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention.
In this application, unless explicitly stated or limited otherwise, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one feature. In the description of the present invention, "a plurality" means at least two, for example, two, three, unless specifically defined otherwise. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
With the continuous development of internet technology, webpage program testing mainly goes through two stages before and after the containerization technology appears. Before the advent of containerization techniques, a single computer device was unable to simultaneously initiate multiple web page program automation test tasks. To perform concurrent testing (i.e., execute multiple test sets simultaneously, each containing multiple test cases), different test sets must be distributed to different computer devices. Or a plurality of virtual machines are started on the computer equipment to simultaneously execute a plurality of automatic test tasks, but the virtual machine resource occupation is high, so that the configuration requirement on the computer equipment is high, and the number of the virtual machines which can be realized by a single computer equipment is limited. After the containerization technology appears, a single computer device can distribute different test sets to different containers by starting a plurality of containers, so as to achieve the purpose of concurrent testing. However, since the specific operation process of the container is not visible, the automated test can only adopt a headless mode (i.e. a thread mode in which the actual operation process of the browser is not visible), so that the reliability of the test method is suffered by users.
When a plurality of computer devices or virtual machines are adopted, the resource waste is very large and the cost is high. When the containerization method is adopted, the test reliability cannot be ensured, and the test experience is poor. Therefore, the current webpage program testing method has poor testing effect and low testing efficiency.
In view of the above problems, embodiments of the present application provide a variety of possible implementation manners to implement container-based visual webpage program testing. The following is explained by way of a number of examples in connection with the drawings. Fig. 1 is a schematic flowchart of a method for testing a web page program according to an embodiment of the present application, where the method for testing a web page program is implemented by an electronic device running a program of the method, and the electronic device may be, for example, a terminal device or a server. As shown in fig. 1, the method includes:
step 101: acquiring a test starting command of an automatic test task aiming at a target webpage program, wherein the test starting command comprises: a first mapping relation between a host port and a container port and a name of a target container; the system comprises a host computer port, a container port and a test task, wherein the host computer port is an access port corresponding to a target container corresponding to an automatic test task on a host computer, and the container port is an access port of the target container; the target container is a container constructed in advance according to the virtual desktop and the virtual network console.
It should be noted that the host may include a plurality of ports, where the ports are an entrance for communication between the host and the outside, and may be virtual ports or physical ports, and the application does not limit this, and may be implemented by the web program testing method of the application.
It should be further noted that the container may establish a communication connection with the host port through the container port, and specifically, the container a may include a container port I, and after the container port I is connected with other ports in a matching manner, data transmission or data interaction between the container a and a main body corresponding to the port may be implemented through the other ports. For example, after the access port I is connected to the host port of the host B in a matching manner, the host B can implement data transmission or data interaction between the container a and the host B through the access port I.
The test starting command of the automatic test task for the target webpage program comprises the following steps: the first mapping relation between the host port and the container port realizes the matching connection between the host port and the container port. The method also comprises the following steps of: and the target container is a container corresponding to the automatic test task, and is constructed in advance according to the virtual desktop and the virtual network console.
It should be noted that the virtual desktop refers to a virtualized execution environment provided for a graphical interface of a program, that is, a virtual manner is used to simulate the program to run under the condition of the graphical interface. In a particular implementation, the virtual desktop may be implemented based on a virtual frame buffer (Xvfb). The foregoing is merely an example, and in an actual implementation, there may be other virtual desktop implementation manners, which is not limited in this application.
It should be further noted that the virtual network console is a desktop control component capable of implementing remote control (or called, remote desktop) function. In a particular implementation, the virtual Network console may be implemented based on a vnc (virtual Network console). The foregoing is merely an example, and in an actual implementation, there may be other possible implementations of the virtual network console, which is not limited in this application.
Step 102: and mapping the automation script of the automation test task to the target container through the port of the target container by adopting a first mapping relation according to the names of the host port and the target container so as to execute the automation script in the target container.
In one possible implementation, the first mapping relationship between the host port and the container port may be described in the test initiation command using a form of "-p host port: container port", for example: "-p 6901: 6901" indicates that the port 6901 (before the colon) of the host is mapped to the port 6901 (after the colon) of the container, thus realizing the matching connection of the port of the host and the port of the container, namely, the port 6901 of the container can be accessed by accessing the port 6901 of the host.
In another possible implementation manner, the host maps the automation script of the automation test task into the target container through the port of the target container by using the first mapping relation according to the host port and the name of the target container, so as to execute the automation script in the target container.
In a possible implementation manner, the host may map the automation script into the target container through the first mapping relationship according to the first mapping relationship and the name of the target container, so as to provide a basis for the automation script to run in the target container. In a specific implementation, the host may use jenkins, each jenkins jobcorresponds to one of the at least one automation script. Each job of Jenkins needs to apply for an available mapping port, i.e. an access port in the first mapping relationship, from the host, and map the automated testing task managed by the job into the container through the first mapping relationship.
In summary, an embodiment of the present application provides a web program testing method, which obtains a test start command for an automated test task of a target web program, and maps an automated script of the automated test task to a target container through a port of the target container by using a first mapping relationship according to a host port in the test start command and a name of the target container, so as to execute the automated script in the target container. The target container constructed according to the virtual desktop and the virtual network console has the functions of virtual desktop and remote access. On one hand, the automatic test task can be simulated in the virtual desktop to run under the condition of a graphical interface; on the other hand, the virtual network console can realize remote access to the virtual desktop, so that a graphical interface running in the virtual desktop can be displayed, and the problem that a container cannot provide a visual interface and cannot observe a short board in the actual execution process of an automatic test task is well solved.
Optionally, on the basis of fig. 1, the present application further provides a possible implementation manner of the web program testing method, where the test start command further includes: a second mapping relation between the host directory and the container directory, wherein the host directory is a test directory of an automatic test task, and the container directory is a test directory of a target container; the container directory stores therein: the target container executes the test report obtained by the automation script; the method further comprises the following steps:
and acquiring the test report from the container directory by adopting a second mapping relation according to the names of the host directory and the target container.
It should be noted that the test start command further includes a second mapping relationship between the host directory and the container directory, and through the second mapping relationship, the host may access the host directory to obtain a test report obtained by executing the automation script on the target container in the container directory.
In one possible implementation, "-v" represents a directory mapping, and the second mapping relationship may be implemented by "-v host directory: container directory". For example, "$ { WORKSPACE }/xtest:/tmp/xtest", -v maps the xtest directory ($ { WORKSPACE }/xtest) under the working directory of the automated script to the/tmp/xtest directory of the container, when the container completes the automated testing process, the automated testing report is saved under the/tmp/xtest directory of the container, and the host computer can obtain the testing report by accessing the xtest directory (i.e., $ { WORKSPACE }/xtest) under the current working directory of the automated script.
If the host can use jenkins, the automation script is jenkins jobb, -v, the xtest directory ($ { WORKSPACE }/xtest) under the work directory of the current jobs of jenkins is mapped to the/tmp/xtest directory of the container, and after the container completes the automation test process and stores the automation test report into the/tmp/xtest directory, the test report can be obtained by accessing the xtest directory under the work directory of the current jobs of jenkins.
In a possible implementation manner, the test report in the xtest directory of the current working directory of the automation script may also be exported and stored, which is not limited in the present application.
Through the second mapping relation, after the container completes the automatic testing process and stores the automatic test report, the test report stored in the corresponding container directory is obtained through the host directory and the interface without being obtained from the container, and the complexity of operation is reduced.
Optionally, on the basis of fig. 1, the present application further provides a possible implementation manner of the web program testing method, where the test start command further includes: a delete instruction of the target container; the method further comprises the following steps:
and controlling the target container to be automatically deleted after the execution is finished through the port of the target container by adopting a first mapping relation according to the host port, the name of the target container and the deletion instruction.
It should be noted that the test start command further includes: and according to the deleting instruction of the target container, adopting a first mapping relation according to the instruction, the host port and the name of the target container, so that the target container is automatically deleted after the instruction is executed.
In one possible implementation, the deletion of the target container may be accomplished using "- - -rm". For example, using "- - -rm", the target container is automatically deleted after the execution of the automation script. It should be noted that the automatically deleted content may include the first mapping relationship, or may include physical resources (for example, a hard disk, a memory, a CPU, and the like occupied by a container) occupied during the operation of the automated script, and the specifically deleted content is not limited in this application, and a user may set the content according to a use requirement.
By adding the deleting instruction of the target container in the test starting command, the port and the physical resources are ensured to be released immediately for reuse, and the use efficiency of the port resources and the physical resources is ensured.
Optionally, on the basis of fig. 1, the present application further provides a possible implementation manner of the web program testing method, where the test start command further includes: an access parameter of the target container; according to the names of the host port and the target container, adopting a first mapping relation, and mapping an automation script of an automation test task to the target container through the port of the target container so as to execute the automation script in the target container, wherein the method comprises the following steps:
and mapping the automation script of the automation test task to the target container through the port of the target container by adopting a first mapping relation according to the name and the access parameter of the host port and the target container so as to execute the automation script in the target container.
It should be noted that the test start command may further include: the access parameters of the target container are parameters required for establishing a communication connection with the target container when the host accesses the target container, for example, the access parameters of the target container may be an access password of the target container, a preset communication connection password, and the like.
In a specific implementation manner, the specific construction process of the target container further includes: and installing the virtual desktop and the virtual network console, and setting access parameters of the virtual network console.
In a possible implementation manner, the "VNC _ PW" represents an access parameter, and the setting of the access parameter of the virtual network console may be implemented by assigning a value to the "VNC _ PW". For example, "VNC _ PW ═ 123456" indicates that the access parameter of this virtual network console is 123456.
In a specific implementation manner, the access parameter may be set in the generation process of the target container, for example, if the target container is a docker container, the Xvbf and the VNC are installed therein, and the access parameter of the VNC is set (for example, the access password is set to be 123456, which is an example, the control parameter of the VNC includes, but is not limited to, the access password). After the access parameters are set, if the access parameters in the test starting command are the same as the access parameters set by the target container, the communication connection between the container port and the host access port can be realized. And then according to the host port and the name of the target container, adopting a first mapping relation to map the automation script of the automation test task to the target container.
By setting the access parameters of the target container, the authentication between the container and the host is realized, and the stability and the safety of the system are further ensured.
Optionally, on the basis of fig. 1, the present application further provides a possible implementation manner of a web page program testing method, where before a test start command for an automated test task of a target web page program is obtained, the method further includes:
according to the identification of the automatic test task, determining an automatic script of the automatic test task from a plurality of preset automatic test sets, wherein the plurality of automatic test sets store: a test script for a plurality of automated test tasks.
It should be noted that each automated test task includes an automated test set, and each automated test set includes one or more automated test cases (also referred to as test scripts). In one possible implementation, the host may determine an automation script for the automation test task from the plurality of automation test sets according to the identification of the automation test task.
In a specific implementation mode, the host can use jenkins to respectively create different jenkins jobs aiming at different automatic test sets, namely one jobb corresponds to one automatic task and is responsible for managing one automatic test set. Each jobof Jenkins has an identification of an automated testing task, and the host can determine an automated script of the automated testing task from a plurality of automated testing sets through the identification.
According to the identification of the automatic test task, the automatic script of the automatic test task is determined from a plurality of automatic test sets, so that the automatic test task is distributed more orderly, and the robustness of program operation is enhanced.
Optionally, on the basis of fig. 1, the present application further provides a possible implementation manner of a web page program testing method, where before a test start command for an automated test task of a target web page program is obtained, the method further includes:
and applying for a host port for the automatic test task by adopting a preset host port program according to the identification of the automatic test task.
The host of the application realizes remote access and container visualization based on communication with a virtual network console in a container, so that a container PORT needs to be mapped to a host access PORT (a simple PORT behind) and then the container is accessed through https:// IP: PORT. In a possible implementation manner, when the container is started, the container PORT can be mapped to an available access PORT of the host through a preset host PORT program, and then the container can be accessed in a https:// IP: PORT manner; in another possible implementation manner, if multiple containers need to be started (for example, during concurrent testing), container PORTs of the multiple containers may be mapped to different access PORTs of the host through a preset host PORT program, and then different containers may be accessed through different PORTs in the https:// IP: PORT manner. The preset host port program is mainly used for port management, and ensures that when different containers are started, an available port can be provided for mapping container ports. Therefore, according to the identification of the automatic test task, a host port can be applied for the automatic test task by adopting a preset host port program. The foregoing implementation manner is only an example, and in actual implementation, there may be possible implementation manners of other host port programs, which is not limited in this application and can be implemented as applying for a host port for an automated test task.
In a specific implementation, the host implements remote access and container visualization based on communication with the VNC in the container, so that the VNC PORT in the container needs to be mapped to a host access PORT (hereinafter abbreviated PORT), and then the container is accessed through https:// IP: PORT. In addition, in the concurrent test, a plurality of containers need to be started, VNC PORTs of the containers need to be mapped to different PORTs of the PC, and then different containers can be accessed through different PORTs in the https:// IP: PORT mode.
Reasonable automatic task distribution is realized through a preset host port program, so that automatic port matching can be realized, and on the basis, the problem of concurrent testing can be solved based on a container.
Optionally, on the basis of the foregoing embodiment, the present application further provides a possible implementation manner for generating a target container in a webpage program testing method, and fig. 2 is a flowchart for generating a target container in a webpage program testing method according to another embodiment of the present application; as shown in fig. 2, before obtaining a test start command for an automated test task of a target web program, the method further includes:
step 201: and on the basis of the browser-free container mirror image in the container warehouse, installing a virtual desktop, a virtual network console, a development kit and a webpage driver corresponding to a target browser to obtain the target container mirror image.
In a possible implementation manner, the specific construction process of the target container may be: firstly, installing a browser, and installing a corresponding software development kit according to the programming language of the automatic test task; secondly, installing a virtual desktop and a virtual network console; thirdly, installing a webpage driver of a corresponding version of the browser; finally, a container is generated and named for the container.
It should be noted that, the specific steps in the above-mentioned construction process are only examples, and in an actual implementation, the order of the steps may be changed or specific actions in the steps may be performed alternately, for example, first, a browser is installed, then, a virtual desktop and a virtual network console are installed, and on this basis, a corresponding software development kit is installed.
In a specific implementation manner, the target container may be a docker container, the automated testing task is written in Java, and a specific construction process of the automated testing task may be as follows: firstly, installing a chrome browser and a software development kit (JDK) (such as Java8) corresponding to Java language; secondly, installing Xvbf and VNC; thirdly, installing a webDriver webpage driver of a corresponding version of the browser; finally, a container is generated and named for the container (e.g., uitest: 2021).
In a specific implementation, the container construction speed can also be increased by constructing on a mirror image basis by taking some well-made mirror images (containers are generated based on mirror images) in a container warehouse (https:// hub. For example, with the help of a browser/chrome image, since the chrome is already installed in the image, namely the image has a browser, the browser does not need to be installed in the construction process, thereby accelerating the construction speed. On this basis, the target container mirror image can be obtained by installing the virtual desktop, the virtual network console, the development kit and the web driver corresponding to the target browser, and the specific steps are shown in the above implementation manner, which is not described herein again.
Step 202: and generating the target container based on the target container mirror image.
On the basis of the browser-free container mirror image in the container warehouse, a virtual desktop, a virtual network console, a development kit and a webpage driver corresponding to a target browser are installed to obtain a target container mirror image, and a container is generated based on the generated target container mirror image, so that the construction speed is increased.
Specific implementation processes and technical effects of the web page program testing device, the electronic device, the storage medium and the like provided by the present application are described below, and are not described in detail below.
The embodiment of the present application provides a possible implementation example of a web page program testing apparatus, which is capable of executing the web page program testing method provided by the above embodiment. Fig. 3 is a schematic diagram of a web page program testing apparatus according to an embodiment of the present application. As shown in fig. 3, the web page program testing apparatus 100 includes: an acquisition module 31, a processing module 33;
an obtaining module 31, configured to obtain a test start command of an automated test task for a target web program, where the test start command includes: a first mapping relation between a host port and a container port and a name of a target container; the system comprises a host computer port, a container port and a test task, wherein the host computer port is an access port corresponding to a target container corresponding to an automatic test task on a host computer, and the container port is an access port of the target container; the target container is a container constructed in advance according to the virtual desktop and the virtual network console;
and the processing module 33 is configured to map the automation script of the automation test task to the target container through the port of the target container by using the first mapping relationship according to the host port and the name of the target container, so as to execute the automation script in the target container.
Optionally, the test start command further includes: a second mapping relation between the host directory and the container directory, wherein the host directory is a test directory of an automatic test task, and the container directory is a test directory of a target container; the container directory stores therein: the target container executes the test report obtained by the automation script;
the processing module 33 is specifically configured to obtain the test report from the container directory by using the second mapping relationship according to the names of the host directory and the target container.
Optionally, the test start command further includes: a delete instruction of the target container; the processing module 33 is specifically configured to adopt the first mapping relationship according to the host port, the name of the target container, and the deletion instruction, and control the target container to be automatically deleted after the execution is completed through the port of the target container.
Optionally, the test start command further includes: an access parameter of the target container; the processing module 33 is specifically configured to map the automation script of the automation test task to the target container through the port of the target container by using the first mapping relationship according to the host port, the name of the target container, and the access parameter, so as to execute the automation script in the target container.
Optionally, the web program testing apparatus 100 further includes: a determination module; the determining module is used for determining an automation script of the automation test task from a plurality of preset automation test sets according to the identification of the automation test task before acquiring a test starting command of the automation test task for the target webpage program, wherein the plurality of automation test sets store: a test script for a plurality of automated test tasks.
Optionally, the web program testing apparatus 100 further includes: an application module; and the application module is specifically used for applying for the host port for the automatic test task by adopting a preset host port program according to the identification of the automatic test task.
Optionally, the web program testing apparatus 100 further includes: a container generation module; the system comprises a container generation module, a container storage module and a browser-free container mirror image generation module, wherein the container generation module is specifically used for installing a virtual desktop, a virtual network console, a development kit and a webpage driver corresponding to a target browser on the basis of the browser-free container mirror image in a container warehouse to obtain a target container mirror image; and generating the target container based on the target container mirror image.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
The embodiment of the application provides a possible implementation example of an electronic device, which can execute the webpage program testing method provided by the embodiment. Fig. 4 is a schematic diagram of an electronic device according to an embodiment of the present disclosure, where the electronic device may be integrated in a terminal device or a chip of the terminal device, and the terminal may be a computing device with a data processing function.
The electronic device includes: the device comprises a processor 401, a storage medium 402 and a bus, wherein the storage medium stores program instructions executable by the processor, when the control device runs, the processor and the storage medium communicate through the bus, and the processor executes the program instructions to execute the steps of the webpage program testing method. The specific implementation and technical effects are similar, and are not described herein again.
The embodiment of the present application provides a possible implementation example of a computer-readable storage medium, which is capable of executing the webpage program testing method provided by the above embodiment, where the storage medium stores a computer program, and the computer program is executed by a processor to execute the steps of the webpage program testing method.
A computer program stored in a storage medium may include instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor (which may be a processor) to perform some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the 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 webpage program testing method is characterized by comprising the following steps:
acquiring a test starting command of an automatic test task for a target webpage program, wherein the test starting command comprises: a first mapping relation between a host port and a container port and a name of a target container; the host port is an access port corresponding to a host where a target container corresponding to the automated test task is located, and the container port is an access port of the target container; the target container is a container constructed in advance according to the virtual desktop and the virtual network console;
and mapping the automation script of the automation test task to the target container through the port of the target container by adopting the first mapping relation according to the names of the host port and the target container so as to execute the automation script in the target container.
2. The method of claim 1, wherein the test initiation command further comprises: a second mapping relation between a host directory and a container directory, wherein the host directory is a test directory of the automated test task, and the container directory is a test directory of the target container; the container directory stores therein: the target container executes a test report obtained by the automation script;
the method further comprises the following steps:
and acquiring the test report from the container directory by adopting the second mapping relation according to the names of the host directory and the target container.
3. The method of claim 1, wherein the test initiation command further comprises: a delete instruction of the target container; the method further comprises the following steps:
and controlling the target container to be automatically deleted after the execution is finished through the port of the target container by adopting the first mapping relation according to the host port, the name of the target container and the deletion instruction.
4. The method of claim 1, wherein the test initiation command further comprises: an access parameter of the target container; the mapping, according to the host port and the name of the target container, an automation script of the automation test task to the target container through the port of the target container by using the first mapping relationship to execute the automation script in the target container includes:
and mapping an automation script of the automation test task to the target container through the port of the target container by adopting the first mapping relation according to the host port, the name of the target container and the access parameter so as to execute the automation script in the target container.
5. The method of claim 1, wherein prior to obtaining the test initiation command for the automated test task of the target web program, the method further comprises:
according to the identification of the automatic test task, determining an automatic script of the automatic test task from a plurality of preset automatic test sets, wherein the plurality of automatic test sets store: a test script for a plurality of automated test tasks.
6. The method of claim 1, wherein prior to obtaining the test initiation command for the automated test task of the target web program, the method further comprises:
and according to the identification of the automatic test task, applying for the host port for the automatic test task by adopting a preset host port program.
7. The method according to any one of claims 1-6, wherein before the obtaining of the test start command for the automated test task of the target webpage program, the method further comprises:
on the basis of a browser-free container mirror image in a container warehouse, installing the virtual desktop, the virtual network console, a development kit and a webpage driver corresponding to a target browser to obtain a target container mirror image;
generating the target container based on the target container mirror.
8. A web page program testing apparatus, comprising: the acquisition module and the processing module;
the acquisition module is used for acquiring a test starting command of an automatic test task for a target webpage program, and the test starting command comprises: a first mapping relation between a host port and a container port and a name of a target container; the host port is an access port corresponding to a host where a target container corresponding to the automated test task is located, and the container port is an access port of the target container; the target container is a container constructed in advance according to the virtual desktop and the virtual network console;
the processing module is configured to map an automation script of the automation test task to the target container through the port of the target container by using the first mapping relationship according to the host port and the name of the target container, so as to execute the automation script in the target container.
9. An electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, the processor and the storage medium communicate with each other through the bus when the electronic device runs, and the processor executes the program instructions to execute the steps of the web page program testing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the web program testing method according to one of claims 1 to 7.
CN202111439274.7A 2021-11-30 2021-11-30 Webpage program testing method and device, electronic equipment and storage medium Pending CN114116491A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111439274.7A CN114116491A (en) 2021-11-30 2021-11-30 Webpage program testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111439274.7A CN114116491A (en) 2021-11-30 2021-11-30 Webpage program testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114116491A true CN114116491A (en) 2022-03-01

Family

ID=80368160

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111439274.7A Pending CN114116491A (en) 2021-11-30 2021-11-30 Webpage program testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114116491A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114826994A (en) * 2022-04-22 2022-07-29 重庆紫光华山智安科技有限公司 User environment playback method, system, electronic device and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114826994A (en) * 2022-04-22 2022-07-29 重庆紫光华山智安科技有限公司 User environment playback method, system, electronic device and readable storage medium
CN114826994B (en) * 2022-04-22 2023-08-29 重庆紫光华山智安科技有限公司 User environment playback method, system, electronic device and readable storage medium

Similar Documents

Publication Publication Date Title
CN108694117B (en) Method and device for managing test environment based on container technology
CN110413288B (en) Application deployment method, device, server and storage medium
CN109597677B (en) Method and apparatus for processing information
US7823023B2 (en) Test framework for testing an application
CN108733553B (en) Docker-based test device configuration method, device and system
CN109995814B (en) Cloud host resource migration method and device, communication equipment and storage medium
CN112783761A (en) Method, device and system for testing cold start duration of application program
CN110941440A (en) Batch updating method, device and equipment for virtual machines and readable storage medium
CN110955409A (en) Method and device for creating resources on cloud platform
CN110781067A (en) Method, device, equipment and storage medium for calculating starting time consumption
CN112286633A (en) Virtual machine creating method, device, equipment and storage medium based on CloudStack platform
CN114116491A (en) Webpage program testing method and device, electronic equipment and storage medium
CN110413328B (en) PXE function enabling method and device for network card port and related equipment
CN111427782A (en) Operation method, device, equipment and storage medium of android dynamic link library
CN110909273B (en) Page generation method and related system
US10997269B1 (en) Using web application components with different web application frameworks in a web application
CN117573338A (en) Resource allocation method and device and electronic equipment
CN116049000A (en) Environment parameter configuration method, device, equipment, storage medium and product
CN115774742A (en) Data storage newly-increased method, device, equipment, medium and product of private cloud
CN110941471A (en) Method and device for internationalizing basic data of software system
CN110327626B (en) Virtual server creation method and device
CN111158645B (en) System and method for providing an integrated development environment
CN113051088A (en) Program loading method, device, equipment and computer readable medium
CN114936031B (en) Component calling method and electronic equipment
US10223148B2 (en) Full virtual machine functionality

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