CN105407012A - Automatic test method and device - Google Patents
Automatic test method and device Download PDFInfo
- Publication number
- CN105407012A CN105407012A CN201510707941.3A CN201510707941A CN105407012A CN 105407012 A CN105407012 A CN 105407012A CN 201510707941 A CN201510707941 A CN 201510707941A CN 105407012 A CN105407012 A CN 105407012A
- Authority
- CN
- China
- Prior art keywords
- test case
- return value
- test
- preset requirement
- xml file
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Health & Medical Sciences (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明公开了一种自动化测试方法及装置,其中,该自动化测试方法包括:获取并解析预先存储于xml文件中的第一测试用例;执行所述第一测试用例得到第一返回值,判断所述第一返回值是否符合第一预设要求,如果是,则确定与所述第一测试用例对应的测试通过。与现有技术相比,本申请中将用于实现测试功能的测试用例存储于xml文件中,从而在进行测试时,可自动利用xml文件中的测试用例完成测试,因此,对于测试用例的编写只需一次,无需在进行测试时再进行手动输入,降低了人工成本,且避免了由于在测试时手动输入容易造成的输入出错的情况,进而提高了测试准确性。
The invention discloses an automated testing method and device, wherein the automated testing method includes: acquiring and parsing a first test case pre-stored in an xml file; executing the first test case to obtain a first return value, and judging the Whether the first return value meets the first preset requirement, and if so, determine that the test corresponding to the first test case passes. Compared with the prior art, the test case for realizing the test function is stored in the xml file in the present application, so that when testing, the test case in the xml file can be used to complete the test automatically, therefore, for the writing of the test case It only needs to be done once, and there is no need to manually input during testing, which reduces labor costs and avoids input errors that are easily caused by manual input during testing, thereby improving test accuracy.
Description
技术领域technical field
本发明涉及自动化测试技术领域,更具体地说,涉及一种自动化测试方法及装置。The invention relates to the technical field of automated testing, and more specifically, to an automated testing method and device.
背景技术Background technique
随着信息数字化的深入发展,数据存储的需求日益增长,基于网络的虚拟化存储技术成为一种发展趋势,其中,基于FC(FibreChannel,网状通道)协议的SAN(StorageAreaNetworkandSANProtocols,存储局域网及其协议)由于其高性能及极强的扩展性成为近年来应用非常广泛的一种存储系统模型。With the in-depth development of information digitization, the demand for data storage is increasing, and network-based virtual storage technology has become a development trend. Among them, SAN (Storage Area Network and SAN Protocols, storage area network and its protocol) ) has become a storage system model that has been widely used in recent years due to its high performance and strong scalability.
针对SAN的FC协议的测试是实现其功能的基础,现有技术中针对FC协议的测试方法通常是由工作人员通过手动进行输入,进而对输入的指令进行执行已达到测试目的。但是,这种方式所需的人工成本较高,并且在人工输入的过程中往往难以避免输入出错,进而导致测试结果不准确的情况发生。The test for the FC protocol of the SAN is the basis for realizing its functions. The test method for the FC protocol in the prior art is usually manually input by the staff, and then the input command is executed to achieve the test purpose. However, this method requires high labor costs, and it is often difficult to avoid input errors during the manual input process, which leads to inaccurate test results.
综上所述,现有技术中针对SAN的FC协议测试方法存在人工成本较高且测试准确度较低的问题。To sum up, the FC protocol testing method for SAN in the prior art has the problems of high labor cost and low testing accuracy.
发明内容Contents of the invention
本发明的目的是提供一种自动化测试方法及装置,以解决现有技术中针对SAN的FC协议测试方法中存在的人工成本较高且测试准确度较低的问题。The purpose of the present invention is to provide an automatic testing method and device to solve the problems of high labor cost and low testing accuracy existing in the FC protocol testing method for SAN in the prior art.
为了实现上述目的,本发明提供如下技术方案:In order to achieve the above object, the present invention provides the following technical solutions:
一种自动化测试方法,包括:An automated testing method comprising:
获取并解析预先存储于xml文件中的第一测试用例;Obtain and parse the first test case pre-stored in the xml file;
执行所述第一测试用例得到第一返回值,判断所述第一返回值是否符合第一预设要求,如果是,则确定与所述第一测试用例对应的测试通过。Executing the first test case to obtain a first return value, judging whether the first return value meets the first preset requirement, and if so, determining that the test corresponding to the first test case passes.
优选的,所述获取并解析预先存储于xml文件中的第一测试用例,包括:Preferably, the acquisition and parsing of the first test case pre-stored in the xml file includes:
获取预先存储于所述xml文件中的第一测试用例;Obtain the first test case pre-stored in the xml file;
将所述第一测试用例解析成能够被执行的测试用例。The first test case is parsed into a test case that can be executed.
优选的,还包括:Preferably, it also includes:
如果所述第一返回值不符合第一预设要求,则将所述第一返回值及导致所述第一返回值不符合第一预设要求的原因写入到日志文件中。If the first return value does not meet the first preset requirement, write the first return value and a reason for the first return value not meeting the first preset requirement into a log file.
优选的,还包括:Preferably, it also includes:
获取并解析外界输入的第二测试用例;Obtain and parse the second test case input from the outside world;
执行所述第二测试用例得到第二返回值,判断所述第二返回值是否符合第二预设要求,如果是,则确定与所述第二测试用例对应的测试通过,如果否,则将所述第二返回值及导致所述第二返回值不符合第二预设要求的原因写入日志文件中。Executing the second test case to obtain a second return value, judging whether the second return value meets the second preset requirement, if yes, then determining that the test corresponding to the second test case passes, if not, setting The second return value and the reason causing the second return value not meeting the second preset requirement are written into a log file.
优选的,还包括:Preferably, it also includes:
将执行所述第一测试用例或者执行所述第二测试用例对应的执行过程、返回值及测试结果进行输出或者写入到日志文件中。Output or write the execution process, return value, and test result corresponding to the execution of the first test case or the execution of the second test case into a log file.
一种自动化测试装置,包括:An automated testing device, comprising:
第一处理模块,用于获取并解析预先存储于xml文件中的第一测试用例;The first processing module is used to obtain and analyze the first test case pre-stored in the xml file;
第一执行模块,用于执行所述第一测试用例得到第一返回值,判断所述第一返回值是否符合第一预设要求,如果是,则确定与所述第一测试用例对应的测试通过。The first execution module is used to execute the first test case to obtain a first return value, determine whether the first return value meets the first preset requirement, and if so, determine the test corresponding to the first test case pass.
优选的,所述第一处理模块包括:Preferably, the first processing module includes:
获取单元,用于获取预先存储于所述xml文件中的第一测试用例;an acquisition unit, configured to acquire the first test case pre-stored in the xml file;
解析单元,用于将所述第一测试用例解析成能够被执行的测试用例。The parsing unit is configured to parse the first test case into a test case that can be executed.
优选的,还包括:Preferably, it also includes:
记录模块,用于如果所述第一返回值不符合第一预设要求,则将所述第一返回值及导致所述第一返回值不符合第一预设要求的原因写入到日志文件中。A recording module, configured to write the first return value and the reason why the first return value does not meet the first preset requirement to a log file if the first return value does not meet the first preset requirement middle.
优选的,还包括:Preferably, it also includes:
第二处理模块,用于获取并解析外界输入的第二测试用例;The second processing module is used to obtain and analyze the second test case input from the outside world;
第二执行模块,用于执行所述第二测试用例得到第二返回值,判断所述第二返回值是否符合第二预设要求,如果是,则确定与所述第二测试用例对应的测试通过,如果否,则将所述第二返回值及导致所述第二返回值不符合第二预设要求的原因写入日志文件中。The second execution module is used to execute the second test case to obtain a second return value, determine whether the second return value meets the second preset requirement, and if so, determine the test corresponding to the second test case If passed, if not, write the second return value and the reason why the second return value does not meet the second preset requirement into a log file.
优选的,还包括:Preferably, it also includes:
输出模块,用于将执行所述第一测试用例或者执行所述第二测试用例对应的执行过程、返回值及测试结果进行输出或者写入到日志文件中。The output module is configured to output or write the execution process, return value and test result corresponding to the execution of the first test case or the execution of the second test case into a log file.
本发明提供了一种自动化测试方法及装置,其中,该自动化测试方法包括:获取并解析预先存储于xml文件中的第一测试用例;执行所述第一测试用例得到第一返回值,判断所述第一返回值是否符合第一预设要求,如果是,则确定与所述第一测试用例对应的测试通过。与现有技术相比,本申请中将用于实现测试功能的测试用例存储于xml文件中,从而在进行测试时,可自动利用xml文件中的测试用例完成测试,因此,对于测试用例的编写只需一次,无需在进行测试时再进行手动输入,降低了人工成本,且避免了由于在测试时手动输入容易造成的输入出错的情况,进而提高了测试准确性。The present invention provides an automated testing method and device, wherein the automated testing method includes: acquiring and parsing a first test case pre-stored in an xml file; executing the first test case to obtain a first return value, and judging the Whether the first return value meets the first preset requirement, and if so, determine that the test corresponding to the first test case passes. Compared with the prior art, the test case for realizing the test function is stored in the xml file in the present application, so that when testing, the test case in the xml file can be used to complete the test automatically, therefore, for the writing of the test case It only needs to be done once, and there is no need to manually input during testing, which reduces labor costs and avoids input errors that are easily caused by manual input during testing, thereby improving test accuracy.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings on the premise of not paying creative efforts.
图1为本发明实施例提供的一种自动化测试方法的流程图;Fig. 1 is a flow chart of an automated testing method provided by an embodiment of the present invention;
图2为本发明实施例提供的一种自动化测试装置的结构示意图。Fig. 2 is a schematic structural diagram of an automatic testing device provided by an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
请参阅图1,其示出了本发明实施例提供的一种自动化测试方法的流程图,可以包括以下步骤:Please refer to Fig. 1, which shows a flow chart of an automated testing method provided by an embodiment of the present invention, which may include the following steps:
S11:获取并解析预先存储于xml文件中的第一测试用例。S11: Obtain and parse the first test case pre-stored in the xml file.
其中,xml为可扩展标记语言,它可以用来标记数据、定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言。而xml文件中的测试用例即为通过xml实现的。Among them, xml is an extensible markup language, which can be used to mark data and define data types, and is a source language that allows users to define their own markup language. The test cases in the xml file are implemented through xml.
S12:执行第一测试用例得到第一返回值,判断第一返回值是否符合第一预设要求,如果是,则执行步骤S13,如果否,则执行步骤S14。S12: Execute the first test case to obtain the first return value, judge whether the first return value meets the first preset requirement, if yes, execute step S13, and if not, execute step S14.
其中,第一预设要求可以由工作人员根据实际需要进行确定。另外,xml中在包括测试用例的同时还可以包括执行该测试用例后期望得到的测试结果,即期望返回值。因此,第一预设要求可以是将第一返回值与期望返回值进行比对,当二者一致时,则证明第一返回值符合第一预设要求,否则,则证明第一返回值不符合第一预设要求。Wherein, the first preset requirement can be determined by the staff according to actual needs. In addition, while including the test case, the xml may also include the expected test result after executing the test case, that is, the expected return value. Therefore, the first preset requirement may be to compare the first return value with the expected return value. When the two are consistent, it proves that the first return value meets the first preset requirement; Meet the first preset requirement.
S13:确定与第一测试用例对应的测试通过。S13: Determine that the test corresponding to the first test case passes.
S14:确定与第一测试用例对应的测试未通过。S14: Determine that the test corresponding to the first test case fails.
本申请中将用于实现测试功能的测试用例存储于xml文件中,即采用自动化测试脚本,从而在进行测试时,可自动利用xml文件中的测试用例完成测试,因此,对于测试用例的编写只需一次,无需在进行测试时再进行手动输入,降低了人工成本,且避免了由于在测试时手动输入容易造成的输入出错的情况,进而提高了测试准确性。In this application, the test case used to realize the test function is stored in the xml file, that is, an automated test script is adopted, so that when testing, the test case in the xml file can be used to automatically complete the test. Therefore, only the test case is written. It needs to be done once, and there is no need for manual input during testing, which reduces labor costs and avoids input errors that are easily caused by manual input during testing, thereby improving test accuracy.
同时,由于对于测试的完成无需人工进行输入,因此,本发明实施例提供的一种自动测试方法可以实现夜间测试及无人测试,并且,对于同一测试用例,只需编写一次,即,xml文件中的测试用例可以用于进行多次测试,不同于人工输入时对于同一测试用例每次利用该测试用例均需进行手动输入,因此,本申请提供的一种自动测试方法可以有效避免重复劳动。并且,背景技术中提到的手动输入放入方式对于同一测试用例每次输入可能发生变化,而本申请提供的一种自动化测试方法则能够保证对于同一测试用例的多次测试所利用的测试用例相同,进一步提高测试准确性。另外,本申请提供的一种自动化测试方法,也可以有效的屏蔽掉底层硬件,更加方便操作及理解。At the same time, since no manual input is required for the completion of the test, an automatic testing method provided by the embodiment of the present invention can realize night testing and unmanned testing, and, for the same test case, it only needs to be written once, that is, the xml file The test case in can be used for multiple tests, which is different from manual input for the same test case every time the test case is used. Therefore, an automatic test method provided by this application can effectively avoid duplication of labor. Moreover, the manual input method mentioned in the background technology may change for each input of the same test case, but an automated test method provided by this application can ensure that the test cases used for multiple tests of the same test case Same, to further improve the test accuracy. In addition, the automated testing method provided by the present application can also effectively shield the underlying hardware, making it easier to operate and understand.
由于基于FC协议的SAN中,是通过SCSI(SmallComputerSystemInterface,小型计算机系统接口)实现对于数据的存储及读取等操作的,而SCST是SCSItarget中间层子系统,它为SCSItarget驱动提供了统一的内核访问接口,以简化SCSItarget驱动的设计开发。因此,本申请实施例中的测试用例均可以包括执行scst命令的isanadm命令。In the SAN based on the FC protocol, operations such as data storage and reading are realized through SCSI (SmallComputerSystemInterface, small computer system interface), and SCST is the SCSItarget middle layer subsystem, which provides a unified kernel access for the SCSItarget driver interface to simplify the design and development of SCSItarget drivers. Therefore, the test cases in the embodiments of the present application may all include the isanadm command for executing the scst command.
上述实施例提供的一种自动化测试方法中,还可以包括:In an automated testing method provided in the above embodiment, it may also include:
如果第一返回值不符合第一预设要求,则将第一返回值及导致第一返回值不符合第一预设要求的原因写入到日志文件中。If the first return value does not meet the first preset requirement, then write the first return value and the reason why the first return value does not meet the first preset requirement into the log file.
当第一返回值部分和第一预设要求,则说明测试未通过,自动分析第一返回值不符合第一预设要求的原因,将该原因及第一返回值写入到日志文件中,能够供工作人员随时进行查看,以便确定导致测试未通过的原因,进一步作出改进,以在改进之后再次进行步骤S11~S14,直至测试通过为止。When the first return value part meets the first preset requirement, it means that the test has failed, and the reason why the first return value does not meet the first preset requirement is automatically analyzed, and the reason and the first return value are written into the log file, It can be checked by the staff at any time, so as to determine the cause of the failure of the test and make further improvements, so as to perform steps S11 to S14 again after the improvement until the test is passed.
上述实施例提供的一种自动化测试方法中,获取并解析预先存储于xml文件中的第一测试用例,可以包括:In a kind of automated testing method provided by the foregoing embodiment, obtaining and parsing the first test case pre-stored in the xml file may include:
获取预先存储于xml文件中的第一测试用例;Obtain the first test case pre-stored in the xml file;
将第一测试用例解析成能够被执行的测试用例。The first test case is parsed into a test case capable of being executed.
在获取第一测试用例之后,可以对第一测试用例进行检查,在发现第一测试用户不符合被执行的相关要求,即第一测试用例不能直接被执行时,需要对第一测试用例进行解析,以保证其能够被正常执行,保证了本发明实施例提供的一种自动化测试方法的顺利实现。After the first test case is obtained, the first test case can be checked, and when it is found that the first test user does not meet the relevant requirements to be executed, that is, the first test case cannot be directly executed, the first test case needs to be parsed , so as to ensure that it can be executed normally, and ensure the smooth realization of an automated testing method provided by the embodiment of the present invention.
上述实施例提供的一种自动化测试方法中,还可以包括:In an automated testing method provided in the above embodiment, it may also include:
获取并解析外界输入的第二测试用例;Obtain and parse the second test case input from the outside world;
执行第二测试用例得到第二返回值,判断第二返回值是否符合第二预设要求,如果是,则确定与第二测试用例对应的测试通过,如果否,则将第二返回值及导致第二返回值不符合第二预设要求的原因写入日志文件中。Execute the second test case to obtain the second return value, judge whether the second return value meets the second preset requirement, if yes, determine that the test corresponding to the second test case passes, if not, then pass the second return value and result The reason why the second return value does not meet the second preset requirement is written into a log file.
对于与执行第二测试用例相关的具体说明请参照上述实施例公开的执行第一测试用例的相关内容。For the specific description related to the execution of the second test case, please refer to the relevant content of the execution of the first test case disclosed in the above embodiment.
需要说明的是,在一些特殊情况下,需要通过人工进行手动输入测试用例,通过人工输入的测试用例完成对于相关功能的测试。通常情况下,通过人工手动输入测试用例是为了实现检测操作环境,从而保证上述测试步骤的顺利实现。因此,本申请公开的一种自动化测试方法中,既可以完成自动化测试,还可以在特殊情况下完成手动输入测试,完善了功能,也使得测试步骤更为灵活。It should be noted that, in some special cases, it is necessary to manually input test cases, and complete the testing of related functions through the manually input test cases. Usually, the purpose of manually inputting test cases is to realize the detection of the operating environment, so as to ensure the smooth realization of the above test steps. Therefore, in the automated testing method disclosed in the present application, not only the automated testing can be completed, but also the manual input testing can be completed under special circumstances, which improves the functions and makes the testing steps more flexible.
上述实施例提供的一种自动化测试方法中,还可以包括:In an automated testing method provided in the above embodiment, it may also include:
将执行第一测试用例或者执行第二测试用例对应的执行过程、返回值及测试结果进行输出或者写入到日志文件中。Output or write the execution process, return value, and test result corresponding to the execution of the first test case or the execution of the second test case into a log file.
将第一测试用例或者第二测试用例的执行过程、返回值及执行结果进行输出,可以方便工作人员及时获取本次测试的相关信息,而将第一测试用例或者第二测试用例的执行过程、返回值及执行结果写入到日志文件中,可以供工作人员在需要时随时对日志文件中的信息进行查询,其中,执行过程可以包括在执行过程中产生的一些中间变量等,而执行结果则为本次测试是否通过的结果。Outputting the execution process, return value and execution result of the first test case or the second test case can facilitate the staff to obtain the relevant information of this test in time, and the execution process of the first test case or the second test case, The return value and execution result are written into the log file, which can be used by the staff to query the information in the log file at any time when needed. Among them, the execution process can include some intermediate variables generated during the execution process, and the execution result is The result of whether the test is passed or not.
与上述方法实施例相对应,如图2所示,本发明实施例还提供了一种自动化测试装置,可以包括:Corresponding to the above method embodiment, as shown in Figure 2, the embodiment of the present invention also provides an automated testing device, which may include:
第一处理模块21,用于获取并解析预先存储于xml文件中的第一测试用例;The first processing module 21 is used to obtain and parse the first test case pre-stored in the xml file;
第一执行模块22,用于执行第一测试用例得到第一返回值,判断第一返回值是否符合第一预设要求,如果是,则确定与第一测试用例对应的测试通过。The first execution module 22 is configured to execute the first test case to obtain the first return value, judge whether the first return value meets the first preset requirement, and if so, determine that the test corresponding to the first test case passes.
本申请中将用于实现测试功能的测试用例存储于xml文件中,即采用自动化测试脚本,从而在进行测试时,可自动利用xml文件中的测试用例完成测试,因此,对于测试用例的编写只需一次,无需在进行测试时再进行手动输入,降低了人工成本,且避免了由于在测试时手动输入容易造成的输入出错的情况,进而提高了测试准确性。In this application, the test case used to realize the test function is stored in the xml file, that is, an automated test script is adopted, so that when testing, the test case in the xml file can be used to automatically complete the test. Therefore, only the test case is written. It needs to be done once, and there is no need for manual input during testing, which reduces labor costs and avoids input errors that are easily caused by manual input during testing, thereby improving test accuracy.
上述实施例提供的一种自动化测试装置中,第一处理模块可以包括:In the automated testing device provided in the above embodiment, the first processing module may include:
获取单元,用于获取预先存储于xml文件中的第一测试用例;an acquisition unit, configured to acquire the first test case pre-stored in the xml file;
解析单元,用于将第一测试用例解析成能够被执行的测试用例。The parsing unit is configured to parse the first test case into a test case that can be executed.
在获取第一测试用例之后,可以对第一测试用例进行检查,在发现第一测试用户不符合被执行的相关要求,即第一测试用例不能直接被执行时,需要对第一测试用例进行解析,以保证其能够被正常执行,保证了本发明实施例提供的一种自动化测试装置的正常工作。After the first test case is obtained, the first test case can be checked, and when it is found that the first test user does not meet the relevant requirements to be executed, that is, the first test case cannot be directly executed, the first test case needs to be parsed , so as to ensure that it can be executed normally, and ensure the normal operation of the automated testing device provided by the embodiment of the present invention.
上述实施例提供的一种自动化测试装置中,还可以包括:In a kind of automated test device provided by the above-mentioned embodiment, can also include:
记录模块,用于如果第一返回值不符合第一预设要求,则将第一返回值及导致第一返回值不符合第一预设要求的原因写入到日志文件中。The recording module is configured to write the first return value and the reason causing the first return value not meeting the first preset requirement into a log file if the first return value does not meet the first preset requirement.
当第一返回值部分和第一预设要求,则说明测试未通过,自动分析第一返回值不符合第一预设要求的原因,将该原因及第一返回值写入到日志文件中,能够供工作人员随时进行查看When the first return value part meets the first preset requirement, it means that the test has failed, and the reason why the first return value does not meet the first preset requirement is automatically analyzed, and the reason and the first return value are written into the log file, Can be viewed by staff at any time
上述实施例提供的一种自动化测试装置中,还可以包括:In a kind of automated test device provided by the above-mentioned embodiment, can also include:
第二处理模块,用于获取并解析外界输入的第二测试用例;The second processing module is used to obtain and analyze the second test case input from the outside world;
第二执行模块,用于执行第二测试用例得到第二返回值,判断第二返回值是否符合第二预设要求,如果是,则确定与第二测试用例对应的测试通过,如果否,则将第二返回值及导致第二返回值不符合第二预设要求的原因写入日志文件中。The second execution module is used to execute the second test case to obtain the second return value, judge whether the second return value meets the second preset requirement, if yes, determine that the test corresponding to the second test case passes, if not, then Writing the second return value and the reason why the second return value does not meet the second preset requirement into the log file.
因此,通过本申请公开的一种自动化测试装置,既可以完成自动化测试,还可以在特殊情况下完成手动输入测试,完善了功能,也使得测试更为灵活。Therefore, through the automated testing device disclosed in the present application, not only the automated testing can be completed, but also the manual input testing can be completed under special circumstances, which improves the functions and makes the testing more flexible.
并且,上述实施例提供的一种自动化测试中的每个执行模块均可以与其他自动化测试装置进行通信,从而实现分布式自动化测试。Moreover, each execution module in the automated testing provided by the above embodiments can communicate with other automated testing devices, thereby realizing distributed automated testing.
上述实施例提供的一种自动化测试装置中,还可以包括:In a kind of automated test device provided by the above-mentioned embodiment, can also include:
输出模块,用于将执行第一测试用例或者执行第二测试用例对应的执行过程、返回值及测试结果进行输出或者写入到日志文件中。The output module is used to output or write the execution process, return value and test result corresponding to the execution of the first test case or the execution of the second test case into a log file.
将第一测试用例或者第二测试用例的执行过程、返回值及执行结果进行输出,可以方便工作人员及时获取本次测试的相关信息,而将将第一测试用例或者第二测试用例的执行过程、返回值及执行结果写入到日志文件中,可以供工作人员在需要时随时对日志文件中的信息进行查询,其中,执行过程可以包括在执行过程中产生的一些中间变量等,而执行结果则为本次测试是否通过的结果。Outputting the execution process, return value and execution result of the first test case or the second test case can facilitate the staff to obtain the relevant information of this test in time, and the execution process of the first test case or the second test case , the return value and the execution result are written into the log file, which can be used by the staff to query the information in the log file at any time when needed. Among them, the execution process can include some intermediate variables generated during the execution process, and the execution result It is the result of whether the test is passed or not.
需要说明的是,本发明实施例中出现的“第一”及“第二”仅仅是为了区分不同的个体,而不具备任何实际意义。It should be noted that "first" and "second" appearing in the embodiments of the present invention are only for distinguishing different individuals, and do not have any practical meaning.
另外需要说明的是,本发明实施例提供的一种自动化测试方法及装置中的相关功能可以通过xml进行实现:In addition, it should be noted that the related functions in the automated testing method and device provided by the embodiment of the present invention can be realized through xml:
1、对xml文件进行相关设置的语句可以是:1. The statement for setting the xml file can be:
#coding=utf-8#coding=utf-8
importxml.dom.minidom#打开xml文档importxml.dom.minidom#Open xml document
dom=xml.dom.minidom.parse('abc.xml')#得到文档元素对象dom=xml.dom.minidom.parse('abc.xml')#Get the document element object
root=dom.documentElementroot=dom.documentElement
bb=root.getElementsByTagName('caption')bb=root.getElementsByTagName('caption')
b=bb[2]b=bb[2]
printb.nodeNameprintb.nodeName
bb=root.getElementsByTagName('item')bb=root.getElementsByTagName('item')
b=bb[1]b=bb[1]
printb.nodeNameprintb.nodeName
其中,xml.dom.minidom.parse()用于打开一个xml文件,并将这个文件对象dom变量;documentElement用于获取dom变量的文档元素,并该文档元素给root;而对应于每一个结点都有它的nodeName、nodeValue及nodeType属性,其中,nodeName为结点名字,nodeValue是结点的值(只对文本结点有效),nodeType是结点的类型;通过root.getElementsByTagName('caption')获得的是标签为caption的一组标签,b[0]表示该组标签中的第1个,b[2]表示该组标签中的第3个。Among them, xml.dom.minidom.parse() is used to open an xml file, and the file object dom variable; documentElement is used to obtain the document element of the dom variable, and the document element is given to root; and corresponds to each node It has its nodeName, nodeValue and nodeType attributes, among them, nodeName is the node name, nodeValue is the value of the node (only valid for text nodes), nodeType is the type of the node; through root.getElementsByTagName('caption') What is obtained is a set of labels labeled caption, b[0] indicates the first label in the set, and b[2] indicates the third label in the set.
2、可以设置一个通用的框架,以方便的将xml文件中的测试用例通过通用的isanadm管理起来,为其他模块提供这些数据结构的访问接口。其中,Isanadm是执行scst的可执行命令,而进行上述设置语句可以是:2. A common framework can be set up to easily manage the test cases in the xml file through the common isanadm, and provide access interfaces of these data structures for other modules. Among them, Isanadm is an executable command to execute scst, and the above setting statement can be:
(1)首先enabletarget(1) first enabletarget
Isanadm--fc-enable_targetisanadm --fc-enable_target
(2)添加device(2) Add device
Isanadm--fc–open_devDISK0-attributesfilename=/dev/vg0101/lun0,scsi_id=1232,lu_id=1233Isanadm --fc --open_devDISK0-attributes filename=/dev/vg0101/lun0, scsi_id=1232, lu_id=1233
查看是否添加成功:Check whether the addition is successful:
Isanadm-list_deviceIsanadm-list_device
查看device属性View device properties
Isanadm--fc-list_dev_attrDISK0Isanadm --fc-list_dev_attrDISK0
如果添加的device大小有变化,需同步:If the size of the added device changes, it needs to be synchronized:
Isanadm-resync_devDISK0Isanadm-resync_devDISK0
(3)添加group(3) Add group
Isanadm--fc-add_groupgroup_AIsanadm --fc-add_groupgroup_A
查看是否添加成功:Check whether the addition is successful:
Isanadm--fc–list_groupisanadm --fc --list_group
(4)添加lun到group组中(4) Add lun to the group group
Isanadm--fc-add_lun0-groupgroup_A-deviceDISK0Isanadm --fc-add_lun0-groupgroup_A-deviceDISK0
查看是否添加成功:Check whether the addition is successful:
Isanadm--fc-list_lun-groupgroup_AIsanadm --fc-list_lun-groupgroup_A
(5)添加initiator到group组中,initiator为客户端光纤卡的wwn号(5) Add the initiator to the group group, the initiator is the wwn number of the client fiber card
Isanadm--fc-add_init21:00:00:0e:1e:09:94:a4-groupgroup_AIsanadm --fc-add_init21:00:00:0e:1e:09:94:a4-groupgroup_A
查看是否认添加成功:Check whether the addition is successful:
Isanadm--fc-list_init-groupgroup_AIsanadm --fc-list_init-groupgroup_A
(6)如果客户端未能识别映射的磁盘(6) If the client fails to recognize the mapped disk
Isanadm--fc-Issue_lipIsanadm --fc-Issue_lip
对所公开的实施例的上述说明,使本领域技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510707941.3A CN105407012A (en) | 2015-10-27 | 2015-10-27 | Automatic test method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510707941.3A CN105407012A (en) | 2015-10-27 | 2015-10-27 | Automatic test method and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN105407012A true CN105407012A (en) | 2016-03-16 |
Family
ID=55472275
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510707941.3A Pending CN105407012A (en) | 2015-10-27 | 2015-10-27 | Automatic test method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN105407012A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109491919A (en) * | 2018-11-28 | 2019-03-19 | 中电科西北集团有限公司 | A kind of method for testing software and test platform |
| CN110532182A (en) * | 2019-08-22 | 2019-12-03 | 锐捷网络股份有限公司 | A kind of automated testing method and device of virtual platform |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040255275A1 (en) * | 2003-06-11 | 2004-12-16 | Microsoft Corporation | Method and system for generating an efficient test suite from a domain description with given constraints |
| CN1648872A (en) * | 2004-12-08 | 2005-08-03 | 上海科泰世纪科技有限公司 | Automatic detection building method |
| CN101339532A (en) * | 2007-07-06 | 2009-01-07 | 中国银联股份有限公司 | An automated testing method and device for a web application system |
| CN102932205A (en) * | 2012-11-19 | 2013-02-13 | 深圳市亚特尔科技有限公司 | Automatic test method and test platform of network server-side interface |
-
2015
- 2015-10-27 CN CN201510707941.3A patent/CN105407012A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040255275A1 (en) * | 2003-06-11 | 2004-12-16 | Microsoft Corporation | Method and system for generating an efficient test suite from a domain description with given constraints |
| CN1648872A (en) * | 2004-12-08 | 2005-08-03 | 上海科泰世纪科技有限公司 | Automatic detection building method |
| CN101339532A (en) * | 2007-07-06 | 2009-01-07 | 中国银联股份有限公司 | An automated testing method and device for a web application system |
| CN102932205A (en) * | 2012-11-19 | 2013-02-13 | 深圳市亚特尔科技有限公司 | Automatic test method and test platform of network server-side interface |
Non-Patent Citations (1)
| Title |
|---|
| 靳云迪: ""光纤通道网络设备自动化测试技术研究"", 《中国优秀硕士学位论文全文数据库•信息科技辑》 * |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109491919A (en) * | 2018-11-28 | 2019-03-19 | 中电科西北集团有限公司 | A kind of method for testing software and test platform |
| CN109491919B (en) * | 2018-11-28 | 2021-10-26 | 中电科西北集团有限公司 | Software testing method and testing platform |
| CN110532182A (en) * | 2019-08-22 | 2019-12-03 | 锐捷网络股份有限公司 | A kind of automated testing method and device of virtual platform |
| CN110532182B (en) * | 2019-08-22 | 2023-05-16 | 锐捷网络股份有限公司 | Automatic testing method and device for virtualization platform |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11163851B2 (en) | Method, apparatus, computer device and storage medium of page displaying | |
| US11372635B2 (en) | In-memory software package installation and testing | |
| US9720799B1 (en) | Validating applications using object level hierarchy analysis | |
| US11792257B2 (en) | Form engine | |
| US6971090B1 (en) | Common Information Model (CIM) translation to and from Windows Management Interface (WMI) in client server environment | |
| CN104572072B (en) | A kind of language transfer method and equipment to the program based on MVC pattern | |
| CN109726136A (en) | Test method, device, equipment and the storage medium of database | |
| US11074162B2 (en) | System and a method for automated script generation for application testing | |
| US20170052877A1 (en) | Generic test automation for graphical user interface (gui) applications | |
| US11768751B2 (en) | Software performance testing | |
| WO2018120721A1 (en) | Method and system for testing user interface, electronic device, and computer readable storage medium | |
| US11029981B2 (en) | Text resources processing in an application | |
| US9195653B2 (en) | Identification of in-context resources that are not fully localized | |
| US20160124795A1 (en) | Evaluation method and apparatus | |
| US20150242380A1 (en) | Checking testing coverage | |
| US20150261766A1 (en) | Method and apparatus for determining a range of files to be migrated | |
| CN112395843A (en) | PHP code-based service processing method, device, equipment and medium | |
| US20150161160A1 (en) | Application Localization | |
| CN113238796B (en) | Code reconstruction method, device, equipment and storage medium | |
| US11113357B2 (en) | Method and system for onboarding a virtual network function package utilized by one or more network services | |
| US20240338958A1 (en) | Synthetic data fine-tuned optical character recognition engine for extensible markup language document reconstruction | |
| CN105407012A (en) | Automatic test method and device | |
| US10936307B2 (en) | Highlight source code changes in user interface | |
| KR20180076020A (en) | Apparatus and method for application test automation | |
| US8452814B1 (en) | Gathering context in action to support in-context localization |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160316 |
|
| RJ01 | Rejection of invention patent application after publication |