CN112667491B - Function test method and device for virtual machine - Google Patents

Function test method and device for virtual machine Download PDF

Info

Publication number
CN112667491B
CN112667491B CN201910982727.7A CN201910982727A CN112667491B CN 112667491 B CN112667491 B CN 112667491B CN 201910982727 A CN201910982727 A CN 201910982727A CN 112667491 B CN112667491 B CN 112667491B
Authority
CN
China
Prior art keywords
target
test
component
function
virtual
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.)
Active
Application number
CN201910982727.7A
Other languages
Chinese (zh)
Other versions
CN112667491A (en
Inventor
蒋艳军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910982727.7A priority Critical patent/CN112667491B/en
Publication of CN112667491A publication Critical patent/CN112667491A/en
Application granted granted Critical
Publication of CN112667491B publication Critical patent/CN112667491B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention discloses a function test method and device of a virtual machine. The function test method of the virtual machine comprises the following steps: when a virtual machine is updated, at least two virtual components related to a target function in the virtual machine are acquired; determining a change component in the at least two virtual components; testing the change component; and after the test of the change component passes, carrying out integrated test on the at least two virtual components to realize the test of the target function. The embodiment of the invention can improve the testing efficiency of the virtual machine function test.

Description

Function test method and device for virtual machine
Technical Field
The invention relates to the technical field of computers, in particular to a function test method and device of a virtual machine.
Background
Prior art virtual machine functional testing typically involves manually performing an integrated test on a plurality of interdependent virtual components. Specifically, a test plan and a test case are formulated according to a demand function, a plurality of virtual components are sequentially deployed into a manually created test environment, a manual integrated test is performed on the plurality of virtual components according to the test plan and the test case, and after the integrated test is completed, the plurality of virtual components are manually packaged and deployed.
The functional test directly performs integrated test on the plurality of virtual components, so that the error rate of the virtual components in the integrated test is higher, the passing rate of the integrated test is lower, the error virtual components are required to be redeployed into a test environment for the integrated test after being modified by a developer, the efficiency of the functional test is low, and in addition, the integrated test of the plurality of virtual components is a manual test, so that the test efficiency is further reduced.
Disclosure of Invention
The invention provides a function test method and device for a virtual machine, which can improve the test efficiency of the function test of the virtual machine.
In a first aspect, the present invention provides a method for testing functions of a virtual machine, where the method for testing functions of a virtual machine includes:
when a virtual machine is updated, at least two virtual components related to a target function in the virtual machine are acquired;
determining a change component in the at least two virtual components;
testing the change component;
and after the test of the change component passes, carrying out integrated test on the at least two virtual components to realize the test of the target function.
In some embodiments of the present invention, the determining a change component in the at least two virtual components specifically includes:
If the target function is a newly added function, each virtual component in the at least two virtual components is used as the change component;
and if the target function is a repaired function, taking the repaired virtual component in the at least two virtual components as the changed component.
In some embodiments of the present invention, the testing the modification component specifically includes:
taking each component in the change components as a target component, and detecting whether the type of the target component is a preset component type or not;
if yes, testing the target assembly;
if not, feeding the target component back to the target terminal.
In some embodiments of the present invention, the performing an integration test on the at least two virtual components specifically includes:
deploying the at least two virtual components;
acquiring a test case set corresponding to the target function;
and carrying out integrated test on the deployed virtual components according to the test case set.
In some embodiments of the present invention, the deploying the at least two virtual components specifically includes:
acquiring a test environment of the target function;
and deploying the at least two virtual components into the test environment in sequence according to the pre-configured dependency relationship of the at least two virtual components.
In some embodiments of the present invention, the test environment for obtaining the target function specifically includes:
detecting whether the test environment with the target function exists in the currently created test environment;
if yes, acquiring the test environment of the target function from the currently created test environment;
if not, creating a test environment of the target function.
In some embodiments of the invention, the method further comprises:
detecting whether the integrated test passes or not;
if yes, archiving the test case set, and destroying the test environment of the target function;
if not, the testing environment of the target function is reserved, and the target component is fed back to the target terminal.
In some embodiments of the present invention, the detecting whether the integrated test passes or not specifically includes:
detecting whether the passing rate of the test cases in the test case set is larger than a preset threshold value;
if yes, judging that the integrated test is passed;
if not, judging that the integrated test is not passed.
In some embodiments of the invention, the method further comprises:
and after the integrated test is passed, merging the at least two virtual components, setting a label for the merged virtual component, packaging the merged virtual component and publishing.
In a second aspect, the present invention provides a function test device for a virtual machine, the function test device for a virtual machine including:
the acquisition module is used for acquiring at least two virtual components related to a target function in the virtual machine when the virtual machine is updated;
the determining module is used for determining a change component in the at least two virtual components;
the testing module is used for testing the change assembly; the method comprises the steps of,
and the integrated test module is used for carrying out integrated test on the at least two virtual components after the test of the change component is passed, so as to realize the test of the target function.
When the virtual machine is updated, at least two virtual components related to target functions in the virtual machine are obtained, and changed components in the at least two virtual components are determined, so that the changed components are tested first, the error rate of the changed components is reduced, after the changed components pass the test, the at least two virtual components are combined and then subjected to the integrated test, the test passing rate of the integrated test is improved, the integrated test is an automatic test, and the test efficiency of the functional test is effectively improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of a scenario of a functional test system of a virtual machine according to an embodiment of the present invention;
FIG. 2 is a flow chart of an embodiment of a method for testing functions of a virtual machine according to the present invention;
FIG. 3 is an interface diagram of a virtual machine functional test in an embodiment of the present invention;
FIG. 4 is a flowchart illustrating another embodiment of a method for testing functions of a virtual machine according to an embodiment of the present invention;
FIG. 5 is a block diagram of a virtual machine functional test in an embodiment of the invention;
FIG. 6 is a schematic structural diagram of one embodiment of a function test device for a virtual machine according to the present invention;
fig. 7 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
In the description that follows, embodiments of the invention will be described with reference to steps and symbols performed by one or more computers, unless otherwise indicated. Thus, these steps and operations will be referred to in several instances as being performed by a computer, which as referred to herein performs operations that include processing units by the computer that represent electronic signals that represent data in a structured form. This operation transforms the data or maintains it in place in the computer's memory system, which may reconfigure or otherwise alter the computer's operation in a manner well known to those skilled in the art. The data structure maintained by the data is the physical location of the memory, which has specific characteristics defined by the data format. However, the principles of the present invention are described in the foregoing text and are not meant to be limiting, and one skilled in the art will recognize that various steps and operations described below may also be implemented in hardware.
The term "module" or "unit" as used herein may be considered a software object executing on the computing system. The various components, modules, engines, and services described herein may be viewed as implementing objects on the computing system. The apparatus and methods described herein are preferably implemented in software, but may of course also be implemented in hardware, all within the scope of the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
The embodiment of the invention provides a function test method and device of a virtual machine.
Referring to fig. 1, fig. 1 is a schematic view of a scenario of a function test system of a virtual machine according to an embodiment of the present invention, where the function test system of a virtual machine may include a terminal 100 and a server 200, the terminal 100 and the server 200 are connected through a network, a function test device of the virtual machine is integrated in the server 200, the server 200 may provide virtual machines with different configuration types, and the terminal 100 may access the server 200. The server 200 in the embodiment of the present invention is mainly used for acquiring at least two virtual components related to a target function in a virtual machine when the virtual machine is updated; determining a change component in the at least two virtual components; testing the change component; after the change component passes the test, merging the at least two virtual components; and carrying out integrated test on the combined virtual components to realize the test of the target function.
In the embodiment of the present invention, the server 200 may be an independent server, or may be a server network or a server cluster formed by servers, for example, the server 200 described in the embodiment of the present invention includes, but is not limited to, a computer, a network host, a single network server, a plurality of network server sets, or a cloud server formed by a plurality of servers. Wherein the Cloud server is composed of a large number of computers or web servers based on Cloud Computing (Cloud Computing). In embodiments of the present invention, communication between the server and the client may be accomplished by any means of communication, including, but not limited to, mobile communication based on the third generation partnership project (3rd Generation Partnership Project,3GPP), long term evolution (Long Term Evolution, LTE), worldwide interoperability for microwave access (Worldwide Interoperability for Microwave Access, wiMAX), or computer network communication based on the TCP/IP protocol family (TCP/IP Protocol Suite, TCP/IP), user datagram protocol (User Datagram Protocol, UDP), etc.
It is understood that the terminal 100 used in the embodiments of the present application may be understood as a client device including both receiving and transmitting hardware devices, i.e., devices having receiving and transmitting hardware capable of performing two-way communication over a two-way communication link. Such a client device may include: a cellular or other communication device having a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The terminal 100 may be a desktop terminal or a mobile terminal, and the mobile terminal may be one of a mobile phone, a tablet computer, a notebook computer, and the like.
It will be understood by those skilled in the art that the application environment shown in fig. 1 is merely an application scenario of the present application, and is not limited to the application scenario of the present application, and other application environments may further include more or fewer servers than those shown in fig. 1, or a server network connection relationship, for example, only 1 server and 1 terminal are shown in fig. 1, and it is understood that the functional testing system of the virtual machine may further include one or more other servers, or/and one or more terminals connected to a server network, which is not limited herein specifically.
In addition, as shown in fig. 1, the function test system of the virtual machine may further include a memory 300, for storing data, such as an object database, where object data is stored, where the object data may include application templates (for example, various application templates such as an approval template and a card punching template), file data (for example, files in various formats such as a Word file, an Excel file and a PPT file), and various data such as picture data (for example, pictures in various formats such as jpg, png, bmp), and the object database may be divided into various types of data, for example, an application database, a file database, a picture database, and the like.
It should be noted that, the schematic view of the scenario of the functional testing system of the virtual machine shown in fig. 1 is only an example, and the functional testing system and scenario of the virtual machine described in the embodiments of the present invention are for more clearly describing the technical solution of the embodiments of the present invention, and do not constitute a limitation on the technical solution provided by the embodiments of the present invention, and as a person of ordinary skill in the art can know that, with the evolution of the functional testing system of the virtual machine and the appearance of a new service scenario, the technical solution provided by the embodiments of the present invention is equally applicable to similar technical problems.
The following describes in detail specific embodiments.
In the present embodiment, description will be made from the viewpoint of a function test device of a virtual machine, which may be integrated in the server 200 in particular.
The invention provides a function test method of a virtual machine, which comprises the following steps: when a virtual machine is updated, at least two virtual components related to a target function in the virtual machine are acquired; determining a change component in the at least two virtual components; testing the change component; after the change component passes the test, merging the at least two virtual components; and carrying out integrated test on the combined virtual components to realize the test of the target function.
Referring to fig. 2, a flowchart of an embodiment of a method for testing functions of a virtual machine according to an embodiment of the present invention is shown, where the method for testing functions of a virtual machine includes:
201. and when the virtual machine is updated, acquiring at least two virtual components related to the target function in the virtual machine.
In the embodiment of the invention, the server can be a cloud server (CVM, cloud Virtual Machine), and the CVM provides virtual machine service and is a scalable virtual computing resource provided by a cloud platform. The CVM provides a plurality of virtual machines with different configuration types and can be used for various scenes such as Web access, data caching, databases and the like. The CVM provides a visual management page, so that a developer can conveniently perform daily management of the server, such as application, refund, restarting and the like; and provides a variety of security measures including resource isolation, security enforcement, network security (e.g., against DDOS attacks), data security (e.g., FTP channels), and password security (e.g., HTTP proxy login), among others.
The virtual machine may provide a variety of component services, such as a network component service, an auto-scaling component service, a DES encryption component service, and the like. A component service corresponds to a function, which may involve multiple virtual components, which refer to at least two virtual components.
Virtual machine update refers to the update of functions in the virtual machine, which may include newly developed functions and repaired functions in the virtual machine. After a certain function is developed or repaired in the virtual machine, the function is taken as a target function, and a plurality of virtual components related to the target function are acquired.
202. And determining a change component in the at least two virtual components.
In this embodiment, the update of the target function may change all virtual components related to the target function, or may change only some virtual components related to the target function. For example, the target function is a newly developed function, that is, a newly added function, all virtual components related to the target function need to be developed, and thus all virtual components related to the target function are changed in this case; the target function is a repaired function, and a part of virtual components related to the target function are repaired, so that the repaired virtual components related to the target function are changed in this case.
Specifically, the determining, in step 202, a change component of the at least two virtual components specifically includes: if the target function is a newly added function, each virtual component in the at least two virtual components is used as the change component; and if the target function is a repaired function, taking the repaired virtual component in the at least two virtual components as the changed component. Wherein the change component is a virtual component of the change.
It should be noted that, the code for implementing the target function is divided into a trunk and at least one branch, the trunk constitutes a parent pipeline, and one branch constitutes a child pipeline. Each of the components of the change component may constitute a branch, i.e., a virtual component of the change constitutes a branch, different branches may be completed by different developers. For example, after a developer is assigned a task, a branch may be pulled from the backbone code and a change to the virtual component code may be implemented in the branch to obtain a changed virtual component. The trunk code and the branch code are uniformly managed by using a GIT, and the GIT is an open-source distributed version control system.
203. And testing the change component.
In this embodiment, after the developer submits the corresponding virtual component code to each branch, a change component is obtained, and then the change component is tested, where the test generally includes component type detection, component function test, and the like. Specifically, the testing the change component in step 203 specifically includes: taking each component in the change components as a target component, and detecting whether the type of the target component is a preset component type or not; if yes, testing the target assembly; if not, feeding the target component back to the target terminal.
The branch types comprise a measurement-free branch, a characteristic branch and a release branch, the naming format specification of the measurement-free branch is hotfix/xxxxx_xxx_xxx, the naming format specification of the characteristic branch is feature/xxxxx, and the naming format specification of the release branch is release/vx.x. Because the subsequent branches need to be merged into the trunk code, the trunk only allows the merging of the test-free branches and the tested release branches, and therefore, after the code is submitted, a plurality of characteristic branches can be merged into the release branches first and then are subjected to subsequent processing, namely, the types of the branches which are merged into the trunk code only comprise the test-free type and the release type.
The type of the target component submitted to the branch, i.e., the type constituting the branch, thus the component type of the target component allowed to be incorporated into the backbone code includes a exempt type and a release type, and thus the above-mentioned preset component type includes a exempt type and a release type. The name of the target component submitted to the branch constitutes the name of the branch, and the naming format specifications are different for different branch types, so that the component type of the target component can be determined by the name of the target component.
After the target component is developed on the branch, firstly detecting whether the name of the target component accords with the specification, namely judging whether the name of the target component is hotfix/xxxxxxxxxxxxx or release/vx.x, if yes, judging that the component type of the target component is a preset component type, and continuing the next test; if not, determining that the component type of the target component is not the preset component type, failing to execute the task, feeding back the target component to a target terminal, such as terminal 100 in fig. 1, so that the developer renames the target component until the name of the target component meets the specification. In addition, the names of all components in the change component need to be the same, i.e., the names of all branches are the same.
After determining that the branch where the target component is located can be merged into the backbone, a Merge Request (MR) is submitted to the backbone, and at this time, the automatic function test of the branch, that is, the automatic function test of the target component, is automatically triggered and started by the GIT webhook.
As shown in fig. 3, in 3 branches, after each branch triggers an automatic test, a branch name check is started first, the branch name is the name of a target component submitted on the branch, after the branch name check passes, the target component is tested, the test may include test 1 and test 2, such as a unit test, a static grammar test, etc., after the test passes, the pipeline can be started, and the automatic test of the branch is ended. The flow of the branch test can be displayed through an interface, and each time a step is completed, a 'V' is correspondingly displayed for a tester to check the progress of the flow. In this embodiment, before each branch is merged into the trunk, the target components in each branch are tested separately, so as to reduce the error rate of the changed components.
Since the subsequent processing can be continued after all target components under the target function are tested, the number of MRs is detected, that is, whether the number of MRs is the same as the number of branches is detected, if so, the number of MRs is detected, that is, all branches are submitted to MRs, that is, all change components are tested, and if not, the number of MRs is detected, that is, all branches are not submitted to MRs, and the number of MRs is waited for all target components to submit to MRs.
For example, 3 code libraries need to be repaired under the target function, 1 code library forms a target component, and a developer pulls 3 branches from the main code, and the names of the 3 branches are the same, namely, hotfix/fix_foo. The 3 branches are in one-to-one correspondence with the 3 code libraries, a developer submits each repaired code library to the corresponding branch, and after determining that the branches can be combined to the trunk, each code library is submitted with one MR, and each MR can trigger the functional test of the corresponding code library. After all 3 branches commit MRs, i.e. after 3 MRs are determined, the subsequent processing will continue.
204. And after the test of the change component passes, carrying out integrated test on the at least two virtual components to realize the test of the target function.
In this embodiment, after testing is completed on all branches, virtual components with inter-dependency relationships are deployed, where the virtual components with inter-dependency relationships generally include all virtual components related to a target function, and then integrated testing is performed on the inter-dependent virtual components, and after the integrated testing is completed, testing of the target function is achieved. Specifically, the performing the integration test on the at least two virtual components in step 204 specifically includes: deploying the at least two virtual components; acquiring a test case set corresponding to the target function; and carrying out integrated test on the deployed virtual components according to the test case set.
When the virtual components are deployed, the test environment of the target function is required to be deployed, and then all the virtual components related to the target function are deployed in the test environment. Specifically, the deploying the at least two virtual components specifically includes: acquiring a test environment of the target function; and deploying the at least two virtual components into the test environment in sequence according to the pre-configured dependency relationship of the at least two virtual components.
When the test environment of the target function is deployed, in order to improve the utilization rate of the test environment, it is first determined whether the test environment has been created by the target function. Specifically, the obtaining the test environment of the target function specifically includes: detecting whether the test environment with the target function exists in the currently created test environment; if yes, acquiring the test environment of the target function from the currently created test environment; if not, creating a test environment of the target function.
Because the names of all branches under the target function are the same, the test environment corresponding to the target function can be named by adopting the branch names. When detecting whether the current created test environment has the test environment with the target function or not, detecting whether the current created test environment has the test environment named by the branch name or not, if so, multiplexing the test environment, namely acquiring the test environment named by the branch name from the current created test environment, and taking the test environment named by the branch name as the test environment corresponding to the target function; if not, creating a test environment corresponding to the target function, and naming the test environment with a branch name.
After the test environment of the target function is obtained, the dependency relationship of the pre-configured virtual components can be obtained, and the interdependent virtual components are sequentially deployed into the test environment of the target function according to the sequence of the virtual components in the dependency relationship.
The embodiment can pre-package the management codes of the test environment, realize the automatic management and maintenance of the test environment with the target function, and improve the management efficiency of the test environment compared with the management and maintenance of the manual operation of the test environment in the prior art. In addition, in the prior art, the dependency relationship among the virtual components is manually maintained, and when the virtual components are deployed, the interdependent relationship among the components needs to be cleared, and the embodiment pre-formulates the interdependent virtual component code development specification, automatically completes the sequential deployment of the virtual components, effectively improves the deployment efficiency of the virtual components, and simultaneously reduces the error probability when in manual deployment.
After the interdependent virtual components are deployed, the interdependent virtual components are subjected to integrated test, and the target function is tested after the integrated test is completed. The integrated test can be realized by adopting automatic test cases, and the test case sets corresponding to various functions are stored in the GIT code warehouse, so that the test case set corresponding to the target function can be obtained from the GIT code warehouse. The automated test case completes automated testing by calling the interfaces provided by each virtual component. After the integrated test is completed, a test report can also be automatically generated.
In the prior art, test cases are designed according to the required functions in a test preparation stage, and in an integrated test stage, the target functions are manually tested according to the test cases, so that the test efficiency is reduced. The embodiment can realize the automatic execution of the test cases and automatically generate the test report, thereby effectively saving the test time and improving the test efficiency.
After the integrated test is performed on the interdependent virtual components, the passing condition of the integrated test is detected, so that subsequent processing is performed according to the passing condition of the test. Specifically, the method further comprises: detecting whether the combined virtual component passes a test or not; if yes, archiving the test case set, and destroying the test environment of the target function; if not, the testing environment of the target function is reserved, and the target component is fed back to the target terminal.
The passing condition of the integrated test can be detected according to the passing rate of the test case set. Specifically, the detecting whether the combined virtual component passes the test specifically includes: detecting whether the passing rate of the test cases in the test case set is larger than a preset threshold value; if yes, judging that the combined virtual component test passes; if not, judging that the combined virtual component test fails.
The test case set comprises a plurality of test cases, the interdependent virtual components are tested according to the plurality of test cases in sequence, the passing number of the test cases is detected, and the passing number of the test cases is divided by the total number of the test cases to be used as the passing rate of the test cases in the test case set. And comparing the passing rate with a preset threshold value, wherein the preset threshold value can be 90%, if the passing rate is greater than or equal to 90%, the passing rate indicates that the integrated test passes, and if the passing rate is lower than 90%, the passing rate indicates that the integrated test fails.
If the integration test fails, each component in the changed components is fed back to the corresponding target terminal, such as terminal 100 in fig. 1, so that the developer modifies the code of the corresponding component, and after the code is modified, the process returns to step 203 to test the corresponding component again, and the deployment and integration test of the interdependent virtual components are performed. In addition, when the integrated test fails, the test environment of the target function is reserved, namely the test environment of the target function is not destroyed, so that when the target function is retested, the test environment deployment virtual component of the target function is directly obtained, and the utilization rate of the test environment is improved.
If the integrated test passes, archiving the test case set, storing the test case set in a test case warehouse, and naming the test case set by the branch name under the target function so as to manage the automatic test case more normally and ensure that the test case is more stable and reliable. Meanwhile, the test environment of the target function is destroyed so as to recycle resources. In addition, the embodiment can complete automatic creation and automatic destruction of the test environment, and compared with manual creation and destruction in the prior art, the management efficiency of the test environment is effectively improved, and the error probability is reduced.
Further, the method further comprises: after the combined virtual components pass the test, a label is set for the change component, and the change component is packaged and issued.
After the integrated test is passed, a TAG (TAG) is automatically set for the change component to identify the change component, the change component is automatically submitted to the release platform, a one-key release order is automatically created, and after the one-key release order is approved, the one-key release order is automatically released to the current network environment. The embodiment is equivalent to manual labeling, manual packaging, manual creation of a one-key release sheet and manual release in the prior art, so that release time is effectively saved, release efficiency is improved, and error rate of manual operation is reduced.
As shown in FIG. 3, after each branch test is completed, the integrated test and package distribution can be started, and generally includes the steps of detecting the number of MRs, creating a deployment test environment, acquiring a test case set, integrating the test, merging into a backbone, marking a TAG, packaging, creating a one-key release sheet, releasing deployment and the like. The integrated test and package distributed flow can be displayed through an interface, and each time a step is completed, a 'V' is correspondingly displayed for a tester to check the flow progress.
In summary, when the virtual machine is updated, the embodiment of the application acquires at least two virtual components related to the target function in the virtual machine, and determines the changed component in the at least two virtual components, so as to test the changed component first, reduce the error rate of the changed component, and after the test of the changed component passes, combine the at least two virtual components and then perform the integrated test, thereby improving the test passing rate of the integrated test, and the integrated test is an automatic test, thereby effectively improving the test efficiency of the functional test.
The method for testing the function of the virtual machine in the embodiment of the application is described below with reference to a specific application scenario.
Referring to fig. 4, a flow chart of another embodiment of a method for testing functions of a virtual machine according to an embodiment of the present application is shown, where the method for testing functions of a virtual machine is applied to a server, and as shown in fig. 5, a QCI platform, a GIT code management platform, a cloud ware testing environment management platform, a QTA testing management platform, a package release platform, and a one-key release platform may be loaded in the server.
The QCI platform is a continuously integrated CI/continuously delivered CD platform which is built from the two aspects of flow series connection and data integration. QCI platforms provide Pipeline capability, which refers to the automated implementation of the process of software from the version control library to the user, which is the core engineering practice of continuous delivery with DevOps. The automation and continuous flow of the Pipeline assembly line can ensure the consistency and stability of product release at different stages and different nodes, and meanwhile, the artificial risk introduced by manual operation can be eliminated, the efficiency is improved, and waiting and waste are eliminated.
The GIT agent management platform is used for triggering QCI tasks by MR, acquiring the number of branches and the number of MR, merging the branches into a trunk and marking TAG.
The cloud ware test environment management platform is used for creating a CVM test environment, deploying the CVM test environment and destroying the CVM test environment.
The QTA test management platform is used for issuing and executing automatic test cases.
The packing release platform is used for packing the CVM component and deploying the CVM component.
The one-key release platform is used for creating one-key release sheets and releasing.
As shown in fig. 4, the function test method of the virtual machine includes:
401. whether the names of the CVM component branches are legal or not is detected, if yes, step 402 is executed, and if not, modification is fed back.
The CVM component is a changed virtual component, one CVM component corresponds to one branch, one branch forms a sub-pipeline, the name of the CVM component branch is the name of the CVM component, whether the name of the CVM component branch is hotfix/xxxxxxxxxxxx or release/vx.x is detected, if yes, the name of the CVM component branch is judged to be legal, if not, the name of the CVM component branch is judged to be illegal, the CVM component is fed back to a terminal corresponding to a developer, and the developer modifies the name of the CVM component. In addition, the branch names of the CVM components of the same batch need to be the same.
402. And automatically testing the CVM component branch.
Wherein, the automatic test comprises unit test, static grammar detection and the like.
403. It is detected whether the MR number is equal to the branch number, if yes, step 404 is executed, and if not, waiting is continued.
After completing automatic test, the CVM component branches submit MR, the MR triggers QCI tasks, and the GIT code management platform acquires and compares the branch number and the MR number. If the number of MR is equal to the number of branches, indicating that all CVM component branches have completed automated testing, and continuing to perform the next step; if the number of MRs is smaller than the number of branches, the fact that automatic testing is not completed by the branches of the CVM component is indicated, and waiting needs to be continued.
404. Whether a test environment corresponding to the branch name of the CVM component exists or not is detected, if not, step 405 is executed, and if yes, step 407 is executed.
And the cloud ware test environment management platform manages the test environment. If there is already a test environment named by the CVM component branch name in the currently created test environment, the test environment is directly acquired and the process goes to step 407.
405. A CVM test environment is created.
If the test environment named by the CVM component branch name does not exist in the currently created test environments, the cloud ware test environment management platform creates the test environment, and the test environment is named by the CVM component branch name. The cloud ware test environment management platform completes automatic creation of the CVM test environment, and improves the efficiency of test environment management.
406. The CVM component is deployed.
And the dependency relationship of the CVM component is managed through the cloud ware test environment management platform, so that sequential deployment of the CVM component is automatically completed, and the deployment efficiency of the CVM component is improved.
407. And executing the automatic test case.
The QTA test management platform issues test tasks, and extracts the automatic test cases from the GIT code warehouse so as to execute the automatic test cases in the CVM test environment, realize integrated test and generate an automatic test report.
408. And detecting whether the passing rate of the test case is greater than 90%, if so, executing a step 409, and otherwise, feeding back the modification.
If the passing rate of the test case is greater than 90%, the integrated test is indicated to pass, and the next step can be continued; if the passing rate of the test case is smaller than 90%, the fact that the integrated test is not passed is indicated, and the CVM component is fed back to a terminal corresponding to the developer, so that the developer can modify the CVM component.
409. The branches merge into the trunk.
After the integrated test passes, the GIT code management platform merges the CVM component branch codes into the backbone code.
410. And (5) marking TAG.
The GIT code management platform performs TAG on the combined components.
411. And (5) packaging.
And automatically submitting the combined components to a packaging and publishing platform, such as a cloud packaging and publishing platform, so that the packaging and publishing platform packages the combined components.
412. A one-touch release sheet is created.
And automatically submitting the packaged components to a one-key release platform, such as a star cloud one-key release platform, so that the one-key release platform creates a one-key release list, and automatically releasing the one-key release list to the current network environment after the one-key release list passes approval.
413. Destroying the test environment.
The cloud ware test environment management platform destroys the CVM test environment so as to recycle resources.
According to the CVM distribution and deployment efficiency is effectively improved by connecting CVM component branch automatic test and branch trunk integrated test automation in series through pipeline capability provided by the QCI platform.
In order to facilitate better implementation of the function test method of the virtual machine provided by the embodiment of the invention, the embodiment of the invention also provides a device of the function test method of the virtual machine. The meaning of the nouns is the same as that in the function test method of the virtual machine, and specific implementation details can be referred to the description in the method embodiment.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a function test device of a virtual machine according to an embodiment of the present invention, where the function test device 700 of a virtual machine may include:
an obtaining module 601, configured to obtain at least two virtual components related to a target function in a virtual machine when the virtual machine is updated;
a determining module 602, configured to determine a change component in the at least two virtual components;
a testing module 603, configured to test the change component; the method comprises the steps of,
and the integrated test module 604 is configured to perform integrated test on the at least two virtual components after the test of the changed component passes, so as to implement the test of the target function.
In some embodiments of the present invention, the determining module 602 is specifically configured to:
if the target function is a newly added function, each virtual component in the at least two virtual components is used as the change component;
and if the target function is a repaired function, taking the repaired virtual component in the at least two virtual components as the changed component.
In some embodiments of the present invention, the test module 603 is specifically configured to:
taking each component in the change components as a target component, and detecting whether the type of the target component is a preset component type or not;
if yes, testing the target assembly;
if not, feeding the target component back to the target terminal.
In some embodiments of the present invention, the integrated test module 604 is specifically configured to:
deploying the at least two virtual components;
acquiring a test case set corresponding to the target function;
and carrying out integrated test on the deployed virtual components according to the test case set.
In some embodiments of the present invention, the integrated test module 604 is specifically further configured to:
acquiring a test environment of the target function;
and deploying the at least two virtual components into the test environment in sequence according to the pre-configured dependency relationship of the at least two virtual components.
In some embodiments of the present invention, the integrated test module 604 is specifically further configured to:
detecting whether the test environment with the target function exists in the currently created test environment;
if yes, acquiring the test environment of the target function from the currently created test environment;
if not, creating a test environment of the target function.
In some embodiments of the present invention, the apparatus further comprises a detection module, specifically configured to:
detecting whether the integrated test passes or not;
if yes, archiving the test case set, and destroying the test environment of the target function;
if not, the testing environment of the target function is reserved, and the target component is fed back to the target terminal.
In some embodiments of the present invention, the detection module is specifically further configured to:
detecting whether the passing rate of the test cases in the test case set is larger than a preset threshold value;
if yes, judging that the integrated test is passed;
if not, judging that the integrated test is not passed.
In some embodiments of the present invention, the apparatus further includes a publishing module, where the publishing module is specifically configured to:
and after the integrated test is passed, merging the at least two virtual components, setting a label for the merged virtual component, packaging the merged virtual component and publishing.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
When the virtual machine is updated, at least two virtual components related to target functions in the virtual machine are obtained, and changed components in the at least two virtual components are determined, so that the changed components are tested first, the error rate of the changed components is reduced, after the changed components pass the test, the at least two virtual components are combined and then subjected to the integrated test, the test passing rate of the integrated test is improved, the integrated test is an automatic test, and the test efficiency of the functional test is effectively improved.
The embodiment of the invention also provides a server, as shown in fig. 7, which shows a schematic structural diagram of the server according to the embodiment of the invention, specifically:
the server may include one or more processors 701 of a processing core, memory 702 of one or more computer readable storage media, power supply 703, and input unit 704, among other components. Those skilled in the art will appreciate that the server architecture shown in fig. 7 is not limiting of the server and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
Wherein:
the processor 701 is a control center of the server, connects various parts of the entire server using various interfaces and lines, and performs various functions of the server and processes data by running or executing software programs and/or modules stored in the memory 702, and calling data stored in the memory 702. Optionally, processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor, wherein the application processor primarily processes operating storage media, user interfaces, application programs, etc., and the modem processor primarily processes wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 701.
The memory 702 may be used to store software programs and modules, and the processor 701 executes various functional applications and data processing by executing the software programs and modules stored in the memory 702. The memory 702 may mainly include a storage program area and a storage data area, wherein the storage program area may store a storage medium, an application program (such as a sound playing function, an image playing function, etc.) required for operating at least one function, and the like; the storage data area may store data created according to the use of the server, etc. In addition, the memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 702 may also include a memory controller to provide access to the memory 702 by the processor 701.
The server also includes a power supply 703 for powering the various components, preferably, the power supply 703 can be logically coupled to the processor 701 via a power management storage medium such that functions such as managing charge, discharge, and power consumption can be performed via the power management storage medium. The power supply 703 may also include one or more of any component of a direct current or alternating current power supply, a rechargeable storage medium, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The server may further comprise an input unit 704, which input unit 704 may be used for receiving input digital or character information and generating keyboard, mouse, joystick, optical or trackball signal inputs in connection with user settings and function control.
Although not shown, the server may further include a display unit or the like, which is not described herein. In this embodiment, the processor 701 in the server loads executable files corresponding to the processes of one or more application programs into the memory 702 according to the following instructions, and the processor 701 executes the application programs stored in the memory 702, so as to implement various functions as follows:
When a virtual machine is updated, at least two virtual components related to a target function in the virtual machine are acquired; determining a change component in the at least two virtual components; testing the change component; and after the test of the change component passes, carrying out integrated test on the at least two virtual components to realize the test of the target function.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present invention provides a storage medium storing a plurality of instructions that can be loaded by a processor to perform steps in any one of the virtual machine function test methods provided in the embodiment of the present invention. For example, the instructions may perform the steps of:
when a virtual machine is updated, at least two virtual components related to a target function in the virtual machine are acquired; determining a change component in the at least two virtual components; testing the change component; and after the test of the change component passes, carrying out integrated test on the at least two virtual components to realize the test of the target function.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The instructions stored in the storage medium can execute the steps in the function test method of any virtual machine provided by the embodiment of the present invention, so that the beneficial effects that can be achieved by the function test method of any virtual machine provided by the embodiment of the present invention can be achieved, which are detailed in the previous embodiments and are not described herein.
The above describes in detail the method, the device, the server and the storage medium for testing functions of the virtual machine provided by the embodiments of the present invention, and specific examples are applied to illustrate the principles and the implementation modes of the present invention, and the description of the above embodiments is only used to help understand the method and the core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present invention, the present description should not be construed as limiting the present invention.

Claims (8)

1. The function test method of the virtual machine is characterized by comprising the following steps of:
when a virtual machine is updated, at least two virtual components related to a target function in the virtual machine are acquired, wherein the target function is a newly developed or repaired function in the virtual machine;
determining a change component in the at least two virtual components;
taking each component in the change components as a target component, wherein each target component forms one branch of codes for realizing the target function;
detecting the legality of the name of the branch code corresponding to the target component, wherein the name of the branch code corresponding to the target component is the name of the target component, and the name of the target component is used for determining the type of the target component;
when the detection result indicates that the name of the branch code corresponding to the target component is legal, automatically testing the branch code; after the branch codes complete automatic testing, submitting a merging request to a trunk code for realizing the target function;
when the detection result indicates that the name of the branch code corresponding to the target component is illegal, feeding back the target component to a target terminal, and renaming the target component through the target terminal until the name of the target component is legal;
When the number of the merging requests is equal to the number of the branch codes, determining that the branch codes of all target components are automatically tested;
after all the branch codes of the target components are automatically tested, acquiring a test environment of the target function;
according to the preset dependency relationship of the at least two virtual components, sequentially deploying the target components into a test environment of a target function according to the sequence of the target components in the dependency relationship;
acquiring a test case set corresponding to the target function;
and carrying out integrated test on the deployed target assembly according to the test case set so as to realize the test of the target function.
2. The method for testing the function of the virtual machine according to claim 1, wherein the determining a change component of the at least two virtual components specifically includes:
if the target function is a newly added function, each virtual component in the at least two virtual components is used as the change component;
and if the target function is a repaired function, taking the repaired virtual component in the at least two virtual components as the changed component.
3. The method for testing the function of the virtual machine according to claim 1, wherein the obtaining the testing environment of the target function specifically includes:
detecting whether the test environment with the target function exists in the currently created test environment;
if yes, acquiring the test environment of the target function from the currently created test environment;
if not, creating a test environment of the target function.
4. The method for testing the function of a virtual machine according to claim 1, further comprising:
detecting whether the integrated test passes or not;
if yes, archiving the test case set, and destroying the test environment of the target function;
if not, the testing environment of the target function is reserved, and the target component is fed back to the target terminal.
5. The method for testing functions of a virtual machine according to claim 4, wherein the detecting whether the integrated test passes or not specifically comprises:
detecting whether the passing rate of the test cases in the test case set is larger than a preset threshold value;
if yes, judging that the integrated test is passed;
if not, judging that the integrated test is not passed.
6. The method for testing the function of a virtual machine according to claim 1, further comprising:
and after the integrated test is passed, merging the at least two virtual components, setting a label for the merged virtual component, packaging the merged virtual component and publishing.
7. A function test device for a virtual machine, comprising:
the system comprises an acquisition module, a restoration module and a restoration module, wherein the acquisition module is used for acquiring at least two virtual components related to a target function in a virtual machine when the virtual machine is updated, and the target function is a newly developed or restored function in the virtual machine;
the determining module is used for determining a change component in the at least two virtual components;
the testing module is used for taking each component in the change components as a target component, and each target component forms one branch of codes for realizing the target function; detecting the legality of the name of the branch code corresponding to the target component, wherein the name of the branch code corresponding to the target component is the name of the target component, and the name of the target component is used for determining the type of the target component; when the detection result indicates that the name of the branch code corresponding to the target component is legal, automatically testing the branch code; after the branch codes complete automatic testing, submitting a merging request to a trunk code for realizing the target function; when the detection result indicates that the name of the branch code corresponding to the target component is illegal, feeding back the target component to a target terminal, and renaming the target component through the target terminal until the name of the target component is legal; when the number of the merging requests is equal to the number of the branch codes, determining that the branch codes of all target components are automatically tested;
The integrated test module is used for acquiring a test environment of the target function after the automatic test of the branch codes of all the target components is completed; according to the preset dependency relationship of the at least two virtual components, sequentially deploying the target components into a test environment of a target function according to the sequence of the target components in the dependency relationship; acquiring a test case set corresponding to the target function; and carrying out integrated test on the deployed target assembly according to the test case set so as to realize the test of the target function.
8. A computer readable storage medium storing a plurality of instructions to be loaded by a processor to perform the steps in the method of testing the functionality of a virtual machine according to any one of claims 1 to 6.
CN201910982727.7A 2019-10-16 2019-10-16 Function test method and device for virtual machine Active CN112667491B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910982727.7A CN112667491B (en) 2019-10-16 2019-10-16 Function test method and device for virtual machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910982727.7A CN112667491B (en) 2019-10-16 2019-10-16 Function test method and device for virtual machine

Publications (2)

Publication Number Publication Date
CN112667491A CN112667491A (en) 2021-04-16
CN112667491B true CN112667491B (en) 2023-09-26

Family

ID=75400654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910982727.7A Active CN112667491B (en) 2019-10-16 2019-10-16 Function test method and device for virtual machine

Country Status (1)

Country Link
CN (1) CN112667491B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113672242A (en) * 2021-09-03 2021-11-19 中国邮政储蓄银行股份有限公司 Cooperative deployment method and device, computer readable storage medium and processor

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105224869A (en) * 2014-06-12 2016-01-06 腾讯科技(深圳)有限公司 Assembly test method and device
CN106227657A (en) * 2016-07-18 2016-12-14 浪潮(北京)电子信息产业有限公司 A kind of continuous integrating method and apparatus virtualizing cloud system
CN108920359A (en) * 2018-06-06 2018-11-30 腾讯科技(成都)有限公司 Test method, device, storage medium and the electronic device of application program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5976946B2 (en) * 2013-09-25 2016-08-24 株式会社日立製作所 Virtual machine test system, virtual machine test method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105224869A (en) * 2014-06-12 2016-01-06 腾讯科技(深圳)有限公司 Assembly test method and device
CN106227657A (en) * 2016-07-18 2016-12-14 浪潮(北京)电子信息产业有限公司 A kind of continuous integrating method and apparatus virtualizing cloud system
CN108920359A (en) * 2018-06-06 2018-11-30 腾讯科技(成都)有限公司 Test method, device, storage medium and the electronic device of application program

Also Published As

Publication number Publication date
CN112667491A (en) 2021-04-16

Similar Documents

Publication Publication Date Title
US9367305B1 (en) Automatic container definition
CN108108297B (en) Method and device for automatic testing
US8418139B2 (en) System and method for updating initialization parameters for application software from within a software development environment
CN110825399B (en) Deployment method and device of application program
WO2016202000A1 (en) Differential rollback upgrading method and apparatus
CN113448862B (en) Software version testing method and device and computer equipment
US20150006736A1 (en) Method and System for Deploying and Modifying a Service-Oriented Architecture Deployment Environment
CN110532182B (en) Automatic testing method and device for virtualization platform
WO2022012305A1 (en) Method and apparatus for managing model file in inference application
CN112667491B (en) Function test method and device for virtual machine
CN110505289B (en) File downloading method and device, computer readable medium and wireless communication equipment
CN114640709B (en) Edge node processing method, device and medium
CN111090442A (en) Application updating method and device and storage medium
CN115129348A (en) Resource updating method, device and equipment of application program and readable storage medium
CN114610446A (en) Method, device and system for automatically injecting probe
CN115964061A (en) Plug-in updating method and device, electronic equipment and computer readable storage medium
CN113032004A (en) Method, apparatus and program product for managing development jobs in a development environment
CN112035228B (en) Resource scheduling method and device
CN113934453B (en) Risk detection method, risk detection device and storage medium
US20230259347A1 (en) Container based generation of inputs for generic functions
CN111240998B (en) Test case processing method and device
CN116931914A (en) Page rendering method, page rendering device, electronic device and computer readable storage medium
CN113900959A (en) Software testing method, device, equipment and storage medium
CN115994077A (en) Service simulation processing method and related equipment
CN116414635A (en) Page processing method, device, equipment, storage medium and computer program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant