[go: up one dir, main page]

CN110750434A - Interface testing method, apparatus, electronic device, and computer-readable storage medium - Google Patents

Interface testing method, apparatus, electronic device, and computer-readable storage medium Download PDF

Info

Publication number
CN110750434A
CN110750434A CN201810811273.2A CN201810811273A CN110750434A CN 110750434 A CN110750434 A CN 110750434A CN 201810811273 A CN201810811273 A CN 201810811273A CN 110750434 A CN110750434 A CN 110750434A
Authority
CN
China
Prior art keywords
interface
test
tested
development document
development
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810811273.2A
Other languages
Chinese (zh)
Inventor
杨会会
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201810811273.2A priority Critical patent/CN110750434A/en
Publication of CN110750434A publication Critical patent/CN110750434A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明公开了接口测试方法、装置、电子设备和计算机可读存储介质。所述方法包括:获取待测试接口的开发文档;从所述开发文档中提取测试相关信息;根据所述测试相关信息生成并保存与所述待测试接口对应的测试项;响应于对测试项的选取请求,对相应的待测试接口进行接口测试。该技术方案提供了一种测试阶段中的接口自动化收集,相应的测试项可以在实际测试时再使用,实现了接口录入与测试的松耦合,灵活可靠,相较于了人工配置接口完成接口测试提高了效率和准确度。

Figure 201810811273

The invention discloses an interface testing method, device, electronic device and computer-readable storage medium. The method includes: acquiring a development document of the interface to be tested; extracting test-related information from the development document; generating and saving a test item corresponding to the interface to be tested according to the test-related information; Select the request to perform the interface test on the corresponding interface to be tested. The technical solution provides an automatic collection of interfaces in the testing phase, and the corresponding test items can be reused during actual testing, which realizes the loose coupling between interface entry and testing, is flexible and reliable, and completes interface testing compared to manually configuring interfaces. Improved efficiency and accuracy.

Figure 201810811273

Description

接口测试方法、装置、电子设备和计算机可读存储介质Interface testing method, apparatus, electronic device, and computer-readable storage medium

技术领域technical field

本发明涉及接口测试领域,具体涉及接口测试方法、装置、电子设备和计算机可读存储介质。The present invention relates to the field of interface testing, in particular to an interface testing method, apparatus, electronic device and computer-readable storage medium.

背景技术Background technique

接口测试是测试系统组件间接口的一种测试。接口测试主要用于检测外部系统与系统之间以及内部各个子系统之间的交互点。测试的重点是要检查数据的交换,传递和控制管理过程,以及系统间的相互逻辑依赖关系等。Interface testing is a type of testing that tests the interface between system components. Interface testing is mainly used to detect the interaction points between the external system and the system and between the various internal subsystems. The focus of the test is to check the data exchange, transfer and control management process, as well as the mutual logical dependencies between systems.

接口测试的对象是接口,而对于一个项目而言,接口可能会新增、被修改或被删除。现有技术中在进行接口测试时,需要对待测试的接口先进行复杂的人工配置过程,效率低下。The object of the interface test is the interface, and for a project, the interface may be added, modified or deleted. In the prior art, when an interface is tested, a complex manual configuration process needs to be performed on the interface to be tested, which is inefficient.

发明内容SUMMARY OF THE INVENTION

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的接口测试方法、装置、电子设备和计算机可读存储介质。In view of the above problems, the present invention is proposed to provide an interface testing method, apparatus, electronic device and computer readable storage medium that overcome the above problems or at least partially solve the above problems.

依据本发明的一个方面,提供了一种接口测试方法,包括:According to one aspect of the present invention, an interface testing method is provided, comprising:

获取待测试接口的开发文档;Obtain the development documentation of the interface to be tested;

从所述开发文档中提取测试相关信息;extracting test-related information from the development documentation;

根据所述测试相关信息生成并保存与所述待测试接口对应的测试项;Generate and save a test item corresponding to the interface to be tested according to the test-related information;

响应于对测试项的选取请求,对相应的待测试接口进行接口测试。In response to the selection request for the test item, the interface test is performed on the corresponding interface to be tested.

可选地,所述获取待测试接口的开发文档包括:Optionally, the obtaining the development document of the interface to be tested includes:

在满足预设的时间条件时,从预先配置的地址获取待测试接口的开发文档;When the preset time condition is met, obtain the development document of the interface to be tested from the pre-configured address;

和/或,and / or,

在获知所述待测试接口的开发文档的保存事件时,从预先配置的地址获取待测试接口的开发文档。When the save event of the development document of the interface to be tested is known, the development document of the interface to be tested is acquired from a preconfigured address.

可选地,所述开发文档是基于开发所使用的编程语言的注释规范编写的。Optionally, the development document is written based on the annotation specification of the programming language used for development.

可选地,所述测试相关信息包括如下的一种或多种:Optionally, the test-related information includes one or more of the following:

接口地址,接口名称,接口参数,接口返回值。Interface address, interface name, interface parameters, interface return value.

可选地,所述响应于对测试项的选取请求,对相应的待测试接口进行接口测试包括:Optionally, in response to the selection request for the test item, performing an interface test on the corresponding interface to be tested includes:

提供接口测试界面,在所述接口测试界面中展示包括一个或多个测试项的接口测试列表;Provide an interface test interface, and display an interface test list including one or more test items in the interface test interface;

接收对接口测试列表中的测试项的选取请求,获取与选取的测试项对应的测试用例,对所述待测试接口进行接口测试。A request for selecting a test item in the interface test list is received, a test case corresponding to the selected test item is acquired, and an interface test is performed on the interface to be tested.

可选地,该方法还包括:Optionally, the method further includes:

提供测试用例生成界面;Provide test case generation interface;

通过所述测试用例生成界面接收数据构造条件;Receive data construction conditions through the test case generation interface;

根据所述数据构造条件生成相应测试用例。Corresponding test cases are generated according to the data construction conditions.

可选地,所述数据构造条件包括如下的一种或多种:Optionally, the data construction conditions include one or more of the following:

基于接口参数构造接口测试数据;Construct interface test data based on interface parameters;

基于数据库连接信息构造接口测试数据;Construct interface test data based on database connection information;

基于缓存地址构造接口测试数据。Constructs interface test data based on cached addresses.

可选地,所述根据所述数据构造条件生成相应的接口测试数据包括:Optionally, the generating corresponding interface test data according to the data construction conditions includes:

根据所述数据库连接信息在相应数据库中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试;Inserting interface test data in the corresponding database according to the database connection information, so as to use the inserted interface test data to perform interface test when performing interface test on the corresponding interface to be tested;

和/或,and / or,

根据所述数据库连接信息构造数据库查询语句,以在对相应的待测试接口进行接口测试时利用所述数据库查询语句查询出的数据进行接口测试;Construct a database query statement according to the database connection information, so as to use the data queried by the database query statement to perform interface testing when performing interface testing on the corresponding interface to be tested;

和/或,and / or,

根据所述缓存地址在相应缓存中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试。The interface test data is inserted into the corresponding cache according to the cache address, so as to use the inserted interface test data to perform the interface test when the interface test is performed on the corresponding interface to be tested.

可选地,该方法进一步包括:Optionally, the method further includes:

通过所述接口测试界面接收校验配置信息;Receive verification configuration information through the interface test interface;

在所述接口测试完成后,根据所述校验配置信息进行校验并进一步生成与所述接口测试对应的测试结果。After the interface test is completed, the verification is performed according to the verification configuration information, and a test result corresponding to the interface test is further generated.

可选地,所述根据所述校验配置信息进行校验包括如下的一种或多种:Optionally, the performing verification according to the verification configuration information includes one or more of the following:

根据所述校验配置信息,对所述待测试接口的返回值进行校验;verifying the return value of the interface to be tested according to the verification configuration information;

根据所述校验配置信息中的数据库查询语句从目标数据库中查询出相应数据,根据所述校验配置信息对读取的数据进行校验;The corresponding data is queried from the target database according to the database query statement in the verification configuration information, and the read data is verified according to the verification configuration information;

获取与完成的接口测试对应的日志,根据所述校验配置信息从所述日志中提取相应的部分日志,对提取的部分日志进行校验。A log corresponding to the completed interface test is acquired, a corresponding part of the log is extracted from the log according to the verification configuration information, and the extracted part of the log is verified.

依据本发明的另一方面,提供了一种接口测试装置,包括:According to another aspect of the present invention, an interface testing device is provided, comprising:

获取单元,适于获取待测试接口的开发文档;The acquisition unit is suitable for acquiring the development documents of the interface to be tested;

提取单元,适于从所述开发文档中提取测试相关信息;an extraction unit, adapted to extract test-related information from the development document;

测试项单元,适于根据所述测试相关信息生成并保存与所述待测试接口对应的测试项;a test item unit, adapted to generate and save a test item corresponding to the interface to be tested according to the test-related information;

