CN110008074A - The method, device and equipment of automatic test inquiry hardware information high-level interface - Google Patents
The method, device and equipment of automatic test inquiry hardware information high-level interface Download PDFInfo
- Publication number
- CN110008074A CN110008074A CN201910290105.8A CN201910290105A CN110008074A CN 110008074 A CN110008074 A CN 110008074A CN 201910290105 A CN201910290105 A CN 201910290105A CN 110008074 A CN110008074 A CN 110008074A
- Authority
- CN
- China
- Prior art keywords
- hardware
- return value
- test
- hardware information
- automatic test
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/2205—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/2273—Test methods
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
技术领域technical field
本发明实施例涉及存储硬件故障检测技术领域,特别是涉及一种自动化测试查询硬件信息上层接口的方法、装置、设备及计算机可读存储介质。Embodiments of the present invention relate to the technical field of storage hardware fault detection, and in particular, to a method, apparatus, device, and computer-readable storage medium for automated testing to query an upper-layer interface of hardware information.
背景技术Background technique
随着云计算、大数据的快速发展,用户对存储产品的要求也越来越高,及时检测硬件故障并快速进行修复对整个存储系统非常必要。With the rapid development of cloud computing and big data, users have higher and higher requirements for storage products. It is very necessary for the entire storage system to detect hardware failures and repair them quickly.
目前对底层设备的一些硬件FRU(Field Replace Unit,现场可更换单元)信息的查询,均是通过软件提供命令行来获取。但是,在验证命令行的有效性时,一般需要手动进行硬件操作。举例来说,验证存储设备中风扇的在位状态,需要手动的拔出该风扇模块,并且连续地手动执行查询命令,直到该查询命令相应的代表在位状态的字段更新为离线为止。这种手动查询硬件上层接口的方法既浪费时间又浪费人力,导致整个硬件故障检测效率较低。Currently, the query for some hardware FRU (Field Replace Unit, field replaceable unit) information of the underlying equipment is obtained through the command line provided by the software. However, when verifying the validity of the command line, manual hardware operations are generally required. For example, to verify the presence status of a fan in the storage device, the fan module needs to be manually pulled out, and the query command is manually executed continuously until the field representing the presence status of the query command is updated to offline. This method of manually querying the upper-layer interface of the hardware is time-consuming and labor-intensive, resulting in low efficiency of the entire hardware fault detection.
发明内容SUMMARY OF THE INVENTION
本公开实施例提供了一种自动化测试查询硬件信息上层接口的方法、装置、设备及计算机可读存储介质,实现了自动化测试查询硬件信息上层接口,提高了查询硬件信息上层接口的效率。The embodiments of the present disclosure provide a method, apparatus, device and computer-readable storage medium for querying an upper-layer interface of hardware information by automated testing, which realizes the querying of an upper-layer interface of hardware information by automatic testing, and improves the efficiency of querying an upper-layer interface of hardware information.
为解决上述技术问题,本发明实施例提供以下技术方案:In order to solve the above-mentioned technical problems, the embodiments of the present invention provide the following technical solutions:
本发明实施例一方面提供了一种自动化测试查询硬件信息上层接口的方法,包括:One aspect of the embodiments of the present invention provides a method for automatically testing an upper-layer interface for querying hardware information, including:
获取待测试硬件实例,确定所述待测试硬件实例对应的查询接口;Obtain the hardware instance to be tested, and determine the query interface corresponding to the hardware instance to be tested;
根据接收到的修改指令修改所述查询接口的返回值,并重定向至预设虚拟文件中;Modify the return value of the query interface according to the received modification instruction, and redirect to the preset virtual file;
读取所述虚拟文件得到修改后的返回值,根据预设期望值和修改后的返回值的匹配结果,生成测试结果;Read the virtual file to obtain the modified return value, and generate a test result according to the matching result between the preset expected value and the modified return value;
其中,所述期望值与所述修改指令中修改数据字段相同。Wherein, the expected value is the same as the modified data field in the modification instruction.
可选的,所述根据预设期望值和修改后的返回值,生成测试结果之后,还包括:Optionally, after generating the test result according to the preset expected value and the modified return value, the method further includes:
将所述测试结果记录在日志中。The test results are recorded in a log.
可选的,所述获取待测试硬件实例之后,还包括:Optionally, after obtaining the hardware instance to be tested, the method further includes:
将所述待测试硬件实例写入至预设特定文件。Write the hardware instance to be tested to a preset specific file.
可选的,所述读取所述虚拟文件得到修改后的返回值为:Optionally, the modified return value obtained by reading the virtual file is:
按照预设频率读取虚拟文件得到修改后的返回值。Read the virtual file according to the preset frequency to get the modified return value.
可选的,所述根据预设期望值和修改后的返回值的匹配结果,生成测试结果包括:Optionally, generating the test result according to the matching result between the preset expected value and the modified return value includes:
若所述预设期望值和修改后的返回值相同,则生成的测试结果为测试通过;If the preset expected value and the modified return value are the same, the generated test result is that the test passed;
若所述预设期望值和修改后的返回值不相同,则生成的测试结果为测试不通过。If the preset expected value and the modified return value are different, the generated test result is that the test fails.
本发明实施例另一方面提供了一种自动化测试查询硬件信息上层接口的装置,包括:Another aspect of the embodiments of the present invention provides a device for automatically testing an upper-layer interface for querying hardware information, including:
待测试硬件实例信息获取模块,用于获取待测试硬件实例,确定所述待测试硬件实例对应的查询接口;a hardware instance information acquisition module to be tested, configured to acquire the hardware instance to be tested, and to determine a query interface corresponding to the hardware instance to be tested;
底层数据修改模块,用于根据接收到的修改指令修改所述查询接口的返回值,并重定向至预设虚拟文件中;The underlying data modification module is used to modify the return value of the query interface according to the received modification instruction, and redirect to the preset virtual file;
自动化测试模块,用于读取所述虚拟文件得到修改后的返回值,根据预设期望值和修改后的返回值的匹配结果,生成测试结果;所述期望值与所述修改指令中修改数据字段相同。An automated test module, used to read the virtual file to obtain the modified return value, and generate a test result according to the matching result between the preset expected value and the modified return value; the expected value is the same as the modified data field in the modification instruction .
可选的,所述自动化测试模块为按照预设频率读取所述虚拟文件得到修改后的返回值的模块。Optionally, the automated testing module is a module that reads the virtual file according to a preset frequency to obtain a modified return value.
可选的,所述自动化测试模块还用于若所述预设期望值和修改后的返回值相同,则生成的测试结果为测试通过;若所述预设期望值和修改后的返回值不相同,则生成的测试结果为测试不通过。Optionally, the automated test module is also used to generate a test result that passes the test if the preset expected value and the modified return value are the same; if the preset expected value and the modified return value are different, The generated test result is that the test fails.
本发明实施例还提供了一种自动化测试查询硬件信息上层接口的设备,包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现如前任一项所述自动化测试查询硬件信息上层接口的方法的步骤。An embodiment of the present invention also provides a device for automatically testing an upper-layer interface for querying hardware information, including a processor, where the processor is configured to implement the upper-layer interface for automatic testing and querying hardware information as described in any preceding item when executing a computer program stored in a memory steps of the method.
本发明实施例最后还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有自动化测试查询硬件信息上层接口的程序,所述自动化测试查询硬件信息上层接口的程序被处理器执行时实现如前任一项所述自动化测试查询硬件信息上层接口的方法的步骤。Finally, an embodiment of the present invention further provides a computer-readable storage medium, where a program for querying an upper-layer interface of hardware information by an automated test is stored thereon, and the program for querying an upper-layer interface of hardware information by an automated test is stored by a processor During execution, the steps of implementing the method for automatically testing the upper-layer interface for querying hardware information as described in any of the preceding items are implemented.
本申请提供的技术方案的优点在于,通过软件方式自动化测试查询硬件信息上层接口,将硬件环境以软件的方式模拟出来,从而将上层软件代码和底层硬件隔离,在验证上层软件功能时,不仅可以避免验证硬件信息时必须手动更改配置硬件环境和环境变量的问题,而且还能够全程自动验证,实现硬件问题软件模拟化,软件功能脚本测试自动化,快速有效,大大提高了测试效率,增强了测试准确率,还有利于增强存储产品的质量;此外,将软硬件环境隔离,有效避免传统验证上层软件接口时对硬件的损坏问题,有利于降低研发成本。The advantage of the technical solution provided by this application is that the upper-layer interface of hardware information is automatically tested and inquired through software, and the hardware environment is simulated in software, thereby isolating the upper-layer software code from the underlying hardware. When verifying the functions of the upper-layer software, not only can Avoid the problem of manually changing the configuration hardware environment and environment variables when verifying hardware information, and can also automatically verify the whole process, realize software simulation of hardware problems, and automate software function script testing, which is fast and effective, greatly improving test efficiency and enhancing test accuracy. It also helps to enhance the quality of storage products; in addition, the software and hardware environments are isolated to effectively avoid the problem of hardware damage during traditional verification of upper-layer software interfaces, which is conducive to reducing R&D costs.
此外,本发明实施例还针对自动化测试查询硬件信息上层接口的方法提供了相应的实现装置、设备及计算机可读存储介质,进一步使得所述方法更具有实用性,所述装置、设备及计算机可读存储介质具有相应的优点。In addition, the embodiments of the present invention also provide a corresponding implementation device, device, and computer-readable storage medium for the method of querying the upper-layer interface of hardware information for automated testing, which further makes the method more practical, and the device, device, and computer can Reading storage media has corresponding advantages.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性的,并不能限制本公开。It is to be understood that the foregoing general description and the following detailed description are exemplary only and do not limit the present disclosure.
附图说明Description of drawings
为了更清楚的说明本发明实施例或相关技术的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions of the embodiments of the present invention or related technologies more clearly, the following briefly introduces the accompanying drawings that are used in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only the present invention. For some embodiments of the present invention, for those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.
图1为本发明实施例提供的一种自动化测试查询硬件信息上层接口的方法的流程示意图;1 is a schematic flowchart of a method for an automated test querying an upper-layer interface for hardware information provided by an embodiment of the present invention;
图2为本发明实施例提供的另一种自动化测试查询硬件信息上层接口的方法的流程示意图;FIG. 2 is a schematic flowchart of another method for automatically testing an upper-layer interface for querying hardware information provided by an embodiment of the present invention;
图3为本发明实施例提供的自动化测试查询硬件信息上层接口的装置的一种具体实施方式结构图;3 is a structural diagram of a specific implementation of an apparatus for an automated test querying an upper-layer interface for hardware information provided by an embodiment of the present invention;
图4为本发明实施例提供的自动化测试查询硬件信息上层接口的装置的另一种具体实施方式结构图。FIG. 4 is a structural diagram of another specific implementation of an apparatus for an automated test querying an upper-layer interface of hardware information provided by an embodiment of the present invention.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make those skilled in the art better understand the solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等是用于区别不同的对象,而不是用于描述特定的顺序。此外术语“包括”和“具有”以及他们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可包括没有列出的步骤或单元。The terms "first", "second", "third", "fourth", etc. in the description and claims of the present application and the above drawings are used to distinguish different objects, rather than to describe a specific order. . Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or elements is not limited to the listed steps or elements, but may include unlisted steps or elements.
在介绍了本发明实施例的技术方案后,下面详细的说明本申请的各种非限制性实施方式。After introducing the technical solutions of the embodiments of the present invention, various non-limiting implementations of the present application are described in detail below.
首先参见图1,图1为本发明实施例提供的一种自动化测试查询硬件信息上层接口的方法的流程示意图,本发明实施例可包括以下内容:Referring first to FIG. 1, FIG. 1 is a schematic flowchart of a method for an automated test querying an upper-layer interface for hardware information provided by an embodiment of the present invention. The embodiment of the present invention may include the following content:
S101:获取待测试硬件实例,确定待测试硬件实例对应的查询接口。S101: Obtain a hardware instance to be tested, and determine a query interface corresponding to the hardware instance to be tested.
待测试硬件实例为测试硬件的信息,也就是硬件测试实例,包括硬件类型和测试信息(测试事项),测试信息也就是需要测试的硬件的事项。举例来说,测试的硬件为风扇,测试的事项为在位状态信息,那么待测试硬件实例为风扇在位状态。The hardware instance to be tested is the information of the tested hardware, that is, the hardware test instance, including the hardware type and test information (test items), and the test information is the item of the hardware to be tested. For example, if the hardware to be tested is a fan, and the item to be tested is in-position status information, the hardware instance to be tested is in the in-position status of the fan.
硬件信息的查询对应固定指令,且由固定的上层接口信息将查询的信息进行返回。举例来说,对于具体一个风扇的在位信息,会有对应的底层的查询接口。例如查询风扇在位状态的信息(如离线)由上层接口A返回离线信息,那么在S101中确定的待测试硬件实例对应的查询接口即为A。The query of hardware information corresponds to a fixed command, and the queried information is returned by the fixed upper-layer interface information. For example, for the presence information of a specific fan, there will be a corresponding low-level query interface. For example, the information about the in-position status of the fan (eg offline) is returned by the upper layer interface A, and the query interface corresponding to the hardware instance to be tested determined in S101 is A.
S102:根据接收到的修改指令修改查询接口的返回值,并重定向至预设虚拟文件中。S102: Modify the return value of the query interface according to the received modification instruction, and redirect to a preset virtual file.
研发人员修改真实硬件环境对应的软件代码,系统接收研发人员输入的修改指令,根据修改指令中包含的修改数据字段,对底层传入的数据(也即查询接口的返回值)进行修改,也即将返回值修改为修改数据字段。举例来说,研发人员期望的风扇在位状态为离线,那么就会发送修改查询接口返回值为离线的指令,也就是说修改数据段为离线,系统在接收到该修改指令时,便将底层接口传入的数据修改为离线。The R&D personnel modify the software code corresponding to the real hardware environment, and the system receives the modification instructions input by the R&D personnel, and according to the modification data fields contained in the modification instructions, modifies the underlying incoming data (that is, the return value of the query interface). The return value is modified to modify the data field. For example, if the fan is expected to be offline, the R&D personnel will send an instruction to modify the return value of the query interface to offline, that is to say, modify the data segment to be offline. When the system receives the modification instruction, it will The data incoming through the interface is modified to be offline.
虚拟文件为预设的一个文件,将修改底层接口返回值实时定向到该虚拟文件中,也就是说系统每次在修完查询接口返回值后,都将修改后的返回值重定向至虚拟文件中。The virtual file is a preset file, and the return value of the modified underlying interface is directed to the virtual file in real time, that is to say, the system redirects the modified return value to the virtual file every time after modifying the return value of the query interface. middle.
S103:读取虚拟文件得到修改后的返回值,根据预设期望值和修改后的返回值的匹配结果,生成测试结果。S103: Read the virtual file to obtain the modified return value, and generate a test result according to the matching result between the preset expected value and the modified return value.
期望值与修改指令中修改数据字段相同,也就是说在成功执行修改指令,并在执行自动测试查询硬件信息上层接口后,修改后的接口返回值与期望值相同。The expected value is the same as the modified data field in the modification instruction, that is to say, after the modification instruction is successfully executed and the upper interface of the hardware information is queried by the automatic test, the return value of the modified interface is the same as the expected value.
可每隔一段时间,对待测试硬件实例可进行一次校验,也即每隔一段时间自动化执行一次测试查询硬件信息上层接口,自动验证上层软件的有效性。通过按照预设频率(例如每隔0.5h)读取S102中定向至虚拟文件中的返回值,并将返回值和期望值进行匹配,实现自动化测试查询硬件信息上层接口。若预设期望值和修改后的返回值相同,则测试通过;若预设期望值和修改后的返回值不相同,则测试不通过,并可将测试结果记录在日志中。At regular intervals, the hardware instance to be tested can be checked once, that is, the test is automatically executed at regular intervals to query the upper-layer interface of hardware information, and the validity of the upper-layer software can be automatically verified. By reading the return value directed to the virtual file in S102 according to a preset frequency (for example, every 0.5h), and matching the return value with the expected value, the upper-layer interface of automatic test query hardware information is realized. If the preset expected value and the modified return value are the same, the test passes; if the preset expected value and the modified return value are different, the test fails, and the test result can be recorded in the log.
可将整个过程通过编写脚本这种软件方式实现,将待测试硬件实例写入至脚本中,并在脚本中创建虚拟文件,将底层传入数据修改并重定向至该虚拟文件中,以使测试人员可以傻瓜似的执行测试脚本,而不再需要手动的配置硬件环境,更改环境变量,提高了测试效率The whole process can be realized by writing a script, the hardware instance to be tested is written into the script, and a virtual file is created in the script, and the underlying incoming data is modified and redirected to the virtual file, so that the tester can The test script can be executed like a fool, without the need to manually configure the hardware environment, change the environment variables, and improve the test efficiency
日志可记录整个测试过程,考虑到日志容量占用太大内存,可能影响系统运行,可仅记录测试结果和测试时间,以便研发人员可直接通过查阅日志,便可校验上次软件功能的有效性,不需要依赖真实的底层硬件信息,也不存在对硬件的改变与配置,避免了对底层固件设备的操作,只需要在开始时,运行测试脚本,中间过程完全不需要关注。The log can record the entire test process. Considering that the log capacity occupies too much memory and may affect the system operation, only the test results and test time can be recorded, so that the R&D personnel can directly check the log to verify the validity of the last software function. , does not need to rely on the real underlying hardware information, and there is no change and configuration of the hardware, avoiding the operation of the underlying firmware device, only need to run the test script at the beginning, and the intermediate process does not need to be concerned at all.
举例来说,待测试硬件实例为风扇的在位信息,会有对应的底层的查询接口,其返回值也肯定是表明在位。可将其查询接口返回值修改为非在位并重定向到特定文件中,通过定期读取特定文件,获取预先修改上层对应的字段,跟期望值匹配,如果上层最终的字段跟期望字段一致,则测试通过,反之,则测试不通过,从而实现自动化测试查询硬件信息上层接口。For example, if the hardware instance to be tested is the presence information of the fan, there will be a corresponding low-level query interface, and the return value must also indicate the presence. The return value of its query interface can be modified to be non-existent and redirected to a specific file. By periodically reading a specific file, the field corresponding to the pre-modified upper layer can be obtained and matched with the expected value. If the final field of the upper layer is consistent with the expected field, then test Pass, otherwise, the test fails, so as to realize the automatic test query hardware information upper interface.
在本发明实施例提供的技术方案中,通过软件方式自动化测试查询硬件信息上层接口,将硬件环境以软件的方式模拟出来,从而将上层软件代码和底层硬件隔离,在验证上层软件功能时,不仅可以避免验证硬件信息时必须手动更改配置硬件环境和环境变量的问题,而且还能够全程自动验证,实现硬件问题软件模拟化,软件功能脚本测试自动化,快速有效,大大提高了测试效率,增强了测试准确率,还有利于增强存储产品的质量;此外,将软硬件环境隔离,有效避免传统验证上层软件接口时对硬件的损坏问题,有利于降低研发成本。In the technical solution provided by the embodiment of the present invention, the upper-layer interface of hardware information is automatically tested and inquired through software, and the hardware environment is simulated in software, thereby isolating the upper-layer software code from the underlying hardware. When verifying the function of the upper-layer software, not only It can avoid the problem of manually changing the configuration hardware environment and environment variables when verifying hardware information, and can also automatically verify the whole process, realize software simulation of hardware problems, and automate software function script testing, which is fast and effective, greatly improving test efficiency and enhancing the test. The accuracy rate is also conducive to enhancing the quality of storage products; in addition, the hardware and software environments are isolated to effectively avoid the problem of hardware damage when traditionally verifying upper-layer software interfaces, which is conducive to reducing R&D costs.
本申请还提供了另外一个实施例,请参阅图2,图2为本发明实施例提供的另一种自动化测试查询硬件信息上层接口的方法的流程示意图,例如可应用于存储系统中,可包括以下内容:The present application also provides another embodiment, please refer to FIG. 2 , FIG. 2 is a schematic flowchart of another method for an automated test querying an upper-layer interface of hardware information provided by an embodiment of the present invention, which may be applied to a storage system, for example, and may include The following:
S201:获取待测试硬件实例,将待测试硬件实例写入至预设特定文件,确定待测试硬件实例对应的查询接口。S201: Obtain the hardware instance to be tested, write the hardware instance to be tested to a preset specific file, and determine a query interface corresponding to the hardware instance to be tested.
S202:根据接收到的修改指令修改查询接口的返回值,并重定向至预设虚拟文件中。S202: Modify the return value of the query interface according to the received modification instruction, and redirect to a preset virtual file.
S203:按照预设频率读取虚拟文件得到修改后的返回值。S203: Read the virtual file according to the preset frequency to obtain the modified return value.
预设频率的设定可根据实际情况进行确定,本申请对此不做任何限定。The setting of the preset frequency can be determined according to the actual situation, which is not limited in this application.
S204:若预设期望值和修改后的返回值相同,则生成的测试结果为测试通过。S204: If the preset expected value and the modified return value are the same, the generated test result is that the test passes.
S205:若预设期望值和修改后的返回值不相同,则生成的测试结果为测试不通过。S205: If the preset expected value and the modified return value are different, the generated test result is that the test fails.
S206:将测试结果记录在日志中。S206: Record the test result in the log.
本发明实施例与上述实施例相同的方法或步骤,可参阅上述实施例的描述,此处,不再赘述。For the same methods or steps in the embodiments of the present invention as the above-mentioned embodiments, reference may be made to the descriptions of the above-mentioned embodiments, and details are not repeated here.
由上可知,本发明实施例通过软件方式自动化测试查询硬件信息上层接口,将硬件环境以软件的方式模拟出来,从而将上层软件代码和底层硬件隔离,快速有效,提高了测试效率,增强了测试准确率,将软硬件环境隔离,有效避免传统验证上层软件接口时对硬件的损坏问题,有利于降低研发成本;研发人员可直接查询日志记录来检验软件功能的可用性,从而提高研发人员代码功能测试效率。As can be seen from the above, the embodiment of the present invention automatically tests and queries the upper-layer interface of hardware information through software, and simulates the hardware environment in software, thereby isolating the upper-layer software code from the underlying hardware, which is fast and effective, improves the test efficiency, and enhances the test. Accuracy rate, isolates the software and hardware environment, effectively avoids the problem of hardware damage when traditionally verifying the upper-layer software interface, and helps reduce R&D costs; R&D personnel can directly query the log records to check the availability of software functions, thereby improving the code function testing of developers. efficiency.
本发明实施例还针对自动化测试查询硬件信息上层接口的方法提供了相应的实现装置,进一步使得所述方法更具有实用性。下面对本发明实施例提供的自动化测试查询硬件信息上层接口的装置进行介绍,下文描述的自动化测试查询硬件信息上层接口的装置与上文描述的自动化测试查询硬件信息上层接口的方法可相互对应参照。The embodiment of the present invention also provides a corresponding implementation device for the method of querying the upper-layer interface of hardware information by automated testing, which further makes the method more practical. The following describes the device for querying the upper-layer interface of hardware information by automated testing provided by the embodiments of the present invention. The device for querying the upper-layer interface of hardware information by automatic testing described below and the method for querying the upper-layer interface of hardware information by automatic testing described above may refer to each other correspondingly.
参见图3,图3为本发明实施例提供的自动化测试查询硬件信息上层接口的装置在一种具体实施方式下的结构图,该装置可包括:Referring to FIG. 3, FIG. 3 is a structural diagram of an apparatus for an automated test querying an upper-layer interface for hardware information provided by an embodiment of the present invention under a specific implementation manner, and the apparatus may include:
待测试硬件实例信息获取模块301,用于获取待测试硬件实例,确定待测试硬件实例对应的查询接口。The hardware instance information acquisition module 301 is configured to acquire the hardware instance to be tested, and determine the query interface corresponding to the hardware instance to be tested.
底层数据修改模块302,用于根据接收到的修改指令修改查询接口的返回值,并重定向至预设虚拟文件中。The underlying data modification module 302 is configured to modify the return value of the query interface according to the received modification instruction, and redirect to a preset virtual file.
自动化测试模块303,用于读取虚拟文件得到修改后的返回值,根据预设期望值和修改后的返回值的匹配结果,生成测试结果;期望值与修改指令中修改数据字段相同。The automated test module 303 is configured to read the virtual file to obtain the modified return value, and generate a test result according to the matching result between the preset expected value and the modified return value; the expected value is the same as the modified data field in the modification instruction.
可选的,在本实施例的一些实施方式中,请参阅图4,所述装置例如还可以包括日志记录模块304,用于将测试结果记录在日志中。Optionally, in some implementations of this embodiment, referring to FIG. 4 , for example, the apparatus may further include a log recording module 304, configured to record the test result in a log.
可选的,在本实施例的另一些实施方式中,所述自动化测试模块303还可为按照预设频率读取虚拟文件得到修改后的返回值的模块。Optionally, in other implementations of this embodiment, the automated testing module 303 may also be a module that reads a virtual file according to a preset frequency to obtain a modified return value.
此外,所述自动化测试模块303还可用于若预设期望值和修改后的返回值相同,则生成的测试结果为测试通过;若预设期望值和修改后的返回值不相同,则生成的测试结果为测试不通过。In addition, the automated test module 303 can also be used to generate a test result that passes the test if the preset expected value and the modified return value are the same; if the preset expected value and the modified return value are different, the generated test result to fail the test.
本发明实施例所述自动化测试查询硬件信息上层接口的装置的各功能模块的功能可根据上述方法实施例中的方法具体实现,其具体实现过程可以参照上述方法实施例的相关描述,此处不再赘述。The functions of each functional module of the apparatus for automatically testing and querying the upper-layer interface of hardware information according to the embodiment of the present invention can be specifically implemented according to the methods in the above method embodiments, and the specific implementation process can refer to the relevant descriptions of the above method embodiments, which are not described here. Repeat.
由上可知,本发明实施例通过软件方式自动化测试查询硬件信息上层接口,将硬件环境以软件的方式模拟出来,从而将上层软件代码和底层硬件隔离,快速有效,提高了测试效率,增强了测试准确率,将软硬件环境隔离,有效避免传统验证上层软件接口时对硬件的损坏问题,有利于降低研发成本。As can be seen from the above, the embodiment of the present invention automatically tests and queries the upper-layer interface of hardware information through software, and simulates the hardware environment in software, thereby isolating the upper-layer software code from the underlying hardware, which is fast and effective, improves the test efficiency, and enhances the test. Accuracy, isolates the software and hardware environment, effectively avoids the problem of damage to the hardware when traditionally verifying the upper-layer software interface, and helps reduce R&D costs.
本发明实施例还提供了一种自动化测试查询硬件信息上层接口的设备,具体可包括:The embodiment of the present invention also provides a device for automatically testing an upper-layer interface for querying hardware information, which may specifically include:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行计算机程序以实现如上任意一实施例所述自动化测试查询硬件信息上层接口的方法的步骤。The processor is configured to execute the computer program to implement the steps of the method for automatically testing the method for querying the upper-layer interface of hardware information according to any one of the above embodiments.
本发明实施例所述自动化测试查询硬件信息上层接口的设备的各功能模块的功能可根据上述方法实施例中的方法具体实现,其具体实现过程可以参照上述方法实施例的相关描述,此处不再赘述。The functions of each functional module of the device for automatically testing and querying the upper-layer interface of hardware information according to the embodiment of the present invention can be specifically implemented according to the methods in the above method embodiments, and the specific implementation process can refer to the relevant descriptions of the above method embodiments, which are not described here. Repeat.
由上可知,本发明实施例通过软件方式自动化测试查询硬件信息上层接口,将硬件环境以软件的方式模拟出来,从而将上层软件代码和底层硬件隔离,快速有效,提高了测试效率,增强了测试准确率,将软硬件环境隔离,有效避免传统验证上层软件接口时对硬件的损坏问题,有利于降低研发成本。As can be seen from the above, the embodiment of the present invention automatically tests and queries the upper-layer interface of hardware information through software, and simulates the hardware environment in software, thereby isolating the upper-layer software code from the underlying hardware, which is fast and effective, improves the test efficiency, and enhances the test. Accuracy, isolates the software and hardware environment, effectively avoids the problem of damage to the hardware when traditionally verifying the upper-layer software interface, and helps reduce R&D costs.
本发明实施例还提供了一种计算机可读存储介质,存储有自动化测试查询硬件信息上层接口的程序,所述自动化测试查询硬件信息上层接口的程序被处理器执行时如上任意一实施例所述自动化测试查询硬件信息上层接口的方法的步骤。An embodiment of the present invention further provides a computer-readable storage medium, which stores a program for querying an upper-layer interface of hardware information by an automated test. The steps of the automated testing method for querying the upper-layer interface for hardware information.
本发明实施例所述计算机可读存储介质的各功能模块的功能可根据上述方法实施例中的方法具体实现,其具体实现过程可以参照上述方法实施例的相关描述,此处不再赘述。The functions of each functional module of the computer-readable storage medium according to the embodiments of the present invention may be specifically implemented according to the methods in the foregoing method embodiments, and the specific implementation process may refer to the relevant descriptions of the foregoing method embodiments, which will not be repeated here.
由上可知,本发明实施例通过软件方式自动化测试查询硬件信息上层接口,将硬件环境以软件的方式模拟出来,从而将上层软件代码和底层硬件隔离,快速有效,提高了测试效率,增强了测试准确率,将软硬件环境隔离,有效避免传统验证上层软件接口时对硬件的损坏问题,有利于降低研发成本。As can be seen from the above, the embodiment of the present invention automatically tests and queries the upper-layer interface of hardware information through software, and simulates the hardware environment in software, thereby isolating the upper-layer software code from the underlying hardware, which is fast and effective, improves the test efficiency, and enhances the test. Accuracy, isolates the software and hardware environment, effectively avoids the problem of damage to the hardware when traditionally verifying the upper-layer software interface, and helps reduce R&D costs.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments may be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the possibilities of hardware and software. Interchangeability, the above description has generally described the components and steps of each example in terms of functionality. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of a method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented in hardware, a software module executed by a processor, or a combination of the two. A software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.
以上对本发明所提供的一种自动化测试查询硬件信息上层接口的方法、装置、设备及计算机可读存储介质进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The method, apparatus, device, and computer-readable storage medium for an automated test querying an upper-layer interface for hardware information provided by the present invention have been described above in detail. The principles and implementations of the present invention are described herein by using specific examples, and the descriptions of the above embodiments are only used to help understand the method and the core idea of the present invention. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, several improvements and modifications can also be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910290105.8A CN110008074B (en) | 2019-04-11 | 2019-04-11 | Method, device and device for automatic test query hardware information upper interface |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910290105.8A CN110008074B (en) | 2019-04-11 | 2019-04-11 | Method, device and device for automatic test query hardware information upper interface |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN110008074A true CN110008074A (en) | 2019-07-12 |
| CN110008074B CN110008074B (en) | 2020-07-07 |
Family
ID=67171158
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910290105.8A Active CN110008074B (en) | 2019-04-11 | 2019-04-11 | Method, device and device for automatic test query hardware information upper interface |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN110008074B (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110737590A (en) * | 2019-09-16 | 2020-01-31 | 上海御渡半导体科技有限公司 | An offline debugging method |
| CN111459403A (en) * | 2020-02-29 | 2020-07-28 | 新华三技术有限公司成都分公司 | Storage hardware management method and device |
| CN115712559A (en) * | 2022-10-14 | 2023-02-24 | 超聚变数字技术有限公司 | Method and device for testing hardware management software and electronic equipment |
| CN115993570A (en) * | 2021-10-18 | 2023-04-21 | 河南许继仪表有限公司 | A hardware virtual acceleration test method and device for the software function of an electric energy meter |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0675811A (en) * | 1992-08-27 | 1994-03-18 | Oki Electric Ind Co Ltd | Terminal testing device |
| CN104360920A (en) * | 2014-12-02 | 2015-02-18 | 微梦创科网络科技(中国)有限公司 | Automatic testing method and device for interface |
| CN105354143A (en) * | 2015-12-02 | 2016-02-24 | 北京奇虎科技有限公司 | Test method and device for application programs |
| CN107294808A (en) * | 2017-07-05 | 2017-10-24 | 网易(杭州)网络有限公司 | The methods, devices and systems of interface testing |
-
2019
- 2019-04-11 CN CN201910290105.8A patent/CN110008074B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0675811A (en) * | 1992-08-27 | 1994-03-18 | Oki Electric Ind Co Ltd | Terminal testing device |
| CN104360920A (en) * | 2014-12-02 | 2015-02-18 | 微梦创科网络科技(中国)有限公司 | Automatic testing method and device for interface |
| CN105354143A (en) * | 2015-12-02 | 2016-02-24 | 北京奇虎科技有限公司 | Test method and device for application programs |
| CN107294808A (en) * | 2017-07-05 | 2017-10-24 | 网易(杭州)网络有限公司 | The methods, devices and systems of interface testing |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110737590A (en) * | 2019-09-16 | 2020-01-31 | 上海御渡半导体科技有限公司 | An offline debugging method |
| CN110737590B (en) * | 2019-09-16 | 2023-11-03 | 上海御渡半导体科技有限公司 | An offline debugging method |
| CN111459403A (en) * | 2020-02-29 | 2020-07-28 | 新华三技术有限公司成都分公司 | Storage hardware management method and device |
| CN115993570A (en) * | 2021-10-18 | 2023-04-21 | 河南许继仪表有限公司 | A hardware virtual acceleration test method and device for the software function of an electric energy meter |
| CN115712559A (en) * | 2022-10-14 | 2023-02-24 | 超聚变数字技术有限公司 | Method and device for testing hardware management software and electronic equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110008074B (en) | 2020-07-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10552301B2 (en) | Completing functional testing | |
| CN110008074B (en) | Method, device and device for automatic test query hardware information upper interface | |
| US10049031B2 (en) | Correlation of violating change sets in regression testing of computer software | |
| CN111797006B (en) | Method, device and equipment for testing thread and storage medium | |
| CN105912460A (en) | Software test method and system based on QTP | |
| US10572373B2 (en) | Automated test generation for multi-interface and multi-platform enterprise virtualization management environment | |
| CN110134609A (en) | Enterprise-level web application system page method for testing performance, device and medium | |
| US9632922B2 (en) | Workload mapper for potential problem areas using modules and defect data | |
| US9842044B2 (en) | Commit sensitive tests | |
| US11874764B2 (en) | Method and system for guaranteeing game quality by using artificial intelligence agent | |
| CN114741303A (en) | Test script generation method and device and electronic equipment | |
| US9990274B2 (en) | Testing integrated business systems | |
| CN110908912B (en) | A software security threat analysis method and system | |
| CN114090357A (en) | Hard disk performance test method and device, electronic equipment and storage medium | |
| CN115934560B (en) | User interface UI automated testing method, device, equipment and medium | |
| TWI592885B (en) | Test system | |
| CN110661678B (en) | Abnormity monitoring method and device | |
| CN120086083A (en) | PCIe device error injection method, device, equipment and readable storage medium | |
| CN118377482A (en) | Interface development method, device, computer equipment and storage medium | |
| CN118331886A (en) | Project test methods, computer devices, storage media and programs | |
| CN116974910A (en) | Continuous delivery methods, devices, storage media and electronic equipment of blockchain SDK | |
| CN116955196A (en) | Test methods, devices and equipment | |
| CN108170597A (en) | A kind of test method, system, equipment and computer storage media | |
| CN115674275A (en) | Method and apparatus for internal testing of robotic systems | |
| CN115495335A (en) | Target machine testing method and device, electronic equipment and readable medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address |
Address after: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province Patentee after: Suzhou Yuannao Intelligent Technology Co.,Ltd. Country or region after: China Address before: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province Patentee before: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Country or region before: China |
|
| CP03 | Change of name, title or address |