CN113407451A - Test method, device, equipment, storage medium and program product - Google Patents

Test method, device, equipment, storage medium and program product Download PDF

Info

Publication number
CN113407451A
CN113407451A CN202110696122.9A CN202110696122A CN113407451A CN 113407451 A CN113407451 A CN 113407451A CN 202110696122 A CN202110696122 A CN 202110696122A CN 113407451 A CN113407451 A CN 113407451A
Authority
CN
China
Prior art keywords
tested
version information
component
mirror image
code
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.)
Withdrawn
Application number
CN202110696122.9A
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.)
Shenzhen Sensetime Technology Co Ltd
Original Assignee
Shenzhen Sensetime Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Sensetime Technology Co Ltd filed Critical Shenzhen Sensetime Technology Co Ltd
Priority to CN202110696122.9A priority Critical patent/CN113407451A/en
Publication of CN113407451A publication Critical patent/CN113407451A/en
Withdrawn 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/3696Methods or tools to render software testable
    • 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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/368Test management for test version control, e.g. updating test cases to a new software version
    • 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 discloses a test method, a test device, a test apparatus, a storage medium and a computer program product, wherein the method comprises the following steps: triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the version information of the code to be tested of the component to be tested to obtain the version information of the mirror image to be tested, which is matched with the version information of the code to be tested; wherein, the mirror image constructed by the continuous integration tool is stored in a mirror image warehouse; triggering a test server to deploy a test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse; and under the condition that the test environment is successfully deployed, executing a set test task to obtain a test result of the component to be tested. In the embodiment of the application, the full-flow automatic test method can be realized, the test can be continuously and automatically carried out, and manual operation is not needed.

Description

