CN107168880A - Virtual machine method of testing and instrument - Google Patents

Virtual machine method of testing and instrument Download PDF

Info

Publication number
CN107168880A
CN107168880A CN201710401159.8A CN201710401159A CN107168880A CN 107168880 A CN107168880 A CN 107168880A CN 201710401159 A CN201710401159 A CN 201710401159A CN 107168880 A CN107168880 A CN 107168880A
Authority
CN
China
Prior art keywords
virtual machine
test
measured
testing
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710401159.8A
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.)
China Standard Software Co Ltd
Original Assignee
China Standard Software 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 China Standard Software Co Ltd filed Critical China Standard Software Co Ltd
Priority to CN201710401159.8A priority Critical patent/CN107168880A/en
Publication of CN107168880A publication Critical patent/CN107168880A/en
Pending legal-status Critical Current

Links

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/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

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 invention provides a kind of virtual machine method of testing and instrument, above-mentioned method of testing includes:Define test environment;Remote testing instrument and remote testing script are pushed in one or more virtual machines to be measured;The remote testing instrument is installed in the virtual machine to be measured and the remote testing script is performed;The test log and test result in the remote testing script implementation procedure are collected, test is completed.Many virtual machines can be carried out difference in functionalitys, the test of performance by the virtual machine testing scheme provided according to embodiments of the present invention simultaneously, ensure being normally carried out for business on virtual machine.

Description