测试单元,适于响应于对测试项的选取请求,对相应的待测试接口进行接口测试。The test unit is adapted to perform interface test on the corresponding interface to be tested in response to the selection request for the test item.

可选地,所述获取单元,适于在满足预设的时间条件时,从预先配置的地址获取待测试接口的开发文档;和/或,在获知所述待测试接口的开发文档的保存事件时,从预先配置的地址获取待测试接口的开发文档。Optionally, the obtaining unit is adapted to obtain the development document of the interface to be tested from a pre-configured address when a preset time condition is met; and/or, upon learning of the saving event of the development document of the interface to be tested , obtain the development document of the interface to be tested from the pre-configured address.

可选地,所述开发文档是基于开发所使用的编程语言的注释规范编写的。Optionally, the development document is written based on the annotation specification of the programming language used for development.

可选地,所述测试相关信息包括如下的一种或多种:Optionally, the test-related information includes one or more of the following:

接口地址,接口名称,接口参数,接口返回值。Interface address, interface name, interface parameters, interface return value.

可选地,所述测试单元,适于提供接口测试界面,在所述接口测试界面中展示包括一个或多个测试项的接口测试列表;接收对接口测试列表中的测试项的选取请求,获取与选取的测试项对应的测试用例,对所述待测试接口进行接口测试。Optionally, the test unit is adapted to provide an interface test interface, and displays an interface test list including one or more test items in the interface test interface; receives a request for selecting a test item in the interface test list, and obtains For the test case corresponding to the selected test item, the interface test is performed on the interface to be tested.

可选地,该装置还包括:Optionally, the device also includes:

测试用例单元,适于提供测试用例生成界面;通过所述测试用例生成界面接收数据构造条件;根据所述数据构造条件生成相应的测试用例。The test case unit is adapted to provide a test case generation interface; receive data construction conditions through the test case generation interface; and generate corresponding test cases according to the data construction conditions.

可选地,所述数据构造条件包括如下的一种或多种:基于接口参数构造接口测试数据;基于数据库连接信息构造接口测试数据;基于缓存地址构造接口测试数据。Optionally, the data construction conditions include one or more of the following: constructing interface test data based on interface parameters; constructing interface test data based on database connection information; constructing interface test data based on cache addresses.

可选地,所述测试用例单元,适于根据所述数据库连接信息在相应数据库中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试;和/或,根据所述数据库连接信息构造数据库查询语句,以在对相应的待测试接口进行接口测试时利用所述数据库查询语句查询出的数据进行接口测试;和/或,根据所述缓存地址在相应缓存中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试。Optionally, the test case unit is adapted to insert interface test data in the corresponding database according to the database connection information, so as to use the inserted interface test data to perform the interface test when the interface test is performed on the corresponding interface to be tested; and /or, constructing a database query statement according to the database connection information, so as to use the data queried by the database query statement to perform an interface test when performing an interface test on a corresponding interface to be tested; and/or, according to the cache address in The interface test data is inserted into the corresponding cache, so as to use the inserted interface test data to perform the interface test when the interface test is performed on the corresponding interface to be tested.

可选地,该装置进一步包括:Optionally, the device further includes:

校验单元,适于通过所述接口测试界面接收校验配置信息;在所述接口测试完成后,根据所述校验配置信息进行校验并进一步生成与所述接口测试对应的测试结果。The verification unit is adapted to receive verification configuration information through the interface test interface; after the interface test is completed, perform verification according to the verification configuration information and further generate a test result corresponding to the interface test.

可选地,所述校验单元,适于根据所述校验配置信息,对所述待测试接口的返回值进行校验;和/或,根据所述校验配置信息中的数据库查询语句从目标数据库中查询出相应数据,根据所述校验配置信息对读取的数据进行校验;和/或,获取与完成的接口测试对应的日志,根据所述校验配置信息从所述日志中提取相应的部分日志,对提取的部分日志进行校验。Optionally, the verification unit is adapted to verify the return value of the interface to be tested according to the verification configuration information; and/or, according to the database query statement in the verification configuration information The corresponding data is queried in the target database, and the read data is verified according to the verification configuration information; and/or, the log corresponding to the completed interface test is acquired, and the log is obtained from the log according to the verification configuration information. Extract the corresponding part of the log, and verify the extracted part of the log.

依据本发明的又一方面,提供了一种电子设备,包括:处理器;以及被安排成存储计算机可执行指令的存储器,所述可执行指令在被执行时使所述处理器执行如上述任一所述的方法。According to yet another aspect of the present invention, there is provided an electronic device comprising: a processor; and a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform any of the above a described method.

依据本发明的再一方面,提供了一种计算机可读存储介质,其中,所述计算机可读存储介质存储一个或多个程序,所述一个或多个程序当被处理器执行时,实现如上述任一所述的方法。According to yet another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, the one or more programs, when executed by a processor, implements the following: Any of the methods described above.

由上述可知,本发明的技术方案,通过获取待测试接口的开发文档,从中提取出测试相关信息,可以自动化地生成并保存与待测试接口对应的测试项,在实际进行接口测试时,依据对测试项的选取请求就可以实现对相应的待测试接口进行接口测试。该技术方案提供了一种测试阶段中的接口自动化收集,相应的测试项可以在实际测试时再使用,实现了接口录入与测试的松耦合,灵活可靠,相较于了人工配置接口完成接口测试提高了效率和准确度。It can be seen from the above that the technical solution of the present invention can automatically generate and save the test items corresponding to the interface to be tested by acquiring the development document of the interface to be tested and extract the relevant test information from it. The selection request of the test item can realize the interface test of the corresponding interface to be tested. The technical solution provides an automatic collection of interfaces in the testing phase, and the corresponding test items can be reused during actual testing, which realizes the loose coupling between interface entry and testing, is flexible and reliable, and completes interface testing compared to manually configuring interfaces. Improved efficiency and accuracy.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, in order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are for the purpose of illustrating preferred embodiments only and are not to be considered limiting of the invention. Also, the same components are denoted by the same reference numerals throughout the drawings. In the attached image:

图1示出了根据本发明一个实施例的一种接口测试方法的流程示意图;1 shows a schematic flowchart of an interface testing method according to an embodiment of the present invention;

图2示出了根据本发明一个实施例的一种接口测试装置的结构示意图;2 shows a schematic structural diagram of an interface testing device according to an embodiment of the present invention;

图3示出了根据本发明一个实施例的电子设备的结构示意图;FIG. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention;

图4示出了根据本发明一个实施例的计算机可读存储介质的结构示意图。FIG. 4 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.

图1示出了根据本发明一个实施例的一种接口测试方法的流程示意图。如图1所示,该方法包括:FIG. 1 shows a schematic flowchart of an interface testing method according to an embodiment of the present invention. As shown in Figure 1, the method includes:

步骤S110,获取待测试接口的开发文档。开发文档可以是开发人员在进行接口开发过程中编写的,具体来说,在本发明的一个实施例中,上述方法中,开发文档是基于开发所使用的编程语言的注释规范编写的。Step S110, acquiring a development document of the interface to be tested. The development document may be written by the developer during the interface development process. Specifically, in an embodiment of the present invention, in the above method, the development document is written based on the annotation specification of the programming language used for development.

例如,网站的接口通常可以采用PHP语言进行开发,则可以利用PHP的注释规范PHPDoc编写开发文档。这样,由于开发文档遵守固定格式的规范,就可以从中方便地自动读取出测试相关信息,即如步骤S120所示。For example, the interface of the website can usually be developed using the PHP language, and the development document can be written by using the PHP annotation specification PHPDoc. In this way, since the development document complies with the specification of the fixed format, the test-related information can be conveniently and automatically read from the development document, as shown in step S120.

步骤S120,从开发文档中提取测试相关信息。Step S120, extracting test-related information from the development document.

在本发明的一个实施例中,上述方法中,测试相关信息包括如下的一种或多种:接口地址,接口名称,接口参数,接口返回值。例如,PHPDoc中以“@return”注释接口返回值,以“@name”注释接口名称等等。In an embodiment of the present invention, in the above method, the test-related information includes one or more of the following: an interface address, an interface name, an interface parameter, and an interface return value. For example, the interface return value is annotated with "@return" in PHPDoc, the interface name is annotated with "@name", and so on.

步骤S130,根据测试相关信息生成并保存与待测试接口对应的测试项。Step S130: Generate and save a test item corresponding to the interface to be tested according to the test-related information.

以具体实现中通过测试平台提供服务为例,则在测试平台中就保存了与各待测试接口对应的测试项,实现了接口自动录入。现有技术中如果想要实现接口测试,需要开发人员为测试人员提供测试相关信息,实现接口的人工录入或者说人工配置,即使采用平台化设计,也仅仅是提供给测试人员和开发人员一个便于交互的媒介,实际上还是需要开发人员手动录入接口,那么不可避免地存在误操作,不仅效率低,准确度也不高。Taking the service provided by the test platform as an example in the specific implementation, the test items corresponding to each interface to be tested are saved in the test platform, realizing the automatic entry of the interface. In the prior art, if you want to implement interface testing, you need developers to provide testers with test-related information and implement manual entry or manual configuration of the interface. The interactive medium actually still requires developers to manually enter the interface, so there will inevitably be misoperations, which are not only inefficient, but also not accurate.