Test method, device, equipment, storage medium and program product
Technical Field
The present application relates to, but not limited to, the field of computer technologies, and in particular, to a testing method, an apparatus, a device, a storage medium, and a computer program product.
Background
Testing is a very important environment in the continuing integration of software development. In the related technology, a general test flow is that after a development engineer completes development of a component version, the development engineer manually compiles and packages the component to be tested to obtain a mirror image of the component to be tested, the mirror image of the component to be tested is pushed to a mirror image warehouse, the test engineer needs to manually update a specified mirror image of the component to be tested in a test environment, the test environment is redeployed, then a test platform manually triggers execution of a test task, after the test task is executed, a test result is manually checked, and when needed, the test engineer needs to manually collect test result information and send the test result information to related personnel through a mail. In the above test scheme, manual intervention is required in compiling and packaging of the component image, deployment and updating of the test environment, execution of the test task and result collection, so that the automation of the whole flow of construction, deployment and test of the component image cannot be really realized, and the test cannot be continuously performed. Moreover, the situation that the environment is not updated and the latest test version is deployed or the test is not performed in time may be caused because the information of the development engineer and the test engineer is not equal.
Disclosure of Invention
In view of the above, embodiments of the present application provide a testing method, apparatus, device, storage medium, and computer program product.
The technical scheme of the embodiment of the application is realized as follows:
in one aspect, an embodiment of the present application provides a testing method, where the method includes:
triggering a continuous integration tool of the component to be tested to construct a mirror image of the component to be tested based on the version information of the code to be tested of the component to be tested, and obtaining the version information of the mirror image to be tested, which is matched with the version information of the code to be tested; wherein the images built by the continuous integration tool are stored in an image warehouse;
triggering a test server to deploy a test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse;
and executing a set test task under the condition that the test environment is successfully deployed to obtain a test result of the component to be tested.
In another aspect, an embodiment of the present application provides a testing apparatus, where the apparatus includes:
the system comprises a construction module, a test module and a control module, wherein the construction module is used for triggering a continuous integration tool of a to-be-tested component to carry out mirror image construction on the to-be-tested component based on version information of a to-be-tested code of the to-be-tested component to obtain version information of the to-be-tested mirror image matched with the version information of the to-be-tested code; wherein the images built by the continuous integration tool are stored in an image warehouse;
the deployment module is used for triggering the test server to deploy the test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse;
and the first testing module is used for executing a set testing task under the condition that the test environment is successfully deployed to obtain a testing result of the component to be tested.
In some embodiments, the apparatus further comprises: the analysis module is used for analyzing the test result of the component to be tested to obtain the execution result statistical information of the test task; and the sending module is used for generating and sending a test report of the component to be tested based on the execution result statistical information of the test task.
In some embodiments, the number of components to be tested is plural, and the building module is further configured to: triggering a continuous integration tool of a plurality of components to be tested to respectively carry out mirror image construction on the plurality of components to be tested by adopting a parallel mode based on the version information of the codes to be tested of the plurality of components to be tested to obtain the version information of the mirror images to be tested, which is matched with the version information of the codes to be tested of each component to be tested.
In some embodiments, the deployment module is further to: based on the version information of the mirror image to be tested, triggering a test server to execute the following operations: acquiring version information of an operating system and version information of a basic component which are matched with the version information of the mirror image to be tested; wherein the basic component is a component on which the component to be tested depends during operation; based on the version information of the operating system, reinstalling the operating system; deploying the base component in the operating system based on the version information of the base component; and acquiring the mirror to be tested matched with the version information of the mirror to be tested from the mirror warehouse based on the version information of the mirror to be tested, and deploying the component to be tested in the operating system by using the mirror to be tested.
In some embodiments, the components to be tested include a first component to be tested, the apparatus further comprising: the first acquisition module is used for acquiring the test requirement of the second component to be tested; the cleaning module is used for triggering the test server to clean the test data of the component to be tested in the test environment in response to the condition that the operating system and the basic component which are depended on by the second component and the first component are the same; and the second testing module is used for completing the testing of the second component based on the version information of the code to be tested of the second component.
In some embodiments, the build module is further to: inquiring the corresponding relation between the version information of the code to be tested and the version information of the mirror image based on the version information of the code to be tested of the component to be tested; under the condition that the version information of the mirror image matched with the version information of the code to be tested does not exist in the corresponding relation, triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the version information of the code to be tested to obtain the version information of the mirror image to be tested matched with the version information of the code to be tested; and/or determining the version information of the mirror image as the version information of the mirror image to be tested under the condition that the version information of the mirror image matched with the version information of the code to be tested exists in the corresponding relation.
In some embodiments, the version information of the code to be tested includes branch information of the code to be tested, and the construction module is further configured to: and triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the branch information of the code to be tested, and obtaining a latest code submission record corresponding to the branch information of the code to be tested and version information of the mirror image to be tested matched with the latest code submission record.
In some embodiments, the version information of the code to be tested further includes a code submission record of the code to be tested, and the apparatus further includes: the second acquisition module is used for acquiring the latest code submission record of the code to be tested from the code management tool of the component to be tested based on the branch information of the code to be tested; the building module is further configured to: and inquiring the corresponding relation between the code submission record of the code to be tested and the mirrored version information based on the latest code submission record of the code to be tested.
In some embodiments, the build module is further to: and under the condition that the version information of the mirror image matched with the latest code submission record of the code to be tested exists in the corresponding relation, determining the version information of the mirror image as the version information of the mirror image to be tested.
In some embodiments, the build module is further to: and under the condition that the automatic mirror image construction function is determined to be started based on the configuration information of the to-be-tested component, triggering a continuous integration tool of the to-be-tested component to carry out mirror image construction on the to-be-tested component based on the version information of the to-be-tested code of the to-be-tested component, and obtaining the version information of the to-be-tested mirror image matched with the version information of the to-be-tested code.
In some embodiments, the build module is further to: and under the condition that the automatic mirror image construction function is not started based on the configuration information, acquiring the version information of the mirror image used by the component to be tested in the production environment, and determining the version information of the mirror image as the version information of the mirror image to be tested.
In another aspect, an embodiment of the present application provides a testing apparatus, which includes a memory and a processor, where the memory stores a computer program that is executable on the processor, and the processor implements some or all of the steps of the method when executing the computer program.
In yet another aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements some or all of the steps of the above method.
In yet another aspect, the present application provides a computer program, which includes computer readable code, and when the computer readable code is executed in a computer device, a processor in the display device executes some or all of the steps for implementing the method.
In yet another aspect, the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, the computer program implements some or all of the steps of the above method.
In the embodiment of the application, based on the version information of the code to be tested of the component to be tested, triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested, and obtaining the version information of the mirror image to be tested, which is matched with the version information of the code to be tested; wherein, the mirror image constructed by the continuous integration tool is stored in a mirror image warehouse; triggering a test server to deploy a test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse; and under the condition that the test environment is successfully deployed, executing a set test task to obtain a test result of the component to be tested. Therefore, the automatic testing method of the whole process including mirror image construction, test environment deployment and test task execution can be automatically realized for the to-be-tested codes of the to-be-tested components, so that the testing can be continuously and automatically carried out, the problem that the version of the tested components is inaccurate or the testing is not timely due to the fact that information of development engineers and testing engineers is not equal can be solved, and the problem that the testing result is inaccurate due to manual operation errors can be avoided. In addition, the set test task is executed under the condition that the test environment is successfully deployed, so that the abnormal deployment of the test environment can be found in time, and the test task execution failure caused by the abnormal deployment of the test environment can be reduced.
Drawings
Fig. 1 is a schematic flow chart illustrating an implementation of a testing method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart illustrating an implementation of a testing method according to an embodiment of the present application;
fig. 3 is a schematic flow chart illustrating an implementation of a testing method according to an embodiment of the present application;
fig. 4 is a schematic flow chart illustrating an implementation of a testing method according to an embodiment of the present application;
fig. 5A is a schematic flow chart illustrating an implementation of a testing method according to an embodiment of the present application;
fig. 5B is a schematic flow chart illustrating an implementation of a mirror image constructing and deploying method according to an embodiment of the present application;
fig. 5C is a schematic view of an implementation flow for performing mirror image construction on a plurality of components to be tested according to an embodiment of the present application;
fig. 6 is a schematic flow chart illustrating an implementation process of testing two modules according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a testing apparatus according to an embodiment of the present disclosure;
fig. 8 is a hardware entity diagram of a testing apparatus according to an embodiment of the present disclosure.
Detailed Description
In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further described in detail with reference to the drawings and the embodiments, the described embodiments should not be considered as limiting the present application, and all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the protection scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
Where a similar description of "first/second" appears in the specification, and the description below is added where the terms "first/second/third" are used merely to distinguish between similar objects and do not denote a particular order or importance to the objects, it will be appreciated that "first/second/third" may, where permissible, be interchanged in a particular order or sequence to enable embodiments of the application described herein to be practiced in other than the order shown or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application.
The embodiment of the application provides a testing method which can be executed by a testing platform running on computer equipment. The computer device refers to a device with data processing capability, such as a server, a notebook computer, a tablet computer, a desktop computer, a smart television, a set-top box, a mobile device (e.g., a mobile phone, a portable video player, a personal digital assistant, a dedicated messaging device, and a portable game device). Fig. 1 is a schematic view of an implementation flow of a testing method provided in an embodiment of the present application, and as shown in fig. 1, the method includes:
step S101, triggering a continuous integration tool of a component to be tested to carry out mirror image construction on the component to be tested based on version information of a code to be tested of the component to be tested, and obtaining version information of a mirror image to be tested, wherein the version information of the mirror image to be tested is matched with the version information of the code to be tested; wherein the images built by the persistent integration tool are stored in an image repository.
Here, the to-be-tested code of the to-be-tested component is the code which needs to be tested after the development of the developer is completed. The code to be tested of the component to be tested can be developed by a developer and then submitted to a code warehouse (such as Github, GitLab, SVN and the like), and the code warehouse can store different versions of the code of the same component. The code of the corresponding version can be determined through the version information of the code. In implementation, the version information of the code may include a version number of the code, and may also include branch information of the code in a code repository, a code submission record, and the like. The version information of the code to be tested of the component to be tested can be configured by a user or can be default by the system.
The persistent integration tool can be an open-source persistent integration tool, such as GitLab CI, Jenkins, CircleCI, Codefresh, and the like, and can also be a tool which is self-developed by a user and can automatically perform image construction. The test platform can send the version information of the to-be-tested code of the to-be-tested component to the continuous integration tool by adopting modes of sending an instruction or calling an interface and the like, and triggers the continuous integration tool to carry out mirror image construction on the to-be-tested component based on the version information of the to-be-tested code. The continuous integration tool can pull the code to be tested from the code warehouse based on the version information of the code to be tested, construct a mirror image of the component to be tested through operations of compiling, packaging and the like on the code to be tested, and push the constructed mirror image to the mirror image warehouse. When the image is constructed, version information of the image may be set, where the version information of the image may include a version number of the image, and may also include version information of a code corresponding to the image, and this is not limited here. The mirror image warehouse can be deployed in a local server or a cloud server. After the mirror image construction is completed, the continuous integration tool can send the packaged version information of the components to be tested and the version information of the mirror image generated by the construction to the test platform by adopting modes of interface calling or function callback and the like. In practice, those skilled in the art may adopt an appropriate persistent integration tool according to practical situations, where the persistent integration tool may be deployed independently or may be a persistent integration plug-in integrated in the code management tool, and is not limited herein.
For example, the persistent integration tool may be a GitLab CI plug-in integrated in a GitLab of the code management tool, and a stage (stage) of component compiling, packaging and callback function of the test platform may be added in a GitLab-ci.yml file configured under a project directory of the GitLab of the code management tool of the component to be tested. And the GitLab CI plug-in can be triggered on the test platform to execute compiling and packaging of the components to be tested, so that a mirror image to be tested matched with the version information of the code to be tested is obtained, and the mirror image to be tested is pushed to a mirror image warehouse. And after the GitLab CI plug-in completes the mirror image construction, a callback function of the test platform is called back, and the packed version information of the component to be tested and the version information of the mirror image generated by the construction can be sent to the test platform by calling the callback function.
Step S102, based on the version information of the mirror image to be tested, triggering a test server to deploy a test environment of the component to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse.
Here, the test environment may include an operating system on which the components to be tested need to run, a base component on which the components to be tested need to run, and the components to be tested. The test server is one or more servers used for building a test environment and testing the components to be tested. In implementation, the test server may be a physical server, a virtual server or a cloud server, an independent server, or a server cluster.
The test platform can trigger the test server to deploy the test environment of the component to be tested after obtaining the version information of the mirror image to be tested. The testing platform can send the version information of the mirror image to be tested to the testing server in a mode of sending a remote instruction to the testing server, and triggers the testing server to deploy the testing environment of the component to be tested based on the version information of the mirror image to be tested. The test environment deployment may include, but is not limited to, one or more of reinstalling an operating system, deploying a base component, deploying a component to be tested, and the like. In the deployed test environment, the versions of the operating system and the basic component are matched with the version of the mirror image to be tested. The test server can obtain the mirror image to be tested from the mirror image warehouse based on the version information of the mirror image to be tested, and deploy the component to be tested based on the mirror image to be tested.
And step S103, executing a set test task under the condition that the test environment is successfully deployed to obtain a test result of the component to be tested.
Here, the successful deployment of the test environment means that the component to be tested can normally run on the test server and provide services. The test server may notify the test platform after the test environment is successfully deployed. The test platform may also automatically detect whether the test environment is successfully deployed in a polling manner, for example, the test platform may detect whether the test environment is successfully deployed by sending heartbeat detection to the component to be tested.
The set test task may be configured on the test platform in advance by the user according to actual conditions, and may include at least one test case. And under the condition that the test environment is successfully deployed, the test platform can execute a set test task to obtain a test result of the component to be tested. The test result may include an execution result of each test case. In implementation, the information included in the test result may be determined according to an actual situation, for example, the test result may include whether the test case is successfully executed, error information, execution duration, and the like.
In some embodiments, after the test task is completed, the test result of the component to be tested may be sent to the tester and/or the developer, so that the tester and/or the developer can conveniently grasp the test result in time.
In some embodiments, the number of the components to be tested is plural, and the step S101 may include: step S101a, triggering a continuous integration tool of a plurality of components to be tested to respectively construct mirror images of the plurality of components to be tested in a parallel mode based on the version information of the codes to be tested of the plurality of components to be tested, and obtaining the version information of the mirror images to be tested, which is matched with the version information of the codes to be tested of each component to be tested. Here, a plurality of components to be tested may use the same continuous integration tool, or may use different continuous integration tools. Therefore, when a plurality of assemblies need to be tested, the mirror image construction is carried out on each assembly in a parallel mode, so that the testing time can be saved, and the testing efficiency can be improved.
In some embodiments, the step S101 may include: step S101b, under the condition that the automatic mirror image construction function is determined to be started based on the configuration information of the components to be tested, triggering a continuous integration tool of the components to be tested to carry out mirror image construction on the components to be tested based on the version information of the codes to be tested of the components to be tested, and obtaining the version information of the mirror images to be tested, which is matched with the version information of the codes to be tested; wherein the images built by the persistent integration tool are stored in an image repository. Here, the configuration information of the component to be tested may be default or user-configured. The configuration information may include a configuration item for characterizing whether to start an automatic mirror image construction function for the component to be tested. In implementation, the configuration information of different components to be tested may be the same or different.
In some embodiments, the step S101 may further include: step S101c, when it is determined that the automatic mirror image creation function is not started based on the configuration information, obtaining version information of a mirror image used by the component to be tested in the production environment, and determining the version information of the mirror image as version information of the mirror image to be tested. Here, the production environment refers to an operating environment in which components formally provide external services. In implementation, version information of a component running in the production environment may be obtained, and based on the version information of the component, version information of a mirror image used in the production environment may be determined. In this way, by configuring whether to start the automatic mirroring construction function in the configuration information of the component to be tested, it is possible to flexibly support the automatic testing of the component running in the production environment and the component under development.
The testing method provided by the embodiment of the application triggers a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the version information of the code to be tested of the component to be tested, and obtains the version information of the mirror image to be tested, wherein the version information of the mirror image to be tested is matched with the version information of the code to be tested; wherein, the mirror image constructed by the continuous integration tool is stored in a mirror image warehouse; triggering a test server to deploy a test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse; and under the condition that the test environment is successfully deployed, executing a set test task to obtain a test result of the component to be tested. Therefore, the test method of the whole process including mirror image construction, test environment deployment and test task execution can be automatically realized for the to-be-tested code of the to-be-tested assembly, so that the test can be continuously and automatically carried out, the problem that the version of the tested assembly is inaccurate or the test is not timely due to unequal information of a development engineer and a test engineer can be solved, and the problem that the test result is inaccurate due to manual operation errors can be avoided. In addition, the set test task is executed under the condition that the test environment is successfully deployed, so that the abnormal deployment of the test environment can be found in time, and the test task execution failure caused by the abnormal deployment of the test environment can be reduced.
The embodiment of the application provides a testing method which can be executed by a testing platform running on computer equipment. As shown in fig. 2, the method includes:
step S201, triggering a continuous integration tool of a component to be tested to carry out mirror image construction on the component to be tested based on version information of a code to be tested of the component to be tested, and obtaining version information of a mirror image to be tested, wherein the version information of the mirror image to be tested is matched with the version information of the code to be tested; wherein the images built by the persistent integration tool are stored in an image repository.
Step S202, based on the version information of the mirror image to be tested, triggering a test server to deploy a test environment of the component to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse.
Step S203, executing a set testing task under the condition that the test environment is successfully deployed, and obtaining a testing result of the component to be tested.
Here, steps S201 to S203 correspond to steps S101 to S103, respectively, and specific embodiments of steps S101 to S103 may be referred to when implemented.
Step S204, analyzing the test result of the component to be tested to obtain the execution result statistical information of the test task.
Here, the test result of the to-be-tested component may include an execution result of each test case, for example, whether the test case is successfully executed, error information, execution duration, and the like. After the test task is executed, the test result of the component to be tested can be analyzed to obtain the execution result statistical information of the test task. The execution result statistics may include, but is not limited to, execution time of the test task, total number of executed test cases, passing rate and failure rate of the test cases, and the like.
Step S205, generating and sending a test report of the component to be tested based on the statistical information of the execution result of the test task.
Here, the test report of the components to be tested may include the execution result statistical information, and may further include a quality evaluation result, an error root cause analysis result, and the like of the code to be tested of the components to be tested, which are determined based on the execution result statistical information. In implementation, the test report of the component to be tested may be sent to a tester, a developer or other project-related personnel by using any suitable manner, such as mail, short message, voice, and the like, which is not limited herein. In this way, a tester, developer or other project-related personnel can monitor the quality of a development project by comparing test reports of the same component over a period of time.
According to the testing method provided by the embodiment of the application, after the testing task is executed, the testing result of the component to be tested can be analyzed to obtain the execution result statistical information of the testing task, and the testing report of the component to be tested can be generated and sent based on the execution result statistical information of the testing task. Therefore, testers, developers or other project related personnel can conveniently and timely master the test results of the components to be tested, and the quality of the development projects can be monitored by comparing the test reports of the same component in a period of time.
The embodiment of the application provides a testing method which can be executed by a testing platform running on computer equipment. As shown in fig. 3, the method includes:
step S301, triggering a continuous integration tool of a to-be-tested component to perform mirror image construction on the to-be-tested component based on version information of a to-be-tested code of the to-be-tested component to obtain version information of the to-be-tested mirror image matched with the version information of the to-be-tested code; wherein the images built by the persistent integration tool are stored in an image repository.
Here, step S301 corresponds to step S101, and reference may be made to a specific embodiment of step S101.
Step S302, based on the version information of the mirror image to be tested, triggering the test server to execute the following operations: acquiring version information of an operating system and version information of a basic component which are matched with the version information of the mirror image to be tested; wherein the basic component is a component on which the component to be tested depends during operation; based on the version information of the operating system, reinstalling the operating system; deploying the base component in the operating system based on the version information of the base component; and acquiring the mirror to be tested matched with the version information of the mirror to be tested from the mirror warehouse based on the version information of the mirror to be tested, and deploying the component to be tested in the operating system by using the mirror to be tested.
Here, the test platform may send version information of the mirror to be tested to the test server, and the test server may obtain version information of the operating system and version information of the base component, which are matched with the version information of the mirror to be tested, by querying configuration information of the component to be tested based on the version information of the mirror to be tested.
The testing platform can also determine the version information of the operating system and the version information of the basic component which are matched with the version information of the mirror to be tested based on the version information of the mirror to be tested, and then sends the version information of the mirror to be tested, the version information of the operating system and the version information of the basic component to the testing server, and the testing server can obtain the version information of the operating system and the version information of the basic component which are matched with the version information of the mirror to be tested and sent by the testing platform.
The test server may obtain the operating system image matched with the version information of the operating system from an image warehouse storing the operating system image based on the version information of the operating system matched with the version information of the image to be tested, and reinstall the operating system by using the operating system image.
After the operating system is reinstalled, the test server may obtain, from a mirror repository storing the mirror images of the base components, the base component mirror image matching the version information of the base component based on the version information of the base component matching the version information of the mirror image to be tested, and deploy the base component in the operating system using the base component mirror image.
The test server may obtain a to-be-tested mirror matched with the version information of the to-be-tested mirror from a mirror warehouse storing the mirror of the to-be-tested component based on the version information of the to-be-tested mirror, and deploy the to-be-tested component in the operating system using the to-be-tested mirror.
It should be noted that the deployment sequence of the base component and the components to be tested can be determined according to actual situations, and is not limited herein. The operating system image, the image of the basic component and the image of the component to be tested can be stored in the same image warehouse or different image warehouses.
Step S303, under the condition that the test environment is deployed successfully, executing a set test task to obtain a test result of the component to be tested.
Here, step S303 corresponds to step S103, and reference may be made to a specific embodiment of step S103.
In some embodiments, the components to be tested include a first component to be tested, and after step S203, the method may further include:
step S304, acquiring a test requirement of a second component to be tested;
here, the test requirement of the second component may include, but is not limited to, version information of the code to be tested of the second component, version information of the operating system and version information of the base component that match the version information of the code to be tested, a test task, and the like. In practice, the testing requirements of the second component may be user-configured or may be default for the testing platform.
Step S305, in response to a situation that the operating system and the basic component that the second component and the first component depend on are the same, triggering the test server to clean the test data of the component to be tested in the test environment.
Here, that the operating system and the base component on which the second component and the first component depend are the same means that the version of the operating system and the version of the base component on which the second component and the first component depend are the same. In the case where the second component is the same as both the operating system and the base component on which the first component depends, the first component and the second component may be tested on the same test server. After the testing of the first component is completed, the testing platform may trigger the testing server to clean up the testing data of the first component in the testing environment. Cleaning of the test data of the first component may include, but is not limited to, a cessation of service of the first component, deletion of intermediate data generated at the time of testing of the first component, initialization of configuration information of the operating system or the base component, and the like. For example, stopping services that conflict with the second component, deleting temporary data in the storage volume, and so on.
Step S306, completing the test of the second component based on the version information of the code to be tested of the second component.
Here, the process of testing the second component based on the version information of the code to be tested of the second component is similar to the process of testing the first component based on the version information of the code to be tested of the first component, and in implementation, the foregoing specific implementation of testing the first component may be referred to.
In some embodiments, the step S306 may be implemented by the following steps S306a to S306 c: step S306a, triggering a continuous integration tool of the second component to construct a mirror image of the second component based on the version information of the code to be tested of the second component, and obtaining the version information of the mirror image to be tested, which is matched with the version information of the code to be tested; step S306b, triggering the test server to deploy the second component in the operating system based on the version information of the image to be tested; step S306c, executing a set test task to obtain a test result of the second component when it is determined that the second component is successfully deployed.
The testing method provided by the embodiment of the application triggers the testing server to execute the following operations based on the version information of the mirror image to be tested: the method comprises the steps of obtaining version information of an operating system and version information of a basic component, wherein the version information of the operating system is matched with the version information of a mirror to be tested, reinstalling the operating system based on the version information of the operating system, deploying the basic component in the operating system based on the version information of the basic component, obtaining the mirror to be tested, which is matched with the version information of the mirror to be tested, from a mirror warehouse based on the version information of the mirror to be tested, and deploying the component to be tested in the operating system by utilizing the mirror to be tested. Therefore, the test platform and the test server only need to interact once to realize the deployment of the test environment of the components to be tested, so that the interaction process can be simplified, and the deployment efficiency of the test environment can be improved to a certain extent.
In addition, under the condition that the operating system and the basic component which are depended by the second component and the first component are the same, after the testing of the first component is finished, the testing server is triggered to clean the testing data of the component to be tested in the testing environment, and then the testing of the second component is finished based on the version information of the code to be tested of the second component. Therefore, when the first assembly and the second assembly are tested, the same set of operating system and basic assembly can be utilized, so that the testing efficiency can be improved, and the influence of the testing data of the first assembly on the testing result of the second assembly can be avoided.
The embodiment of the application provides a testing method which can be executed by a testing platform running on computer equipment. As shown in fig. 4, the method includes:
step S401, based on the version information of the code to be tested of the component to be tested, inquiring the corresponding relation between the version information of the code to be tested and the version information of the mirror image.
Here, the correspondence between the version information of the code to be tested and the version information of the mirror image may be recorded by the continuous integration tool after the mirror image construction is completed each time, or may be recorded by the test platform based on the version information of the mirror image to be tested, which is returned by the continuous integration tool and matches with the version information of the code to be tested, after the continuous integration tool is triggered to perform the mirror image construction each time.
Step S402, under the condition that the version information of the mirror image matched with the version information of the code to be tested does not exist in the corresponding relation, triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the version information of the code to be tested, and obtaining the version information of the mirror image to be tested matched with the version information of the code to be tested; and/or determining the version information of the mirror image as the version information of the mirror image to be tested under the condition that the version information of the mirror image matched with the version information of the code to be tested exists in the corresponding relation.
Here, in the case that the version information of the mirror image matching the version information of the code to be tested does not exist in the corresponding relationship, it indicates that the code to be tested has not been tested in the historical test task, and therefore, the test code needs to be mirror-constructed by a continuous integration tool to obtain the version information of the mirror image to be tested matching the version information of the code to be tested.
Under the condition that the version information of the mirror image matched with the version information of the code to be tested exists in the corresponding relation, the code to be tested is tested in the historical test task, so that the mirror image construction is not needed again, and the version information of the mirror image matched with the version information of the code to be tested in the corresponding relation can be determined as the version information of the mirror image to be tested.
Step S403, triggering a test server to deploy a test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse.
And S404, executing a set test task under the condition that the test environment is successfully deployed to obtain a test result of the component to be tested.
Here, step S403 and step S404 correspond to step S102 and step S103, respectively, and specific embodiments of step S102 and step S103 may be referred to when implemented.
In some embodiments, the version information of the code to be tested includes branch information of the code to be tested, and the triggering of the continuous integration tool of the component to be tested to construct the image of the component to be tested based on the version information of the code to be tested in step S402 to obtain the version information of the image to be tested, which is matched with the version information of the code to be tested, may include: and triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the branch information of the code to be tested, and obtaining a latest code submission record corresponding to the branch information of the code to be tested and version information of the mirror image to be tested matched with the latest code submission record. Here, the version information of the code to be tested may include branch information of the code to be tested, since a developer may submit a plurality of codes for the same code branch, there may be multiple code submission records in the code warehouse for the same code branch of a component, in order to ensure that the tested code is the code which is newly submitted by the developer, the continuous integration tool needs to determine the latest code submission record corresponding to the branch information based on the branch information of the code to be tested, and the mirror image construction is carried out based on the code corresponding to the latest code submission record to obtain the mirror image to be tested matched with the latest code submission record, the mirror image to be tested is pushed to a mirror image warehouse, and returning the latest code submission record corresponding to the branch information of the code to be tested and the version information of the mirror image to be tested matched with the latest code submission record.
In some embodiments, the version information of the code to be tested further includes a code submission record of the code to be tested, the method further comprising: step S405, based on the branch information of the code to be tested, obtaining the latest code submission record of the code to be tested from the code management tool of the component to be tested. The step S401 may include: step S401a, based on the last code submission record of the code to be tested, querying a corresponding relationship between the code submission record of the code to be tested and the version information of the mirror image. Here, the code management tool of the component to be tested may manage the code branches of the component to be tested and the code submission records of each branch, and thus, based on the branch information of the code to be tested, the latest code submission record of the code to be tested may be acquired from the code management tool of the component to be tested. The corresponding relation between the latest code submission record of the code to be tested and the version information of the mirror image can be recorded by the continuous integration tool after the mirror image construction is completed each time, or can be recorded by the testing platform based on the latest code submission record corresponding to the branch information of the code to be tested returned by the continuous integration tool and the version information of the mirror image to be tested matched with the latest code submission record after the continuous integration tool is triggered to carry out the mirror image construction each time.
In some embodiments, in the case that the version information of the mirror image matching the version information of the code to be tested exists in the corresponding relationship after being queried in step S402, determining the version information of the mirror image as the version information of the mirror image to be tested may include: and under the condition that the version information of the mirror image matched with the latest code submission record of the code to be tested exists in the corresponding relation, determining the version information of the mirror image as the version information of the mirror image to be tested.
The testing method provided by the embodiment of the application queries the corresponding relation between the version information of the code to be tested and the version information of the mirror image based on the version information of the code to be tested of the component to be tested, and determines the version information of the mirror image as the version information of the mirror image to be tested under the condition that the version information of the mirror image matched with the version information of the code to be tested exists in the queried corresponding relation. Therefore, repeated mirror image construction operation can be reduced, the testing efficiency is improved, and the storage space of a mirror image warehouse can be saved.
The embodiment of the application can be applied to the technical field of computers and can be used for testing product components which can be deployed by adopting mirror images. For example, in a scene that an automated test is required, the test method provided by the embodiment of the present application may be used to perform full-process automated test from component development to test, automatic deployment from component development to test environment, automatic generation of component mirror images, development of continuous integration related tasks of a test platform, and the like.
The embodiment of the application provides a testing method, which is executed by a testing platform and can perform full-process automatic testing of automatic mirror image packaging, deployment, testing and result collection on a component to be tested. Tasks needing to be triggered in the full-process automatic test in the continuous integration process can be configured on the test platform, and the tasks can include reinstalling an operating system, deploying basic components, automatically constructing and deploying a mirror image for the components to be tested, executing test tasks, sending test reports and the like.
Fig. 5A shows a schematic implementation flow diagram of a testing method provided in an embodiment of the present application, and as shown in fig. 5A, the method includes the following steps S501 to S506:
step S501, the test server is triggered to reinstall the system.
Step S502, triggering the test server to deploy the basic components required by the test.
Step S503, triggering the continuous integration tool to construct a mirror image of the component to be tested, and triggering the test server to deploy the component to be tested based on the mirror image.
Here, the stage of compiling, packaging and calling back the callback function of the test platform by the component can be added in the GitLab-ci.yml file configured by the code management tool GitLab project of the component to be tested. The GitLab is integrated with a continuous integration tool GitLab CI in a plug-in mode, when the execution of the test method is triggered on the test platform, the GitLab CI plug-in can be automatically triggered to carry out mirror image construction (including code compiling and packing) on the components to be tested, a mirror image of the codes to be tested of the components to be tested is generated, and the mirror image is pushed to a mirror image warehouse.
The test platform records the version number of the component to be tested which needs to be subjected to the mirror image construction and the version number of the mirror image generated by the mirror image construction in the result of the callback function received, and can also include a mirror image application scene and the like. In some embodiments, before triggering the GitLab CI plug-in to perform the mirror image construction on the component to be tested, the testing platform compares whether the version number of the code to be tested of the current component to be tested is changed from the last mirror image construction, if not, the last recorded version number of the mirror image of the component to be tested is directly used for deploying the component to be tested, and if so, the GitLab CI plug-in is triggered to perform the mirror image construction and push the constructed mirror image to the mirror image warehouse. In some embodiments, when the test platform triggers the GitLab CI plugin to perform the image construction on the component to be tested, the GitLab CI plugin compares whether the version number of the code to be tested of the current component to be tested is changed from the last image construction, if not, the callback function of the test platform is directly called to return the version number of the image of the component to be tested recorded last time, if so, the image construction is executed, the constructed image is pushed to the image warehouse, and the callback function of the test platform is called to return the version number of the image constructed this time. And receiving the result of the callback function to obtain the version number of the mirror image matched with the current code submission record. Therefore, repeated compiling, packaging and mirroring operations can be reduced, the storage space of a mirror warehouse is saved, and meanwhile the time cost of testing can be reduced.
Referring to fig. 5B, the step S503 may include the steps of:
step S511, judging whether the version number of the mirror image corresponding to the current code submitting record (i.e. commit id) of the code branch to be tested of the component to be tested is recorded; if yes, go to step S512; if not, go to step S514;
step S512, judging whether the version number of the recorded mirror image is the same as the version number of the mirror image recorded in the version information of the component to be tested used in the production environment; if yes, go to step S518; if not, go to step S513;
here, the version number of the currently locally stored image to be tested is by default the version number of the image recorded in the version information of the component to be tested used in the production environment.
Step S513, updating the version number of the locally stored mirror to be tested into the version number of the recorded mirror; entering step S518;
step S514, obtaining the current code submission record of the to-be-tested code branch of the to-be-tested component;
step S515, judging whether the current code submitting record is the same as the code submitting record corresponding to the version number of the mirror image of the component to be tested used in the production environment; if yes, go to step S512; if not, go to step S516;
step S516, triggering a continuous integration tool to submit a record based on the current code, and carrying out mirror image construction on the component to be tested;
step S517, receiving the result of the callback function, and obtaining the version number of the mirror image matched with the current code submission record; proceed to step S513;
and S518, triggering the test server to deploy the component to be tested based on the locally stored version number of the mirror image to be tested.
It should be noted that, the logic for determining the version number of the image to be tested, which needs to be deployed by the testing server in steps S511 to S515 may be executed by the testing platform, or may be executed by the persistent integration tool, which is not limited herein.
When the test platform triggers the GitLab CI plug-in to deploy the components to be tested, whether the mirror image generated by automatic packaging is used for deployment or not can be determined based on the configuration information of the components to be tested. And under the condition of deployment by using the mirror image generated by automatic packaging, the deployed code version of the component to be tested is the latest code version in the test server. And under the condition that the mirror image generated by automatic packaging is not used for deployment, the version number of the mirror image recorded in the version information of the component to be tested used in the production environment is used for deploying the component to be tested. In the version information of the components to be tested used in the production environment, the version number of the corresponding image is specified, and the test server can acquire the image of the components to be tested from the image warehouse based on the version number of the image. Thus, the version test of the components used in the production environment and the version test of the components under development can be supported more flexibly. In implementation, the mirror image generated by automatic packaging is not used for deployment when the to-be-tested component is deployed by default, namely the version number of the mirror image recorded in the version information of the to-be-tested component used in the production environment is used for deploying the to-be-tested component.
Under the condition that a plurality of components to be tested need to be subjected to mirror image construction in a development project, the mirror image construction of the plurality of components to be tested can be configured to be executed in parallel on a test platform, so that a continuous integration tool can be triggered to carry out mirror image construction on the plurality of components to be tested in parallel, the running time of the mirror image construction can be saved, and the test efficiency can be improved. Referring to fig. 5C, in the case that the component a, the component B, and the component C need to be mirror-constructed, the following steps may be performed:
step S521, triggering a continuous integration tool to perform mirror image construction;
step S522, the continuous integration tool adopts a parallel mode to respectively carry out mirror image construction on the component A, the component B and the component C;
step S523, in a case where the mirror image building of the component a, the component B, and the component C is completely completed, it is determined that the mirror image building of the persistent integration tool is completed.
The execution time of the whole process is the longest time length in the time lengths of the mirror image construction in the component A, the component B and the component C.
Step S504, the testing environment is checked to confirm that the component to be tested operates normally.
Here, the test environment may include an operating system, a base component, a component to be tested. After the deployment of the components to be tested is completed, it is necessary to confirm that the deployment of the operating system, the basic components and the components to be tested is normal, so that the components to be tested can be confirmed to operate normally. And after the component to be tested is confirmed to normally operate, executing the testing task. Therefore, whether the component to be tested is abnormal or not can be found in time, and the execution failure of the test case caused by the abnormal component deployment can be reduced.
Step S505, a test task is executed.
Here, the test case to be executed may be configured in the test task.
Step S506, the execution result of the test task is subjected to statistical analysis, and a test report is obtained and sent.
After the test task is executed, the test platform sends a mail to notify the relevant personnel of the project, and performs preliminary summary analysis on the test result, including the execution time of the test task, the total number of executed cases, the passing rate and the failure rate of the cases, and the like, so that the test personnel can conveniently master the test result in time. By comparing test reports of the same continuous integration task over a period of time, the quality of the development project can be monitored.
When two modules (modules may include at least one component) of M1 and M2 in a test environment need to be tested simultaneously, after a test case related to the M1 module is executed, in order to avoid the influence of historical test data on the test result of the M2 module, the test environment needs to be cleaned, including stopping services related to the M1 module, deleting temporary data or intermediate data in a storage volume, and the like. Referring to fig. 6, when testing two modules, M1 and M2, the following steps may be included:
step S601, triggering the test server to reinstall the system.
Step S602, triggering the test server to deploy the basic components required by the test.
Step S603, triggering the persistent integration tool to perform image construction on the M1 module, and triggering the test server to deploy the components in the M1 module based on the image.
In step S604, the test environment is checked to confirm that the components in the M1 module are operating normally.
In step S605, the test task of the M1 module is executed.
Step S606, cleaning the test environment.
Step S607, triggering the persistent integration tool to perform image construction on the M2 module, and triggering the test server to deploy the components in the M2 module based on the image.
In step S608, the test environment is checked to confirm that the components in the M2 module are operating normally.
In step S609, a test task of the M2 module is executed.
Step S610, performing statistical analysis on the execution result of the test task of the M1 module and the execution result of the test task of the M2 module, and obtaining and sending a test report.
The test method provided by the embodiment of the application has at least the following beneficial effects: 1) automatically realizing an automatic test method of a full flow including mirror image construction, test environment deployment and test task execution for a to-be-tested code of a to-be-tested assembly; 2) when automatic mirror image construction is carried out, the times of automatic mirror image construction are reduced by comparing whether the latest submission record of the code to be tested of the component to be tested corresponds to the version information of the mirror image constructed in the recorded historical test process, so that the time cost of the test and the storage space cost of a mirror image warehouse can be saved; 3) when a plurality of components to be tested need to be subjected to automatic mirror image construction, the time for constructing the mirror image in the whole testing process can be reduced through parallel operation; 4) when a plurality of modules are tested in the same test environment, the test environment is cleared after the test task of one module is executed by optimizing the whole-flow task process, and then the test tasks of other modules are executed, so that the influence of historical test data on the test result can be reduced.
Fig. 7 is a schematic structural diagram of a testing apparatus according to an embodiment of the present application, and as shown in fig. 7, a testing apparatus 700 includes: a build module 710, a deployment module 720, and a first test module 730, wherein:
the constructing module 710 is configured to trigger a continuous integration tool of a to-be-tested component to perform mirror image construction on the to-be-tested component based on version information of a to-be-tested code of the to-be-tested component, so as to obtain version information of a to-be-tested mirror image matched with the version information of the to-be-tested code; wherein the images built by the continuous integration tool are stored in an image warehouse;
the deployment module 720 is configured to trigger the test server to deploy the test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse;
the first testing module 730 is configured to execute a set testing task to obtain a testing result of the component to be tested, when the test environment is successfully deployed.
In some embodiments, the apparatus further comprises: the analysis module is used for analyzing the test result of the component to be tested to obtain the execution result statistical information of the test task; and the sending module is used for generating and sending a test report of the component to be tested based on the execution result statistical information of the test task.
In some embodiments, the number of components to be tested is plural, and the building module is further configured to: triggering a continuous integration tool of a plurality of components to be tested to respectively carry out mirror image construction on the plurality of components to be tested by adopting a parallel mode based on the version information of the codes to be tested of the plurality of components to be tested to obtain the version information of the mirror images to be tested, which is matched with the version information of the codes to be tested of each component to be tested.
In some embodiments, the deployment module is further to: based on the version information of the mirror image to be tested, triggering a test server to execute the following operations: acquiring version information of an operating system and version information of a basic component which are matched with the version information of the mirror image to be tested; wherein the basic component is a component on which the component to be tested depends during operation; based on the version information of the operating system, reinstalling the operating system; deploying the base component in the operating system based on the version information of the base component; and acquiring the mirror to be tested matched with the version information of the mirror to be tested from the mirror warehouse based on the version information of the mirror to be tested, and deploying the component to be tested in the operating system by using the mirror to be tested.
In some embodiments, the components to be tested include a first component to be tested, the apparatus further comprising: the first acquisition module is used for acquiring the test requirement of the second component to be tested; the cleaning module is used for triggering the test server to clean the test data of the component to be tested in the test environment in response to the condition that the operating system and the basic component which are depended on by the second component and the first component are the same; and the second testing module is used for completing the testing of the second component based on the version information of the code to be tested of the second component.
In some embodiments, the build module is further to: inquiring the corresponding relation between the version information of the code to be tested and the version information of the mirror image based on the version information of the code to be tested of the component to be tested; under the condition that the version information of the mirror image matched with the version information of the code to be tested does not exist in the corresponding relation, triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the version information of the code to be tested to obtain the version information of the mirror image to be tested matched with the version information of the code to be tested; and/or determining the version information of the mirror image as the version information of the mirror image to be tested under the condition that the version information of the mirror image matched with the version information of the code to be tested exists in the corresponding relation.
In some embodiments, the version information of the code to be tested includes branch information of the code to be tested, and the construction module is further configured to: and triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the branch information of the code to be tested, and obtaining a latest code submission record corresponding to the branch information of the code to be tested and version information of the mirror image to be tested matched with the latest code submission record.
In some embodiments, the version information of the code to be tested further includes a code submission record of the code to be tested, and the apparatus further includes: the second acquisition module is used for acquiring the latest code submission record of the code to be tested from the code management tool of the component to be tested based on the branch information of the code to be tested; the building module is further configured to: and inquiring the corresponding relation between the code submission record of the code to be tested and the mirrored version information based on the latest code submission record of the code to be tested.
In some embodiments, the build module is further to: and under the condition that the version information of the mirror image matched with the latest code submission record of the code to be tested exists in the corresponding relation, determining the version information of the mirror image as the version information of the mirror image to be tested.
In some embodiments, the build module is further to: and under the condition that the automatic mirror image construction function is determined to be started based on the configuration information of the to-be-tested component, triggering a continuous integration tool of the to-be-tested component to carry out mirror image construction on the to-be-tested component based on the version information of the to-be-tested code of the to-be-tested component, and obtaining the version information of the to-be-tested mirror image matched with the version information of the to-be-tested code.
In some embodiments, the build module is further to: and under the condition that the automatic mirror image construction function is not started based on the configuration information, acquiring the version information of the mirror image used by the component to be tested in the production environment, and determining the version information of the mirror image as the version information of the mirror image to be tested.
The above description of the apparatus embodiments, similar to the above description of the method embodiments, has similar beneficial effects as the method embodiments. For technical details not disclosed in the embodiments of the apparatus of the present application, reference is made to the description of the embodiments of the method of the present application for understanding.
It should be noted that, in the embodiment of the present application, if the testing method is implemented in the form of a software functional module and sold or used as a standalone product, the testing method may also be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially implemented or a part contributing to the related art may be embodied in the form of a software product stored in a storage medium, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a magnetic disk, or an optical disk. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
Correspondingly, the embodiment of the present application provides a testing device, which includes a memory and a processor, where the memory stores a computer program that can be run on the processor, and the processor implements the steps in the above method when executing the program.
Correspondingly, the embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program realizes the steps of the above method when being executed by a processor.
Accordingly, embodiments of the present application provide a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, the computer program implements some or all of the steps of the above method. The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
Correspondingly, the embodiment of the present application provides a computer program, which includes computer readable code, and when the computer readable code is run in a computer device, a processor in the display device executes some or all of the steps for implementing the method.
Here, it should be noted that: the above description of the storage medium, the computer program product and the test device embodiments is similar to the description of the method embodiments described above, with similar advantageous effects as the method embodiments. For technical details not disclosed in the embodiments of the storage medium, the computer program product and the device of the present application, reference is made to the description of the embodiments of the method of the present application for understanding.
It should be noted that fig. 8 is a schematic diagram of a hardware entity of a testing apparatus in an embodiment of the present application, and as shown in fig. 8, the hardware entity of the testing apparatus 800 includes: a processor 801, a communication interface 802, and a memory 803, wherein:
the processor 801 generally controls the overall operation of the computer device 800.
The communication interface 802 may enable the computer device to communicate with other terminals or servers via a network.
The Memory 803 is configured to store instructions and applications executable by the processor 801, and may also buffer data (e.g., image data, audio data, voice communication data, and video communication data) to be processed or already processed by the processor 801 and modules in the computer apparatus 800, and may be implemented by a FLASH Memory (FLASH) or a Random Access Memory (RAM).
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in the various embodiments of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
It should be noted that, in this document, 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 like elements in a process, method, article, or apparatus that comprises the element.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
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; can be located in one place or 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, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be 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.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as a removable Memory device, a Read Only Memory (ROM), a magnetic disk, or an optical disk.
Alternatively, the integrated units described above in the present application may be stored in a computer-readable storage medium if they are implemented in the form of software functional modules and sold or used as independent products. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a removable storage device, a ROM, a magnetic or optical disk, or other various media that can store program code.
The above description is only for the 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 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 (14)