Virtual machine method of testing and instrument
Technical field
The present invention relates to field of computer technology, more particularly to a kind of virtual machine method of testing and instrument.
Background technology
Increasingly extensive with the application of virtual machine technique, various cloud computing solutions emerge in an endless stream.A large amount of government affairs offices, The business migration that enterprises and institutions operate in script on physical server is to virtualized environment, in the hope of reducing O&M cost and increasing The scalability of strong system.In order to ensure that business can normally be run, how to lift the testing efficiency of virtual machine in itself turns into urgently To be solved the problem of.
The content of the invention
The invention provides a kind of virtual machine method of testing and instrument to overcome above mentioned problem or solve at least in part Above mentioned problem.
According to an aspect of the invention, there is provided a kind of virtual machine method of testing, including:
Define test environment;
Remote testing instrument and remote testing script are pushed in one or more virtual machines to be measured;
The remote testing instrument is installed in the virtual machine to be measured, the remote testing script is performed;
The test log and test result in the remote testing script implementation procedure are collected, test is completed.
Alternatively, the test environment that defines includes at least one of:
Define global variable;
Define protos test suite PROTOS;
Define test case;
Define the virtual machine to be measured.
Alternatively, also include before the execution remote testing script:
Judge whether the virtual machine to be measured is in off-mode;
If so, then recovering to recover the system of the virtual machine to be measured to original state by snapshot.
Alternatively, it is described to recover to recover to original state also to wrap by the system of the virtual machine to be measured by snapshot Include:
Start the virtual machine to be measured;
Check whether the SSH safety shell protocols port of the virtual machine to be measured is in listening state, if, it is determined that institute The system for stating virtual machine to be measured starts successfully.
Alternatively, it is described that remote testing instrument and remote testing script are pushed to it in one or more virtual machines to be measured Also include afterwards:
Test access script is created according to the title of the remote testing script, the test access script is committed to institute Performed in the plan target for stating virtual machine to be measured.
Alternatively, the above method also includes:
The various test modes that the virtual machine to be measured occurs in test process are handled by the state engine.
Alternatively, the test environment that defines includes:
Based on test environment described in XML Markup Language document definitions.
Alternatively, it is described that the remote testing instrument is installed in the virtual machine to be measured and the remote testing pin is performed Also include after this:
Replicate the status file in the virtual machine to be measured;
According to the status file content judge the remote testing script whether start perform and/or whether perform knot Beam.
Alternatively, the test log and test result collected in the remote testing script implementation procedure, completes to survey After examination, in addition to:
The test log being collected into and test result are sent to specified user.
According to another aspect of the present invention, a kind of virtual machine testing tool is additionally provided, including:
Definition module, is configured to define test environment;
Pushing module, is configured to remote testing instrument and remote testing script being pushed to one or more virtual machines to be measured In;
Performing module, is configured in the virtual machine to be measured install the remote testing instrument, performs the long-range survey Training sheet;
Collection module, is configured to collect test log and test result in the remote testing script implementation procedure, complete Into test.
Alternatively, the definition module includes at least one of:
First definition unit, is configured to define global variable;
Second definition unit, is configured to define protos test suite PROTOS;
3rd definition unit, is configured to define test case;
4th definition unit, is configured to define the virtual machine to be measured.
Alternatively, above-mentioned testing tool also includes:
Recovery module, is configured to judge whether the virtual machine to be measured is in off-mode;If so, then being recovered by snapshot The system of the virtual machine to be measured is recovered to original state.
Alternatively, above-mentioned testing tool also includes;
Starting module, is configured to start the virtual machine to be measured;Check the SSH safety shell protocols of the virtual machine to be measured Whether port is in listening state, if, it is determined that the system of the virtual machine to be measured starts successfully.
Alternatively, above-mentioned testing tool also includes:
Creation module, is configured to create test access script according to the title of the remote testing script, and survey described Examination entrance script, which is committed in the plan target of the virtual machine to be measured, to be performed.
Alternatively, the various test shapes that the virtual machine to be measured occurs in test process are handled by the state engine State.
Alternatively, the definition module is additionally configured to be based on test wrapper described in XML Markup Language document definitions Border.
Alternatively, above-mentioned testing tool also includes:
Judge module, is configured to replicate the status file in the virtual machine to be measured;Sentenced according to the status file content Whether whether the remote testing script that breaks, which start to perform and/or perform, is terminated.
Alternatively, above-mentioned testing tool also includes:
Sending module, is configured to send the test log being collected into and test result to specified user.
The invention provides the virtual machine method of testing and instrument of a kind of automation, before test, test environment is first defined, is opened During dynamic test, testing tool and test script are pushed in virtual machine to be measured according to configuration, instrument installation, test script is carried out Perform, regather test result.The virtual machine testing scheme provided according to embodiments of the present invention, can be simultaneously to many virtual machines Difference in functionality, the test of performance are carried out, the testing efficiency of virtual machine is lifted while simplifying operating procedure, and then ensures virtual machine Upper business is normally carried out.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, And can be practiced according to the content of specification, and in order to allow above and other objects of the present invention, feature and advantage can Become apparent, below especially exemplified by the embodiment of the present invention.
According to the accompanying drawings to the detailed description of the specific embodiment of the invention, those skilled in the art will be brighter Above-mentioned and other purposes, the advantages and features of the present invention.
Brief description of the drawings
By reading the detailed description of hereafter preferred embodiment, various other advantages and benefit is common for this area Technical staff will be clear understanding.Accompanying drawing is only used for showing the purpose of preferred embodiment, and is not considered as to the present invention Limitation.And in whole accompanying drawing, identical part is denoted by the same reference numerals.In the accompanying drawings:
Fig. 1 is virtual machine method of testing schematic flow sheet according to an embodiment of the invention;
Fig. 2 is virtual machine method of testing schematic flow sheet in accordance with another embodiment of the present invention;
Fig. 3 is virtual machine method of testing schematic flow sheet in accordance with a preferred embodiment of the present invention;
Fig. 4 is the virtual machine method of testing schematic flow sheet according to another preferred embodiment of the present invention;
Fig. 5 is virtual machine testing tool structural representation according to embodiments of the present invention;
Fig. 6 is virtual machine testing tool structural representation according to the preferred embodiment of the invention.
Embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in accompanying drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here Limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure Complete conveys to those skilled in the art.
Fig. 1 is virtual machine method of testing schematic flow sheet according to an embodiment of the invention.As described in Figure 1, it is of the invention The virtual machine method of testing of embodiment includes:
Step S102, defines test environment;
Step S104, remote testing instrument and remote testing script are pushed in one or more virtual machines to be measured;
Step S106, installs remote testing instrument in virtual machine to be measured, performs remote testing script;
Step S108, collects the test log and test result in remote testing script implementation procedure, completes test.
The embodiments of the invention provide a kind of virtual machine method of testing of automation, before test, test environment is first defined, is opened During dynamic test, testing tool and test script are pushed in virtual machine to be measured according to configuration, instrument installation, test script is carried out Perform, regather test result.The virtual machine testing scheme provided according to embodiments of the present invention, can be simultaneously to many virtual machines Difference in functionality, the test of performance are carried out, the testing efficiency of virtual machine is lifted while simplifying operating procedure, and then ensures virtual machine Upper business is normally carried out.
Preferably, in the present embodiment, XML (Extensible Markup Language, extensible markup can be used Language) document definition test environment.Define test environment when, can respectively to global variable, protos test suite PROTOS, test case with And virtual machine to be measured is defined, and is described in detail as follows.
1. define global variable
The part defines the general information required for test environment, independent of any specific test or virtual machine, should Part defines content can be as shown in table 1:
Table 1
XML Tag Description
<ResRootDir> The basic catalogue of journal file storage
<Snapshot> The snapshot title recovered for virtual machine snapshot
<recipients> The purpose email address set that test result is sent
<to> Inbox address
<sender> Outbox address
<subject> Mail matter topics
<smtpServer> Send the smtp server that mail is used
Define being realized by following procedure code for global variable:
2. define protos test suite PROTOS
Protos test suite PROTOS part defines one or more protos test suite PROTOSs.One protos test suite PROTOS is the collection of test case title Close.The order testing results use-case that the testing tool will be listed according to test case in protos test suite PROTOS.Following table lists protos test suite PROTOS In the XML tag that is likely to occur.
Table 2
XML Tag Description
<testSuites> Protos test suite PROTOS section start location
<suite> Protos test suite PROTOS defines original position
<suiteName> Protos test suite PROTOS title
<suiteTests> Test case list beginning position
<suiteTest> The test case title that protos test suite PROTOS is included
The definition of protos test suite PROTOS part can be realized by following procedure code:
3. define test case
Test case part defines all test cases that can be run.One protos test suite PROTOS is typically test in XML file The subset for the test case that use-case part is defined.Test case part only defines the test that can be run, and the test that can be run is i.e. The automatic test cases that the automated test tool can be realized before feeling the pulse with the finger-tip.
Table 3 lists the XML tag being likely to occur in test case.
Table 3
The definition of test case part can be realized by following procedure code:
4. define virtual machine to be measured
Virtual machine part defines virtual machines to be measured all in test environment, the protos test suite PROTOS that will be run comprising virtual machine Title.
Table 4 lists the XML tag being likely to occur in virtual machine
Table 4
XML Tag Description
<VMs> Virtual machine section start location to be measured
<vm> One virtual machine definition
<Host> Run the host IP address of virtual machine
<vmName> Virtual machine title
<os> The operating system run in virtual machine
<ipv4> The IPv4 addresses of virtual machine.
<suite> <testSuites>The protos test suite PROTOS title of part definition.
The definition of virtual machine part can be realized by following procedure code:
In virtual machine method of testing provided in an embodiment of the present invention, test environment is by control server and to be measured virtual Machine composition, and the testing tool of whole related automation is deployed on control server.It draws comprising XML file, state Hold up, need to be pushed to remote testing instrument and remote testing script in virtual machine when entrance test script, test start, from void Test log and test result, the running log of the testing tool collected in plan machine, the void provided according to embodiments of the present invention Many virtual machines can be carried out different functions, performance test by plan machine method of testing simultaneously.
The part of remote testing instrument and remote testing script, the simply testing tool, is stored in the testing tool Catalogue under, test start when, they are pushed in virtual machine, these remote testing instruments and remote testing script are in void Run in plan machine, for testing the function and performance of virtual machine.
Further, in embodiments of the present invention, by controlling server to push remote testing instrument and test script Into virtual machine to be measured, then carry out instrument installation, test execution and test result and reclaim.Avoid artificially sign in it is each to be measured Operated respectively in virtual machine, simplify operating procedure, improve testing efficiency.
When proceeding by test, the entrance script of testing tool can be performed with root user on control server Autotest.sh, the grammer of order line is as follows:
#sh autotest.sh xmlFile[-debugLevel][-email][-help]
Table 5 be perform test when, in fact it could happen that parameter relevant information.
Table 5
Preferably, before the execution remote testing script in above-mentioned steps S104, it can also judge that virtual machine to be measured is No to be in off-mode, if virtual machine to be measured is in off-mode, recover function by snapshot is by virtual machine to be measured System recovers to original state.Original state is that virtual machine does not have the state before testing results, for tester, Ke Yizhi Which service is started in road virtual machine, the information such as which rpm bag are mounted with, and then ensure that the stability of test and repeat Property.
Fig. 2 is that the virtual machine method of testing flow that operating system according to the preferred embodiment of the invention is linux version is shown It is intended to, in the preferred embodiment, virtual machine is mounted with that SSH (Secure Shell, safety shell protocol) is serviced, and is provided with Start self-starting;Root user is allowed to be logged in by SSH;The fire wall of virtual machine opens No. 22 ports, and 22 ports are exactly SSH ends Mouthful;Virtual machine configuration SSH key, control server can exempt from password login virtual machine;Virtual machine creating snapshot, Neng Goujin Row snapshot recovers.
As shown in Fig. 2 virtual machine method of testing according to the preferred embodiment of the invention includes:
Whether step S202, it is root user to judge active user;If it is, perform next step S204. if it is not, then Terminate test;
When starting test, in order to perform test, entering for the testing tool is performed using root user on control server Mouth script, entrance script first determines whether whether active user is root user, if it is not, exiting script, terminates test;If It is to continue next step;
Step S204, judges that the xml document specified whether there is, if it does not, exiting script, terminates test;If In the presence of continuation next step;
Step S206, parses xml document;
Step S208, creates test result catalogue;
Test result catalogue is used for depositing the fortune of the test log collected from virtual machine, test result and the testing tool Row daily record, test result catalogue uses title<xmlfilename>_<date/time>, wherein xmlfilename is order line Incoming xml document title, date and time when date/time is entrance script startup;
Step S210, judgement treats whether virtual machine is off-mode;If virtual machine to be measured is not off-mode, perform Step S212, closes virtual machine;If virtual machine to be measured is off-mode, step S214 is performed;
Step S214, virtual machine snapshot is recovered;The system of virtual machine to be measured is recovered to original state, virtual machine is entered Row snapshot recovers, it is ensured that virtual machine is tested since a known kilter;
Recover function using the snapshot of virtual machine and dummy machine system is returned into original state before testing, it is ensured that every time During testing results instrument, known to the state of virtual machine.
Step S216, judges whether setup scripts;If there is setup scripts, then step S218 is performed, performed Setup scripts, if there is no setup scripts, then perform step S220;
Step S220, performs test;
Step S222, judges whether cleanup scripts;If it is, performing step S224, cleanup pin are performed This, if it is not, then performing step S226;
Step S226, judges whether to need to send mail;If it is, step S228 is performed, if it is not, then terminating to survey Examination;
Step S228, sends mail;
Needed to send mail according to configuration determination, then test result catalogue sent into mail to specified mailbox, notify user, Terminate test.
Recovering to recover the system of virtual machine to be measured to original state by snapshot in above-mentioned steps S214 just can be with Start virtual machine to be measured, it is alternatively possible to whether listening state is in by the SSH ports for checking virtual machine to be measured, if It is, it is determined that the system of virtual machine to be measured starts successfully.SSH ports are No. 22 ports of virtual machine to be measured, in present invention implementation In example, by checking whether No. 22 ports of virtual machine to be measured in listening state judge whether the system of virtual machine starts into Work(, can improve the accuracy of judgement.Virtual machine to be measured, which starts, successfully to be carried out setup scripts and then starts to install test.
Further, the daily record for testing tool is perfect, not only including testing tool in itself so output journal, together When also include the test script output journal that is collected into from virtual machine to be measured, daily record rank can be set, and facilitate test result Check and problem positioning.
The embodiments of the invention provide a kind of stronger virtual machine method of testing of flexibility, before test, it can pass through Snapshot recovers to recover virtual machine to be measured to known state, it is ensured that the stability and repeatability of test.Terminate after test, go back The test result catalogue of be stored with test log and test result can be sent to mail or other modes notify to specify user, So that related personnel lifts Consumer's Experience even if can not also grasp test case in time at the scene.
Virtual machine testing scheme provided in an embodiment of the present invention, its core is state engine, is handled by state engine The various test modes that virtual machine to be measured occurs in test process, i.e., the different test modes based on virtual machine are called accordingly Function is handled.The test mode of virtual machine mainly includes:SystemDown (shutting down successfully), StartSystem (start), SystemStarting (starting shooting), SystemUp (starting shooting successfully), PushTestFiles (push test file), StartTest (start test), TestStarting (starting test), TestRunning (test execution), CollectResFiles (collection test result), DetermineReboot (judging whether to restart), ShutdownSystem (are closed Machine), ShuttingDown (shutting down).After virtual machine snapshot is recovered, the test mode for setting virtual machine current is SystemDown.State engine is called, starts test.The corresponding power function name of every kind of test mode be before Status Name plus “Do”.For example, the corresponding power function of SystemDown test modes is exactly DoSystemDown functions.
Fig. 3 is according to the virtual machine method of testing flow signal that preferred embodiment of the present invention operating system is linux version Figure, in a preferred embodiment, the various states that virtual machine to be measured occurs in test process, such as Fig. 3 is handled by state engine Shown, virtual machine method of testing according to the preferred embodiment of the invention includes:
Step S302, SystemDown;When flow starts, the test mode of virtual machine is SystemDown, is called DoSystemDown functions, obtain virtual machine information, perform step S304;
Whether step S304, it is off to judge virtual machine state;
In above-mentioned DoSystemDown functions, virtual machine state is judged;
If virtual machine state is not off, the test mode for updating virtual machine is ForceSystemDown, performs step Rapid S306;
If virtual machine state is off, step S308 is performed;
Step S306, ForceSystemDown;DoForceSystemDown functions are called, pressure pass is carried out to virtual machine Machine, then the test mode of virtual machine is updated for SystemDown, perform step S302;
Step S308, judgement currently tests whether that is done;
In above-mentioned DoSystemDown functions, judgement currently tests whether that is done;
If current test is done, illustrate that test has been completed, the test mode for updating virtual machine is Finished, Perform step S310;
If current test is not done, the test mode for updating virtual machine is StartSystem, performs step S312;
Step S310, Finished;Terminate test;
Step S312, StartSystem;DoStartSystem functions are called, start virtual machine, when the state of virtual machine When being changed into running, the test mode for updating virtual machine is SystemStarting, performs step S314;
Step S314, SystemStarting;DoSystemStarting functions are called, step S316 is performed;
Step S316, judges whether virtual machine is in SystemStarting test modes overtime;
DoSystemStarting functions are called above-mentioned, by checking No. 22 ports of virtual machine whether in monitoring State, to judge whether the system of virtual machine starts success;
If dummy machine system starts successfully, the test mode of virtual machine is updated for SystemUp, step S324 is performed;
Start successfully if dummy machine system never has, cause virtual machine super in SystemStarting test modes When, then the test mode for updating virtual machine is SlowSystemStarting, performs step S318;
Step S318, SlowSystemStarting;DoSlowSystemStarting functions are called, step is performed S320;
Step S320, judges whether virtual machine is in SlowSystemStarting test modes overtime;
DoSlowSystemStarting functions are called above-mentioned, continue waiting for dummy machine system startup;
If virtual machine starts successfully, the test mode of virtual machine is updated for SystemUp, step S324 is performed;
Start successfully if dummy machine system never has, cause virtual machine to be in SlowSystemStarting and test shape State time-out, the then test mode for updating virtual machine is ForceShutDown, performs step S322;
Step S322, ForceShutDown;DoForceShutDown functions are called, positive closing virtual machine updates empty The test mode of plan machine is SystemDown, performs step S302;
Step S324, SystemUp;DoSystemUp functions are called, an exit order is sent to virtual machine using SSH, And receiving any prompting of server key, the test mode for updating virtual machine is PushTestFiles, performs step S326;
Step S326, PushTestFiles;DoPushTestFiles functions are called, the remote testing work of needs will be tested Tool, test script and the alternative document of definition are pushed in virtual machine to be measured, and the test mode for updating virtual machine is StartTest, performs step S328;
Step S328, StartTest;DoStartTest functions are called, according to test script title, are created Runtest.sh, runtest.sh is pushed in virtual machine, and submits runtest.sh at, is performed test script, is updated The test mode of virtual machine is TestStarting, performs step S330;
Step S330, TestStarting;DoTestStarting functions are called, step S332 is performed;
Step S332, judges whether virtual machine is in TestStarting test modes overtime;
DoTestStarting functions are called above-mentioned, and state.txt (virtual machines are copied from virtual machine using SSH The remote testing script at end creates state.txt files first when bringing into operation, the shape performed for labeled test script State);
If copying successfully and locally there is state.txt files, illustrate that test script has begun to execution, update virtual The test mode of machine is TestRunning, performs step S334;
If never copied successfully, cause virtual machine to be in TestStarting test modes time-out, then update empty The test mode of plan machine is DetermineReboot, performs step S342;
Step S334, TestRunning;DoTestRunning functions are called, step S336 is performed;
Step S336, judges whether virtual machine is in TestRunning test modes overtime;
DoTestRunning functions are called above-mentioned, and state.txt is copied from virtual machine using SSH, and in verifying Hold;When the remote testing script of virtual generator terminal brings into operation, state.txt files are created, and write to file " TestRunning " content, if be successfully tested, " TestCompleted " is write into state.txt files, if test Failure, " TestFailed " is write into state.txt files;
If it is not overtime that virtual machine is in TestRunning test modes, step S338 is performed;
If virtual machine is in TestRunning test modes time-out, the test mode for updating virtual machine is CollectResFiles, performs step S340;
Whether step S338, it is TestRunning to judge state.txt contents;
Whether in the above-mentioned DoTestRunning functions called, it is TestRunning to judge state.txt contents;
If state.txt is TestRunning, step S336 is continued executing with;
If the content in state.txt is not " TestRunning ", illustrate that test terminates, then update the survey of virtual machine Examination state is CollectResFiles, performs step S340;
Step S340, CollectResFiles;DoCollectResFiles functions are called, by SSH from virtual machine Test log and test result are collected, the test mode for updating virtual machine is DetermineReboot, performs step S342;
Step S342, DetermineReboot;DoDetermineReboot functions are called, step S344 is performed;
Step S344, judges whether virtual machine needs to restart;
DoDetermineReboot functions are called above-mentioned, judge whether virtual machine needs to restart;
If XML file definition need not restart, step S346 is performed;
If needing to restart defined in XML file, the test mode for updating virtual machine is ShutDownSystem, is performed Step S348;
Step S346, judges whether also next test;
DoDetermineReboot functions are called above-mentioned, judge whether also next test;
If also next test, the test mode for updating virtual machine is SystemUp, performs step S324;
If completed without next test, and all tests, then updating virtual machine state is ShutDownSystem, performs step S348;
Step S348, ShutDownSystem;DoShutDownSystem functions are called, virtual machine is closed, update virtual The test mode of machine is ShuttingDown, performs step S350;
Step S350, ShuttingDown;DoShuttingDown functions are called, step S352 is performed;
Step S352, judging ShuttingDown, whether state is overtime;
DoShuttingDown functions are called above-mentioned, obtain virtual machine information;
If the state of virtual machine is off, illustrate that virtual machine shuts down successfully, then the test mode for updating virtual machine is SystemDown, performs step S302;
If the state of virtual machine is not always off, virtual machine is caused to be in ShuttingDown test modes time-out, then The test mode for updating virtual machine is ForecShutDown, performs step S322;
In a preferred embodiment of the invention, a variety of test modes that virtual machine is likely to occur are defined, by state engine, The various situations that virtual machine occurs in test process can be handled, being smoothed out for test has been ensured.Further, this is preferred Embodiment can also be by checking whether No. 22 ports of virtual machine in listening state judge whether the system of virtual machine opens Move successfully, improve the accuracy of judgement.
In above-mentioned steps S328, runtest.sh is the entrance script of testing results in virtual machine, and the script is according to xml Defined in the test script title to be performed create, when performing runtest.sh scripts, it is fixed in xml document to run The test script of justice.At is a service of (SuSE) Linux OS, i.e. plan target.In the present embodiment, can be according to long-range The title of test script creates test access script, and test access script is committed in the plan target of virtual machine to be measured and carried out Perform.That is, when runtest.sh is submitted at, can the specified time operating system running background this Script.The stability of test script operation can so be improved.
In above-mentioned steps S332, state.txt files are a status files, situation about being performed for labeled test. This file rewrites content in the process of running by the remote testing script in virtual machine, when starting to perform remote testing script, Remote testing script writes " TestRunning " to state.txt files, and labeled test starts;During test crash, remote testing Script writes " TestFailed " to state.txt files, labeled test failure;At the end of test, remote testing to State.txt files write " TestCompleted ", and labeled test is completed.Control service copies state.txt from virtual machine File, by reading the content of file, judges that what stage is the test execution in virtual machine arrived.Once it was found that state.txt Content in file is not " TestRunning ", illustrates that this test has stopped.
Preferably, can be with permissible after the installation remote testing instrument in virtual machine to be measured, execution remote testing script The status file in virtual machine to be measured is replicated, and judges whether remote testing script starts execution according to status file content And/or whether perform and terminate, and then upgrading in time for virtual machine test mode is realized, improve testing efficiency.
Virtual machine testing scheme provided in an embodiment of the present invention is integrated with some remote testing instruments and the test of virtual machine Script, the test script content of virtual machine generally comprises flow shown in Fig. 4.
Step S402, creates state.txt files, and write " TestRunning ";
State.txt files are created first, " TestRunning " content is write into this document, and labeled test starts, shape State.txt file of the state engine in virtual machine whether there is and the content of file judges testing whether for virtual machine Start to perform and whether perform to terminate;
Step S404, installs testing tool;
Step S406, setup test premise;
Step S408, testing results instrument;
Step S410, arranges test result;
Step S412, judgement tests whether success;
If be successfully tested, step S414 is performed, the content updated in state.txt files is “TestCompleted”;
If test not into, perform step S416, update state.txt files in content be " TestFailed ", Terminate test.
In the preferred embodiment, script main body include install testing tool, setup test premise, testing results instrument and Arrange test result.Some test cases need not use testing tool, and the part, which is just write, to be needed to perform dummy machine system Operational order.Arrange test result be usually generation two files, one be the test script all outputting log files, One be test execution test result file, such as performance data.
Corresponding to above-mentioned virtual machine method of testing, the embodiment of the present invention additionally provides a kind of virtual machine testing tool, and Fig. 5 is Virtual machine testing tool structural representation according to embodiments of the present invention, as shown in figure 5, virtual machine according to embodiments of the present invention Testing tool can include:
Definition module 10, is configured to define test environment;
Pushing module 20, is configured to remote testing instrument and remote testing script being pushed to one or more to be measured virtual In machine;
Performing module 30, is configured in virtual machine to be measured install remote testing instrument, performs remote testing script;
Collection module 40, is configured to collect test log and test result in remote testing script implementation procedure, completes Test.
In a preferred embodiment of the invention, as shown in fig. 6, definition module 10 can include:
First definition unit 11, is configured to define global variable;
Second definition unit 12, is configured to define protos test suite PROTOS;
3rd definition unit 13, is configured to define test case;
4th definition unit 14, is configured to define virtual machine to be measured.
In a preferred embodiment of the invention, as shown in fig. 6, above-mentioned testing tool also includes:
Recovery module 50, is configured to judge whether virtual machine to be measured is in off-mode;If so, then will by snapshot recovery The system of virtual machine to be measured is recovered to original state.
In a preferred embodiment of the invention, as shown in fig. 6, above-mentioned testing tool also includes:
Starting module 60, is configured to start the virtual machine to be measured;
Check whether the SSH safety shell protocols port of the virtual machine to be measured is in listening state, if, it is determined that institute The system for stating virtual machine to be measured starts successfully.
In a preferred embodiment of the invention, as shown in fig. 6, above-mentioned testing tool also includes:
Creation module 70, is configured to create test access script according to the title of the remote testing script, and will be described Test access script is committed in the plan target of the virtual machine to be measured and performed.
Alternatively, the various test modes that the virtual machine to be measured occurs are handled by the state engine.
In a preferred embodiment of the invention, above-mentioned definition module 10 is additionally configured to:
Based on test environment described in XML Markup Language document definitions.
In a preferred embodiment of the invention, as shown in fig. 6, above-mentioned testing tool also includes:
Judge module 80, is configured to replicate the status file in the virtual machine to be measured;According to the status file content Judge whether the remote testing script starts to perform and/or whether perform to terminate.
In a preferred embodiment of the invention, as shown in fig. 6, above-mentioned testing tool also includes:
Sending module 90, is configured to send the test log being collected into and test result to specified user.
The virtual machine method of testing and instrument provided according to embodiments of the present invention can be carried out not to many virtual machines simultaneously Function together, performance test.Function is recovered by the snapshot of virtual machine before test every time dummy machine system is returned into known shape State, it is ensured that the stability and repeatability of test.By state engine, the various situations of virtual machine appearance can be handled, are protected Being smoothed out for test is hindered.The instrument is to be measured virtual by controlling server to be pushed to remote testing instrument and test script In machine, perform test and reclaim result, simplify operating procedure, improve testing efficiency.Remote testing instrument and test script It can be modified and add according to demand, with flexibility and scalability.
In the specification that this place is provided, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention Example can be put into practice in the case of these no details.In some instances, known method, structure is not been shown in detail And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help to understand one or more of each inventive aspect, exist Above in the description of the exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:It is i.e. required to protect The application claims of shield features more more than the feature being expressly recited in each claim.More precisely, such as following Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore, Thus the claims for following embodiment are expressly incorporated in the embodiment, wherein each claim is in itself All as the separate embodiments of the present invention.
Those skilled in the art, which are appreciated that, to be carried out adaptively to the module in the equipment in embodiment Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or Sub-component.In addition at least some in such feature and/or process or unit exclude each other, it can use any Combination is disclosed to all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so to appoint Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power Profit is required, summary and accompanying drawing) disclosed in each feature can or similar purpose identical, equivalent by offer alternative features come generation Replace.
Although in addition, it will be appreciated by those of skill in the art that some embodiments described herein include other embodiments In included some features rather than further feature, but the combination of the feature of be the same as Example does not mean in of the invention Within the scope of and form different embodiments.For example, in detail in the claims, embodiment claimed it is one of any Mode it can use in any combination.
The present invention all parts embodiment can be realized with hardware, or with one or more processor run Software module realize, or realized with combinations thereof.It will be understood by those of skill in the art that can use in practice Microprocessor or digital signal processor (DSP) realize some in virtual machine testing tool according to embodiments of the present invention Or some or all functions of whole parts.The present invention be also implemented as perform method as described herein one Partly or completely equipment or program of device (for example, computer program and computer program product).It is such to realize this The program of invention can be stored on a computer-readable medium, or can have the form of one or more signal.So Signal can download and obtain from internet website, either provide or provided in any other form on carrier signal.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference symbol between bracket should not be configured to limitations on claims.Word "comprising" is not excluded the presence of not Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such Element.The present invention can be by means of including the hardware of some different elements and coming real by means of properly programmed computer It is existing.In if the unit claim of equipment for drying is listed, several in these devices can be by same hardware branch To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and run after fame Claim.
So far, although those skilled in the art will appreciate that detailed herein have shown and described multiple showing for the present invention Example property embodiment, still, still can be direct according to present disclosure without departing from the spirit and scope of the present invention It is determined that or deriving many other variations or modifications for meeting the principle of the invention.Therefore, the scope of the present invention is understood that and recognized It is set to and covers other all these variations or modifications.