步骤S140,响应于对测试项的选取请求,对相应的待测试接口进行接口测试。Step S140, in response to the selection request for the test item, perform an interface test on the corresponding interface to be tested.

可见,图1所示的方法,通过获取待测试接口的开发文档,从中提取出测试相关信息,可以自动化地生成并保存与待测试接口对应的测试项,在实际进行接口测试时,依据对测试项的选取请求就可以实现对相应的待测试接口进行接口测试。该技术方案提供了一种测试阶段中的接口自动化收集,相应的测试项可以在实际测试时再使用,实现了接口录入与测试的松耦合,灵活可靠,相较于了人工配置接口完成接口测试提高了效率和准确度。It can be seen that the method shown in FIG. 1 can automatically generate and save the test items corresponding to the interface to be tested by obtaining the development document of the interface to be tested, and extract relevant test information from it. The selection request of the item can realize the interface test of the corresponding interface to be tested. The technical solution provides an automatic collection of interfaces in the testing phase, and the corresponding test items can be reused during actual testing, which realizes the loose coupling between interface entry and testing, is flexible and reliable, and completes interface testing compared to manually configuring interfaces. Improved efficiency and accuracy.

在本发明的一个实施例中,上述方法中,获取待测试接口的开发文档包括:在满足预设的时间条件时,从预先配置的地址获取待测试接口的开发文档;和/或,在获知待测试接口的开发文档的保存事件时,从预先配置的地址获取待测试接口的开发文档。In an embodiment of the present invention, in the above method, acquiring the development document of the interface to be tested includes: when a preset time condition is satisfied, acquiring the development document of the interface to be tested from a preconfigured address; and/or, after learning During the save event of the development document of the interface to be tested, the development document of the interface to be tested is obtained from the pre-configured address.

一种方式下,可以每隔固定时间(例如半小时)从开发人员提供的地址(例如文件系统中的路径或是开发文档数据库的地址)中获取开发文档,或者在每天的固定时间获取开发文档。另一种方式下,考虑到前种方式的时效性不强,重复工作可能很多(例如连续几次获得的开发文档都是相同的),则可以利用例如HOOK技术,获知待测试接口的开发文档的保存事件。这样就可以在开发文档新增、修改的时候再获取开发文档。当然,获知待测试接口的开发文档的保存事件也可以是开发人员手动通知的,或是以其他方式实现。In one way, the development documents can be obtained from the address provided by the developer (such as the path in the file system or the address of the development document database) every fixed time (for example, half an hour), or the development document can be obtained at a fixed time every day. . In another method, considering that the former method is not very time-sensitive, and there may be a lot of repetitive work (for example, the development documents obtained several times in a row are the same), for example, the HOOK technology can be used to obtain the development documents of the interface to be tested. save event. In this way, the development documents can be obtained when the development documents are added or modified. Of course, the save event of the development document that knows the interface to be tested may also be manually notified by the developer, or implemented in other ways.

在本发明的一个实施例中,上述方法中,响应于对测试项的选取请求,对相应的待测试接口进行接口测试包括:提供接口测试界面,在接口测试界面中展示包括一个或多个测试项的接口测试列表;接收对接口测试列表中的测试项的选取请求,获取与选取的测试项对应的测试用例,对待测试接口进行接口测试。In an embodiment of the present invention, in the above method, in response to a request for selecting a test item, performing an interface test on a corresponding interface to be tested includes: providing an interface test interface, and displaying in the interface test interface includes one or more tests The interface test list of the item; receive the selection request for the test item in the interface test list, obtain the test case corresponding to the selected test item, and perform the interface test on the interface to be tested.

在本实施例中,在进行接口测试时,用户可以通过访问图形化的、命令行等形式的接口测试界面,获取包括一个或多个测试项的接口测试列表,这样用户可以选择对哪些接口进行测试。In this embodiment, when performing an interface test, the user can obtain an interface test list including one or more test items by accessing a graphical interface test interface, command line, etc., so that the user can choose which interfaces to perform test.

接口测试也通常依赖于测试用例来实现,这里,测试用例可以是用户提交的,例如测试人员预先编写一些测试用例。Interface testing is also usually implemented by relying on test cases. Here, test cases can be submitted by users, for example, testers pre-write some test cases.

考虑测试平台这样的场景,如果能够把测试用例在测试平台进行有效的管理是一种很好的想法,例如划分多个层级,将一些测试用例以测试用例组的方式进行管理。然而,如果仅仅是将测试用例在平台进行这样的管理保存,也不能说满足测试人员的全部需求,例如编写测试用例是一个耗费时间的工作。Considering a scenario such as a test platform, it is a good idea to effectively manage test cases on the test platform, such as dividing into multiple levels and managing some test cases as test case groups. However, if the test cases are only managed and saved on the platform, it cannot be said that all the needs of testers can be met. For example, writing test cases is a time-consuming task.

在本发明的一个实施例中,上述该方法还包括:提供测试用例生成界面;通过测试用例生成界面接收数据构造条件;根据数据构造条件生成相应的测试用例。In an embodiment of the present invention, the above-mentioned method further includes: providing a test case generation interface; receiving data construction conditions through the test case generation interface; and generating corresponding test cases according to the data construction conditions.

在本实施例中,可以由例如测试平台提供一个测试用例生成界面,实现了平台化的测试用例生成。测试用例中通常最重要的就是构造合适的数据,例如测试接口的健壮性,故意向一个只能接受int型数据的接口传入float型的数据。在本实施例中只需要用户提供数据构造条件即可,In this embodiment, a test case generation interface may be provided by, for example, a test platform, thereby realizing platform-based test case generation. The most important thing in a test case is usually to construct appropriate data, such as testing the robustness of an interface, and deliberately passing float data to an interface that can only accept int data. In this embodiment, the user only needs to provide the data construction conditions,

具体来说,在本发明的一个实施例中,上述方法中,数据构造条件包括如下的一种或多种:基于接口参数构造接口测试数据;基于数据库连接信息构造接口测试数据;基于缓存地址构造接口测试数据。Specifically, in an embodiment of the present invention, in the above method, the data construction conditions include one or more of the following: constructing interface test data based on interface parameters; constructing interface test data based on database connection information; constructing based on cache addresses Interface test data.

基于接口参数构造数据的例子已经在上面示出,根据接口参数的类型、范围等可以构造对接口而言正确或错误的数据。也可以支持接口间变量的传递,将前一个接口的返回值作为下一个接口的参数,这样就可以把多个接口串起来实现一个完整的功能,模拟真实的用户操作调用接口的过程,达到构造数据的完整性和测试的仿真性。The example of constructing data based on interface parameters has been shown above, and data that is correct or incorrect for the interface can be constructed according to the type, scope, etc. of the interface parameters. It can also support the transfer of variables between interfaces, and use the return value of the previous interface as the parameter of the next interface, so that multiple interfaces can be chained together to achieve a complete function, simulating the process of real user operation and calling the interface, to achieve the structure Data integrity and test simulation.

在本实施例中还提供了其他几种方式:基于数据库连接信息构造数据;基于缓存地址构造数据。这是因为许多接口需要访问数据库或是缓存,为了对这些场景进行测试,提供了这样的数据构造方式。其中,数据库连接信息可以是预先仅是数据库连接的配置,在提供数据构造条件时仅需提供数据库名称即可。Several other ways are also provided in this embodiment: constructing data based on database connection information; constructing data based on cache addresses. This is because many interfaces require access to databases or caches. In order to test these scenarios, such data structures are provided. Wherein, the database connection information may be only the configuration of the database connection in advance, and only the database name needs to be provided when the data construction conditions are provided.

在本发明的一个实施例中,上述方法中,根据数据构造条件生成相应的测试用例包括:根据数据库连接信息在相应数据库中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试;和/或,根据数据库连接信息构造数据库查询语句,以在对相应的待测试接口进行接口测试时利用数据库查询语句查询出的数据进行接口测试;和/或,根据缓存地址在相应缓存中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试。In an embodiment of the present invention, in the above method, generating the corresponding test case according to the data construction conditions includes: inserting interface test data into the corresponding database according to the database connection information, so as to use the interface test data when performing the interface test on the corresponding interface to be tested. The inserted interface test data is used for interface testing; and/or, a database query statement is constructed according to the database connection information, so as to use the data queried by the database query statement to perform interface testing when performing the interface test on the corresponding interface to be tested; and/or, The interface test data is inserted into the corresponding cache according to the cache address, so as to use the inserted interface test data to perform the interface test when the interface test is performed on the corresponding interface to be tested.

