CN103473148A - Method and device for restoring testing environment - Google Patents
Method and device for restoring testing environment Download PDFInfo
- Publication number
- CN103473148A CN103473148A CN2012101887812A CN201210188781A CN103473148A CN 103473148 A CN103473148 A CN 103473148A CN 2012101887812 A CN2012101887812 A CN 2012101887812A CN 201210188781 A CN201210188781 A CN 201210188781A CN 103473148 A CN103473148 A CN 103473148A
- Authority
- CN
- China
- Prior art keywords
- business module
- script file
- operation interface
- interface object
- sign
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Test And Diagnosis Of Digital Computers (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明公开了一种恢复测试环境的方法及装置,不需要外界人为干预,能够按照业务命令之间关联关系智能恢复测试环境。所述方法包括:对业务模块进行自动化测试过程中,按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中;在完成自动化测试后,调用所述脚本文件,按照后进先出的顺序执行所述脚本文件中的清除操作接口对象。所述装置包括脚本文件生成单元和测试环境恢复单元。本发明能够自动清除当前用例的测试数据,且算法简单,易于实现。
The invention discloses a method and device for restoring a test environment, which can intelligently restore the test environment according to the association relationship between business commands without external human intervention. The method includes: during the automated testing of the business modules, writing the clear operation interface object identifiers of the tested business modules into the script file according to the sequence of configuration operations of the tested business modules; After that, the script file is invoked, and the clearing operation interface objects in the script file are executed in the order of last-in-first-out. The device includes a script file generating unit and a test environment restoring unit. The invention can automatically clear the test data of the current use case, and the algorithm is simple and easy to implement.
Description
技术领域 technical field
本发明涉及通信技术领域,具体涉及一种恢复测试环境的方法及装置。The invention relates to the field of communication technology, in particular to a method and device for restoring a test environment.
背景技术 Background technique
测试环境是指测试运行其上的软件和硬件环境的描述,以及任何其它与被测软件交互的软件。任何测试都依赖于测试环境,所以稳定和可控的测试环境,可以使测试人员花费较少的时间就完成测试用例的执行,也无需为测试用例、测试过程的维护花费额外的时间,并且可以保证每一个被提交的缺陷都可以在任何时候被准确的重现。经过良好规划和管理的测试环境,可以尽可能的减少环境的变动对测试工作的不利影响,并可以对测试工作的效率和质量的提高产生积极的作用。A test environment is a description of the software and hardware environment on which the tests run, as well as any other software that interacts with the software under test. Any test depends on the test environment, so a stable and controllable test environment can enable testers to spend less time completing the execution of test cases, and does not need to spend extra time on the maintenance of test cases and test processes, and can Ensure that every reported defect can be accurately reproduced at any time. A well-planned and managed test environment can minimize the adverse impact of environmental changes on the test work, and can play a positive role in improving the efficiency and quality of the test work.
在执行测试过程中,需要时刻保持一个良好的测试环境,就涉及到测试环境的恢复问题。通过恢复测试环境,提供一个干净、良好的测试环境,尽量减少因测试环境中残留的数据;否则,很容易对测试过程及结果造成不必要的干扰作用,增加故障排除难度,所以对测试环境进行有效地恢复,是进行自动化测试的可靠性保证和前提条件。In the process of executing the test, it is necessary to maintain a good test environment at all times, which involves the recovery of the test environment. By restoring the test environment, provide a clean and good test environment, and minimize the residual data in the test environment; otherwise, it is easy to cause unnecessary interference to the test process and results, and increase the difficulty of troubleshooting, so the test environment Effective recovery is the reliability guarantee and prerequisite for automated testing.
目前,业界对于恢复测试环境的操作方法有:将测试环境分解为树状结构、分级排布的多个测试集,之后针对每个测试集进行环境恢复,或者通过备份方式进行环境恢复等等。这几种方法,如果应用在自动化测试过程中,可能会存在几个潜在风险:At present, the industry's operation methods for restoring the test environment include: decomposing the test environment into multiple test sets arranged in a tree structure and hierarchical arrangement, and then restoring the environment for each test set, or restoring the environment through backup, etc. If these methods are applied in the automated testing process, there may be several potential risks:
1、无法实现自动地、安全地进行清除所有相关的业务;1. It is impossible to automatically and safely clear all related businesses;
2、业务命令之间可能存在关联关系,清除业务数据需要注意测试执行先后顺序,否则,会直接导致恢复测试环境失败,这通常需要人为干预。2. There may be a relationship between business commands. To clear business data, you need to pay attention to the order of test execution. Otherwise, it will directly lead to failure to restore the test environment, which usually requires human intervention.
由于这些风险存在,导致了这些方法无法适用于自动化测试领域。Due to the existence of these risks, these methods cannot be applied to the field of automated testing.
发明内容 Contents of the invention
本发明要解决的技术问题是提供一种恢复测试环境的方法及装置,不需要外界人为干预,能够按照业务命令之间关联关系智能恢复测试环境。The technical problem to be solved by the present invention is to provide a method and device for restoring the test environment, which can intelligently restore the test environment according to the association relationship between business commands without external human intervention.
为解决上述问题,本发明提供了一种恢复测试环境方法,包括:In order to solve the above problems, the present invention provides a method for restoring the test environment, including:
对业务模块进行自动化测试过程中,按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中;In the automated testing process of the business modules, write the clearing operation interface object identifiers of each of the tested business modules into the script file according to the sequence of configuration operations of each tested business module;
在完成自动化测试后,调用所述脚本文件,按照后进先出的顺序执行所述脚本文件中的清除操作接口对象。After the automated test is completed, the script file is invoked, and the clearing operation interface objects in the script file are executed in a last-in-first-out sequence.
进一步地,所述按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中,包括:Further, writing the clear operation interface object identifiers of each tested business module into the script file according to the sequence of configuration operations of each tested business module includes:
每进行一个业务模块的业务配置时或配置后,根据该业务模块的标识查找映射表,所述映射表中保存有业务模块与其清除操作接口对象的对应关系,从映射表中获取该业务模块的清除操作接口对象标识,将该清除操作接口对象标识写入脚本文件中,脚本文件中各清除操作接口对象标识写入的先后次序与各清除操作接口对象标识对应的业务模块执行配置操作的先后次序相同。When or after the business configuration of a business module is performed, the mapping table is searched according to the identification of the business module, and the corresponding relationship between the business module and its clearing operation interface object is stored in the mapping table, and the business module is obtained from the mapping table. Clear the operation interface object ID, write the clear operation interface object ID into the script file, the order in which each clear operation interface object ID is written in the script file is the same as the order in which the business modules corresponding to each clear operation interface object ID perform configuration operations same.
进一步地,所述按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中,包括:Further, writing the clear operation interface object identifiers of each tested business module into the script file according to the sequence of configuration operations of each tested business module includes:
每进行一个业务模块的业务配置时或配置后,将该业务模块的标识存入测试日志中;When or after the business configuration of a business module is performed, the identification of the business module is stored in the test log;
从测试日志中读取本次测试的所有业务模块标识,根据业务模块的标识查找映射表,获取本次测试的所有业务模块的清除操作接口对象标识,所述映射表中保存有业务模块与其清除操作接口对象的对应关系;Read all the business module identifications of this test from the test log, search the mapping table according to the identification of the business modules, and obtain the clearing operation interface object identifications of all the business modules of this test, and the business modules and their cleaning operations are stored in the mapping table Correspondence between operation interface objects;
将获取的各业务模块的清除操作接口对象标识按照各业务模块执行配置操作的先后顺序写入脚本文件中。Write the obtained clear operation interface object identifiers of each business module into the script file according to the order in which each business module performs configuration operations.
为解决上述问题,本发明还提供了一种恢复测试环境方法,包括:In order to solve the above problems, the present invention also provides a method for restoring the test environment, including:
对业务模块进行自动化测试过程中,按照与各被测试业务模块的配置操作先后顺序相反的顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中;In the process of automated testing of the business modules, write the clearing operation interface object identifiers of each of the tested business modules into the script file in the reverse order of the configuration operations of each tested business module;
在完成自动化测试后,调用所述脚本文件,按后进后出的顺序执行所述脚本文件中的清除操作接口对象。After the automated test is completed, the script file is invoked, and the clearing operation interface objects in the script file are executed in a last-in, last-out sequence.
进一步地,所述按照与各被测试业务模块的配置操作先后顺序相反的顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中,包括:Further, writing the clear operation interface object identifiers of each tested business module into the script file in the reverse order of the configuration operation sequence of each tested business module includes:
每进行一个业务模块的业务配置时或配置后,将该业务模块的标识存入测试日志中;When or after the business configuration of a business module is performed, the identification of the business module is stored in the test log;
从测试日志中按后进先出的顺序读取本次测试的所有业务模块标识,根据业务模块的标识查找映射表,获取本次测试的所有业务模块的清除操作接口对象标识,所述映射表中保存有业务模块与其清除操作接口对象的对应关系;Read all business module identifications of this test in the order of last-in-first-out from the test log, search the mapping table according to the identification of the business modules, and obtain the clearing operation interface object identifications of all business modules of this test, in the mapping table The corresponding relationship between the business module and its clearing operation interface object is saved;
将获取的各业务模块的清除操作接口对象标识按照与各业务模块执行配置操作先后顺序相反的顺序写入脚本文件中。Write the acquired object identifiers of the clearing operation interfaces of each business module into the script file in the reverse order of the order in which the configuration operations are performed by each business module.
为解决上述问题,本发明还提供了一种恢复测试环境的装置,包括脚本文件生成单元和测试环境恢复单元,其中:In order to solve the above problems, the present invention also provides a device for restoring the test environment, including a script file generation unit and a test environment restoration unit, wherein:
所述脚本文件生成单元,用于在对业务模块进行自动化测试过程中,按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中;The script file generation unit is used to write the clear operation interface object identifiers of each tested business module into the script file according to the sequence of configuration operations of each tested business module during the automated testing of the business modules ;
所述测试环境恢复单元,用于在完成自动化测试后,调用所述脚本文件,按照后进先出的顺序执行所述脚本文件中的清除操作接口对象。The test environment recovery unit is configured to invoke the script file after the automated test is completed, and execute the clearing operation interface objects in the script file in a last-in-first-out sequence.
进一步地,所述装置还包括:映射表单元,用于创建映射表,并将业务模块与其清除操作接口对象的对应关系保存在映射表中;Further, the device further includes: a mapping table unit, configured to create a mapping table, and save the corresponding relationship between the business module and its clearing operation interface object in the mapping table;
所述脚本文件生成单元按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中,包括:The script file generation unit writes the clear operation interface object identification of each tested service module into the script file according to the sequence of configuration operations of each tested service module, including:
所述脚本文件生成单元在每进行一个业务模块的业务配置时或配置后,根据该业务模块的标识查找映射表,获取该业务模块的清除操作接口对象标识,将该清除操作接口对象标识写入脚本文件中,脚本文件中各清除操作接口对象标识写入的先后次序与各清除操作接口对象标识对应的业务模块执行配置操作的先后次序相同。When or after the configuration of a business module, the script file generation unit searches the mapping table according to the identification of the business module, obtains the object identification of the clearing operation interface of the business module, and writes the identification of the clearing operation interface object into In the script file, the order in which the clearing operation interface object identifiers are written in the script file is the same as the order in which the business modules corresponding to the clearing operation interface object identifiers execute configuration operations.
进一步地,所述装置还包括:映射表单元,用于创建映射表,并将业务模块与其清除操作接口对象的对应关系保存在映射表中;Further, the device further includes: a mapping table unit, configured to create a mapping table, and save the corresponding relationship between the business module and its clearing operation interface object in the mapping table;
所述脚本文件生成单元按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中,包括:The script file generation unit writes the clear operation interface object identification of each tested service module into the script file according to the sequence of configuration operations of each tested service module, including:
所述脚本文件生成单元在每进行一个业务模块的业务配置时或配置后,将该业务模块的标识存入测试日志中;从测试日志中读取本次测试的所有业务模块标识,根据业务模块的标识查找映射表,获取本次测试的所有业务模块的清除操作接口对象标识;将获取的各业务模块的清除操作接口对象标识按照各业务模块执行配置操作的先后顺序写入脚本文件中。Described script file generation unit is when carrying out the business configuration of a business module every time or after configuration, stores the mark of this business module in the test log; Reads all business module marks of this test from the test log, according to the business module Search the mapping table for the identification of each business module to obtain the object identification of the clear operation interface of all business modules in this test; write the obtained object identification of the clear operation interface of each business module into the script file according to the order in which the configuration operations are performed by each business module.
为解决上述问题,本发明还提供了一种恢复测试环境的装置,包括脚本文件生成单元和测试环境恢复单元,其中:In order to solve the above problems, the present invention also provides a device for restoring the test environment, including a script file generation unit and a test environment restoration unit, wherein:
所述脚本文件生成单元,用于在对业务模块进行自动化测试过程中,按照与各被测试业务模块的配置操作先后顺序相反的顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中;The script file generation unit is used to write the clear operation interface object identifier of each tested business module into in the script file;
所述测试环境恢复单元,用于在完成自动化测试后,调用所述脚本文件,按后进后出顺序执行所述脚本文件中的清除操作接口对象。The test environment recovery unit is configured to invoke the script file after the automated test is completed, and execute the clearing operation interface objects in the script file in a last-in, last-out sequence.
进一步地,所述装置还包括:映射表单元,用于创建映射表,并将业务模块与其清除操作接口对象的对应关系保存在映射表中;Further, the device further includes: a mapping table unit, configured to create a mapping table, and save the corresponding relationship between the business module and its clearing operation interface object in the mapping table;
所述脚本文件生成单元按照与各被测试业务模块的配置操作先后顺序相反的顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中,包括:The script file generation unit writes the clear operation interface object identifier of each tested service module into the script file in the reverse order of the configuration operation sequence of each tested service module, including:
所述脚本文件生成单元每进行一个业务模块的业务配置时或配置后,将该业务模块的标识存入测试日志中;从测试日志中按后进先出的顺序读取本次测试的所有业务模块标识,根据业务模块的标识查找映射表,获取本次测试的所有业务模块的清除操作接口对象标识;将获取的各业务模块的清除操作接口对象标识按照与各业务模块执行配置操作先后顺序相反的顺序写入脚本文件中。The script file generation unit stores the identification of the business module in the test log every time or after the configuration of a business module; reads all the business modules of this test in the order of last-in-first-out from the test log ID, look up the mapping table according to the ID of the business module, and obtain the clear operation interface object ID of all the business modules in this test; the obtained clear operation interface object ID of each business module is in the reverse order of the configuration operation performed by each business module Sequentially written in the script file.
本发明实施例的装置及方法,只需要对各个业务模块定义唯一的标识符,将标识符和其对应的清除操作接口对象标识整合成一个映射表。当操作自动化测试用例时,根据所配置的业务模块的标识符,在映射表中查找其对应的清除操作接口对象标识,并按顺序写入脚本文件,当测试完成后,即可调用该脚本文件,并按照先进后出的顺序执行,最终实现自动清除测试环境。The device and method of the embodiment of the present invention only need to define a unique identifier for each business module, and integrate the identifier and its corresponding clear operation interface object identifier into a mapping table. When operating an automated test case, according to the identifier of the configured business module, look up the corresponding clear operation interface object identifier in the mapping table, and write the script file in order. After the test is completed, the script file can be called , and execute in the order of first in, last out, and finally realize the automatic cleaning of the test environment.
本发明方案与现有技术方案比较起来,有如下优点:Compared with the prior art scheme, the scheme of the present invention has the following advantages:
1、本发明实施例实现了根据所配置的业务模块,自动清除当前用例的测试数据,而不会清除其他的数据,保证了恢复测试环境的可靠性和安全性;1. The embodiment of the present invention realizes automatically clearing the test data of the current use case according to the configured business modules without clearing other data, ensuring the reliability and safety of the recovery test environment;
2、本发明实施例的自动化测试装置,算法简单,易于实现,只需要根据业务模块的配置信息,同步生成对应的清除操作接口的信息,即可实现智能恢复测试环境的目的。2. The automatic test device of the embodiment of the present invention has a simple algorithm and is easy to implement. It only needs to synchronously generate corresponding clearing operation interface information according to the configuration information of the business module, so as to achieve the purpose of intelligently restoring the test environment.
附图说明 Description of drawings
图1是本发明实施例1流程图;Fig. 1 is a flowchart of Embodiment 1 of the present invention;
图2是本发明实施例2流程图;Fig. 2 is the flow chart of embodiment 2 of the present invention;
图3是映射表的数据结构框图;Fig. 3 is the data structure block diagram of mapping table;
图4是本发明实施例3流程图;Fig. 4 is the flow chart of embodiment 3 of the present invention;
图5是本发明实施例4恢复测试环境装置示意图。Fig. 5 is a schematic diagram of a recovery test environment device according to Embodiment 4 of the present invention.
具体实施方式 Detailed ways
为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.
实施例1Example 1
如图1所示,包括以下步骤110-120:As shown in Figure 1, the following steps 110-120 are included:
步骤110,对业务模块进行自动化测试过程中,按照各被测试业务模块的配置操作的先后顺序将前述各被测试业务模块的清除操作接口对象标识写入脚本文件中;
本文以业务模块作为自动化测试的粒度进行描述,每个业务模块一般包括配置操作接口对象、修改操作接口对象、查询操作接口对象、清除操作接口对象等。在进行自动化测试过程中,有可能执行的是配置操作,或者是配置操作和修改操作,或者是配置操作和查询操作,或者是配置操作、修改操作和查询操作均执行。故可在配置操作时或配置操作后将该配置操作接口对象所属业务模块的清除操作接口对象标识写入脚本文件中。This paper uses business modules as the granularity of automated testing to describe. Each business module generally includes configuring operation interface objects, modifying operation interface objects, querying operation interface objects, clearing operation interface objects, etc. During the automated testing process, it is possible to execute configuration operations, or configuration operations and modification operations, or configuration operations and query operations, or both configuration operations, modification operations, and query operations. Therefore, the clear operation interface object identifier of the business module to which the configuration operation interface object belongs can be written into the script file during or after the configuration operation.
步骤120,在完成自动化测试后,调用所述脚本文件,按照后进先出(先进后出)的顺序执行所述脚本文件中的清除操作接口对象。
通过上述方法保证清除业务数据时先后顺序的正确性,且可以实现自动智能地恢复测试环境,Through the above method, the correctness of the sequence when clearing business data is guaranteed, and the test environment can be restored automatically and intelligently.
在其他实施例中,步骤110中的顺序可以是相反的,即按照与各被测试业务模块的配置操作先后顺序相反的顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中。此时,在步骤120中,执行清除操作接口对象时只要按照脚本文件中的顺序执行即可,即按照后进后出的顺序执行。In other embodiments, the order in
不论采用哪种方式,总之只要保证先进行配置操作的后进行清除,后进行配置操作的先进行清除即可。No matter which method is used, in short, it is only necessary to ensure that the configuration operation is performed first and then cleared, and the configuration operation is performed after the configuration operation is cleared first.
实施例2Example 2
本实施例中提供了将清除操作接口对象标识写入脚本文件中的具体方法。首先为各个被测试业务模块定义各自唯一的标识符,之后创建一张映射表,在映射表中写入所有被测试业务模块的标识符和其对应的清除操作接口对象标识(如名称)。这样,在执行自动化测试过程中,当进行业务配置时,可以通过该被测试业务模块的标识符在映射表中遍历查找其所对应的清除操作接口对象标识,将查找到的接口对象标识按配置的顺序写入到指定的脚本文件中,最后当测试用例执行完,紧接着调用该脚本文件,按照先进后出的顺序执行脚本文件中的清除操作接口对象,就可自动按与配置用例相反顺序清除先前配置的业务数据,达到智能恢复测试环境目的。This embodiment provides a specific method for writing the clear operation interface object identifier into the script file. First, define unique identifiers for each tested business module, and then create a mapping table, write the identifiers of all tested business modules and their corresponding clear operation interface object identifiers (such as names) in the mapping table. In this way, during the execution of the automated test, when performing business configuration, the identifier of the tested business module can be used to traverse the mapping table to find its corresponding clear operation interface object identifier, and the interface object identifier found can be configured according to the configuration Write them into the specified script file in the order of the test case, and finally when the test case is executed, the script file is called immediately, and the clearing operation interface objects in the script file are executed in the order of first in, last out, and the reverse order of the configuration case can be automatically executed. Clear the previously configured business data to achieve the purpose of intelligent recovery test environment.
如图2所示,具体包括以下步骤:As shown in Figure 2, it specifically includes the following steps:
步骤210,为各个被测试业务模块设置标识符,用以唯一标识该业务模块;
步骤220,将各个被测试业务模块的标识符和其清除操作接口对象标识写入映射表中;Step 220, write the identifier of each tested business module and its clearing operation interface object identifier into the mapping table;
上述步骤210和220是为被测试业务模块设置标识,并配置映射表,在测试过程中,如果有新增的被测试模块加入,则为新增的被测试模块配置标识符,并将该新增被测试模块的清除操作接口对象标识写入映射表。The above-mentioned
或者,在其他实施例中,步骤210中可以针对所有业务模块设置标识符,而步骤220中只针对被测试业务模块创建映射表。Or, in other embodiments, in
或者,在其他实施例中也可以预先为所有的业务模块设置标识符,并将该标识符和业务模块对应的清除操作接口对象标识写入映射表。Alternatively, in other embodiments, identifiers may be set for all business modules in advance, and the identifiers and the corresponding clear operation interface object identifiers of the business modules are written into the mapping table.
通过创建映射表,以描述业务模块的标识符与其清除操作接口对象标识之间的一一对应关系,如图3所示,映射表的每一个数据项,都是由业务模块的标识符与其清除操作接口标识符组成,并以业务模块的标识符作为表的主键。By creating a mapping table to describe the one-to-one correspondence between the identifier of the business module and the object identifier of the clearing operation interface, as shown in Figure 3, each data item in the mapping table is determined by the identifier of the business module and its clearing Composed of operation interface identifiers, and the identifier of the business module is used as the primary key of the table.
步骤230,在自动化测试测试用例过程当中,执行业务模块的配置操作接口对象时,或执行配置操作接口对象后,根据该业务模块的标识符,在映射表中遍历查找对应的清除操作接口对象标识,将其写入生成的可执行的脚本文件中;
如果在映射表中,没有匹配到目标业务模块的清除操作接口对象标识,则执行步骤220,查找并在映射表中写入该业务模块的清除操作接口对象标识。If there is no match in the mapping table for the clearing operation interface object identifier of the target business module, then step 220 is performed to search for and write the clearing operation interface object identifier of the business module in the mapping table.
为了实现正确的恢复,在本实施例中按照执行配置操作的顺序将业务模块的标识符写入脚本文件。In order to achieve correct recovery, in this embodiment, the identifiers of the business modules are written into the script file in accordance with the order in which the configuration operations are performed.
实质上,以业务模块的标识符作为桥梁,在该业务模块的配置操作接口对象和清除操作接口对象之间建立其映射关系。当所要测试的业务模块的配置操作接口对象执行完后,即可同步生成一个脚本文件,包含对应的清除操作接口对象标识。In essence, the identifier of the business module is used as a bridge to establish a mapping relationship between the configuration operation interface object and the clear operation interface object of the business module. After the configuration operation interface object of the business module to be tested is executed, a script file can be generated synchronously, including the corresponding clear operation interface object identifier.
步骤240,在完成自动化测试用例执行时,调用上述脚本文件,按先进后出即后进先出的顺序执行清除操作接口对象。Step 240, when the execution of the automated test case is completed, the above-mentioned script file is invoked, and the clearing operation interface objects are executed in the order of first-in-last-out or last-in-first-out.
只要保证清除操作接口对象与配置操作接口对象的执行顺序相反,即可避免业务模块间的关联关系问题。As long as the execution order of clearing the operation interface object and configuring the operation interface object are reversed, the problem of association relationship between business modules can be avoided.
根据所配置的业务模块,调用其清除操作接口对象,只会清除配置的测试数据,而不会清除其他数据,这样保证不会破坏测试环境。According to the configured business module, calling its clear operation interface object will only clear the configured test data, but not other data, so as to ensure that the test environment will not be damaged.
实施例3Example 3
本实施例提供另一智能恢复测试环境具体示例,如图4所示,包括如下步骤:This embodiment provides another specific example of an intelligent recovery test environment, as shown in Figure 4, including the following steps:
步骤310,对每个业务模块定义一个ID号,用以唯一标识该业务模块;
步骤320,将所有业务模块的ID号及其清除操作接口对象标识写入映射表中,形成一一对应关系;
步骤330,在进行自动化测试过程中,每执行一个业务模块的配置操作接口对象时,将该业务模块的ID号存进测试日志中;
步骤340,从该测试日志中按照配置操作的先后顺序读取本次测试用例的所有业务模块ID号,根据这些业务模块ID号,在映射表中查找其对应的清除操作接口对象标识;
步骤350,将查找到的清除操作接口对象标识按照先后顺序,写入可执行脚本文件中,脚本文件中各清除操作接口对象标识写入的先后次序与各清除操作接口对象标识对应的业务模块执行配置操作的先后次序相同,即先执行的业务模块的清除操作接口对象标识先写入脚本文件;Step 350, write the found clearing operation interface object identifiers in the executable script file according to the sequence, and the order in which each clearing operation interface object identifier is written in the script file is executed by the business module corresponding to each clearing operation interface object identifier The order of configuration operations is the same, that is, the clear operation interface object identifier of the business module executed first is written into the script file first;
写入脚本文件时也可以按照读取业务模块ID号相反的顺序进行,这样在步骤360执行脚本文件时,就可以按照写入的顺序执行了。Writing the script file can also be performed in the reverse order of reading the business module ID number, so that when the script file is executed in
步骤360,在完成自动化测试用例执行之后,调用该脚本文件,按先进后出顺序依次执行清除操作接口对象,完成对所配置数据的清除操作,实现智能化的测试环境恢复目的。In
实施例4Example 4
本实施例介绍实现上述方法的装置,如图5所示,包括脚本文件生成单元和测试环境恢复单元,其中:This embodiment introduces the device for implementing the above method, as shown in Figure 5, including a script file generation unit and a test environment recovery unit, wherein:
该脚本文件生成单元,用于在对业务模块进行自动化测试过程中,按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中;The script file generation unit is used to write the clearing operation interface object identifiers of each tested business module into the script file according to the sequence of configuration operations of each tested business module during the automated testing of the business modules;
该测试环境恢复单元,用于在完成自动化测试后,调用所述脚本文件,按照后进先出的顺序执行所述脚本文件中的清除操作接口对象。The test environment recovery unit is configured to invoke the script file after the automated test is completed, and execute the clearing operation interface objects in the script file in a last-in-first-out sequence.
优选地,该装置还包括:映射表单元,用于创建映射表,并将业务模块与其清除操作接口对象的对应关系保存在映射表中。Preferably, the device further includes: a mapping table unit, configured to create a mapping table, and store the corresponding relationship between the service module and its clearing operation interface object in the mapping table.
脚本文件生成单元可以采用以下方式中的任一种实现按照各被测试业务模块的配置操作的先后顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中:The script file generation unit can adopt any one of the following ways to realize that the clearing operation interface object identification of each tested business module is written in the script file according to the sequence of configuration operations of each tested business module:
1、脚本文件生成单元在每进行一个业务模块的业务配置时或配置后,根据该业务模块的标识查找映射表,获取该业务模块的清除操作接口对象标识,将该清除操作接口对象标识写入脚本文件中,脚本文件中各清除操作接口对象标识写入的先后次序与各清除操作接口对象标识对应的业务模块执行配置操作的先后次序相同;1. The script file generating unit searches the mapping table according to the identification of the business module during or after the business configuration of a business module, obtains the object identification of the clear operation interface of the business module, and writes the object identification of the clear operation interface into In the script file, the order in which the object identifiers of the clearing operation interface are written in the script file is the same as the order in which the business modules corresponding to the object identifiers of the clearing operation interface execute configuration operations;
2、脚本文件生成单元在每进行一个业务模块的业务配置时或配置后,将该业务模块的标识存入测试日志中;从测试日志中读取本次测试的所有业务模块标识,根据业务模块的标识查找映射表,获取本次测试的所有业务模块的清除操作接口对象标识;将获取的各业务模块的清除操作接口对象标识按照各业务模块执行配置操作的先后顺序写入脚本文件中。2. The script file generation unit stores the identification of the business module in the test log when or after the configuration of a business module; reads all the business module identifications of this test from the test log, and according to the business module Search the mapping table for the identification of each business module to obtain the object identification of the clear operation interface of all business modules in this test; write the obtained object identification of the clear operation interface of each business module into the script file according to the order in which the configuration operations are performed by each business module.
实施例5Example 5
本实施例介绍实现上述方法的另一种装置,如图5所示,包括脚本文件生成单元和测试环境恢复单元,其中:This embodiment introduces another device for implementing the above method, as shown in Figure 5, including a script file generation unit and a test environment recovery unit, wherein:
该脚本文件生成单元,用于在对业务模块进行自动化测试过程中,按照与各被测试业务模块的配置操作先后顺序相反的顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中;The script file generation unit is used to write the clear operation interface object identifiers of each tested business module into the script in the reverse order of the configuration operation sequence of each tested business module during the automated testing process of the business modules in the file;
该测试环境恢复单元,用于在完成自动化测试后,调用所述脚本文件,按后进后出顺序执行所述脚本文件中的清除操作接口对象。The test environment restoration unit is configured to invoke the script file after the automated test is completed, and execute the clearing operation interface objects in the script file in a last-in, last-out sequence.
优选地,该装置还包括:映射表单元,用于创建映射表,并将业务模块与其清除操作接口对象的对应关系保存在映射表中;Preferably, the device further includes: a mapping table unit, configured to create a mapping table, and store the corresponding relationship between the business module and its clearing operation interface object in the mapping table;
所述脚本文件生成单元采用以下方式实现:按照与各被测试业务模块的配置操作先后顺序相反的顺序将所述各被测试业务模块的清除操作接口对象标识写入脚本文件中:The script file generation unit is implemented in the following manner: write the clearing operation interface object identification of each tested service module into the script file in the reverse order with the configuration operation sequence of each tested service module:
脚本文件生成单元每进行一个业务模块的业务配置时或配置后,将该业务模块的标识存入测试日志中;从测试日志中按后进先出的顺序读取本次测试的所有业务模块标识,根据业务模块的标识查找映射表,获取本次测试的所有业务模块的清除操作接口对象标识;将获取的各业务模块的清除操作接口对象标识按照与各业务模块执行配置操作先后顺序相反的顺序写入脚本文件中。When the script file generating unit performs the business configuration of a business module or after configuration, store the identification of the business module in the test log; read all the business module identifications of this test in the order of last-in-first-out from the test log, Search the mapping table according to the identification of the business module to obtain the object identification of the clear operation interface of all the business modules in this test; write the object identification of the clear operation interface of each business module obtained in the order opposite to the order in which the configuration operations are performed by each business module into the script file.
如果各业务模块尚无标识,则可在上述实施例4或实施例5所述装置中增加一标识符设置模块,用于为各业务模块设置标识符。If there is no identification for each business module, an identifier setting module may be added to the device described in Embodiment 4 or Embodiment 5 above to set an identifier for each business module.
综上所述,本文提供的在自动化测试过程中智能恢复测试环境的装置及方法很好地解决了现有技术方案的缺陷,实现了对所配置的测试数据进行清除的智能化,并解决了业务命令之间的关联关系问题。该方法简单可靠,实现该方法的装置经过实际测试,结果稳定可靠。To sum up, the device and method for intelligently restoring the test environment in the process of automated testing provided in this paper solve the defects of the existing technical solutions well, realize the intelligentization of clearing the configured test data, and solve the problem of The relationship between business commands. The method is simple and reliable, and the device for realizing the method is actually tested, and the result is stable and reliable.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本发明不限制于任何特定形式的硬件和软件的结合。Those skilled in the art can understand that all or part of the steps in the above method can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk or an optical disk, and the like. Optionally, all or part of the steps in the foregoing embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the foregoing embodiments may be implemented in the form of hardware, or may be implemented in the form of software function modules. The present invention is not limited to any specific combination of hardware and software.
当然,本发明还可有其他多种实施例,在不背离本发明精神及其实质的情况下,熟悉本领域的技术人员当可根据本发明作出各种相应的改变和变形,但这些相应的改变和变形都应属于本发明所附的权利要求的保护范围。Of course, the present invention can also have other various embodiments, and those skilled in the art can make various corresponding changes and deformations according to the present invention without departing from the spirit and essence of the present invention, but these corresponding Changes and deformations should belong to the scope of protection of the appended claims of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210188781.2A CN103473148B (en) | 2012-06-08 | 2012-06-08 | One kind recovers test environment method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210188781.2A CN103473148B (en) | 2012-06-08 | 2012-06-08 | One kind recovers test environment method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103473148A true CN103473148A (en) | 2013-12-25 |
| CN103473148B CN103473148B (en) | 2017-10-10 |
Family
ID=49798014
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210188781.2A Expired - Fee Related CN103473148B (en) | 2012-06-08 | 2012-06-08 | One kind recovers test environment method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103473148B (en) |
Cited By (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105701000A (en) * | 2014-11-25 | 2016-06-22 | 中兴通讯股份有限公司 | Service testing method and device |
| CN106126427A (en) * | 2016-07-06 | 2016-11-16 | 中国银联股份有限公司 | A kind of method and system of fast quick-recovery test |
| CN107749800A (en) * | 2017-09-22 | 2018-03-02 | 安徽皖通邮电股份有限公司 | A kind of method realized the configuration of communication equipment automatic test and implicitly deleted |
| CN110928771A (en) * | 2019-10-30 | 2020-03-27 | 苏州浪潮智能科技有限公司 | Method and system for timed automatic batch test of Rest interfaces |
| CN111274140A (en) * | 2020-01-19 | 2020-06-12 | 苏州浪潮智能科技有限公司 | Apparatus, method, and server for performing on-site recovery for automated use cases |
| CN111309598A (en) * | 2020-01-19 | 2020-06-19 | 苏州浪潮智能科技有限公司 | Test case execution environment recovery method, system, terminal and storage medium |
| CN114780436A (en) * | 2022-05-17 | 2022-07-22 | 中电云数智科技有限公司 | Method and device for directionally cleaning system data |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1851655A (en) * | 2005-11-07 | 2006-10-25 | 华为技术有限公司 | Method for realizing product automatic test by test environment composed of test set |
| CN101043543A (en) * | 2006-03-24 | 2007-09-26 | 中兴通讯股份有限公司 | An automated testing tool and method for a program-controlled switchboard |
| CN101079000A (en) * | 2007-05-29 | 2007-11-28 | 华为技术有限公司 | Automated test method and apparatus for quick positioning question |
| JP2008293382A (en) * | 2007-05-25 | 2008-12-04 | Fuji Electric Holdings Co Ltd | Automatic test specification generation method |
| CN101329652A (en) * | 2008-07-30 | 2008-12-24 | 中兴通讯股份有限公司 | A regression test automation system and method |
| US20090070742A1 (en) * | 2003-05-27 | 2009-03-12 | Venkata Subbarao Voruganti | Method of converting a regression test script of an automated testing tool into a function |
| US20090249297A1 (en) * | 2008-03-25 | 2009-10-01 | Lehman Brothers Inc. | Method and System for Automated Testing of Computer Applications |
| CN102043716A (en) * | 2010-12-24 | 2011-05-04 | 南京联创科技集团股份有限公司 | Automatic software testing method based on business driving |
-
2012
- 2012-06-08 CN CN201210188781.2A patent/CN103473148B/en not_active Expired - Fee Related
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090070742A1 (en) * | 2003-05-27 | 2009-03-12 | Venkata Subbarao Voruganti | Method of converting a regression test script of an automated testing tool into a function |
| CN1851655A (en) * | 2005-11-07 | 2006-10-25 | 华为技术有限公司 | Method for realizing product automatic test by test environment composed of test set |
| CN101043543A (en) * | 2006-03-24 | 2007-09-26 | 中兴通讯股份有限公司 | An automated testing tool and method for a program-controlled switchboard |
| JP2008293382A (en) * | 2007-05-25 | 2008-12-04 | Fuji Electric Holdings Co Ltd | Automatic test specification generation method |
| CN101079000A (en) * | 2007-05-29 | 2007-11-28 | 华为技术有限公司 | Automated test method and apparatus for quick positioning question |
| US20090249297A1 (en) * | 2008-03-25 | 2009-10-01 | Lehman Brothers Inc. | Method and System for Automated Testing of Computer Applications |
| CN101329652A (en) * | 2008-07-30 | 2008-12-24 | 中兴通讯股份有限公司 | A regression test automation system and method |
| CN102043716A (en) * | 2010-12-24 | 2011-05-04 | 南京联创科技集团股份有限公司 | Automatic software testing method based on business driving |
Cited By (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105701000A (en) * | 2014-11-25 | 2016-06-22 | 中兴通讯股份有限公司 | Service testing method and device |
| CN105701000B (en) * | 2014-11-25 | 2019-05-07 | 中兴通讯股份有限公司 | Service testing method and device |
| CN106126427A (en) * | 2016-07-06 | 2016-11-16 | 中国银联股份有限公司 | A kind of method and system of fast quick-recovery test |
| CN107749800A (en) * | 2017-09-22 | 2018-03-02 | 安徽皖通邮电股份有限公司 | A kind of method realized the configuration of communication equipment automatic test and implicitly deleted |
| CN110928771A (en) * | 2019-10-30 | 2020-03-27 | 苏州浪潮智能科技有限公司 | Method and system for timed automatic batch test of Rest interfaces |
| CN111274140A (en) * | 2020-01-19 | 2020-06-12 | 苏州浪潮智能科技有限公司 | Apparatus, method, and server for performing on-site recovery for automated use cases |
| CN111309598A (en) * | 2020-01-19 | 2020-06-19 | 苏州浪潮智能科技有限公司 | Test case execution environment recovery method, system, terminal and storage medium |
| CN114780436A (en) * | 2022-05-17 | 2022-07-22 | 中电云数智科技有限公司 | Method and device for directionally cleaning system data |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103473148B (en) | 2017-10-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103473148B (en) | One kind recovers test environment method and device | |
| CN111352651A (en) | Code branch management method and device | |
| US9189135B2 (en) | Three-dimensional GUI object stores in automation test tools | |
| US9015530B2 (en) | Reliably testing virtual machine failover using differencing disks | |
| CN111651353A (en) | Method, apparatus, electronic device and storage medium for fault injection | |
| CN110008129B (en) | Reliability test method, device and equipment for storage timing snapshot | |
| CN101819543A (en) | Snapshot data processing method, system and storage device | |
| CN104778118B (en) | The improved method of automatization testing technique | |
| CN102411538B (en) | Method for restoring test script of graphical user interface based on event reachability mode | |
| CN109324918A (en) | Application program exception handling method and device, terminal and storage medium | |
| CN105279196A (en) | Test script generation method and apparatus | |
| CN106649125A (en) | Method and frame system for establishing multi-platform-supporting automatic testing script | |
| CN103064759B (en) | The method of data restore and device | |
| CN105938445B (en) | Data back up method and device | |
| CN105159944A (en) | Database emergency handling method and system | |
| CN108874611A (en) | A kind of construction method and device of test data | |
| CN105573788A (en) | Patch processing method and device as well as patch generation method and device | |
| CN108804257A (en) | SOT state of termination detection method, device, terminal and storage medium | |
| CN106469115A (en) | A kind of telecommunication network management automatic software test method and device | |
| CN107818010A (en) | The method and apparatus switched between different maps | |
| CN103593295B (en) | A kind of multi-branch software defect tracking and system | |
| CN104407932A (en) | Data backup method and device | |
| CN117439867B (en) | Cluster upgrade fault handling method, device, equipment and storage medium | |
| CN106776296A (en) | Startup method, device and starting device that coverage rate is detected | |
| CN105740146A (en) | Method and device for fast positioning change of test script of mobile terminal |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20171010 Termination date: 20200608 |