Claims (18)

1. a kind of virtual machine method of testing, including:
Define test environment;
Remote testing instrument and remote testing script are pushed in one or more virtual machines to be measured;
The remote testing instrument is installed in the virtual machine to be measured, the remote testing script is performed;
The test log and test result in the remote testing script implementation procedure are collected, test is completed.
2. according to the method described in claim 1, wherein, it is described define test environment include at least one of:
Define global variable;
Define protos test suite PROTOS;
Define test case;
Define the virtual machine to be measured.
3. according to the method described in claim 1, wherein, it is described perform the remote testing script before also include:
Judge whether the virtual machine to be measured is in off-mode;
If so, then recovering to recover the system of the virtual machine to be measured to original state by snapshot.
4. method according to claim 3, wherein, it is described to recover to recover the system of the virtual machine to be measured by snapshot Also include after to original state:
Start the virtual machine to be measured;
Check whether the SSH safety shell protocols port of the virtual machine to be measured is in listening state, if, it is determined that it is described to treat The system for surveying virtual machine starts successfully.
5. method according to claim 1, wherein, it is described by remote testing instrument and remote testing script be pushed to one or Also include after in multiple virtual machines to be measured:
Test access script is created according to the title of the remote testing script, the test access script is committed to described treat Performed in the plan target for surveying virtual machine.
6. the method according to claim any one of 1-5, wherein, in addition to:
The various test modes that the virtual machine to be measured occurs in test process are handled by the state engine.
7. the method according to claim any one of 1-5, wherein, the test environment that defines includes:
Based on test environment described in XML Markup Language document definitions.
8. the method according to claim any one of 1-5, wherein, it is described to install described long-range in the virtual machine to be measured Also include after testing tool, the execution remote testing script:
Replicate the status file in the virtual machine to be measured;
Judge whether the remote testing script starts to perform and/or whether perform to terminate according to the status file content.
9. method according to claim 8, wherein, the test day collected in the remote testing script implementation procedure Will and test result, are completed after testing, in addition to:
The test log being collected into and test result are sent to specified user.
10. a kind of virtual machine testing tool, including:
Definition module, is configured to define test environment;
Pushing module, is configured to remote testing instrument and remote testing script being pushed in one or more virtual machines to be measured;
Performing module, is configured in the virtual machine to be measured install the remote testing instrument, performs the remote testing pin This;
Collection module, is configured to collect test log and test result in the remote testing script implementation procedure, completes to survey Examination.
11. testing tool according to claim 10, wherein, the definition module includes at least one of:
First definition unit, is configured to define global variable;
Second definition unit, is configured to define protos test suite PROTOS;
3rd definition unit, is configured to define test case;
4th definition unit, is configured to define the virtual machine to be measured.
12. testing tool according to claim 10, wherein, in addition to:
Recovery module, is configured to judge whether the virtual machine to be measured is in off-mode;If so, then being recovered by snapshot by institute The system for stating virtual machine to be measured is recovered to original state.
13. testing tool according to claim 12, wherein, in addition to:
Starting module, is configured to start the virtual machine to be measured;Check the SSH safety shell protocols port of the virtual machine to be measured Whether listening state is in, if, it is determined that the system of the virtual machine to be measured starts successfully.
14. testing tool according to claim 10, wherein, in addition to:
Creation module, be configured to according to the title of the remote testing script create test access script, and by it is described test into Mouth script, which is committed in the plan target of the virtual machine to be measured, to be performed.
15. the testing tool according to claim any one of 10-14, wherein,
The various test modes that the virtual machine to be measured occurs in test process are handled by the state engine.
16. the testing tool according to claim any one of 10-14, wherein, the definition module is additionally configured to be based on XML Test environment described in Markup Language document definition.
17. the testing tool according to claim any one of 10-14, wherein, in addition to:
Judge module, is configured to replicate the status file in the virtual machine to be measured;Institute is judged according to the status file content State whether remote testing script starts to perform and/or whether perform to terminate.
18. testing tool according to claim 17, wherein, in addition to:
Sending module, is configured to send the test log being collected into and test result to specified user.
CN201710401159.8A 2017-05-31 2017-05-31 Virtual machine method of testing and instrument Pending CN107168880A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710401159.8A CN107168880A (en) 2017-05-31 2017-05-31 Virtual machine method of testing and instrument

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710401159.8A CN107168880A (en) 2017-05-31 2017-05-31 Virtual machine method of testing and instrument

