CN111240998A - Test case processing method and device - Google Patents

Test case processing method and device Download PDF

Info

Publication number
CN111240998A
CN111240998A CN202010097612.2A CN202010097612A CN111240998A CN 111240998 A CN111240998 A CN 111240998A CN 202010097612 A CN202010097612 A CN 202010097612A CN 111240998 A CN111240998 A CN 111240998A
Authority
CN
China
Prior art keywords
environment
test
request
module
constructing
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.)
Granted
Application number
CN202010097612.2A
Other languages
Chinese (zh)
Other versions
CN111240998B (en
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202010097612.2A priority Critical patent/CN111240998B/en
Priority claimed from CN202010097612.2A external-priority patent/CN111240998B/en
Publication of CN111240998A publication Critical patent/CN111240998A/en
Application granted granted Critical
Publication of CN111240998B publication Critical patent/CN111240998B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Abstract

The invention discloses a test case processing method and device. The method comprises the following steps: receiving a request for constructing an operating environment; after receiving the request for constructing the operating environment, the message queue module forwards the request for constructing the operating environment to the operating environment management module; the running environment management module constructs a test environment according to the code branch information in the request for constructing the running environment; after the test environment is constructed, the request for constructing the test environment is transmitted to the scheduling module through the message queue module; and executing the use case of the test code or the use case of the test running environment according to the message sent by the message queue module. By the invention, the effect of facilitating the authority management during the test of the code or the running environment is achieved.

Description

Test case processing method and device
Technical Field
The invention relates to the field of computers, in particular to a test case processing method and device.
Background
With the development of computer technology, rapid iteration of a software system is required, and in order to ensure the stability of the system, a continuous integration technology is widely applied to the field of testing.
Existing persistent integration tests are primarily through listening for code submission events on a code repository such as git. When codes are submitted, the continuous integration software such as Jenkins is informed to construct a test task. The testing task comprises the following steps of: deploying a running environment, pulling code, executing test cases, generating reports, and the like.
The above systems tend to have the following problems:
1) only testing is carried out aiming at code modification, and when the system operation environment changes, such as addition and deletion of a database, addition of a dependent library, upgrading of a third-party component and the like, additional manual testing or additional provision of a testing tool is needed to ensure that the code operates correctly in the new environment.
2) In the process of requiring to construct a test task, Jenkins has the authority to pull codes on a test terminal. Therefore, permission separation cannot be achieved, the Jenkins user can be a non-technical person such as a product manager, operation, art and the like, and when the code requirement is strictly kept secret, the Jenkins user does not have the permission to pull the code.
Aiming at the problem of inconvenient authority management operation during code or running environment test in the related technology, no effective solution is provided at present.
Disclosure of Invention
The invention mainly aims to provide a test case processing method and a test case processing device so as to solve the problem of inconvenient authority management operation during code or running environment test.
In order to achieve the above object, according to an aspect of the present invention, there is provided a test case processing method, including: receiving a request for constructing an operating environment; after receiving the request for constructing the operating environment, the message queue module forwards the request for constructing the operating environment to the operating environment management module; the running environment management module constructs a test environment according to the code branch information in the request for constructing the running environment; after the test environment is constructed, the request for constructing the test environment is transmitted to the scheduling module through the message queue module; and executing the use case of the test code or the use case of the test running environment according to the message sent by the message queue module.
Further, before executing a use case of the test code or a use case of the test execution environment according to the message sent by the message queue module, the method further includes: after the running environment management module completes the construction of the test environment, judging whether a running environment updating request is received; and executing the use case of the test operation environment after receiving the operation environment updating request.
Further, the use case for executing the test code or the use case for testing the operating environment according to the message sent by the message queue module includes: after receiving a message sent by a message queue module, judging whether the message is an environment construction completion request or an environment updating request; if the message is an environment construction completion request, uploading and executing a use case of the test code; and if the message is an environment updating request, uploading and testing the use case of the operating environment.
Further, prior to receiving the request to build the runtime environment, the method further comprises: after receiving a code submission event, a scheduling module sends a request for constructing an operating environment to a message queue module, wherein the message queue module constructs an operating environment queue and an operating environment updating queue through Rabbitmq, and the operating environment queue is used for storing the request for constructing the operating environment sent by the scheduling module and the request for successfully constructing the operating environment sent by the operating environment management module.
Further, the operating environment management module maintains a docker mirror image by using a Dockerfile, wherein the Dockerfile carries an instruction of the operating environment information to be constructed.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a test case processing apparatus including: a receiving unit configured to receive a request for constructing an operating environment; the first forwarding unit is used for forwarding the request for constructing the running environment to the running environment management module through the message queue module after receiving the request for constructing the running environment; the construction unit is used for constructing a test environment according to the code branch information in the request for constructing the running environment through the running environment management module; the second forwarding unit is used for forwarding the request for completing the test environment construction to the scheduling module through the message queue module after the test environment construction is completed; and the first execution unit is used for executing the use case of the test code or the use case of the test running environment according to the message sent by the message queue module.
Further, the apparatus further comprises: the judging unit is used for judging whether an operating environment updating request is received or not after the operating environment management module finishes constructing the test environment before executing the use case of the test code or the use case of the test operating environment according to the message sent by the message queue module; and the second execution unit is used for executing the use case of the test operation environment after receiving the operation environment updating request.
Further, the first execution unit includes: the judging module is used for judging whether the message is an environment construction completion request or an environment updating request after receiving the message sent by the message queue module; the first uploading module is used for uploading and executing a use case of the test code when the message is an environment construction completion request; and the second uploading module is used for uploading and testing the use case of the operating environment when the message is the environment updating request.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a storage medium, including a stored program, where, when the program runs, a device where the storage medium is located is controlled to execute the test case processing method according to the present invention.
In order to achieve the above object, according to another aspect of the present invention, there is also provided an apparatus, which at least includes a processor, and at least one memory and a bus connected to the processor, wherein the processor and the memory complete communication with each other through the bus, and the processor is configured to call program instructions in the memory to execute the test case processing method according to the present invention.
The invention receives the request of constructing the operation environment; after receiving the request for constructing the operating environment, the message queue module forwards the request for constructing the operating environment to the operating environment management module; the running environment management module constructs a test environment according to the code branch information in the request for constructing the running environment; after the test environment is constructed, the request for constructing the test environment is transmitted to the scheduling module through the message queue module; the use case of the test code or the use case of the test running environment is executed according to the message sent by the message queue module, so that the problem of inconvenient authority management operation during the test of the code or the running environment is solved, and the effect of facilitating the authority management during the test of the code or the running environment is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flow diagram of a test case processing method according to an embodiment of the invention;
FIG. 2 is a flow diagram of a method of testing code and a runtime environment of an embodiment of the present invention;
fig. 3 is a block diagram of an apparatus according to an embodiment of the invention.
FIG. 4 is a flow diagram of a scheduling module;
FIG. 5 is a flow diagram of a message queue module;
FIG. 6 is a flow diagram of an execution environment management module;
fig. 7 is a schematic diagram of a test case processing apparatus according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiment of the invention provides a test case processing method.
Fig. 1 is a flowchart of a test case processing method according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step S102: receiving a request for constructing an operating environment;
step S104: after receiving the request for constructing the operating environment, the message queue module forwards the request for constructing the operating environment to the operating environment management module;
step S106: the running environment management module constructs a test environment according to the code branch information in the request for constructing the running environment;
step S108: after the test environment is constructed, the request for constructing the test environment is transmitted to the scheduling module through the message queue module;
step S110: and executing the use case of the test code or the use case of the test running environment according to the message sent by the message queue module.
The embodiment employs receiving a request to build an operating environment; after receiving the request for constructing the operating environment, the message queue module forwards the request for constructing the operating environment to the operating environment management module; the running environment management module constructs a test environment according to the code branch information in the request for constructing the running environment; after the test environment is constructed, the request for constructing the test environment is transmitted to the scheduling module through the message queue module; the use case of the test code or the use case of the test running environment is executed according to the message sent by the message queue module, so that the problem of inconvenient authority management operation during the test of the code or the running environment is solved, and the effect of facilitating the authority management during the test of the code or the running environment is achieved.
In this embodiment, the request for constructing the operating environment may be sent by a scheduling module, the scheduling module sends the request for constructing the operating environment to a message queue module, the message queue module serves as an intermediary to forward the request to an operating environment management module, the operating environment management module constructs a test environment in the test terminal based on code branch information in the request, after the construction is completed, the message queue module forwards the request for completing the construction of the test environment to the scheduling module again, the scheduling module executes a case of a test code on the test terminal to test the code, since the message queue module is used as the intermediary to forward the message, the permission can be separated, the test task of the scheduling module only needs to send the request to the message queue module, and the operating environment management module is responsible for pulling the code to return to the request for completing the environment construction, the authority for pulling the code is not required to be provided for the user of the scheduling module, the safety of the code is ensured, and the problem of inconvenient authority management operation during the test of the code or the running environment is solved.
Optionally, before executing a use case of the test code or a use case of the test operating environment according to the message sent by the message queue module, after the execution environment management module completes the construction of the test environment, whether an update request of the operating environment is received is judged; after receiving the runtime environment update request, executing a use case of the test runtime environment.
The scheduling module can control the test terminal to execute the use case of the test running environment besides controlling the test terminal to execute the use case of the test code, and the use case of the test running environment is executed after the running environment updating request is received.
Optionally, the use case for executing the test code according to the message sent by the message queue module or the use case for testing the runtime environment includes: after receiving the message sent by the message queue module, judging whether the message is an environment construction completion request or an environment updating request; if the message is an environment construction completion request, uploading and executing a use case of the test code; if the message is an environment update request, the use case of the operating environment is uploaded and tested.
The scheduling module controls the test terminal to execute two types of test cases, so that the type of request is judged firstly during execution, and different cases are uploaded and tested according to the type of the request.
Optionally, before receiving the request for constructing the operating environment, after the scheduling module receives the code submission event, the scheduling module sends the request for constructing the operating environment to the message queue module, where the message queue module constructs an operating environment queue and an operating environment update queue through Rabbitmq, and the operating environment queue is used to store the request for constructing the operating environment sent by the scheduling module, and the request for successfully constructing the operating environment sent by the operating environment management module.
The message queue module maintains two queues by configuring and starting a Rabbitmq.
Optionally, the operating environment management module maintains a docker image by using a Dockerfile, where the Dockerfile carries an instruction of the operating environment information to be constructed.
The present embodiment also provides a preferred embodiment.
The embodiment of the invention provides a method and a device for testing codes and an operating environment, which simultaneously meet the requirement that a system for testing the codes and the operating environment can complete continuous integrated test without providing the code pulling authority for Jenkins, can multiplex the same system, test the codes and the operating environment, and can achieve the purpose of providing the code pulling authority for the Jenkins.
The system comprises a code monitoring module, a scheduling module, a message queue module and a running environment management module, wherein the four modules can be arranged in a scattered mode or in an integrated mode. In actual operation, the code monitoring module operates in the server A where the git code warehouse is located, the scheduling module operates in the server B, the operation environment management module operates in the server C, and the message queue module can operate in the server D independently. In addition to the code snooping module having to be on the git repository, other modules may share a server.
A code monitoring module: and setting webhook in a git code warehouse, monitoring code submission events Push events, and also monitoring Tag Push events, Issues events and the like. And sending the monitored code submission events to a scheduling module, wherein the sent content comprises information such as branches, submitters, submission time and the like.
A scheduling module: scheduling of test tasks is performed using persistent integration software such as Jenkins. And receiving a code change message sent by the code monitoring module, and sending a request for constructing the operating environment to the message queue module, wherein the request comprises code branch information. And the monitoring message queue module is used for processing the request of completing construction of the running environment, the constructed request comprises the address information of the test terminal, and the test case is executed on the returned test terminal. And the monitoring message queue module is used for processing the updating request of the running environment, the updating request comprises the address information of the test terminal, and the test case is executed on the returned test terminal.
A message queue module: and receiving a construction environment request sent by Jenkins, and waiting for processing by the operation environment management module. And receiving a construction completion request of the operation environment management module, and waiting for processing by the scheduling module. And receiving an operation environment updating request of the operation environment management module, and waiting for processing by the scheduling module.
The operation environment management module: and managing the running environment by using docker. And storing all operating environment information such as a database, a dependency library, a dependency service and the like in a docker mirror image, newly building a docker container as a terminal for executing the test case when the docker container is used every time, wherein the terminal comprises all operating environments. And the monitoring message queue module processes the request for constructing the operating environment, the processing process is to create a docker container, a code corresponding to the git branch is installed in the container, and a message for successful environment construction is sent to the message queue module, wherein the message comprises the address of the test terminal. When the mirror image is updated, namely the running environment is updated, a docker container is newly established, the current stable version code of the git branch is installed in the container, and the environment updating message is sent to the message queue module and comprises the address of the test terminal.
The embodiment of the invention solves the problem of meeting the requirements of code test and running environment test at the same time through a message queue module, such as a rabbitmq. 1) And (3) code testing: the code monitoring module initiates the code monitoring module to trigger Jenkins to send the constructed running environment message to the message queue, the running environment management module processes the message and returns the message to the test terminal, and the Jenkins execute the test case of the code test at the corresponding terminal. 2) And (3) testing the operating environment: the method comprises the steps that the running environment management module initiates, when a docker mirror image is updated, namely the running environment is updated, an environment is constructed according to the latest mirror image, an updated running environment message is sent to a message queue, Jenkins process the message, and a test case is executed at an obtained terminal to test the new running environment.
Meanwhile, the problem that the permission of pulling codes is not required to be provided for Jenkins is solved through the message queue module and the operating environment management module. The message queue is used as an intermediary for permission separation, a Jenkins test task only needs to send a request to the message queue, the operating environment management module obtains the request from the message queue, finally the operating environment management module is responsible for pulling codes, a test terminal with a required environment is returned to the Jenkins, the environment management module can also reject the Jenkins unreasonable request, and the environment management module does not need to provide any interface and permission to the Jenkins.
Based on the system, the embodiment of the invention can jointly test the codes and the environment in the continuous integration test process, saves the cost, can separate the Jenkins from the code authority and ensures the code safety.
The execution of each module is further described below.
Fig. 2 is a flowchart of a method for testing a code and an operating environment according to an embodiment of the present invention, and as shown in fig. 2, the code test and the operating environment test may share one set of system, where the processes 1.1 to 1.7 implement the code test, the processes 2.1 to 2.4 implement the operating environment test, and the two tests share one set of system. The specific test procedure is as follows:
1.1: and the code warehouse monitoring module is used for sending a code submission event to the scheduling module.
1.2: and the scheduling module sends a request for constructing the operating environment to the message queue module.
1.3: and the operation environment management module is taken out from the message queue module to construct a request of the operation environment.
1.4: and the running environment management module is used for constructing a test environment according to the code branch information in the request.
1.5: and the operation environment management module sends a request for completing environment construction to the message queue module.
1.6: and the scheduling module is taken out from the message queue module, requests for completing environment construction are obtained, and addresses of the test terminals are obtained.
1.7: and the scheduling module executes the use case of the test code on the test terminal to test the code.
2.1: and the operating environment management module monitors the modification of the Dockerfile through a daemon process, and constructs a test environment by using a stable code branch.
2.2: and the running environment management module sends a request for updating the running environment to the message queue module.
2.3: and the scheduling module is taken out from the message queue module, runs the request for updating the environment and obtains the address of the test terminal.
2.4: and the scheduling module executes the use case of the test operation environment on the test terminal to test the operation environment.
Through the process, the continuous integration test can be completed without providing the permission of pulling codes for the scheduling module (namely Jenkins).
The message queue acts as an intermediary for rights separation and is implemented using rabbitmq. The test task of the scheduling module only needs to send a request to a message queue, namely step 1.2, the operation environment management module obtains the request from the message queue, step 1.3, the operation environment management module is finally responsible for pulling codes, step 1.4, the operation environment management module returns an environment construction completion request, the message queue module is given, step 1.5, the scheduling module obtains the environment construction completion request from the message queue module, the environment construction completion request comprises a test terminal address to Jenkins, step 1.6, the code is actually pulled by the operation environment management module, and the permission of pulling the codes does not need to be provided for a scheduling module (Jenkins) user. The environment management module can also reject the unreasonable request of Jenkins, namely, the request of constructing the running environment in the message queue module is checked, step 1.3, the request is discarded if unreasonable, the running environment management module does not need to provide any interface and permission for Jenkins, Jenkins can only send out the request to the message queue module, actual operation codes cannot be operated, the code safety is ensured, a good environment address is created, the message queue module can also be passed, the request is finally returned to Jenkins users for use, the requirement of continuous integration test is ensured, and the code content is hidden for Jenkins users in the whole process.
A code warehouse monitoring module: in this embodiment, a webhook is set in the git code repository, and the code submitting events Push events, and Tag Push events, issue events, and the like can also be monitored. The callback address of webhook is set as the address of the scheduling module, so that the monitored code submission event can be sent to the scheduling module, and the sent content comprises information such as branches, submitters, submission time and the like. FIG. 3 is a flow diagram of a code warehouse listening module, as shown in FIG. 3:
s201: a code monitoring module: and setting a webhook callback address as a scheduling module address, namely an address of a Jenkins monitoring task, on git.
S202: a code monitoring module: the webhook listens for code commit events for gits.
S203: a code monitoring module: and sending a git code submission event to a Jenkins monitoring task, wherein the event comprises information such as code branches, submitters, submission time and the like.
A scheduling module: the embodiment is realized by continuously integrating software Jenkins to schedule the test tasks. And receiving a code change message sent by the code monitoring module, and sending a request for constructing the operating environment to the message queue module, wherein the request comprises code branch information. And the monitoring message queue module is used for processing the request of completing construction of the running environment, the constructed request comprises the address information of the test terminal, and the test case is executed on the returned test terminal. And the monitoring message queue module is used for processing the updating request of the running environment, the updating request comprises the address information of the test terminal, and the test case is executed on the returned test terminal.
FIG. 4 is a flow diagram of a scheduling module, such as that shown in FIG. 4:
s301: and configuring the Jenkins task to trigger when git is submitted. And receiving a code submission event and triggering a Jenkins task by a webhook callback of the code warehouse monitoring module.
S302: a build environment request is sent to a message queue. In this embodiment, the message queue is implemented by using a robbitmq, the task in S301 calls a python script, uses a pika library, uses a BlockingConnection function to connect the robbitmq, and uses a basic _ publish function to send a build environment request to the message queue.
S303: and monitoring the message queue, and processing the environment construction completion request and the environment updating request. And monitoring the environment construction completion request and the environment updating request sent by the message queue through a basic _ control function of the pika library.
S304: after receiving the message of the message queue, judging whether the request is an environment construction completion request or an environment updating request.
S305: and processing the environment updating request, acquiring the address of the test terminal from the request, uploading a use case of the test operation environment to the test terminal by the Jenkins task, and executing.
S306: and the processing environment builds a completion request, obtains the address of the test terminal from the request, uploads a case of the test code to the test terminal by the Jenkins task, and executes the case.
A message queue module: the present embodiment implements the message queue module using rabbitmq. And the message queue receives a construction environment request sent by Jenkins and waits for the operation environment management module to process. And receiving a construction completion request of the operation environment management module, and waiting for processing by the scheduling module. And receiving an operation environment updating request of the operation environment management module, and waiting for processing by the scheduling module.
FIG. 5 is a flow diagram of a message queue module, as shown in FIG. 5:
s401: configuring and starting Rabbitmq, and maintaining 2 queues: and constructing a running environment queue and a running environment updating queue.
S402: the method comprises the steps of constructing a running environment queue, managing type 2 messages, 1, receiving a running environment constructing request sent by a scheduling module, waiting for the running environment managing module to process 2, receiving the running environment managing module, sending a running environment constructing success request, and waiting for the scheduling module to process.
S403: and the running environment updating queue receives the running environment updating request sent by the running environment management module and waits for the processing of the scheduling module.
The operation environment management module: the embodiment is realized by using docker, and manages the operating environment. And storing all operating environment information such as a database, a dependency library, a dependency service and the like in a docker mirror image, newly building a docker container as a terminal for executing the test case when the docker container is used every time, wherein the terminal comprises all operating environments. And the monitoring message queue module processes the request for constructing the operating environment, the processing process is to create a docker container, a code corresponding to the git branch is installed in the container, and a message for successful environment construction is sent to the message queue module, wherein the message comprises the address of the test terminal. When the mirror image is updated, namely the running environment is updated, a docker container is newly established, the current stable version code of the git branch is installed in the container, and the environment updating message is sent to the message queue module and comprises the address of the test terminal.
FIG. 6 is a flow diagram of the runtime environment management module, as shown in FIG. 6:
s501: and maintaining a docker image by using the Dockerfile, wherein the Dockerfile has various environmental information and instructions, and using the Dockerfile to build the image. The image includes all operating environment information such as databases, dependent libraries, dependent components, etc.
S502: starting a daemon process, monitoring a message queue, and constructing a request of an operating environment. After receiving the request, the docker container is constructed using the docker mirror in S501.
S503: and pulling the corresponding branch code in the docker container according to the code branch information in the request in the S502.
S504: and sending an environment construction completion request to the message queue, wherein the request comprises a docker container address serving as a test terminal address.
S505: starting a daemon process, and monitoring: dockerfile modifications, if any, are considered runtime environment updates. A new image of Dockerfile, build, is used, and then a docker container is constructed using the new image.
S506: the currently stable branch code, such as the currently dropped version of the branch code, is pulled in the docker container.
S506: and sending an environment updating request to the message queue, wherein the request comprises a docker container address serving as a test terminal address.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
The embodiment of the invention provides a test case processing device, which can be used for executing the test case processing method of the embodiment of the invention.
Fig. 7 is a schematic diagram of a test case processing apparatus according to an embodiment of the present invention, and as shown in fig. 7, the apparatus includes:
a receiving unit 10, configured to receive a request for constructing an operating environment;
a first forwarding unit 20, configured to forward, after receiving the request for constructing the runtime environment, the request for constructing the runtime environment to the runtime environment management module through the message queue module;
the building unit 30 is used for building a test environment according to the code branch information in the request for building the running environment through the running environment management module;
the second forwarding unit 40 is configured to forward, through the message queue module, the request for completing the test environment construction to the scheduling module after the test environment construction is completed;
and the first execution unit 50 is configured to execute a use case of the test code or a use case of the test execution environment according to the message sent by the message queue module.
The embodiment employs a receiving unit 10 for receiving a request for constructing an operating environment; a first forwarding unit 20, configured to forward, after receiving the request for constructing the runtime environment, the request for constructing the runtime environment to the runtime environment management module through the message queue module; the building unit 30 is used for building a test environment according to the code branch information in the request for building the running environment through the running environment management module; the second forwarding unit 40 is configured to forward, through the message queue module, the request for completing the test environment construction to the scheduling module after the test environment construction is completed; the first execution unit 50 is configured to execute a test code case or a test operation environment case according to the message sent by the message queue module, so that the problem of inconvenience in rights management operation during testing of the code or the operation environment is solved, and further, the effect of facilitating rights management during testing of the code or the operation environment is achieved.
The test case processing device comprises a processor and a memory, wherein the receiving unit, the first forwarding unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
Optionally, the apparatus further comprises: the judging unit is used for judging whether an operating environment updating request is received or not after the operating environment management module finishes constructing the test environment before executing the use case of the test code or the use case of the test operating environment according to the message sent by the message queue module; and the second execution unit is used for executing the use case of the test operation environment after receiving the operation environment updating request.
Optionally, the first executing unit 50 includes: the judging module is used for judging whether the message is an environment construction completion request or an environment updating request after receiving the message sent by the message queue module; the first uploading module is used for uploading and executing a use case of the test code when the message is an environment construction completion request; and the second uploading module is used for uploading and testing the use case of the operating environment when the message is the environment updating request.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the kernel parameters are adjusted to facilitate the authority management during the test of the code or the running environment.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium, on which a program is stored, and the program implements the test case processing method when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the test case processing method is executed when the program runs.
The embodiment of the invention provides equipment, which comprises at least one processor, at least one memory and a bus, wherein the memory and the bus are connected with the processor; the processor and the memory complete mutual communication through a bus; the processor is used for calling the program instructions in the memory so as to execute the test case processing method. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: receiving a request for constructing an operating environment; after receiving the request for constructing the operating environment, the message queue module forwards the request for constructing the operating environment to the operating environment management module; the running environment management module constructs a test environment according to the code branch information in the request for constructing the running environment; after the test environment is constructed, the request for constructing the test environment is transmitted to the scheduling module through the message queue module; and executing the use case of the test code or the use case of the test running environment according to the message sent by the message queue module.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that 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 the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A test case processing method is characterized by comprising the following steps:
receiving a request for constructing an operating environment;
after receiving the request for constructing the operating environment, the message queue module forwards the request for constructing the operating environment to the operating environment management module;
the running environment management module constructs a test environment according to the code branch information in the request for constructing the running environment;
after the test environment is constructed, the request for constructing the test environment is transmitted to the scheduling module through the message queue module;
and executing the use case of the test code or the use case of the test running environment according to the message sent by the message queue module.
2. The method of claim 1, wherein prior to executing a use case of the test code or a use case of the test runtime environment according to the message sent by the message queue module, the method further comprises:
after the running environment management module completes the construction of the test environment, judging whether a running environment updating request is received;
and executing the use case of the test operation environment after receiving the operation environment updating request.
3. The method of claim 2, wherein executing a use case of test code or a use case of a test runtime environment according to a message sent by a message queue module comprises:
after receiving a message sent by a message queue module, judging whether the message is an environment construction completion request or an environment updating request;
if the message is an environment construction completion request, uploading and executing a use case of the test code;
and if the message is an environment updating request, uploading and testing the use case of the operating environment.
4. The method of claim 3, wherein prior to receiving the request to build the runtime environment, the method further comprises:
after the scheduling module receives the code submission event, sending a request for constructing the operating environment to the message queue module,
the message queue module constructs a running environment queue and a running environment updating queue through Rabbitmq, wherein the running environment queue is used for storing a request for constructing a running environment sent by the scheduling module and a request for successfully constructing the running environment sent by the running environment management module.
5. The method according to claim 1, wherein the runtime environment management module maintains a docker image by using a Dockerfile, wherein the Dockerfile carries instructions of runtime environment information to be constructed.
6. A test case processing apparatus, comprising:
a receiving unit configured to receive a request for constructing an operating environment;
the first forwarding unit is used for forwarding the request for constructing the running environment to the running environment management module through the message queue module after receiving the request for constructing the running environment;
the construction unit is used for constructing a test environment according to the code branch information in the request for constructing the running environment through the running environment management module;
the second forwarding unit is used for forwarding the request for completing the test environment construction to the scheduling module through the message queue module after the test environment construction is completed;
and the first execution unit is used for executing the use case of the test code or the use case of the test running environment according to the message sent by the message queue module.
7. The apparatus of claim 6, further comprising:
the judging unit is used for judging whether an operating environment updating request is received or not after the operating environment management module finishes constructing the test environment before executing the use case of the test code or the use case of the test operating environment according to the message sent by the message queue module;
and the second execution unit is used for executing the use case of the test operation environment after receiving the operation environment updating request.
8. The apparatus of claim 7, wherein the first execution unit comprises:
the judging module is used for judging whether the message is an environment construction completion request or an environment updating request after receiving the message sent by the message queue module;
the first uploading module is used for uploading and executing a use case of the test code when the message is an environment construction completion request;
and the second uploading module is used for uploading and testing the use case of the operating environment when the message is the environment updating request.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device where the storage medium is located is controlled to execute the test case processing method according to any one of claims 1 to 5.
10. An apparatus, characterized in that the apparatus at least comprises a processor, and at least one memory and a bus connected with the processor, wherein the processor and the memory complete communication with each other through the bus, and the processor is configured to call program instructions in the memory to execute the test case processing method according to any one of claims 1 to 5.
CN202010097612.2A 2020-02-17 Test case processing method and device Active CN111240998B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010097612.2A CN111240998B (en) 2020-02-17 Test case processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010097612.2A CN111240998B (en) 2020-02-17 Test case processing method and device