可见,只需要预先配置数据库连接信息和/或缓存地址,就可以在相应位置插入想要的接口测试数据以完成接口测试。例如,某接口需要访问数据库中的用户名查询用户名是否已被注册,则需要在数据库中插入相应的接口测试数据。It can be seen that, only the database connection information and/or the cache address need to be preconfigured, and the desired interface test data can be inserted in the corresponding position to complete the interface test. For example, if an interface needs to access the user name in the database to check whether the user name has been registered, the corresponding interface test data needs to be inserted into the database.

在实践中,许多开发人员习惯于利用redis缓存一些数据,例如访问的次数、是否访问过之类的值,如果真实模拟这些数据需要前期进行较为复杂的其他步骤才能得到这些数据,也可能需要重复构造多次数据,效率很低,因此可以通过直接设置redis中相应的值(例如输入构造的key和value)来实现数据的构造。In practice, many developers are accustomed to using redis to cache some data, such as the number of visits, whether it has been visited, etc. If the real simulation of these data requires other complicated steps in the early stage to obtain the data, it may also be necessary to repeat Constructing data multiple times is inefficient, so data construction can be achieved by directly setting the corresponding values in redis (such as the key and value of the input construction).

在本发明的一个实施例中,上述方法进一步包括:通过接口测试界面接收校验配置信息;在接口测试完成后,根据校验配置信息进行校验并进一步生成与接口测试对应的测试结果。In an embodiment of the present invention, the above method further includes: receiving verification configuration information through an interface test interface; after the interface test is completed, performing verification according to the verification configuration information and further generating a test result corresponding to the interface test.

本实施例可以主要针对功能测试的场景,即测试某接口返回值是否正确等等,例如在本发明的一个实施例中,上述方法中,根据校验配置信息进行校验包括如下的一种或多种:根据校验配置信息,对待测试接口的返回值进行校验;根据校验配置信息中的数据库查询语句从目标数据库中查询出相应数据,根据校验配置信息对读取的数据进行校验;获取与完成的接口测试对应的日志,根据校验配置信息从日志中提取相应的部分日志,对提取的部分日志进行校验。This embodiment may be mainly aimed at the scenario of functional testing, that is, testing whether the return value of an interface is correct, etc. For example, in an embodiment of the present invention, in the above method, the verification according to the verification configuration information includes one of the following or Various: According to the verification configuration information, the return value of the interface to be tested is verified; the corresponding data is queried from the target database according to the database query statement in the verification configuration information, and the read data is verified according to the verification configuration information The log corresponding to the completed interface test is obtained, the corresponding part of the log is extracted from the log according to the verification configuration information, and the extracted part of the log is verified.

一般而言对返回值进行校验属于接口测试中最重要的部分,在本实施例中还提供了两种其他校验方式,使得能够校验的部分增多,测试结果更为准确。例如,某接口需要向数据库中写入数据,则相应的校验配置信息中可以包括一条sql查询语句,来查询是否成功向数据库中写入了数据;又例如从日志中提取出某几串关键信息,等等。通常,一些数据库的字段页面是无法直接检测正确性的,而其又对其他模块,或者整体业务完整性有很大的影响,如果人工检查,就需要频繁的页面操作,然后再去写sql(结构化查询语言)语句查询,涉及到申请数据库权限,连数据库,写sql等一系列的操作。在本实施例中仅需要输入一次检查的sql语句,就能自动检查正确性,并返回结果。测试也变得简单,方便。Generally speaking, verifying the return value is the most important part in the interface test. In this embodiment, two other verification methods are also provided, so that the number of parts that can be verified increases and the test result is more accurate. For example, if an interface needs to write data to the database, the corresponding verification configuration information can include a sql query statement to check whether the data has been successfully written to the database; another example is to extract some key strings from the log. information, etc. Usually, the correctness of the field pages of some databases cannot be directly detected, and they have a great impact on other modules or the overall business integrity. If manual inspection is performed, frequent page operations are required, and then sql ( Structured query language) statement query, which involves a series of operations such as applying for database permissions, connecting to the database, and writing sql. In this embodiment, the sql statement for checking only needs to be input once, and the correctness can be checked automatically and the result is returned. Testing has also become simple and convenient.

日志校验则需要预先配置好要校验的日志所在的机器,路径和访问方式。然后在校验器中需要选择对应的文件名称,输入要校验的字段即可,也支持多字段校验。在具体的业务场景下,经常有两个模块之间交互的文件,如果手动去校验文件,就特别繁琐,文件的格式,内容等都需要一一检查,很容易发生测试遗漏的问题。在这里就可以输入要关注的重要字段,或者全部行的内容,执行用例,就自动检查完了全部的内容,简单,方便。另外,还可以从文件的格式中抽取出关键参数,作为文件内容唯一性的标准,防止以前的用例间的相互影响。For log verification, you need to configure the machine, path, and access method of the log to be verified in advance. Then in the validator, you need to select the corresponding file name, enter the field to be checked, and also support multi-field check. In a specific business scenario, there are often files that interact between two modules. If you manually verify the files, it is very cumbersome. The format and content of the files need to be checked one by one, and the problem of test omission is easy to occur. Here, you can enter important fields to be concerned about, or the content of all lines, execute the use case, and automatically check all the content, which is simple and convenient. In addition, key parameters can also be extracted from the format of the file as a standard for the uniqueness of the file content to prevent the interaction between previous use cases.

图2示出了根据本发明一个实施例的一种接口测试装置的结构示意图。如图2所示,接口测试装置200包括:FIG. 2 shows a schematic structural diagram of an interface testing apparatus according to an embodiment of the present invention. As shown in FIG. 2, the interface testing apparatus 200 includes:

获取单元210,适于获取待测试接口的开发文档。开发文档可以是开发人员在进行接口开发过程中编写的,具体来说,在本发明的一个实施例中,上述装置中,开发文档是基于开发所使用的编程语言的注释规范编写的。The obtaining unit 210 is adapted to obtain the development document of the interface to be tested. The development document may be written by the developer during the interface development process. Specifically, in an embodiment of the present invention, in the above device, the development document is written based on the annotation specification of the programming language used for development.

例如,网站的接口通常可以采用PHP语言进行开发,则可以利用PHP的注释规范PHPDoc编写开发文档。这样,由于开发文档遵守固定格式的规范,就可以从中方便地自动读取出测试相关信息,即如步骤S120所示。For example, the interface of the website can usually be developed using the PHP language, and the development document can be written by using the PHP annotation specification PHPDoc. In this way, since the development document complies with the specification of the fixed format, the test-related information can be conveniently and automatically read from the development document, as shown in step S120.

提取单元220,适于从开发文档中提取测试相关信息。The extraction unit 220 is adapted to extract test-related information from the development document.

在本发明的一个实施例中,上述装置中,测试相关信息包括如下的一种或多种:接口地址,接口名称,接口参数,接口返回值。例如,PHPDoc中以“@return”注释接口返回值,以“@name”注释接口名称等等。In an embodiment of the present invention, in the above device, the test-related information includes one or more of the following: an interface address, an interface name, an interface parameter, and an interface return value. For example, the interface return value is annotated with "@return" in PHPDoc, the interface name is annotated with "@name", and so on.

测试项单元230,适于根据测试相关信息生成并保存与待测试接口对应的测试项。The test item unit 230 is adapted to generate and save the test item corresponding to the interface to be tested according to the test-related information.

以具体实现中通过测试平台提供服务为例,则在测试平台中就保存了与各待测试接口对应的测试项,实现了接口自动录入。现有技术中如果想要实现接口测试,需要开发人员为测试人员提供测试相关信息,实现接口的人工录入或者说人工配置,即使采用平台化设计,也仅仅是提供给测试人员和开发人员一个便于交互的媒介,实际上还是需要开发人员手动录入接口,那么不可避免地存在误操作,不仅效率低,准确度也不高。Taking the service provided by the test platform as an example in the specific implementation, the test items corresponding to each interface to be tested are saved in the test platform, realizing the automatic entry of the interface. In the prior art, if you want to implement interface testing, you need developers to provide testers with test-related information and implement manual entry or manual configuration of the interface. The interactive medium actually still requires developers to manually enter the interface, so there will inevitably be misoperations, which are not only inefficient, but also not accurate.

测试单元240,适于响应于对测试项的选取请求,对相应的待测试接口进行接口测试。The testing unit 240 is adapted to perform an interface test on the corresponding interface to be tested in response to a request for selecting a test item.