Publications (1)

Publication Number Publication Date
CN107168880A true CN107168880A (en) 2017-09-15

Family

ID=59821260

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710401159.8A Pending CN107168880A (en) 2017-05-31 2017-05-31 Virtual machine method of testing and instrument

Country Status (1)

Country Link
CN (1) CN107168880A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726093A (en) * 2017-10-27 2019-05-07 伊姆西Ip控股有限责任公司 Method, equipment and computer program product for implementation of test cases
CN109828875A (en) * 2019-01-11 2019-05-31 虫极科技(北京)有限公司 Intelligent cargo cabinet stability test device and method
CN109960657A (en) * 2019-03-26 2019-07-02 浪潮商用机器有限公司 A kind of test environment dispositions method and relevant apparatus
CN110058920A (en) * 2019-03-04 2019-07-26 平安科技(深圳)有限公司 Virtual machine performance detection method and device, electronic equipment, storage medium
CN110941440A (en) * 2019-10-31 2020-03-31 北京浪潮数据技术有限公司 Batch updating method, device and equipment for virtual machines and readable storage medium
CN112187933A (en) * 2020-09-29 2021-01-05 苏州浪潮智能科技有限公司 Method and system for monitoring services in multi-architecture cloud platform
CN116383090A (en) * 2023-05-29 2023-07-04 麒麟软件有限公司 Automatic testing method and platform for kylin system migration tool

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833498A (en) * 2009-07-31 2010-09-15 北京伟晨豪嘉科技有限责任公司 Automatic detection system of embedded type system based on testing script technique
CN101876940A (en) * 2009-11-30 2010-11-03 北京飞天诚信科技有限公司 Automatic test method and device
CN101916224A (en) * 2010-08-20 2010-12-15 迈普通信技术股份有限公司 Test progress abnormality detection method and automatic test control device
CN101986280A (en) * 2010-11-29 2011-03-16 浙江大学 Automatic testing platform for virtual computing system
WO2013006708A1 (en) * 2011-07-07 2013-01-10 Vce Company, Llc System of automatic monitoring of a physical computing platform and just- in-time allocation of resources
CN103218280A (en) * 2013-04-15 2013-07-24 飞天诚信科技股份有限公司 Hardware general testing method of USB (Universal Serial Bus) equipment
CN104239217A (en) * 2014-10-14 2014-12-24 北京全路通信信号研究设计院有限公司 Method and system for testing railway signal software
CN104333488A (en) * 2014-11-04 2015-02-04 哈尔滨工业大学 Cloud service platform performance test method
CN106708740A (en) * 2017-01-10 2017-05-24 网易(杭州)网络有限公司 Script testing method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833498A (en) * 2009-07-31 2010-09-15 北京伟晨豪嘉科技有限责任公司 Automatic detection system of embedded type system based on testing script technique
CN101876940A (en) * 2009-11-30 2010-11-03 北京飞天诚信科技有限公司 Automatic test method and device
CN101916224A (en) * 2010-08-20 2010-12-15 迈普通信技术股份有限公司 Test progress abnormality detection method and automatic test control device
CN101986280A (en) * 2010-11-29 2011-03-16 浙江大学 Automatic testing platform for virtual computing system
WO2013006708A1 (en) * 2011-07-07 2013-01-10 Vce Company, Llc System of automatic monitoring of a physical computing platform and just- in-time allocation of resources
CN103218280A (en) * 2013-04-15 2013-07-24 飞天诚信科技股份有限公司 Hardware general testing method of USB (Universal Serial Bus) equipment
CN104239217A (en) * 2014-10-14 2014-12-24 北京全路通信信号研究设计院有限公司 Method and system for testing railway signal software
CN104333488A (en) * 2014-11-04 2015-02-04 哈尔滨工业大学 Cloud service platform performance test method
CN106708740A (en) * 2017-01-10 2017-05-24 网易(杭州)网络有限公司 Script testing method and device

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726093A (en) * 2017-10-27 2019-05-07 伊姆西Ip控股有限责任公司 Method, equipment and computer program product for implementation of test cases
CN109726093B (en) * 2017-10-27 2022-03-22 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for executing test cases
CN109828875A (en) * 2019-01-11 2019-05-31 虫极科技(北京)有限公司 Intelligent cargo cabinet stability test device and method
CN110058920A (en) * 2019-03-04 2019-07-26 平安科技(深圳)有限公司 Virtual machine performance detection method and device, electronic equipment, storage medium
CN110058920B (en) * 2019-03-04 2023-01-31 平安科技(深圳)有限公司 Virtual machine performance detection method and device, electronic equipment and storage medium
CN109960657A (en) * 2019-03-26 2019-07-02 浪潮商用机器有限公司 A kind of test environment dispositions method and relevant apparatus
CN110941440A (en) * 2019-10-31 2020-03-31 北京浪潮数据技术有限公司 Batch updating method, device and equipment for virtual machines and readable storage medium
CN112187933A (en) * 2020-09-29 2021-01-05 苏州浪潮智能科技有限公司 Method and system for monitoring services in multi-architecture cloud platform
CN116383090A (en) * 2023-05-29 2023-07-04 麒麟软件有限公司 Automatic testing method and platform for kylin system migration tool
CN116383090B (en) * 2023-05-29 2023-08-22 麒麟软件有限公司 Automatic testing method and platform for kylin system migration tool