Publications (2)

Publication Number Publication Date
CN111240998A true CN111240998A (en) 2020-06-05
CN111240998B CN111240998B (en) 2024-04-19

Family

ID=

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112329020A (en) * 2020-11-05 2021-02-05 国网江苏省电力有限公司信息通信分公司 Automatic detection method and device based on safety rules of electric power data middling station
CN112363946A (en) * 2020-11-24 2021-02-12 上海悦易网络信息技术有限公司 Message forwarding method and device based on service system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329652A (en) * 2008-07-30 2008-12-24 中兴通讯股份有限公司 Regression test automatic system and method
US20140245264A1 (en) * 2013-02-28 2014-08-28 International Business Machines Corporation Identifying Test Cases Based on Changed Test Code
CN106201850A (en) * 2015-04-29 2016-12-07 阿里巴巴集团控股有限公司 A kind of compatibility test method and device
CN109614341A (en) * 2018-12-29 2019-04-12 微梦创科网络科技(中国)有限公司 A kind of test method and system of code coverage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329652A (en) * 2008-07-30 2008-12-24 中兴通讯股份有限公司 Regression test automatic system and method
US20140245264A1 (en) * 2013-02-28 2014-08-28 International Business Machines Corporation Identifying Test Cases Based on Changed Test Code
CN106201850A (en) * 2015-04-29 2016-12-07 阿里巴巴集团控股有限公司 A kind of compatibility test method and device
CN109614341A (en) * 2018-12-29 2019-04-12 微梦创科网络科技(中国)有限公司 A kind of test method and system of code coverage

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112329020A (en) * 2020-11-05 2021-02-05 国网江苏省电力有限公司信息通信分公司 Automatic detection method and device based on safety rules of electric power data middling station
CN112363946A (en) * 2020-11-24 2021-02-12 上海悦易网络信息技术有限公司 Message forwarding method and device based on service system
CN112363946B (en) * 2020-11-24 2024-04-16 上海万物新生环保科技集团有限公司 Message forwarding method and device based on service system

