WO2009076827A1 - 一种自动化测试方法、系统及一种测试设备 - Google Patents
一种自动化测试方法、系统及一种测试设备 Download PDFInfo
- Publication number
- WO2009076827A1 WO2009076827A1 PCT/CN2008/073186 CN2008073186W WO2009076827A1 WO 2009076827 A1 WO2009076827 A1 WO 2009076827A1 CN 2008073186 W CN2008073186 W CN 2008073186W WO 2009076827 A1 WO2009076827 A1 WO 2009076827A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- test
- difference
- device under
- under test
- automated
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/368—Test management for test version control, e.g. updating test cases to a new software version
Definitions
- the present invention relates to the field of automated testing, and in particular to an automated test method, system and test apparatus.
- Automated testing of equipment is a relatively large part of the testing field. Although automated testing technology is not a new technology, it is still not perfect and can provide automated testing technology for effective product quality.
- One of the important reasons is that when the software level of the device under test, such as the command line changes, the corresponding automated test script corresponding to the original command line will not be available. In this case, the tester needs to modify the automated test script. When the number is large, the workload of the maintenance script will increase. Since in one test cycle, the automated test and the manual test are performed simultaneously to achieve mutual verification, but when a new software version is generated and the corresponding automated test script has not been modified, it will result in the end of a test cycle.
- script 1 corresponds to device under test 1
- the configuration commands to be called during test are command 1, command 2, command 3, command 4, and command 5
- 2 corresponds to the device under test 2
- the configuration commands to be called during the test are command 1, command 2, command 4, command 5, and command 6
- script 3 corresponds to the device under test 3
- the configuration command to be called during the test is command 1, command 2.
- a small script a and a small script b are written, wherein the small script a calls the configuration command 1 and the command 2, and the small script b calls the configuration command 4 and the command 5.
- the script 1 sequentially calls the configuration command of the small script a when testing the device 1.
- Script 2 calls Small Script a, Small Script b, Configuration Command 6 in Test Device 2; Script 3
- the small script a, the small script b, the configuration command 3, and the configuration command 6 are sequentially called.
- An automated test method including:
- the test command is sent to the device under test for testing.
- An automated test system comprising a test device and at least one device under test that is tested according to test commands
- the test device is configured to run an automated test script to obtain a difference attribute of the device under test, invoke a test command corresponding to the difference attribute of the device under test, and send the test command to the device under test for testing. .
- a test device comprising:
- a obtaining unit configured to run an automated test script to obtain a difference attribute of the device under test
- the calling unit is configured to invoke a test command corresponding to the difference attribute of the device under test
- the sending unit is configured to send the test command to the device under test for testing.
- the difference attribute of the device under test is obtained by running an automatic test script, and the test script corresponding to the difference attribute of the device under test is invoked by running the automatic test script, and then the test command is executed. It is sent to the device under test for testing.
- the test command corresponding to the device under test is not directly written into the automated test script, but the test command can be saved by constructing a separate database, so when the test command is changed, the automated test script need not be performed one by one. Changes, as long as the corresponding test command in the database can be modified, the workload of maintaining the automated test script during the test is reduced, so that the automation script can quickly adapt to the changes of the test command.
- Figure 1 is a flow chart of a first embodiment of the method of the present invention
- FIG. 2 is a flow chart of a second embodiment of the method of the present invention.
- FIG. 3 is a schematic flow chart of an automated test embodiment of the present invention.
- Figure 4 is a block diagram of a first embodiment of the system of the present invention.
- Figure 5 is a block diagram of a second embodiment of the system of the present invention.
- Figure 6 is a block diagram of a first embodiment of a test apparatus of the present invention.
- Figure 7 is a block diagram of a second embodiment of a test apparatus of the present invention.
- An embodiment of the present invention provides an automated test method, a system, and a test device.
- an automatic test script is run to obtain a difference attribute of the device under test, and an automated test script is invoked to call a test corresponding to the difference attribute of the device under test.
- the command is sent to the device under test for testing.
- Block Diagram 101 Run an automated test script to get the difference properties of the device under test.
- Block 102 Running an automated test script to call the test attribute corresponding to the difference attribute of the device under test Order.
- the device under test and its difference attribute may be pre-stored, that is, after analyzing the difference attribute of the device under test, the difference attribute of the device under test is written into the test file.
- the difference attribute of the device under test and its corresponding test command are saved in a pre-configured difference library of the device under test, and the difference library may be a differential library based on XML (Extensible Markup Language) or based on SQL.
- a difference library Structured Query Language, Structured Query Language
- a difference library based on a data structure.
- the automated test script includes a logical device name and a method for calling the logical device, where the method corresponds to a similar difference attribute in the difference library of the device under test, and the logical device is saved in a topology file.
- the corresponding logical device in the topology file is searched according to the logical device name in the automated test script, and the logical device maps the device under test to obtain the device under test corresponding to the logical device, and the current device is obtained.
- the difference attribute of the device under test is assigned to the logic device, and the test command corresponding to the difference attribute is invoked in the device difference library of the device by the given difference attribute.
- Block diagram 103 Send the test command to the device under test for testing.
- FIG. 2 shows the details of the automated test of the device under test after the test command corresponding to the device under test is saved in a preset XML difference library.
- Block Diagram 201 Analyze the difference properties of the device under test.
- Analysis of the difference attribute of the device under test is to analyze the factors that cause the test command of the device under test to differ. For example, the type of the product is different, the version of the product is different, or the physical interface of the device under test is different. Common factors that cause differences in commands.
- Block 202 Write the device under test and its difference properties to the test file.
- the test file in the embodiment of the present invention generally refers to a test bed file based on a corresponding automated test framework, and the test bed file is used to record the difference attribute of the device under test and the analyzed device under test, for example, the difference attribute corresponding to the device A under test.
- the test bed file is used to record the difference attribute of the device under test and the analyzed device under test, for example, the difference attribute corresponding to the device A under test.
- Block 203 Find the corresponding logical device in the topology file based on the logical device name in the automated test script.
- test equipment In addition to the test files corresponding to the automated test framework, the test equipment also includes the automated test The topology file corresponding to the framework, and the logical file is saved in the topology file.
- the automated test script includes the logical device name and the method invoked by the logical device.
- an automated test script can be described as follows: RTA AW1, where RTA is the logical device name saved in the topology file, and AW1 is the A method that a logical device can call, which corresponds to the same type of difference attribute in the difference library of the device under test.
- the name of the logical device through the automation script can find the corresponding logical device in the topology file.
- Block 204 The logical device is mapped to the corresponding device under test in the test file.
- a relationship between a logical device and a device under test is usually formed. If the device under test is the device A to be tested, the mapping relationship is a logical device. The RTA is mapped to the device under test A.
- Block 205 Obtain the difference attribute saved by the device under test in the test file.
- the difference attribute of the device under test stored in the test file is assigned to the logical device according to the device under test to which the logical device is mapped, for example, the difference attribute product X_version Y of the device A to be tested is assigned to the logical device RTA.
- Block diagram 206 The test command corresponding to the difference attribute is called in the XML difference library by the difference attribute.
- the difference library for storing the difference attribute between devices in the method embodiment is an XML difference library pre-established based on XML.
- XML is a simple data storage language that uses a series of simple tags to describe data, and these tags can be built in a convenient way, and XML has powerful data storage and analysis capabilities, such as: data indexing, sorting, finding, correlation Consistency, etc., XML only shows data.
- the simplicity of XML makes it easy to read and write data in any application. This makes XML the only common language for data exchange.
- XML can be combined with information generated under the operating system platform, and XML The data is loaded into the program for analysis, and finally the results are output in XML format.
- the pre-analyzed difference attribute of the device under test and the test command corresponding to the difference attribute are saved, and the similar difference attribute has a unified name and is saved in the same directory, and the name is in the automatic test script.
- the names of the methods invoked by the logical device are the same, so that the logical device can call the test command corresponding to the difference attribute in the XML difference library according to the given difference attribute.
- the difference attribute of the corresponding method and version in the XML difference library has the unified name AW1
- the difference attribute product X-version Y of the device under test A is also located in the directory of AW1
- the test command corresponding to the difference attribute product X-version Y is the command M
- the logical device RTA is based on the differentiated attribute product X-version Y.
- the test command M corresponding to the difference attribute product X-version Y can be found by calling the method AW1 in the automated test script.
- Block 207 The test command is sent to the current device under test for testing.
- the automated test framework tests the device A under test based on the test command M of the device under test A called in the XML difference library.
- FIG. 3 a schematic diagram of the flow of the automated test embodiment: The figure shows an automated test framework, test bed files and topology files corresponding to the automated test framework, automated test scripts, XML difference libraries, and Measuring equipment eight.
- the specific difference attribute is the product and the version.
- the XML command line difference library is established by analyzing the difference attribute, and the command line stored in the difference library is first. The differences between them are shown in Table 1 below:
- the specific test corresponds to other difference attributes.
- the method in the AW1 directory of the XML difference library can also store the other difference attributes, such as the return information of the command line, that is, the method AW1 is only called when calling. The actual test command is not called directly.
- Block 301 The analyzed difference attribute product 3 - version 5 of device A is written into the test bed file, and "Device A - Product 3 - Version 5" is saved in the test bed file.
- Block 302 The automated test script is specifically "RTA AW1", and the corresponding logical device RTA is found in the topology file according to the logical device name "RTA" in the automated test script.
- Block 303 According to the logical device, the RTA is mapped to the current device under test A in the test bed file, and the difference attribute product 3 - version 5 of the device under test A is assigned to the logical device RTA.
- Block diagram 304 The logic device RTA invokes the real test command corresponding to the parameter in the XML difference library by using the method function AW1 in the automated test script with the difference attribute product 3 - version 5 as a parameter, that is, according to the above table 1, through AW1
- the actual test command called is 555555.
- Block 305 The actual test command 555555 is sent to the device A under test corresponding to the difference attribute product 3 - version 5.
- Block 306 ⁇ The actual test command 555555 automates testing of device A.
- the automatic test script does not include the actual test command, only the method name that can call the corresponding difference attribute of the actual test command is included. Therefore, it is not necessary to modify the test commands configured in the automated test script, that is, without modifying the AW1, only the actual test command corresponding to the product 3 - version 5 is modified to 777777 in the XML command line difference library, and the logical object mapping is performed. After the physical object, the modified actual test command 777777 can be called from the XML command line difference library through the method AW1 in the automated test script.
- the automatic test is performed when the actual test command is changed. The script's modification maintains the workload so that the automated test script can quickly adapt to the changed test commands.
- the present invention also provides an embodiment of an automated test system.
- FIG. 4 A block diagram of a first embodiment of the automated test system of the present invention is shown in Figure 4:
- the automated test system includes: a test device 410 and a device under test 420.
- a test device 410 For the convenience of description, only one device under test is shown in the block diagram of the embodiment. In the process of automated testing, the system embodiment may also include multiple devices. Measuring equipment.
- the test device 410 includes an obtaining unit 411 for running an automated test script to obtain
- the calling unit 412 is configured to: run the automated test script to call the test command corresponding to the difference attribute of the device under test; the sending unit 413, configured to send the test command to the device under test carry out testing.
- FIG. 5 A block diagram of a second embodiment of the automated test system of the present invention is shown in Figure 5:
- the automated test system includes: a test device 510 and a device under test 520, as in the above embodiment, for the convenience of description, only one device under test is shown in the block diagram of the embodiment, and the system embodiment can also be used in the automatic test process. Contains multiple devices under test.
- the testing device 510 includes a configuration unit 5110, configured to pre-configure a device-to-device difference library, where the difference library includes a difference attribute of the device under test and a test command corresponding to the difference attribute; and an obtaining unit 5120, configured to run an automated test script a difference attribute of the device under test; a calling unit 5130, configured to run an automated test script to invoke a test command corresponding to the difference attribute of the device under test; a sending unit 5140, configured to send the test command to the measured The device is tested.
- a configuration unit 5110 configured to pre-configure a device-to-device difference library, where the difference library includes a difference attribute of the device under test and a test command corresponding to the difference attribute
- an obtaining unit 5120 configured to run an automated test script a difference attribute of the device under test
- a calling unit 5130 configured to run an automated test script to invoke a test command corresponding to the difference attribute of the device under test
- a sending unit 5140 configured to send the test command
- the obtaining unit 5120 includes an analysis difference attribute unit 5121 for analyzing the difference attribute of the device under test, and a write difference attribute unit 5122 for writing the device under test and its difference attribute into the test file;
- the unit 5123 is configured to run an automated test script to obtain a difference attribute of the device under test from the test file.
- the calling unit 5130 includes a mapping device unit 5131 for mapping to the current device under test by the logical device corresponding to the automated test script.
- the difference attribute unit 5132 is configured to obtain the difference attribute of the current device under test.
- the test command unit 5133 is configured to invoke, by using the difference attribute, a test command corresponding to the difference attribute in the device difference library to be tested.
- the present invention also provides embodiments of test equipment.
- FIG. 6 A block diagram of a first embodiment of the test apparatus of the present invention is shown in Figure 6:
- the test device includes: an obtaining unit 610, a calling unit 620, and a sending unit 630.
- the obtaining unit 610 is configured to run an automated test script to obtain a difference attribute of the device under test; the calling unit 620 is configured to run an automated test script to invoke a test command corresponding to the difference attribute of the device under test; the sending unit 630 is configured to use the The test command is sent to the device under test for testing.
- FIG. 7 A block diagram of a second embodiment of the test apparatus of the present invention is shown in Figure 7:
- the testing device includes a configuration unit 710, configured to pre-configure a tested device difference library, the difference The library includes a difference attribute of the device under test and a test command corresponding to the difference attribute; an obtaining unit 720, configured to run an automated test script to obtain a difference attribute of the device under test; and a calling unit 730, configured to run the automated test script to invoke the The test command corresponding to the difference attribute of the device is tested; the sending unit 740 is configured to send the test command to the device under test for testing.
- the obtaining unit 720 includes an analysis difference attribute unit 721 for analyzing the difference attribute of the device under test, and a write difference attribute unit 722 for writing the device under test and its difference attribute into the test file;
- the unit 723 is configured to run an automated test script to obtain a difference attribute of the device under test from the test file.
- the calling unit 730 includes a mapping device 731 for mapping to the current device under test by the logical device corresponding to the automated test script, and a difference attribute unit 732 for acquiring the difference attribute of the current device under test.
- the test command unit 733 is configured to invoke, by using the difference attribute, a test command corresponding to the difference attribute in the device difference library to be tested.
- mapping device device 731 includes: searching for a device under test, searching for a corresponding logical device in the topology file according to the logical device name in the automated test script; acquiring a device device under test, where After the logical device maps the device under test, the device under test corresponding to the logical device is obtained.
- the test command corresponding to the device under test in the embodiment of the present invention is not directly written into the automatic test script, but the test command can be saved by constructing a separate database, so when the test command is changed
- the test command can be saved by constructing a separate database, so when the test command is changed
- the method includes the following steps: running an automated test script to obtain a difference attribute of the device under test; running an automated test script to invoke a test command corresponding to the difference attribute of the device under test; and transmitting the test command to the device under test test.
- the storage medium is, for example, a ROM/RAM, a magnetic disk, an optical disk, or the like.
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)
Description
一种自动化测试方法、 系统及一种测试设备
本申请要求于 2007 年 11 月 28 日提交中国专利局、 申请号为 200710168195.0、 发明名称为"一种自动化测试方法、 系统及一种测试设备 "的 中国专利申请的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及自动化测试领域,特别涉及一种自动化测试方法、 系统及一种 测试设备。
背景技术
对设备进行自动化测试是测试领域中应用比较大的部分,虽然自动化测试 技术并不是新生的技术,但是至今仍然没有完善的,可以为产品质量提供行之 有效服务的自动化测试技术。 其中一个重要原因在于当被测设备的软件层面, 例如命令行发生改变时, 相应的对应原来命令行的自动化测试脚本将无法使 用,此时需要测试人员对自动化测试脚本进行修改, 当自动化测试脚本数量较 大时, 将增加维护脚本的工作量。 由于在一个测试周期中, 自动化测试和手动 测试同时进行, 以实现相互间的验证, 但是当新的软件版本产生, 而相应的自 动化测试脚本还未修改完毕,会导致当一个测试周期结束时, 自动化测试脚本 还不能适配该软件版本, 而手动测试已经完成,使得自动化测试脚本无法在自 动化测试中发挥应有的作用。针对上述问题, 需要有一种技术能够改进被测设 备的软件变动对自动化测试脚本带来的影响,即只要对自动化测试脚本进行较 小的改动就能够适配被测设备的软件变动。
现有技术中为了实现上述目的,通常采用拆分自动化测试脚本, 并编写重 用过程的方法。 例如, 有三个脚本, 分别为脚本 1、 脚本 2和脚本 3 , 其中脚 本 1对应被测设备 1, 测试时需要调用的配置命令为命令 1、 命令 2、 命令 3、 命令 4和命令 5; 脚本 2对应被测设备 2, 测试时需要调用的配置命令为命令 1、 命令 2、 命令 4、 命令 5和命令 6; 脚本 3对应被测设备 3 , 测试时需要调 用的配置命令为命令 1、 命令 2、 命令 4、 命令 5、 命令 6和命令 3。
根据上述三个脚本在测试过程中调用命令的情况,编写小脚本 a和小脚本 b,其中小脚本 a调用配置命令 1和命令 2,小脚本 b调用配置命令 4和命令 5。 则根据拆分后的小脚本,脚本 1在测试设备 1时顺序调用小脚本 a的配置命令
(命令 1和命令 2 ), 配置命令 3, 小脚本 b的配置命令(命令 4和命令 5 ); 脚本 2在测试设备 2时顺序调用小脚本 a, 小脚本 b, 配置命令 6; 脚本 3在 测试设备 3时顺序调用小脚本 a, 小脚本 b, 配置命令 3, 配置命令 6。
由以上对现有技术的描述可知, 如果配置命令 1 , 命令 2, 命令 4或命令 5中的任意命令发生变化, 只需要修改小脚本 a或小脚本 b即可, 但是如果配 置命令 3发生了变化, 则需要修改脚本 1和脚本 3, 而如果配置命令 6发生变 化, 则需要修改脚本 2和脚本 3。 由于上例中的脚本数量较少 (仅 3个), 而 如果脚本数量增多, 则在根据众多脚本调用配置命令的情况拆分脚本, 编写能 够共用的小脚本时, 难以较好地把握拆分尺度, 例如上例中脚本 2 和脚本 3 都调用配置命令 4、 命令 5和命令 6, 而脚本 1、 脚本 2和脚本 3又都调用了 配置命令 4和命令 5, 因此将配置命令 4、命令 5和命令 6拆分为一个小脚本, 还是将配置命令 4和命令 5拆分成一个小脚本将难以掌握,尤其在脚本较多且 调用的配置命令也较多时更不好拆分;而且在被测设备的软件改动时仍然需要 修改自动化测试脚本的代码, 相应增加了自动化测试人员的工作量。
发明内容
本发明实施例的目的在于提供一种自动化测试方法、 系统及一种测试设 备。
为实现本发明实施例的目的 , 本发明实施例提供如下技术方案:
一种自动化测试方法, 包括:
运行自动化测试脚本获得被测设备的差异属性;
调用与所述被测设备的差异属性对应的测试命令;
将所述测试命令下发至所述被测设备进行测试。
一种自动化测试系统,包括测试设备和至少一台根据测试命令进行测试的 被测设备,
所述测试设备, 用于运行自动化测试脚本获得被测设备的差异属性,调用 与所述被测设备的差异属性对应的测试命令,并将所述测试命令下发至所述被 测设备进行测试。
一种测试设备, 包括:
获得单元, 用于运行自动化测试脚本获得被测设备的差异属性;
调用单元, 用于调用与所述被测设备的差异属性对应的测试命令; 下发单元, 用于将所述测试命令下发至所述被测设备进行测试。
由以上本发明实施例提供的技术方案可见,本发明实施例中通过运行自动 化测试脚本获得被测设备的差异属性,运行自动化测试脚本调用被测设备的差 异属性对应的测试命令, 然后将测试命令下发至所述被测设备进行测试。本发 明实施例中被测设备对应的测试命令未直接写入自动化测试脚本中,而是可以 通过构建单独的数据库对该测试命令进行保存, 因此当测试命令改变时, 无需 对自动化测试脚本进行逐一改动, 只要修改数据库中相应的测试命令即可, 缩 小了测试过程中对自动化测试脚本进行维护的工作量,使得自动化脚本可以快 速适配测试命令的改动。
附图说明
图 1为本发明方法的第一实施例流程图;
图 2为本发明方法的第二实施例流程图;
图 3为本发明自动化测试实施例的流程示意图;
图 4为本发明系统的第一实施例框图;
图 5为本发明系统的第二实施例框图;
图 6为本发明测试设备的第一实施例框图;
图 7为本发明测试设备的第二实施例框图。
具体实施方式
本发明实施例提供了一种自动化测试方法、 系统及一种测试设备,该实施 例中通过运行自动化测试脚本获得被测设备的差异属性,运行自动化测试脚本 调用被测设备的差异属性对应的测试命令,将测试命令下发至被测设备进行测 试。
为了使本技术领域的人员更好地理解本发明实施例提供的技术方案 ,下面 结合附图和具体实施方式对本发明实施例提供的技术方案作进一步的详细说 明。
本发明自动化测试方法的第一实施例流程如图 1所示:
框图 101 : 运行自动化测试脚本获得被测设备的差异属性。
框图 102: 运行自动化测试脚本调用被测设备的差异属性对应的测试命
令。
其中,可以预先保存被测设备及其差异属性, 即分析被测设备的差异属性 后, 将该被测设备的差异属性写入测试文件中。
其中 ,被测设备的差异属性及其对应的测试命令保存在预先配置被测设备 差异库中, 该差异库可以为基于 XML ( Extensible Markup Language, 扩展标 i己语言) 的差异库、 或基于 SQL ( Structured Query Language, 结构化查询语 言) 的差异库、 或基于数据结构的差异库。
其中 , 自动化测试脚本中包括逻辑设备名称及所述逻辑设备调用的方法, 所述方法对应所述被测设备差异库中的同类差异属性,所述逻辑设备保存在拓 朴文件中。
具体的,根据自动化测试脚本中的逻辑设备名称查找所述拓朴文件中对应 的逻辑设备,所述逻辑设备映射所述被测设备后获取对应该逻辑设备的被测设 备,将获取所述当前被测设备的差异属性赋予该逻辑设备,通过赋予的差异属 性在被测设备差异库中调用对应该差异属性的测试命令。
框图 103: 将测试命令下发至被测设备进行测试。
本发明自动化测试方法的第二实施例流程如图 2所示,该实施例示出了将 被测设备对应的测试命令保存在预先设置的 XML差异库中后, 对被测设备进 行自动化测试的详细流程:
框图 201 : 分析被测设备的差异属性。
分析被测设备的差异属性就是分析导致被测设备的测试命令出现差异的 因素, 例如产品的类型不同、 产品的版本不同、 或者被测设备对应的物理接口 的不同等都是造成被测设备测试命令出现差异的常见因素。
框图 202: 将被测设备及其差异属性写入测试文件中。
本发明实施例中测试文件通常是指基于对应自动化测试框架的测试床文 件, 测试床文件用于记录被测设备和分析出的该被测设备的差异属性, 例如被 测设备 A对应的差异属性为产品 X—版本 Y。
框图 203: 根据自动化测试脚本中的逻辑设备名称查找拓朴文件中对应的 逻辑设备。
除与自动化测试框架对应测试文件外,测试设备中还包括与该自动化测试
框架对应的拓朴文件, 该拓朴文件中保存了逻辑设备。
相应的, 自动化测试脚本中包括逻辑设备名称及该逻辑设备调用的方法, 例如, 一个自动化测试脚本可以描述如下: RTA AW1 , 其中, RTA为保存在 拓朴文件中的逻辑设备名称, AW1 为该逻辑设备可以调用的方法, 该方法对 应被测设备差异库中的同类差异属性。
当自动化测试脚本在测试床框架上运行的时候,通过该自动化脚本的逻辑 设备的名称就能够在拓朴文件中找到相应的逻辑设备。
框图 204: 逻辑设备映射到测试文件中的相应的被测设备。
拓朴文件中的逻辑设备映射测试文件中的被测设备时,通常形成一个逻辑 设备对应一个被测设备的关系,假设该被测设备为前述的被测设备 A, 则映射 关系即为逻辑设备 RTA映射到被测设备 A。
框图 205: 获取被测设备在测试文件中保存的差异属性。
根据逻辑设备映射到的被测设备,将保存在测试文件中的该被测设备的差 异属性赋予该逻辑设备, 例如, 将被测设备 A的差异属性产品 X—版本 Y赋予 逻辑设备 RTA。
框图 206: 通过该差异属性在 XML差异库中调用对应该差异属性的测试 命令。
本方法实施例中保存设备间差异属性的差异库是基于 XML而预先建立的 XML差异库。 XML是一种简单的数据存储语言,使用一系列简单的标记描述 数据, 而这些标记可以用方便的方式建立, 并且 XML具有强大的数据存储和 分析能力, 例如: 数据索引、 排序、 查找、 相关一致性等, XML仅仅 示 数据, XML的简单使其易于在任何应用程序中读写数据, 这使 XML成为数 据交换的唯一公共语言, XML可以与操作系统平台下产生的信息结合, 并将 XML数据加载到程序中进行分析, 最后以 XML格式输出结果。
本实施例中的 XML差异库中保存了预先分析出的被测设备的差异属性及 该差异属性对应的测试命令,同类差异属性具有统一名称,在同一目录下保存, 该名称与自动化测试脚本中逻辑设备调用的方法的名称一致,使得该逻辑设备 可以才 据赋予的差异属性在该 XML差异库中调用到对应该差异属性的测试命 令。例如,在 XML差异库中对应方法和版本的差异属性均具有统一名称 AW1,
而被测设备 A的差异属性产品 X—版本 Y也位于 AW1的目录下, 对应该差异 属性产品 X—版本 Y的测试命令为命令 M, 则逻辑设备 RTA根据赋予的差异 属性产品 X—版本 Y通过调用自动化测试脚本中的方法 AW1可以查找到对应 差异属性产品 X—版本 Y的测试命令 M。
框图 207: 将测试命令下发至当前被测设备进行测试。
自动化测试框架根据在 XML差异库中调用的被测设备 A的测试命令 M 对该被测设备 A进行测试。
结合上述本发明的方法实施例,下面以一个具体的测试实例对本发明实施 例的自动化测试过程进行描述, 假设被测设备的差异属性为产品类型和版本 号:
如图 3所示, 为该自动化测试实施例流程的示意图: 该图中示出了自动化 测试框架, 与该自动化测试框架对应的测试床文件和拓朴文件, 自动化测试脚 本, XML差异库以及被测设备八。
首先, 需要分析导致被测设备命令行出现差异的差异属性,该实施例中具 体的差异属性为产品和版本,通过分析出的差异属性建立 XML命令行差异库, 该差异库中存储的命令行之间的差异如下表 1所示:
表 1
当然, 具体测试时对应其它的差异属性, 该 XML差异库中的方法 AW1 目录下还可以存放上述其它的差异属性, 比如命令行的返回信息等, 即保证在 调用时仅调用该方法 AW1 , 而不直接调用实际的测试命令。
假设在本实施例中分析出的被测设备 A的差异属性为产品 3—版本 5, 结
合图 3:
框图 301 : 将分析出的设备 A的差异属性产品 3—版本 5写入测试床文件 中, 在测试床文件中就保存了 "设备 A—产品 3—版本 5"。
框图 302: 自动化测试脚本具体为" RTA AW1", 根据该自动化测试脚本 中的逻辑设备名称" RTA"在拓朴文件中找到对应的逻辑设备 RTA。
框图 303: 根据该逻辑设备 RTA在测试床文件中映射到当前被测设备 A, 将该被测设备 A的差异属性产品 3—版本 5赋予该逻辑设备 RTA。
框图 304: 该逻辑设备 RTA通过自动化测试脚本中的方法函数 AW1 , 以 差异属性产品 3—版本 5为参数在 XML差异库中调用对应产该参数的真实测试 命令, 即根据上表 1, 通过 AW1调用到的实际测试命令为 555555。
框图 305: 将实际测试命令 555555发送到对应差异属性产品 3—版本 5的 被测设备 A。
框图 306: ^居该实际测试命令 555555对设备 A进行自动化测试。
根据上述描述可知, 当差异属性产品 3—版本 5对应的实际测试命令变为 777777 时, 由于自动化测试脚本中不包含实际测试命令, 而仅包含可以调用 该实际测试命令对应差异属性的方法名称,因此不必对自动化测试脚本中配置 的测试命令进行修改, 即无需对 AW1进行修改, 只需要在 XML命令行差异 库中, 将对应产品 3—版本 5的实际测试命令修改为 777777, 则逻辑对象映射 物理对象后通过自动化测试脚本中的方法 AW1就可以从 XML命令行差异库 中相应调用修改后的实际测试命令 777777, 通过建立差异库的方法, 减小了 在实际测试命令发生改动时对自动化测试脚本的修改维护工作量,使自动化测 试脚本能够快速适配改变的测试命令。
与本发明自动化测试方法的实施例相对应,本发明还提供了自动化测试系 统的实施例。
本发明自动化测试系统的第一实施例框图如图 4所示:
该自动化测试系统包括: 测试设备 410和被测设备 420, 为了描述方便, 该实施例框图中仅示出了一台被测设备,在自动化测试过程中,该系统实施例 也可以包含多台被测设备。
其中, 测试设备 410包括获得单元 411 , 用于运行自动化测试脚本获得被
测设备的差异属性; 调用单元 412, 用于运行自动化测试脚本调用所述被测设 备的差异属性对应的测试命令; 下发单元 413, 用于将所述测试命令下发至所 述被测设备进行测试。
本发明自动化测试系统的第二实施例框图如图 5所示:
该自动化测试系统包括: 测试设备 510和被测设备 520, 同上实施例, 为 了描述方便, 该实施例框图中仅示出了一台被测设备, 在自动化测试过程中, 该系统实施例也可以包含多台被测设备。
测试设备 510包括配置单元 5110, 用于预先配置被测设备差异库, 所述 差异库中包括被测设备的差异属性及该差异属性对应的测试命令; 获得单元 5120, 用于运行自动化测试脚本获得被测设备的差异属性; 调用单元 5130, 用于运行自动化测试脚本调用所述被测设备的差异属性对应的测试命令;下发 单元 5140, 用于将所述测试命令下发至所述被测设备进行测试。
其中, 获得单元 5120包括分析差异属性单元 5121 , 用于分析被测设备的 差异属性; 写入差异属性单元 5122, 用于将所述被测设备及其差异属性写入 测试文件中; 运行测试脚本单元 5123, 用于运行自动化测试脚本从所述测试 文件中获取被测设备的差异属性。
其中, 调用单元 5130包括映射被测设备单元 5131 , 用于通过自动化测试 脚本对应的逻辑设备映射到当前被测设备; 获取差异属性单元 5132, 用于获 取所述当前被测设备的差异属性; 调用测试命令单元 5133, 用于通过所述差 异属性在所述被测设备差异库中调用对应所述差异属性的测试命令。
与本发明自动化测试方法实施例和自动化测试系统的实施例相对应,本发 明还提供了测试设备的实施例。
本发明测试设备的第一实施例框图如图 6所示:
该测试设备包括: 获得单元 610、 调用单元 620和下发单元 630。
其中, 获得单元 610用于运行自动化测试脚本获得被测设备的差异属性; 调用单元 620 用于运行自动化测试脚本调用所述被测设备的差异属性对应的 测试命令; 下发单元 630用于将所述测试命令下发至所述被测设备进行测试。
本发明测试设备的第二实施例框图如图 7所示:
该测试设备包括配置单元 710, 用于预先配置被测设备差异库, 所述差异
库中包括被测设备的差异属性及该差异属性对应的测试命令; 获得单元 720, 用于运行自动化测试脚本获得被测设备的差异属性; 调用单元 730, 用于运行 自动化测试脚本调用所述被测设备的差异属性对应的测试命令; 下发单元 740, 用于将所述测试命令下发至所述被测设备进行测试。
其中, 获得单元 720包括分析差异属性单元 721 , 用于分析被测设备的差 异属性; 写入差异属性单元 722, 用于将所述被测设备及其差异属性写入测试 文件中; 运行测试脚本单元 723 , 用于运行自动化测试脚本从所述测试文件中 获取被测设备的差异属性。
其中, 调用单元 730包括映射被测设备单元 731, 用于通过自动化测试脚 本对应的逻辑设备映射到当前被测设备; 获取差异属性单元 732, 用于获取所 述当前被测设备的差异属性; 调用测试命令单元 733, 用于通过所述差异属性 在所述被测设备差异库中调用对应所述差异属性的测试命令。
进一步的, 映射被测设备单元 731包括查找被测设备单元,根据自动化测 试脚本中的所述逻辑设备名称查找所述拓朴文件中对应的逻辑设备;获取被测 设备单元,用于在所述逻辑设备映射所述被测设备后获取对应该逻辑设备的被 测设备。
通过本发明实施例的描述可知,本发明实施例中被测设备对应的测试命令 未直接写入自动化测试脚本中,而是可以通过构建单独的数据库对该测试命令 进行保存, 因此当测试命令改变时, 无需对自动化测试脚本进行逐一改动, 只 要修改数据库中相应的测试命令即可,缩小了测试过程中对自动化测试脚本进 行维护的工作量, 使得自动化脚本可以快速适配测试命令的改动。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤 是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可 读取存储介质中, 该程序在执行时, 包括如下步骤: 运行自动化测试脚本获得 被测设备的差异属性;运行自动化测试脚本调用所述被测设备的差异属性对应 的测试命令;将所述测试命令下发至所述被测设备进行测试。所述的存储介质, 如: ROM/RAM、 磁碟、 光盘等。
虽然通过实施例描绘了本发明,本领域普通技术人员知道,本发明有许多 变形和变化而不脱离本发明的精神,希望所附的权利要求包括这些变形和变化
而不脱离本发明的精神<
Claims
1、 一种自动化测试方法, 其特征在于, 包括:
运行自动化测试脚本获得被测设备的差异属性;
调用与所述被测设备的差异属性对应的测试命令;
将所述测试命令下发至所述被测设备进行测试。
2、 根据权利要求 1所述的方法, 其特征在于, 所述运行自动化测试脚本 获得被测设备的差异属性具体为:
分析被测设备的差异属性;
将所述被测设备的差异属性写入测试文件中;
通过运行自动化测试脚本从所述测试文件中获取被测设备的差异属性。
3、 根据权利要求 2所述的方法, 其特征在于, 进一步包括:
预先配置被测设备差异库,所述差异库中包括被测设备的差异属性及与该 差异属性对应的测试命令。
4、 根据权利要求 3所述的方法, 其特征在于, 所述调用与所述被测设备 的差异属性对应的测试命令具体为:
将自动化测试脚本对应的逻辑设备映射到当前被测设备;
通过所述逻辑设备在所述被测设备差异库中调用对应所述差异属性的测 试命令。
5、 根据权利要求 4所述的方法, 其特征在于, 所述自动化测试脚本中包 括所述逻辑设备名称及所述逻辑设备调用的方法,所述方法对应所述被测设备 差异库中的同类差异属性, 所述逻辑设备保存在拓朴文件中。
6、 根据权利要求 5所述的方法, 其特征在于, 所述将自动化测试脚本对 应的逻辑设备映射到当前被测设备具体为:
根据自动化测试脚本中的所述逻辑设备名称查找所述拓朴文件中对应的 逻辑设备;
所述逻辑设备映射所述被测设备后获取对应该逻辑设备的被测设备。
7、 根据权利要求 1至 6任意一项所述的方法, 其特征在于, 所述差异库 为基于 XML的差异库、 基于 SQL的差异库或基于数据结构的差异库。
8、 一种自动化测试系统, 其特征在于, 包括测试设备和至少一台 ^居测
试命令进行测试的被测设备,
所述测试设备, 用于运行自动化测试脚本获得被测设备的差异属性,调用 与所述被测设备的差异属性对应的测试命令,并将所述测试命令下发至所述被 测设备进行测试。
9、根据权利要求 8所述的系统, 其特征在于, 所述测试设备进一步用于: 预先配置被测设备差异库,所述差异库中包括被测设备的差异属性及该差 异属性对应的测试命令。
10、 一种测试设备, 其特征在于, 包括:
获得单元, 用于运行自动化测试脚本获得被测设备的差异属性;
调用单元, 用于调用与所述被测设备的差异属性对应的测试命令; 下发单元, 用于将所述测试命令下发至所述被测设备进行测试。
11、 根据权利要求 10所述的测试设备, 其特征在于, 进一步包括: 配置单元, 用于预先配置被测设备差异库, 所述差异库中包括被测设备的 差异属性及该差异属性对应的测试命令。
12、根据权利要求 11所述的测试设备, 其特征在于, 所述获得单元包括: 分析差异属性单元, 用于分析被测设备的差异属性;
写入差异属性单元, 用于将所述被测设备的差异属性写入测试文件中; 运行测试脚本单元,用于通过运行自动化测试脚本从所述测试文件中获取 被测设备的差异属性。
13、根据权利要求 12所述的测试设备, 其特征在于, 所述调用单元包括: 映射被测设备单元,用于通过自动化测试脚本对应的逻辑设备映射到当前 被测设备;
调用测试命令单元,用于通过所述逻辑设备在所述被测设备差异库中调用 对应所述差异属性的测试命令。
14、 根据权利要求 13所述的被测设备, 其特征在于, 所述映射被测设备 单元包括:
查找被测设备单元,根据自动化测试脚本中的所述逻辑设备名称查找所述 拓朴文件中对应的逻辑设备;
获取被测设备单元,用于在所述逻辑设备映射所述被测设备后获取对应该
逻辑设备的被测设备。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200710168195.0 | 2007-11-28 | ||
CN2007101681950A CN101174237B (zh) | 2007-11-28 | 2007-11-28 | 一种自动化测试方法、系统及一种测试设备 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2009076827A1 true WO2009076827A1 (zh) | 2009-06-25 |
Family
ID=39422760
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2008/073186 WO2009076827A1 (zh) | 2007-11-28 | 2008-11-25 | 一种自动化测试方法、系统及一种测试设备 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN101174237B (zh) |
WO (1) | WO2009076827A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115361327A (zh) * | 2022-09-29 | 2022-11-18 | 苏州浪潮智能科技有限公司 | 一种自动化测试网卡ncsi命令的方法、装置、终端及介质 |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101174237B (zh) * | 2007-11-28 | 2011-04-13 | 华为技术有限公司 | 一种自动化测试方法、系统及一种测试设备 |
CN102394797B (zh) * | 2011-11-16 | 2013-09-11 | 深圳市赛格导航科技股份有限公司 | 一种嵌入式网络通信设备自动化测试方法及系统 |
CN105512017A (zh) * | 2014-09-22 | 2016-04-20 | 阿里巴巴集团控股有限公司 | 一种数据库兼容性检测方法及设备 |
CN106155848B (zh) * | 2015-03-24 | 2019-09-03 | 阿里巴巴集团控股有限公司 | 一种测试方法和设备 |
CN108614768A (zh) * | 2016-12-14 | 2018-10-02 | 北京国双科技有限公司 | 一种分布式持续集成方法及装置 |
CN106776182B (zh) * | 2016-12-21 | 2020-02-07 | 苏州浪潮智能科技有限公司 | 一种自动识别工站并执行对应脚本的方法 |
CN111124892B (zh) * | 2019-12-04 | 2023-03-21 | 四川安迪科技实业有限公司 | 基于命令行的自动化测试方法及系统 |
CN112527661B (zh) * | 2020-12-17 | 2024-04-26 | 平安消费金融有限公司 | 数据脚本的验证方法、装置以及计算机设备 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1503168A (zh) * | 2002-11-22 | 2004-06-09 | 深圳市中兴通讯股份有限公司 | 一种系统产品的自动化测试方法 |
CN1536789A (zh) * | 2003-04-09 | 2004-10-13 | 华为技术有限公司 | 通过波动分析辅助测试用例升级的方法 |
US20060136579A1 (en) * | 2004-12-21 | 2006-06-22 | International Business Machines Corporation | Method of executing test scripts against multiple systems |
WO2006091408A2 (en) * | 2005-02-18 | 2006-08-31 | S2 Technologies, Inc. | System and method for testing devices |
CN1851666A (zh) * | 2005-11-01 | 2006-10-25 | 华为技术有限公司 | 一种实现软件自动测试的方法及系统 |
CN101174237A (zh) * | 2007-11-28 | 2008-05-07 | 华为技术有限公司 | 一种自动化测试方法、系统及一种测试设备 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1790957A (zh) * | 2004-12-14 | 2006-06-21 | 华为技术有限公司 | 设备测试方法 |
-
2007
- 2007-11-28 CN CN2007101681950A patent/CN101174237B/zh not_active Expired - Fee Related
-
2008
- 2008-11-25 WO PCT/CN2008/073186 patent/WO2009076827A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1503168A (zh) * | 2002-11-22 | 2004-06-09 | 深圳市中兴通讯股份有限公司 | 一种系统产品的自动化测试方法 |
CN1536789A (zh) * | 2003-04-09 | 2004-10-13 | 华为技术有限公司 | 通过波动分析辅助测试用例升级的方法 |
US20060136579A1 (en) * | 2004-12-21 | 2006-06-22 | International Business Machines Corporation | Method of executing test scripts against multiple systems |
WO2006091408A2 (en) * | 2005-02-18 | 2006-08-31 | S2 Technologies, Inc. | System and method for testing devices |
CN1851666A (zh) * | 2005-11-01 | 2006-10-25 | 华为技术有限公司 | 一种实现软件自动测试的方法及系统 |
CN101174237A (zh) * | 2007-11-28 | 2008-05-07 | 华为技术有限公司 | 一种自动化测试方法、系统及一种测试设备 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115361327A (zh) * | 2022-09-29 | 2022-11-18 | 苏州浪潮智能科技有限公司 | 一种自动化测试网卡ncsi命令的方法、装置、终端及介质 |
CN115361327B (zh) * | 2022-09-29 | 2023-08-08 | 苏州浪潮智能科技有限公司 | 一种自动化测试网卡ncsi命令的方法、装置、终端及介质 |
Also Published As
Publication number | Publication date |
---|---|
CN101174237A (zh) | 2008-05-07 |
CN101174237B (zh) | 2011-04-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2009076827A1 (zh) | 一种自动化测试方法、系统及一种测试设备 | |
WO2019085079A1 (zh) | 接口测试方法、装置、计算机设备和存储介质 | |
WO2019085073A1 (zh) | 接口测试方法、装置、计算机设备和存储介质 | |
US9483386B2 (en) | Information interaction test device and method based on automatic generation of associated test cases | |
US20160034582A1 (en) | Computing device and method for executing database operation command | |
WO2017000424A1 (zh) | 协议检测方法及装置 | |
CN108459850B (zh) | 生成测试脚本的方法、装置及系统 | |
AU2017200895B2 (en) | Software integration testing with unstructured database | |
US12061595B2 (en) | Facilitating performance of database operations using microservices | |
WO2024001493A1 (zh) | 一种可视化的数据分析方法及设备 | |
CN110287696B (zh) | 一种反弹shell进程的检测方法、装置和设备 | |
CN107092535B (zh) | 用于测试接口的数据存储的方法及设备 | |
US20180165179A1 (en) | Determining incompatibilities of automated test cases with modified user interfaces | |
CN114465937B (zh) | 网卡测试方法、装置、服务器和介质 | |
CN108959065A (zh) | 软件接口测试参数的验证方法及系统 | |
CN113836014A (zh) | 一种接口测试方法、装置、电子设备和存储介质 | |
CN113962597A (zh) | 一种数据分析方法、装置、电子设备及存储介质 | |
CN112738230A (zh) | 一种自动化网闸测试系统及其工作方法 | |
CN113722277A (zh) | 一种数据导入方法、装置、服务平台及存储介质 | |
CN113485927A (zh) | 一种测试数据生成方法、装置、设备及存储介质 | |
CN117648257A (zh) | 一种Linux操作系统下的Web自动化测试方法及系统 | |
CN116069577A (zh) | 一种rpc服务的接口测试方法、设备及介质 | |
CN104572638B (zh) | 数据读写方法及装置 | |
CN113076300A (zh) | 数据迁移后的数据校验方法及装置 | |
CN117171108A (zh) | 一种虚拟模型映射方法和系统 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 08862278 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 08862278 Country of ref document: EP Kind code of ref document: A1 |