1. A method of testing, the method comprising:
triggering a continuous integration tool of the component to be tested to construct a mirror image of the component to be tested based on the version information of the code to be tested of the component to be tested, and obtaining the version information of the mirror image to be tested, which is matched with the version information of the code to be tested; wherein the images built by the continuous integration tool are stored in an image warehouse;
triggering a test server to deploy a test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse;
and executing a set test task under the condition that the test environment is successfully deployed to obtain a test result of the component to be tested.
2. The method of claim 1, further comprising:
analyzing the test result of the component to be tested to obtain the execution result statistical information of the test task;
and generating and sending a test report of the component to be tested based on the execution result statistical information of the test task.
3. The method according to claim 1 or 2, wherein the number of the components to be tested is multiple, and the triggering of the continuous integration tool of the components to be tested to perform image construction on the components to be tested based on the version information of the codes to be tested of the components to be tested to obtain the version information of the images to be tested, which matches the version information of the codes to be tested, comprises:
triggering a continuous integration tool of a plurality of components to be tested to respectively carry out mirror image construction on the plurality of components to be tested by adopting a parallel mode based on the version information of the codes to be tested of the plurality of components to be tested to obtain the version information of the mirror images to be tested, which is matched with the version information of the codes to be tested of each component to be tested.
4. The method according to any one of claims 1 to 3, wherein the triggering a test server to deploy a test environment of the component to be tested based on the version information of the image to be tested comprises:
based on the version information of the mirror image to be tested, triggering a test server to execute the following operations:
acquiring version information of an operating system and version information of a basic component which are matched with the version information of the mirror image to be tested; wherein the basic component is a component on which the component to be tested depends during operation;
based on the version information of the operating system, reinstalling the operating system;
deploying the base component in the operating system based on the version information of the base component;
and acquiring the mirror to be tested matched with the version information of the mirror to be tested from the mirror warehouse based on the version information of the mirror to be tested, and deploying the component to be tested in the operating system by using the mirror to be tested.
5. The method of claim 4, wherein the component to be tested comprises a first component to be tested, and after the performing the set testing task and obtaining the testing result of the component to be tested, the method further comprises:
acquiring a test requirement of a second component to be tested;
triggering the test server to clean test data of the component to be tested in the test environment in response to the condition that the operating system and the basic component on which the second component and the first component depend are the same;
and completing the test of the second component based on the version information of the code to be tested of the second component.
6. The method according to any one of claims 1 to 5, wherein the triggering, based on the version information of the code to be tested of the component to be tested, the persistent integration tool of the component to be tested to perform image construction on the component to be tested, so as to obtain the version information of the image to be tested, which matches the version information of the code to be tested, includes:
inquiring the corresponding relation between the version information of the code to be tested and the version information of the mirror image based on the version information of the code to be tested of the component to be tested;
under the condition that the version information of the mirror image matched with the version information of the code to be tested does not exist in the corresponding relation, triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the version information of the code to be tested to obtain the version information of the mirror image to be tested matched with the version information of the code to be tested; and/or the presence of a gas in the gas,
and determining the version information of the mirror image as the version information of the mirror image to be tested under the condition that the version information of the mirror image matched with the version information of the code to be tested exists in the corresponding relation.
7. The method of claim 6, wherein the version information of the code to be tested includes branch information of the code to be tested, and the triggering of the persistent integration tool of the component to be tested to perform image construction on the component to be tested based on the version information of the code to be tested to obtain version information of an image to be tested, which matches the version information of the code to be tested, includes:
and triggering a continuous integration tool of the component to be tested to carry out mirror image construction on the component to be tested based on the branch information of the code to be tested, and obtaining a latest code submission record corresponding to the branch information of the code to be tested and version information of the mirror image to be tested matched with the latest code submission record.
8. The method of claim 7, wherein the version information of the code to be tested further comprises a code submission record of the code to be tested, the method further comprising:
acquiring a latest code submission record of the code to be tested from a code management tool of the component to be tested based on the branch information of the code to be tested;
the querying the corresponding relation between the version information of the code to be tested and the version information of the mirror image based on the version information of the code to be tested of the component to be tested comprises the following steps:
and inquiring the corresponding relation between the code submission record of the code to be tested and the mirrored version information based on the latest code submission record of the code to be tested.
9. The method according to claim 8, wherein in the case that the version information of the mirror image matching the version information of the code to be tested exists in the corresponding relationship, determining the version information of the mirror image as the version information of the mirror image to be tested comprises:
and under the condition that the version information of the mirror image matched with the latest code submission record of the code to be tested exists in the corresponding relation, determining the version information of the mirror image as the version information of the mirror image to be tested.
10. The method according to any one of claims 1 to 9, wherein the triggering of the persistent integration tool of the component to be tested to perform image construction on the component to be tested based on the version information of the code to be tested of the component to be tested to obtain the version information of the image to be tested, which matches with the version information of the code to be tested, includes one of:
under the condition that an automatic mirror image construction function is determined to be started based on the configuration information of the to-be-tested component, triggering a continuous integration tool of the to-be-tested component to carry out mirror image construction on the to-be-tested component based on the version information of the to-be-tested code of the to-be-tested component, and obtaining the version information of the to-be-tested mirror image matched with the version information of the to-be-tested code;
and under the condition that the automatic mirror image construction function is not started based on the configuration information, acquiring the version information of the mirror image used by the component to be tested in the production environment, and determining the version information of the mirror image as the version information of the mirror image to be tested.
11. A test apparatus, comprising:
the system comprises a construction module, a test module and a control module, wherein the construction module is used for triggering a continuous integration tool of a to-be-tested component to carry out mirror image construction on the to-be-tested component based on version information of a to-be-tested code of the to-be-tested component to obtain version information of the to-be-tested mirror image matched with the version information of the to-be-tested code; wherein the images built by the continuous integration tool are stored in an image warehouse;
the deployment module is used for triggering the test server to deploy the test environment of the component to be tested based on the version information of the mirror image to be tested; the testing environment is deployed based on the to-be-tested mirror image matched with the version information of the to-be-tested mirror image in the mirror image warehouse;
and the first testing module is used for executing a set testing task under the condition that the test environment is successfully deployed to obtain a testing result of the component to be tested.
12. A test apparatus comprising a memory and a processor, the memory storing a computer program operable on the processor, wherein the processor implements the steps of the method of any one of claims 1 to 10 when executing the program.
13. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 10.
14. A computer program product comprising a non-transitory computer readable storage medium storing a computer program which, when read and executed by a computer, implements the steps of the method of any one of claims 1 to 10.
CN202110696122.9A 2021-06-23 2021-06-23 Test method, device, equipment, storage medium and program product Withdrawn CN113407451A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110696122.9A CN113407451A (en) 2021-06-23 2021-06-23 Test method, device, equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110696122.9A CN113407451A (en) 2021-06-23 2021-06-23 Test method, device, equipment, storage medium and program product