可见,图2所示的装置,通过获取待测试接口的开发文档,从中提取出测试相关信息,可以自动化地生成并保存与待测试接口对应的测试项,在实际进行接口测试时,依据对测试项的选取请求就可以实现对相应的待测试接口进行接口测试。该技术方案提供了一种测试阶段中的接口自动化收集,相应的测试项可以在实际测试时再使用,实现了接口录入与测试的松耦合,灵活可靠,相较于了人工配置接口完成接口测试提高了效率和准确度。It can be seen that the device shown in FIG. 2 can automatically generate and save the test items corresponding to the interface to be tested by acquiring the development document of the interface to be tested and extract the relevant test information from it. The selection request of the item can realize the interface test of the corresponding interface to be tested. The technical solution provides an automatic collection of interfaces in the testing phase, and the corresponding test items can be reused during actual testing, which realizes the loose coupling between interface entry and testing, is flexible and reliable, and completes interface testing compared to manually configuring interfaces. Improved efficiency and accuracy.

在本发明的一个实施例中,上述装置中,获取单元210,适于在满足预设的时间条件时,从预先配置的地址获取待测试接口的开发文档;和/或,在获知待测试接口的开发文档的保存事件时,从预先配置的地址获取待测试接口的开发文档。In an embodiment of the present invention, in the above-mentioned apparatus, the obtaining unit 210 is adapted to obtain the development document of the interface to be tested from a preconfigured address when a preset time condition is satisfied; and/or, after obtaining the interface to be tested During the save event of the development document, obtain the development document of the interface to be tested from the pre-configured address.

一种方式下,可以每隔固定时间(例如半小时)从开发人员提供的地址(例如文件系统中的路径或是开发文档数据库的地址)中获取开发文档,或者在每天的固定时间获取开发文档。另一种方式下,考虑到前种方式的时效性不强,重复工作可能很多(例如连续几次获得的开发文档都是相同的),则可以利用例如HOOK技术,获知待测试接口的开发文档的保存事件。这样就可以在开发文档新增、修改的时候再获取开发文档。当然,获知待测试接口的开发文档的保存事件也可以是开发人员手动通知的,或是以其他方式实现。In one way, the development documents can be obtained from the address provided by the developer (such as the path in the file system or the address of the development document database) every fixed time (for example, half an hour), or the development document can be obtained at a fixed time every day. . In another method, considering that the former method is not very time-sensitive, and there may be a lot of repetitive work (for example, the development documents obtained several times in a row are the same), for example, the HOOK technology can be used to obtain the development documents of the interface to be tested. save event. In this way, the development documents can be obtained when the development documents are added or modified. Of course, the save event of the development document that knows the interface to be tested may also be manually notified by the developer, or implemented in other ways.

在本发明的一个实施例中,上述装置中,测试单元240,适于提供接口测试界面,在接口测试界面中展示包括一个或多个测试项的接口测试列表;接收对接口测试列表中的测试项的选取请求,获取与选取的测试项对应的测试用例,对待测试接口进行接口测试。In an embodiment of the present invention, in the above device, the testing unit 240 is adapted to provide an interface testing interface, and display an interface testing list including one or more test items in the interface testing interface; Item selection request, obtain the test case corresponding to the selected test item, and perform interface testing on the interface to be tested.

在本实施例中,在进行接口测试时,用户可以通过访问图形化的、命令行等形式的接口测试界面,获取包括一个或多个测试项的接口测试列表,这样用户可以选择对哪些接口进行测试。In this embodiment, when performing an interface test, the user can obtain an interface test list including one or more test items by accessing a graphical interface test interface, command line, etc., so that the user can choose which interfaces to perform test.

接口测试也通常依赖于测试用例来实现,这里,测试用例可以是用户提交的,例如测试人员预先编写一些测试用例。Interface testing is also usually implemented by relying on test cases. Here, test cases can be submitted by users, for example, testers pre-write some test cases.

考虑测试平台这样的场景,如果能够把测试用例在测试平台进行有效的管理是一种很好的想法,例如划分多个层级,将一些测试用例以测试用例组的方式进行管理。然而,如果仅仅是将测试用例在平台进行这样的管理保存,也不能说满足测试人员的全部需求,例如编写测试用例是一个耗费时间的工作。Considering a scenario such as a test platform, it is a good idea to effectively manage test cases on the test platform, such as dividing into multiple levels and managing some test cases as test case groups. However, if the test cases are only managed and saved on the platform, it cannot be said that all the needs of testers can be met. For example, writing test cases is a time-consuming task.

在本发明的一个实施例中,上述装置还包括:测试用例单元,适于提供测试用例生成界面;通过测试用例生成界面接收数据构造条件;根据数据构造条件生成相应的测试用例。In an embodiment of the present invention, the above device further includes: a test case unit, adapted to provide a test case generation interface; receive data construction conditions through the test case generation interface; and generate corresponding test cases according to the data construction conditions.

在本实施例中,可以由例如测试平台提供一个测试用例生成界面,实现了平台化的测试用例生成。测试用例中通常最重要的就是构造合适的数据,例如测试接口的健壮性,故意向一个只能接受int型数据的接口传入float型的数据。在本实施例中只需要用户提供数据构造条件即可,In this embodiment, a test case generation interface may be provided by, for example, a test platform, thereby realizing platform-based test case generation. The most important thing in a test case is usually to construct appropriate data, such as testing the robustness of an interface, and deliberately passing float data to an interface that can only accept int data. In this embodiment, the user only needs to provide data construction conditions,

具体来说,在本发明的一个实施例中,上述装置中,数据构造条件包括如下的一种或多种:基于接口参数构造接口测试数据;基于数据库连接信息构造接口测试数据;基于缓存地址构造接口测试数据。Specifically, in an embodiment of the present invention, in the above device, the data construction conditions include one or more of the following: constructing interface test data based on interface parameters; constructing interface test data based on database connection information; constructing based on cache addresses Interface test data.

基于接口参数构造数据的例子已经在上面示出,根据接口参数的类型、范围等可以构造对接口而言正确或错误的数据。也可以支持接口间变量的传递,将前一个接口的返回值作为下一个接口的参数,这样就可以把多个接口串起来实现一个完整的功能,模拟真实的用户操作调用接口的过程,达到构造数据的完整性和测试的仿真性。The example of constructing data based on interface parameters has been shown above, and data that is correct or incorrect for the interface can be constructed according to the type, scope, etc. of the interface parameters. It can also support the transfer of variables between interfaces, and use the return value of the previous interface as the parameter of the next interface, so that multiple interfaces can be chained together to achieve a complete function, simulating the process of real user operation and calling the interface, to achieve the structure Data integrity and test simulation.

在本实施例中还提供了其他几种方式:基于数据库连接信息构造数据;基于缓存地址构造数据。这是因为许多接口需要访问数据库或是缓存,为了对这些场景进行测试,提供了这样的数据构造方式。其中,数据库连接信息可以是预先仅是数据库连接的配置,在提供数据构造条件时仅需提供数据库名称即可。Several other ways are also provided in this embodiment: constructing data based on database connection information; constructing data based on cache addresses. This is because many interfaces require access to databases or caches, and in order to test these scenarios, such data structures are provided. Wherein, the database connection information may be only the configuration of the database connection in advance, and only the database name needs to be provided when the data construction conditions are provided.

在本发明的一个实施例中,上述装置中,测试用例单元,适于根据数据库连接信息在相应数据库中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试;和/或,根据数据库连接信息构造数据库查询语句,以在对相应的待测试接口进行接口测试时利用数据库查询语句查询出的数据进行接口测试;和/或,根据缓存地址在相应缓存中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试。In an embodiment of the present invention, in the above device, the test case unit is adapted to insert interface test data into the corresponding database according to the database connection information, so as to use the inserted interface test data when performing the interface test on the corresponding interface to be tested. Perform an interface test; and/or, construct a database query statement according to the database connection information, so as to use the data queried by the database query statement to perform the interface test when performing the interface test on the corresponding interface to be tested; and/or, according to the cache address in the corresponding The interface test data is inserted into the cache, so as to use the inserted interface test data to perform the interface test when the interface test is performed on the corresponding interface to be tested.

可见,只需要预先配置数据库连接信息和/或缓存地址,就可以在相应位置插入想要的接口测试数据以完成接口测试。例如,某接口需要访问数据库中的用户名查询用户名是否已被注册,则需要在数据库中插入相应的接口测试数据。It can be seen that, only the database connection information and/or the cache address need to be preconfigured, and the desired interface test data can be inserted in the corresponding position to complete the interface test. For example, if an interface needs to access the user name in the database to check whether the user name has been registered, the corresponding interface test data needs to be inserted into the database.

在实践中,许多开发人员习惯于利用redis缓存一些数据,例如访问的次数、是否访问过之类的值,如果真实模拟这些数据需要前期进行较为复杂的其他步骤才能得到这些数据,也可能需要重复构造多次数据,效率很低,因此可以通过直接设置redis中相应的值(例如输入构造的key和value)来实现数据的构造。In practice, many developers are accustomed to using redis to cache some data, such as the number of visits, whether it has been visited, etc. If the real simulation of these data requires other complicated steps in the early stage to obtain the data, it may also be necessary to repeat Constructing data multiple times is inefficient, so data construction can be achieved by directly setting the corresponding values in redis (such as the key and value of the input construction).