Similar Documents

Publication Publication Date Title
US10585698B2 (en) Template-driven multi-tenant workflow processing
EP3128416B1 (en) Sdn application integration, management and control method, system and device
TW201411387A (en) Updating hardware libraries for use by applications on a computer system with an FPGA coprocessor
CN111258565B (en) Method, system, server and storage medium for generating applet
US11474842B2 (en) Integration application creator design
CN113220431B (en) Cross-cloud distributed data task scheduling method, device and storage medium
CN114168179A (en) Micro-service management method, device, computer equipment and storage medium
CN109828830B (en) Method and apparatus for managing containers
CN110659104B (en) Service monitoring method and related equipment
CN109657485B (en) Authority processing method and device, terminal equipment and storage medium
CN115080101A (en) Application management method, application subscription method and related equipment
CN114546588A (en) Task deployment method and device, storage medium and electronic device
CN116982029A (en) Hosting event-based applications
CN117076096A (en) Task flow execution method and device, computer readable medium and electronic equipment
CN111240998B (en) Test case processing method and device
US10728323B2 (en) Method and apparatus for operating infrastructure layer in cloud computing architecture
CN111240998A (en) Test case processing method and device
CN115357198A (en) Mounting method and device of storage volume, storage medium and electronic equipment
CN114860203A (en) Project creation method, project creation device, server and storage medium
CN114090268A (en) Container management method and container management system
CN113254825A (en) Page generation method and device, electronic equipment and storage medium
CN113296829A (en) Method, device, equipment and computer readable medium for processing service
CN112231231A (en) Method, system and device for debugging cloud service
CN112463616A (en) Chaos testing method and device for Kubernetes container platform
CN112559001A (en) Method and device for updating application

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
GR01 Patent grant