Similar Documents

Publication Publication Date Title
CN107168880A (en) Virtual machine method of testing and instrument
CN102468985B (en) The method and system of penetration testing is carried out for Network Security Device
US8156485B2 (en) Method and apparatus for creating a pluggable, prioritized configuration engine to be used for configuring a software during installation, update and new profile creation
JP5295269B2 (en) Method for generating component model-based virtual software platform, method for verifying software platform architecture using the same, and apparatus therefor
KR102341154B1 (en) High-speed application for installation on mobile devices for permitting remote configuration of such mobile devices
US20140068334A1 (en) Reliable unit testing through cached mocking
US20120117545A1 (en) Efficiently developing software using test cases to check the conformity of the software to the requirements
CN106325953A (en) Weblogic cluster one-key automatic deployment method
CN102662701A (en) Online CPLD (Complex Programmable Logic Devices) upgrading method, device and business veneer
CN103001801A (en) Network repairing method and device
JP2009087354A (en) Automatic test generation system and method for web application
CN103023699A (en) Network repair method and system
CN108008962A (en) The collocation method and system of PXE server under a kind of linux system
WO2015039793A1 (en) Derivation of generalized test cases
CN109582524A (en) A kind of test method, system and electronic equipment and storage medium
CN110990289B (en) Method and device for automatically submitting bug, electronic equipment and storage medium
CN104484176B (en) A kind of Android system window object acquisition methods and device
CN107590064A (en) A kind of application upgrade method of testing, device and system
CN106649019A (en) Test method for overall automatic PCIE communication quality based on serial port
Seiter et al. Determining relevant model elements for the verification of UML/OCL specifications
JP2008293382A (en) Automatic test specification generation system
CN110244986A (en) Browser configuration method and device
CN106648797A (en) Method and system for installing test software, test server and shared server
CN106557379B (en) Method and device for generating silent installation package
CN110045971A (en) System upgrade restoration methods and device

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170915