在本发明的一个实施例中,上述装置进一步包括:校验单元,适于通过接口测试界面接收校验配置信息;在接口测试完成后,根据校验配置信息进行校验并进一步生成与接口测试对应的测试结果。In an embodiment of the present invention, the above device further includes: a verification unit, adapted to receive verification configuration information through an interface test interface; after the interface test is completed, perform verification according to the verification configuration information and further generate and interface test corresponding test results.

本实施例可以主要针对功能测试的场景,即测试某接口返回值是否正确等等,例如在本发明的一个实施例中,上述装置中,校验单元,适于根据校验配置信息,对待测试接口的返回值进行校验;和/或,根据校验配置信息中的数据库查询语句从目标数据库中查询出相应数据,根据校验配置信息对读取的数据进行校验;和/或,获取与完成的接口测试对应的日志,根据校验配置信息从日志中提取相应的部分日志,对提取的部分日志进行校验。This embodiment may be mainly aimed at the scenario of functional testing, that is, testing whether the return value of an interface is correct, etc. For example, in an embodiment of the present invention, in the above-mentioned apparatus, the verification unit is adapted to perform the test to be tested according to the verification configuration information Verify the return value of the interface; and/or, query the corresponding data from the target database according to the database query statement in the verification configuration information, and verify the read data according to the verification configuration information; and/or, obtain For the log corresponding to the completed interface test, extract the corresponding part of the log from the log according to the verification configuration information, and verify the extracted part of the log.

一般而言对返回值进行校验属于接口测试中最重要的部分,在本实施例中还提供了两种其他校验方式,使得能够校验的部分增多,测试结果更为准确。例如,某接口需要向数据库中写入数据,则相应的校验配置信息中可以包括一条sql查询语句,来查询是否成功向数据库中写入了数据;又例如从日志中提取出某几串关键信息,等等。通常,一些数据库的字段页面是无法直接检测正确性的,而其又对其他模块,或者整体业务完整性有很大的影响,如果人工检查,就需要频繁的页面操作,然后再去写sql语句查询,涉及到申请数据库权限,连数据库,写sql等一系列的操作。在本实施例中仅需要输入一次检查的sql语句,就能自动检查正确性,并返回结果。测试也变得简单,方便。Generally speaking, verifying the return value is the most important part in the interface test. In this embodiment, two other verification methods are also provided, so that the number of parts that can be verified increases and the test result is more accurate. For example, if an interface needs to write data to the database, the corresponding verification configuration information can include a sql query statement to check whether the data has been successfully written to the database; another example is to extract some key strings from the log. information, etc. Usually, the correctness of the field pages of some databases cannot be directly detected, and they have a great impact on other modules or the overall business integrity. If manual inspection is performed, frequent page operations are required, and then sql statements are written. Query involves a series of operations such as applying for database permissions, connecting to databases, and writing sql. In this embodiment, the sql statement for checking only needs to be input once, and the correctness can be checked automatically and the result is returned. Testing has also become simple and convenient.

日志校验则需要预先配置好要校验的日志所在的机器,路径和访问方式。然后在校验器中需要选择对应的文件名称,输入要校验的字段即可,也支持多字段校验。在具体的业务场景下,经常有两个模块之间交互的文件,如果手动去校验文件,就特别繁琐,文件的格式,内容等都需要一一检查,很容易发生测试遗漏的问题。在这里就可以输入要关注的重要字段,或者全部行的内容,执行用例,就自动检查完了全部的内容,简单,方便。另外,还可以从文件的格式中抽取出关键参数,作为文件内容唯一性的标准,防止以前的用例间的相互影响。For log verification, you need to configure the machine, path, and access method of the log to be verified in advance. Then in the validator, you need to select the corresponding file name, enter the field to be checked, and also support multi-field check. In a specific business scenario, there are often files that interact between two modules. If you manually verify the files, it is very cumbersome. The format and content of the files need to be checked one by one, and the problem of test omission is easy to occur. Here, you can enter important fields to be concerned about, or the content of all lines, execute the use case, and automatically check all the content, which is simple and convenient. In addition, key parameters can also be extracted from the format of the file as a standard for the uniqueness of the file content to prevent the interaction between previous use cases.

通过上述实施例也可以看出,接口测试装置可以提供平台服务,例如在服务器侧实现。It can also be seen from the above embodiments that the interface testing apparatus can provide platform services, for example, implemented on the server side.

综上所述,本发明的技术方案,通过获取待测试接口的开发文档,从中提取出测试相关信息,可以自动化地生成并保存与待测试接口对应的测试项,在实际进行接口测试时,依据对测试项的选取请求就可以实现对相应的待测试接口进行接口测试。该技术方案提供了一种测试阶段中的接口自动化收集,相应的测试项可以在实际测试时再使用,实现了接口录入与测试的松耦合,灵活可靠,相较于了人工配置接口完成接口测试提高了效率和准确度。To sum up, the technical solution of the present invention can automatically generate and save the test items corresponding to the interface to be tested by acquiring the development document of the interface to be tested, and extract the relevant test information from it. The selection request for the test item can implement the interface test on the corresponding interface to be tested. The technical solution provides an automatic collection of interfaces in the testing phase, and the corresponding test items can be reused during actual testing, which realizes the loose coupling between interface entry and testing, is flexible and reliable, and completes interface testing compared to manually configuring interfaces. Improved efficiency and accuracy.

需要说明的是:It should be noted:

在此提供的算法和显示不与任何特定计算机、虚拟装置或者其它设备固有相关。各种通用装置也可以与基于在此的示教一起使用。根据上面的描述,构造这类装置所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays provided herein are not inherently related to any particular computer, virtual appliance, or other device. Various general-purpose devices can also be used with the teachings based on this. The structure required to construct such a device is apparent from the above description. Furthermore, the present invention is not directed to any particular programming language. It is to be understood that various programming languages may be used to implement the inventions described herein, and that the descriptions of specific languages above are intended to disclose the best mode for carrying out the invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. It will be understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it is to be understood that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or its description. This disclosure, however, should not be construed as reflecting an intention that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. The modules or units or components in the embodiments may be combined into one module or unit or component, and further they may be divided into multiple sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method so disclosed may be employed in any combination, unless at least some of such features and/or procedures or elements are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will appreciate that although some of the embodiments described herein include certain features, but not others, included in other embodiments, that combinations of features of different embodiments are intended to be within the scope of the invention within and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的接口测试装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components of the interface testing apparatus according to the embodiments of the present invention. The present invention can also be implemented as apparatus or apparatus programs (eg, computer programs and computer program products) for performing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form.

例如,图3示出了根据本发明一个实施例的电子设备的结构示意图。该电子设备包括处理器310和被安排成存储计算机可执行指令(计算机可读程序代码)的存储器320。存储器320可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器320具有存储用于执行上述方法中的任何方法步骤的计算机可读程序代码331的存储空间330。例如,用于存储计算机可读程序代码的存储空间330可以包括分别用于实现上面的方法中的各种步骤的各个计算机可读程序代码331。计算机可读程序代码331可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为例如图4所述的计算机可读存储介质。图4示出了根据本发明一个实施例的一种计算机可读存储介质的结构示意图。该计算机可读存储介质400存储有用于执行根据本发明的方法步骤的计算机可读程序代码331,可以被电子设备300的处理器310读取,当计算机可读程序代码331由电子设备300运行时,导致该电子设备300执行上面所描述的方法中的各个步骤,具体来说,该计算机可读存储介质存储的计算机可读程序代码331可以执行上述任一实施例中示出的方法。计算机可读程序代码331可以以适当形式进行压缩。For example, FIG. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device includes a processor 310 and a memory 320 arranged to store computer-executable instructions (computer-readable program code). The memory 320 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. The memory 320 has storage space 330 for storing computer readable program code 331 for performing any of the method steps in the above-described methods. For example, the storage space 330 for storing computer-readable program code may include various computer-readable program codes 331 for implementing various steps in the above methods, respectively. Computer readable program code 331 can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such a computer program product is typically a computer-readable storage medium as described in FIG. 4 . FIG. 4 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention. The computer-readable storage medium 400 stores computer-readable program code 331 for performing the method steps according to the invention, which can be read by the processor 310 of the electronic device 300 when the computer-readable program code 331 is executed by the electronic device 300 , causing the electronic device 300 to execute each step in the above-described method. Specifically, the computer-readable program code 331 stored in the computer-readable storage medium can execute the method shown in any of the above-described embodiments. The computer readable program code 331 may be compressed in a suitable form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-described embodiments illustrate rather than limit the invention, and that alternative embodiments may be devised by those skilled in the art without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.

本发明的实施例公开了A1、一种接口测试方法,包括:The embodiment of the present invention discloses A1, an interface testing method, comprising:

获取待测试接口的开发文档;Obtain the development documentation of the interface to be tested;