Publications (1)

Publication Number Publication Date
CN113407451A true CN113407451A (en) 2021-09-17

Family

ID=77682635

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110696122.9A Withdrawn CN113407451A (en) 2021-06-23 2021-06-23 Test method, device, equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN113407451A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113933627A (en) * 2021-10-08 2022-01-14 网易有道信息技术(北京)有限公司 Method for automatically testing and verifying electronic product and related product

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113933627A (en) * 2021-10-08 2022-01-14 网易有道信息技术(北京)有限公司 Method for automatically testing and verifying electronic product and related product

Similar Documents

Publication Publication Date Title
CN109358858B (en) Automatic deployment method, device, medium and electronic equipment
CN105094783B (en) method and device for testing stability of android application
US8938406B2 (en) Constructing a bayesian network based on received events associated with network entities
US20090006493A1 (en) Method For Enabling Traceability And Recovery From Errors During Migration Of Software Applications
EP3192024A1 (en) Automated tenant upgrades for multi-tenant services
CN113778486A (en) Containerization processing method, device, medium and equipment for code pipeline
US10372572B1 (en) Prediction model testing framework
US7506212B2 (en) Distributed exception handling testing
CN111061498A (en) Configuration information management system
WO2019005294A1 (en) Recovery of application from error
CN112966056B (en) Information processing method, device, equipment, system and readable storage medium
CN113407451A (en) Test method, device, equipment, storage medium and program product
CN111190791A (en) Application exception reporting method and device and electronic equipment
CN113760617A (en) Fault processing method and device, equipment and storage medium
CN110532305B (en) Service data cutting-over method and system
CN112817869A (en) Test method, test device, test medium, and electronic apparatus
CN113238849A (en) Timed task processing method and device, storage medium and electronic equipment
CN108595323A (en) A kind of system detection method and relevant apparatus
JP2007241873A (en) Program for monitoring change in computer resource on network
CN116010244A (en) Automatic test method, device, electronic equipment and storage medium
US9354962B1 (en) Memory dump file collection and analysis using analysis server and cloud knowledge base
CN112596750B (en) Application testing method and device, electronic equipment and computer readable storage medium
CN109814911A (en) Method, apparatus, computer equipment and storage medium for Manage Scripts program
CN113656210A (en) Processing method and device for error reporting information, server and readable storage medium
CN111291101A (en) Cluster management method and system

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20210917

WW01 Invention patent application withdrawn after publication