从所述开发文档中提取测试相关信息;extracting test-related information from the development documentation;

根据所述测试相关信息生成并保存与所述待测试接口对应的测试项;Generate and save a test item corresponding to the interface to be tested according to the test-related information;

响应于对测试项的选取请求,对相应的待测试接口进行接口测试。In response to the selection request for the test item, the interface test is performed on the corresponding interface to be tested.

A2、如A1所述的方法,其中,所述获取待测试接口的开发文档包括:A2. The method of A1, wherein the obtaining the development document of the interface to be tested includes:

在满足预设的时间条件时,从预先配置的地址获取待测试接口的开发文档;When the preset time condition is met, obtain the development document of the interface to be tested from the pre-configured address;

和/或,and / or,

在获知所述待测试接口的开发文档的保存事件时,从预先配置的地址获取待测试接口的开发文档。When the save event of the development document of the interface to be tested is known, the development document of the interface to be tested is acquired from a preconfigured address.

A3、如A1所述的方法,其中,所述开发文档是基于开发所使用的编程语言的注释规范编写的。A3. The method of A1, wherein the development document is written based on an annotation specification of a programming language used for development.

A4、如A1所述的方法,其中,所述测试相关信息包括如下的一种或多种:A4. The method of A1, wherein the test-related information includes one or more of the following:

接口地址,接口名称,接口参数,接口返回值。Interface address, interface name, interface parameters, interface return value.

A5、如A1所述的方法,其中,所述响应于对测试项的选取请求,对相应的待测试接口进行接口测试包括:A5. The method of A1, wherein, in response to the selection request for the test item, performing an interface test on the corresponding interface to be tested includes:

提供接口测试界面,在所述接口测试界面中展示包括一个或多个测试项的接口测试列表;Provide an interface test interface, and display an interface test list including one or more test items in the interface test interface;

接收对接口测试列表中的测试项的选取请求,获取与选取的测试项对应的测试用例,对所述待测试接口进行接口测试。A request for selecting a test item in the interface test list is received, a test case corresponding to the selected test item is acquired, and an interface test is performed on the interface to be tested.

A6、如A5所述的方法,其中,该方法还包括:A6. The method of A5, wherein the method further comprises:

提供测试用例生成界面;Provide test case generation interface;

通过所述测试用例生成界面接收数据构造条件;Receive data construction conditions through the test case generation interface;

根据所述数据构造条件生成相应的测试用例。Corresponding test cases are generated according to the data construction conditions.

A7、如A6所述的方法,其中,所述数据构造条件包括如下的一种或多种:A7. The method according to A6, wherein the data construction conditions include one or more of the following:

基于接口参数构造接口测试数据;Construct interface test data based on interface parameters;

基于数据库连接信息构造接口测试数据;Construct interface test data based on database connection information;

基于缓存地址构造接口测试数据。Constructs interface test data based on cached addresses.

A8、如A7所述的方法,其中,所述根据所述数据构造条件生成相应的测试用例包括:A8. The method according to A7, wherein the generating a corresponding test case according to the data construction condition includes:

根据所述数据库连接信息在相应数据库中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试;Inserting interface test data in the corresponding database according to the database connection information, so as to use the inserted interface test data to perform interface test when performing interface test on the corresponding interface to be tested;

和/或,and / or,

根据所述数据库连接信息构造数据库查询语句,以在对相应的待测试接口进行接口测试时利用所述数据库查询语句查询出的数据进行接口测试;Construct a database query statement according to the database connection information, so as to use the data queried by the database query statement to perform interface testing when performing interface testing on the corresponding interface to be tested;

和/或,and / or,

根据所述缓存地址在相应缓存中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试。The interface test data is inserted into the corresponding cache according to the cache address, so as to use the inserted interface test data to perform the interface test when the interface test is performed on the corresponding interface to be tested.

A9、如A5所述的方法,其中,该方法进一步包括:A9. The method of A5, wherein the method further comprises:

通过所述接口测试界面接收校验配置信息;Receive verification configuration information through the interface test interface;

在所述接口测试完成后,根据所述校验配置信息进行校验并进一步生成与所述接口测试对应的测试结果。After the interface test is completed, the verification is performed according to the verification configuration information, and a test result corresponding to the interface test is further generated.

A10、如A9所述的方法,其中,所述根据所述校验配置信息进行校验包括如下的一种或多种:A10. The method according to A9, wherein the performing verification according to the verification configuration information includes one or more of the following:

根据所述校验配置信息,对所述待测试接口的返回值进行校验;verifying the return value of the interface to be tested according to the verification configuration information;

根据所述校验配置信息中的数据库查询语句从目标数据库中查询出相应数据,根据所述校验配置信息对读取的数据进行校验;The corresponding data is queried from the target database according to the database query statement in the verification configuration information, and the read data is verified according to the verification configuration information;

获取与完成的接口测试对应的日志,根据所述校验配置信息从所述日志中提取相应的部分日志,对提取的部分日志进行校验。A log corresponding to the completed interface test is acquired, a corresponding part of the log is extracted from the log according to the verification configuration information, and the extracted part of the log is verified.

本发明的实施例还公开了B11、一种接口测试装置,包括:The embodiment of the present invention also discloses B11, an interface testing device, comprising:

获取单元,适于获取待测试接口的开发文档;The acquisition unit is suitable for acquiring the development documents of the interface to be tested;

提取单元,适于从所述开发文档中提取测试相关信息;an extraction unit, adapted to extract test-related information from the development document;

测试项单元,适于根据所述测试相关信息生成并保存与所述待测试接口对应的测试项;a test item unit, adapted to generate and save a test item corresponding to the interface to be tested according to the test-related information;

测试单元,适于响应于对测试项的选取请求,对相应的待测试接口进行接口测试。The test unit is adapted to perform interface test on the corresponding interface to be tested in response to the selection request for the test item.

B12、如B11所述的装置,其中,B12. The device of B11, wherein,

所述获取单元,适于在满足预设的时间条件时,从预先配置的地址获取待测试接口的开发文档;和/或,在获知所述待测试接口的开发文档的保存事件时,从预先配置的地址获取待测试接口的开发文档。The obtaining unit is adapted to obtain the development document of the interface to be tested from a pre-configured address when a preset time condition is met; and/or, when learning the saving event of the development document of the interface to be tested, from the pre-configured address. The configured address obtains the development documentation of the interface to be tested.

B13、如B11所述的装置,其中,所述开发文档是基于开发所使用的编程语言的注释规范编写的。B13. The apparatus of B11, wherein the development document is written based on an annotation specification of a programming language used for development.

B14、如B11所述的装置,其中,所述测试相关信息包括如下的一种或多种:B14. The device according to B11, wherein the test-related information includes one or more of the following:

接口地址,接口名称,接口参数,接口返回值。Interface address, interface name, interface parameters, interface return value.

B15、如B11所述的装置,其中,B15. The device of B11, wherein,

所述测试单元,适于提供接口测试界面,在所述接口测试界面中展示包括一个或多个测试项的接口测试列表;接收对接口测试列表中的测试项的选取请求,获取与选取的测试项对应的测试用例,对所述待测试接口进行接口测试。The test unit is adapted to provide an interface test interface, and an interface test list including one or more test items is displayed in the interface test interface; a request for selecting a test item in the interface test list is received, and the selected test The test case corresponding to the item is used, and the interface test is performed on the interface to be tested.

B16、如B15所述的装置,其中,该装置还包括:B16. The device according to B15, wherein the device further comprises:

测试用例单元,适于提供测试用例生成界面;通过所述测试用例生成界面接收数据构造条件;根据所述数据构造条件生成相应的测试用例。The test case unit is adapted to provide a test case generation interface; receive data construction conditions through the test case generation interface; and generate corresponding test cases according to the data construction conditions.

B17、如B16所述的装置,其中,所述数据构造条件包括如下的一种或多种:基于接口参数构造接口测试数据;基于数据库地址构造接口测试数据;基于缓存地址构造接口测试数据。B17. The device according to B16, wherein the data construction conditions include one or more of the following: constructing interface test data based on interface parameters; constructing interface test data based on database addresses; constructing interface test data based on cache addresses.

B18、如B17所述的装置,其中,B18. The device of B17, wherein,

所述测试用例单元,适于根据所述数据库连接信息在相应数据库中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试;和/或,根据所述数据库连接信息构造数据库查询语句,以在对相应的待测试接口进行接口测试时利用所述数据库查询语句查询出的数据进行接口测试;和/或,根据所述缓存地址在相应缓存中插入接口测试数据,以在对相应的待测试接口进行接口测试时利用插入的接口测试数据进行接口测试。The test case unit is adapted to insert interface test data into the corresponding database according to the database connection information, so as to use the inserted interface test data to perform interface testing when performing interface testing on the corresponding interface to be tested; and/or, according to The database connection information constructs a database query statement, so as to use the data queried by the database query statement to perform an interface test when performing an interface test on the corresponding interface to be tested; and/or, inserting into the corresponding cache according to the cache address The interface test data is used to perform the interface test using the inserted interface test data when the interface test is performed on the corresponding interface to be tested.

B19、如B15所述的装置,其中,该装置进一步包括:B19. The device of B15, wherein the device further comprises:

校验单元,适于通过所述接口测试界面接收校验配置信息;在所述接口测试完成后,根据所述校验配置信息进行校验并进一步生成与所述接口测试对应的测试结果。The verification unit is adapted to receive verification configuration information through the interface test interface; after the interface test is completed, perform verification according to the verification configuration information and further generate a test result corresponding to the interface test.

B20、如B19所述的装置,其中,B20. The device of B19, wherein,

所述校验单元,适于根据所述校验配置信息,对所述待测试接口的返回值进行校验;和/或,根据所述校验配置信息中的数据库查询语句从目标数据库中查询出相应数据,根据所述校验配置信息对读取的数据进行校验;和/或,获取与完成的接口测试对应的日志,根据所述校验配置信息从所述日志中提取相应的部分日志,对提取的部分日志进行校验。The verification unit is adapted to verify the return value of the interface to be tested according to the verification configuration information; and/or, query from the target database according to the database query statement in the verification configuration information outputting corresponding data, and verifying the read data according to the verification configuration information; and/or, acquiring a log corresponding to the completed interface test, and extracting the corresponding part from the log according to the verification configuration information log, and verify the extracted part of the log.

本发明的实施例还公开了C21、一种电子设备,其中,该电子设备包括:处理器;以及被安排成存储计算机可执行指令的存储器,所述可执行指令在被执行时使所述处理器执行如A1-A10中任一项所述的方法。Embodiments of the present invention also disclose C21, an electronic device, wherein the electronic device comprises: a processor; and a memory arranged to store computer-executable instructions that, when executed, cause the processing The device performs the method as described in any one of A1-A10.

本发明的实施例还公开了D22、一种计算机可读存储介质,其中,所述计算机可读存储介质存储一个或多个程序,所述一个或多个程序当被处理器执行时,实现如A1-A10中任一项所述的方法。The embodiment of the present invention also discloses D22, a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs, when executed by the processor, implement the following The method of any one of A1-A10.

Claims (10)

1. An interface testing method, comprising:
acquiring a development document of an interface to be tested;
extracting test-related information from the development document;
generating and storing a test item corresponding to the interface to be tested according to the test related information;
and responding to the selection request of the test item, and performing interface test on the corresponding interface to be tested.
2. The method of claim 1, wherein said obtaining a development document for an interface to be tested comprises:
when a preset time condition is met, acquiring a development document of an interface to be tested from a pre-configured address;
and/or the presence of a gas in the gas,
and when the storage event of the development document of the interface to be tested is obtained, obtaining the development document of the interface to be tested from a pre-configured address.
3. The method of claim 1, wherein the development document is written based on an annotation specification of a programming language used for development.
4. The method of claim 1, wherein the test-related information comprises one or more of:
interface address, interface name, interface parameter, interface return value.
5. An interface test apparatus comprising:
the acquisition unit is suitable for acquiring a development document of the interface to be tested;
an extraction unit adapted to extract test-related information from the development document;
the test item unit is suitable for generating and storing a test item corresponding to the interface to be tested according to the test related information;
and the test unit is suitable for responding to the selection request of the test item and carrying out interface test on the corresponding interface to be tested.
6. The apparatus of claim 5, wherein,
the acquisition unit is suitable for acquiring a development document of the interface to be tested from a pre-configured address when a preset time condition is met; and/or acquiring the development document of the interface to be tested from a pre-configured address when the storage event of the development document of the interface to be tested is known.
7. The apparatus of claim 5, wherein the development document is written based on an annotation specification of a programming language used for development.
8. The apparatus of claim 5, wherein the test-related information comprises one or more of:
interface address, interface name, interface parameter, interface return value.
9. An electronic device, wherein the electronic device comprises: a processor; and a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the method of any one of claims 1-4.
10. A computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method of any of claims 1-4.
CN201810811273.2A 2018-07-23 2018-07-23 Interface testing method, apparatus, electronic device, and computer-readable storage medium Pending CN110750434A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810811273.2A CN110750434A (en) 2018-07-23 2018-07-23 Interface testing method, apparatus, electronic device, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810811273.2A CN110750434A (en) 2018-07-23 2018-07-23 Interface testing method, apparatus, electronic device, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
CN110750434A true CN110750434A (en) 2020-02-04

Family

ID=69274884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810811273.2A Pending CN110750434A (en) 2018-07-23 2018-07-23 Interface testing method, apparatus, electronic device, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN110750434A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111552632A (en) * 2020-03-27 2020-08-18 北京奇艺世纪科技有限公司 Interface testing method and device
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium
CN114356786A (en) * 2022-03-11 2022-04-15 中电云数智科技有限公司 IAM interface authority verification method and device based on automatic interface generation
CN114978973A (en) * 2022-05-18 2022-08-30 宁畅信息产业(北京)有限公司 Communication interface testing method, device, testing machine and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140289699A1 (en) * 2009-08-18 2014-09-25 Adobe Systems Incorporated Methods and Systems for Data Service Development
CN106201865A (en) * 2016-06-27 2016-12-07 乐视控股(北京)有限公司 A kind of application programming interface API method of testing, device and terminal unit
CN106776334A (en) * 2016-12-28 2017-05-31 北京奇虎科技有限公司 Based on annotation generation method of test example and device
CN106815140A (en) * 2015-12-02 2017-06-09 北京奇虎科技有限公司 A kind of interface test method and device
CN106886494A (en) * 2017-03-07 2017-06-23 深圳国泰安教育技术股份有限公司 A kind of automatic interface testing method and its system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140289699A1 (en) * 2009-08-18 2014-09-25 Adobe Systems Incorporated Methods and Systems for Data Service Development
CN106815140A (en) * 2015-12-02 2017-06-09 北京奇虎科技有限公司 A kind of interface test method and device
CN106201865A (en) * 2016-06-27 2016-12-07 乐视控股(北京)有限公司 A kind of application programming interface API method of testing, device and terminal unit
CN106776334A (en) * 2016-12-28 2017-05-31 北京奇虎科技有限公司 Based on annotation generation method of test example and device
CN106886494A (en) * 2017-03-07 2017-06-23 深圳国泰安教育技术股份有限公司 A kind of automatic interface testing method and its system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111552632A (en) * 2020-03-27 2020-08-18 北京奇艺世纪科技有限公司 Interface testing method and device
CN111552632B (en) * 2020-03-27 2024-03-19 北京奇艺世纪科技有限公司 Interface testing method and device
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium
CN114356786A (en) * 2022-03-11 2022-04-15 中电云数智科技有限公司 IAM interface authority verification method and device based on automatic interface generation
CN114356786B (en) * 2022-03-11 2022-06-07 中电云数智科技有限公司 IAM interface authority verification method and device based on automatic interface generation
CN114978973A (en) * 2022-05-18 2022-08-30 宁畅信息产业(北京)有限公司 Communication interface testing method, device, testing machine and storage medium
CN114978973B (en) * 2022-05-18 2023-05-09 宁畅信息产业(北京)有限公司 Communication interface testing method and device, testing machine and storage medium

Similar Documents

Publication Publication Date Title
US8151247B2 (en) Test data management
CN110750434A (en) Interface testing method, apparatus, electronic device, and computer-readable storage medium
CN103714002B (en) Project testing method and device based on configuration system
WO2015096661A1 (en) Project creation method and device based on configuration system, project test method and device, and background test method and device for configuration system
CN111274120B (en) Interface document verification method and device
CN106776334A (en) Based on annotation generation method of test example and device
CN105389262A (en) Method and device for generating test suggestions in allusion to interface tests
CN108459961A (en) The method, client and server of examination are resurveyed after a kind of failure of testing case
US8887112B2 (en) Test validation planning
CN109815141A (en) A test method and device
CN110968511A (en) Recommendation engine testing method, device, computing equipment and system
CN111797006B (en) Method, device and equipment for testing thread and storage medium
US20120054560A1 (en) Verifying correctness of processor transactions
CN110737577B (en) A method and device for storing test defect data
CN110737573B (en) Method and device for automatically testing user interface UI
US20050229045A1 (en) Method and device for managing software error
CN109086198A (en) Test method, device and the storage medium of database
CN115878467A (en) Interface automation test method, device, equipment and storage medium
CN116148636A (en) Embedded board test method, device, electronic equipment and readable storage medium
CN110119351B (en) A test case execution method and device
CN115203300A (en) Data verification method and device
CN109446091B (en) Business entity object testing method and device
CN112463042A (en) Data volume import data verification method, device, terminal and storage medium
CN106815136B (en) Unit testing method and device
CN110737580A (en) Test data generation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200204