CN112306855B - Interface automation test method, device, terminal and storage medium - Google Patents
Interface automation test method, device, terminal and storage medium Download PDFInfo
- Publication number
- CN112306855B CN112306855B CN201910710107.8A CN201910710107A CN112306855B CN 112306855 B CN112306855 B CN 112306855B CN 201910710107 A CN201910710107 A CN 201910710107A CN 112306855 B CN112306855 B CN 112306855B
- Authority
- CN
- China
- Prior art keywords
- interface
- test
- data source
- data
- parameters
- 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.)
- Expired - Fee Related
Links
- 238000010998 test method Methods 0.000 title description 5
- 238000012360 testing method Methods 0.000 claims abstract description 317
- 238000000034 method Methods 0.000 claims description 54
- 230000006870 function Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012986 modification Methods 0.000 claims description 12
- 230000004048 modification Effects 0.000 claims description 12
- 238000001514 detection method Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 description 31
- 230000002159 abnormal effect Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 9
- 238000013461 design Methods 0.000 description 8
- 238000007792 addition Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 238000012795 verification Methods 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 4
- 238000012217 deletion Methods 0.000 description 4
- 230000037430 deletion Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 2
- 230000004913 activation Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
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
本发明提供了一种接口自动化测试方法、装置、终端、和存储介质,其中,接口自动化测试方法包括:自动获取配置参数;根据配置参数连接数据源;根据待测试的接口的定义文档、业务需求文档以及测试用例,确定参数生成规则;根据参数生成规则生成接口参数;根据接口参数调用接口,并记录接口的返回值;根据返回值确定接口是否通过测试。通过本发明的技术方案能够提高接口参数的准确性,减少接口测试参数准备的时间,提高接口测试的正确性和效率。
The invention provides an interface automatic testing method, device, terminal and storage medium, wherein the interface automatic testing method includes: automatically acquiring configuration parameters; connecting a data source according to the configuration parameters; according to the definition document and business requirements of the interface to be tested Documents and test cases, determine the parameter generation rules; generate interface parameters according to the parameter generation rules; call the interface according to the interface parameters, and record the return value of the interface; determine whether the interface passes the test according to the return value. The technical scheme of the present invention can improve the accuracy of the interface parameters, reduce the time for preparing the interface test parameters, and improve the correctness and efficiency of the interface test.
Description
技术领域technical field
本发明涉及接口测试技术领域,具体而言,涉及一种接口自动化测试方法、一种接口自动化测试装置、一种终端和一种计算机可读存储介质。The present invention relates to the technical field of interface testing, and in particular, to an interface automatic testing method, an interface automatic testing device, a terminal and a computer-readable storage medium.
背景技术Background technique
接口自动化测试是属于自动测试的一种测试方法,主要对各个项目对外提供的接口正确性及稳定性进行验证,其主要目的是减少人工的参与,提高测试效率。测试过程主要是通过向被测试接口发送参数,接收返回的结果并与预期结果进行比较,从而判断接口是否能够通过测试。Interface automation testing is a test method that belongs to automatic testing. It mainly verifies the correctness and stability of the interfaces provided by each project. Its main purpose is to reduce manual participation and improve testing efficiency. The test process is mainly to determine whether the interface can pass the test by sending parameters to the tested interface, receiving the returned result and comparing it with the expected result.
相关技术中,接口的输入参数需要测试前根据业务流程及测试环境的数据进行提前准备,测试人员工作量大,操作步骤多,接口测试自动化程度低,导致接口参数输入的准确性以及测试效率较低。In the related art, the input parameters of the interface need to be prepared in advance according to the data of the business process and the test environment before the test. The workload of the tester is large, the operation steps are many, and the degree of automation of the interface test is low, which leads to the accuracy of the interface parameter input and the test efficiency. Low.
发明内容SUMMARY OF THE INVENTION
本发明旨在至少解决现有技术或相关技术中存在的技术问题之一。The present invention aims to solve at least one of the technical problems existing in the prior art or related technologies.
为此,本发明的一个目的在于提供一种接口自动化测试方法。To this end, one object of the present invention is to provide an interface automated testing method.
本发明的另一个目的在于提供一种接口自动化测试装置。Another object of the present invention is to provide an interface automatic testing device.
本发明的另一个目的在于提供一种终端。Another object of the present invention is to provide a terminal.
本发明的另一个目的在于提供一种计算机可读存储介质。Another object of the present invention is to provide a computer-readable storage medium.
为了实现上述目的,根据本发明的第一方面的技术方案,提供了一种接口自动化测试方法,包括:自动获取配置参数;根据配置参数连接数据源;根据待测试的接口的定义文档、业务需求文档以及测试用例,确定参数生成规则;根据参数生成规则生成接口参数;根据接口参数调用接口,并记录接口的返回值;根据返回值确定接口是否通过测试。In order to achieve the above object, according to the technical solution of the first aspect of the present invention, an automatic interface testing method is provided, including: automatically obtaining configuration parameters; connecting a data source according to the configuration parameters; according to the definition document and business requirements of the interface to be tested Documents and test cases, determine the parameter generation rules; generate interface parameters according to the parameter generation rules; call the interface according to the interface parameters, and record the return value of the interface; determine whether the interface passes the test according to the return value.
在该技术方案中,本发明提供的接口自动化测试方法可应用于单一接口的测试和业务流程的测试中,对于单一接口的自动化测试倾向于对接口的参数、接口的业务进行测试,对于业务流程测试倾向于同一测试项目及不同测试项目间的接口数据流转是否正确。通过自动获取配置参数,自动连接数据源,自动生成对应于待测接口的输入参数(接口参数)并根据接口的返回值确定测试是否通过,减少了修改配置以及参数拼接的时间,能够提高接口参数输入的准确性以及测试效率。其中,对于同一个接口,自动生成的接口参数不止一组,根据不同的业务需求及不同的接口规范,以及根据测试用例的需要,生成的接口参数可以是多组参数的组合,旨在能够覆盖业务逻辑,覆盖接口正常用例以及异常用例,以达到接口测试的代码覆盖率。In this technical solution, the interface automatic testing method provided by the present invention can be applied to the test of a single interface and the test of a business process. The automated test of a single interface tends to test the parameters of the interface and the business of the interface, and for the business process The test tends to be the same test item and whether the interface data flow between different test items is correct. By automatically acquiring configuration parameters, automatically connecting to data sources, automatically generating input parameters (interface parameters) corresponding to the interface to be tested, and determining whether the test passes or not according to the return value of the interface, the time for configuration modification and parameter splicing is reduced, and the interface parameters can be improved. Input accuracy and test efficiency. Among them, for the same interface, there are more than one set of automatically generated interface parameters. According to different business requirements, different interface specifications, and the needs of test cases, the generated interface parameters can be a combination of multiple sets of parameters, aiming to cover Business logic covers normal use cases and abnormal use cases of the interface to achieve code coverage of interface testing.
此外,本发明提供的接口自动化测试方法的测试用例能够根据业务需要,嵌入到测试系统中,测试执行时,可以通过配置界面添加指定的测试用例来指定需要执行的测试用例,不需要在测试前反复重新编写测试用例,减少了测试用例编写或者将测试用例导入系统的工作,提高了测试效率。In addition, the test case of the interface automatic testing method provided by the present invention can be embedded in the test system according to business needs. When the test is executed, the specified test case can be added through the configuration interface to specify the test case to be executed. Repeatedly rewriting test cases reduces the work of writing test cases or importing test cases into the system, and improves test efficiency.
根据上述技术方案的接口自动化测试方法,可选地,还包括:根据业务逻辑以及测试用例自动生成接口的输出期望值,其中,对于非查询功能的接口,输出期望值包括:带有成功标志的关键词或带有失败标志的关键词以及对数据源进行符合业务逻辑的操作;对于查询类的接口,输出期望值包括:带有成功标志的关键词或带有失败标志的关键词以及返回符合业务逻辑的数据结果。The interface automatic testing method according to the above technical solution, optionally, further includes: automatically generating the output expected value of the interface according to the business logic and the test case, wherein, for the non-query function interface, the output expected value includes: a keyword with a success sign Or keywords with failure signs and operations that conform to business logic on the data source; for the interface of the query class, the output expected values include: keywords with success signs or keywords with failure signs and return business logic-compliant keywords data results.
在该技术方案中,接口的返回值对应的期望结果(输出期望值)能够根据业务自动生成,该输出期望值中包括对数据源进行符合业务逻辑的期望操作或根据业务逻辑确定的期望数据结果,在该输出期望值的基础上,判断测试通过的依据不仅是状态码及返回信息内容,而是通过自动检查接口调用后对数据源的操作是否正确(如:增加、删除、修改等),或根据被测接口及业务逻辑从数据源中直接查询符合条件的数据并自动与返回值进行比较等方法对接口测试结果(返回值)进行更深层次的判断,提高了接口测试的准确率。In this technical solution, the expected result (output expected value) corresponding to the return value of the interface can be automatically generated according to the business, and the output expected value includes the expected operation of the data source that conforms to the business logic or the expected data result determined according to the business logic. On the basis of the expected output value, the basis for judging the passing of the test is not only the status code and the content of the returned information, but also whether the operation of the data source after the interface is called is correct (such as: adding, deleting, modifying, etc.) The test interface and business logic directly query the qualified data from the data source and automatically compare it with the return value to make a deeper judgment on the interface test result (return value), which improves the accuracy of the interface test.
根据上述任一项技术方案的接口自动化测试方法,可选地,根据返回值确定接口是否通过测试的步骤,具体包括:根据接口进行调用操作后对数据源的操作的正确性确定接口是否通过测试;或者根据接口进行调用操作后返回值是否符合业务逻辑确定接口是否通过测试。According to the interface automatic testing method according to any one of the above technical solutions, optionally, the step of determining whether the interface passes the test according to the return value specifically includes: determining whether the interface passes the test according to the correctness of the operation of the data source after the calling operation is performed on the interface. ; Or determine whether the interface passes the test according to whether the return value conforms to the business logic after the calling operation is performed on the interface.
在该技术方案中,基于输出期望值中包含的对数据源进行符合业务逻辑的操作,对接口参数输入接口后得到的返回值进行判断,若返回值反映的对数据源的操作与输出期望值中记录的对数据源进行符合业务逻辑的操作相一致则说明接口功能正常(通过测试)。基于输出期望值中包含的符合业务逻辑的数据结果,对接口参数输入接口后得到的返回值进行判断,若返回值反映的数据符合业务逻辑则说明接口功能正常(通过测试)。判断测试通过的依据不是简单的状态码及返回信息内容,而是在此基础上对返回值进行了更深层次的判断,提高了测试准确率。In this technical solution, based on the operation of the data source in the output expectation value that conforms to the business logic, the return value obtained after the interface parameter is input into the interface is judged. If the return value reflects the operation of the data source and the output expectation value, it is recorded in the If the operation of the data source is consistent with the business logic, it means that the interface function is normal (pass the test). Based on the data result that conforms to the business logic contained in the output expected value, the return value obtained after the interface parameter is input into the interface is judged. If the data reflected by the return value conforms to the business logic, it means that the interface function is normal (passed the test). The basis for judging the passing of the test is not a simple status code and the content of the returned information, but a deeper judgment on the return value on this basis, which improves the test accuracy.
根据上述任一项技术方案的接口自动化测试方法,可选地,还包括:记录用例信息、接口信息、接口参数信息和接口的返回值信息,并统计通过测试的用例数量以及失败的用例数量,生成测试报告。The interface automated testing method according to any one of the above technical solutions, optionally, further comprising: recording use case information, interface information, interface parameter information and interface return value information, and counting the number of use cases that passed the test and the number of use cases that failed, Generate test reports.
在该技术方案中,根据测试的结果自动生成测试报告,测试报告的内容需要包括通过的用例数,失败的用例数,并且能够对详细的测试结果进行查看,详细的测试结果包括用例信息、接口信息、接口参数信息及接口返回结果信息等,便于在执行结束后查看生成的测试报告并根据报告分析测试结果。In this technical solution, a test report is automatically generated according to the test results. The content of the test report needs to include the number of passed use cases and the number of failed use cases, and detailed test results can be viewed. The detailed test results include use case information, interface Information, interface parameter information, and interface return result information, etc., are convenient to view the generated test report after execution and analyze the test results according to the report.
根据上述任一项技术方案的接口自动化测试方法,可选地,还包括:根据业务需求文档以及接口的定义文档编写测试用例;确定接口服务器的地址和指定执行的测试用例;根据接口的定义文档将接口的定义编写为带有输入参数的脚本,以供测试用例调用。The interface automated testing method according to any one of the above technical solutions, optionally, further comprising: writing a test case according to the business requirement document and the interface definition document; determining the address of the interface server and the test case specified for execution; according to the interface definition document Write the definition of the interface as a script with input parameters to be invoked by the test case.
在该技术方案中,在自动获取配置参数之前,设立配置编辑界面,并根据业务需求文档以及接口的定义文档编写测试用例,在执行时通过配置编辑界面进行选择,选择相关的要执行的测试用例进行测试。配置编辑界面还用于确定接口服务器的地址和指定执行的测试用例。根据接口的定义文档将接口的定义进行封装,减少接口的重复定义,其中,接口的定义包括接口的名称、接口的输入、接口调用的路径及过程、接口的输出等,为后续用例中调用接口的方法提供了很好的支持。In this technical solution, before the configuration parameters are automatically obtained, a configuration editing interface is set up, and test cases are written according to the business requirements document and the interface definition document, and the configuration editing interface is selected during execution, and the relevant test cases to be executed are selected. carry out testing. The configuration editing interface is also used to determine the address of the interface server and specify the test cases to execute. The definition of the interface is encapsulated according to the definition document of the interface to reduce the repeated definition of the interface. The definition of the interface includes the name of the interface, the input of the interface, the path and process of the interface call, the output of the interface, etc. method provides good support.
此外,当测试环境改变时,接口的地址随之发生变化,将变化的内容提取到配置编辑界面中,在执行测试前进行相应配置,能够满足不同的测试需要,通过简单的配置就能够适应不同的测试环境,操作简单,效率高。根据测试需求,如果不需要每次都执行全部的测试用例,那么可以将测试用例也在配置编辑界面进行配置,添加要执行的测试用例,添加后在执行测试时就可以执行添加了的所有用例或者用例集,达到测试范围自定义的功能。测试用例可分为单一接口的测试用例和业务流程的测试用例。单一接口的测试用例测试对象是某个接口,需要包含接口的业务逻辑及参数规范的测试;业务流程的测试,需要涉及各个接口间的相互调用,倾向于对业务流程的多种正常及异常情况的测试。根据需求及接口的定义,编写测试用例时,要求每个测试用例与其他测试用例间相对独立,不存在相互调用及相互依赖的关系,要求用例必须包含正常情况和异常情况以提高用例对需求的覆盖率,达到对接口的逻辑、输入规则、异常操作等进行全面的验证。In addition, when the test environment changes, the address of the interface changes accordingly, and the changed content is extracted into the configuration editing interface, and the corresponding configuration is performed before the test is executed, which can meet different test needs, and can adapt to different needs through simple configuration. The test environment is simple, the operation is simple, and the efficiency is high. According to the test requirements, if you do not need to execute all the test cases every time, you can configure the test cases in the configuration editing interface, add the test cases to be executed, and then execute all the added test cases when the test is executed. Or use case set, to achieve the function of testing scope customization. Test cases can be divided into single interface test cases and business process test cases. The test object of a single interface test case is an interface, which needs to include the business logic of the interface and the test of parameter specifications; the test of the business process needs to involve the mutual calls between various interfaces, which tends to be a variety of normal and abnormal conditions of the business process. 's test. According to the definition of requirements and interfaces, when writing test cases, each test case is required to be relatively independent from other test cases, and there is no mutual invocation and interdependence. Coverage, to achieve comprehensive verification of interface logic, input rules, abnormal operations, etc.
根据上述任一项技术方案的接口自动化测试方法,可选地,自动获取配置参数的步骤,具体包括:通过服务器地址获取服务器中的配置文件中的配置参数,根据参数名从配置参数中获取参数值。According to the interface automatic testing method according to any one of the above technical solutions, optionally, the step of automatically obtaining configuration parameters specifically includes: obtaining configuration parameters in a configuration file in the server through a server address, and obtaining parameters from the configuration parameters according to parameter names value.
在该技术方案中,配置参数不需要手动配置,而是通过服务器地址获取服务器中的配置文件中的配置参数,根据参数名从配置参数中获取参数值。实现了接口参数值的自动生成,提高了测试效率。例如:通过SSH(Secure Shell,安全外壳)建立客户端的对象;根据服务器地址、端口号、用户名、密码建立SSH连接;在服务器上根据项目名称找到项目部署的配置文件位置,读取配置文件返回配置文件内容;在返回的内容中根据参数名获取参数值并保存。In this technical solution, the configuration parameters do not need to be manually configured, but the configuration parameters in the configuration file in the server are obtained through the server address, and the parameter values are obtained from the configuration parameters according to the parameter name. The automatic generation of interface parameter values is realized, and the test efficiency is improved. For example: establish a client object through SSH (Secure Shell); establish an SSH connection according to the server address, port number, user name, and password; find the location of the configuration file deployed by the project on the server according to the project name, read the configuration file and return The content of the configuration file; in the returned content, get the parameter value according to the parameter name and save it.
根据上述任一项技术方案的接口自动化测试方法,可选地,根据配置参数连接数据源的步骤,具体包括:根据从配置参数中读取的数据源服务器相关信息连接数据源服务器;在数据源服务器上执行检测命令,检测数据源是否已经启动,若数据源服务器已启动则进行数据源连接,若数据源服务器未启动则启动数据源服务器并进行数据源连接。According to the interface automated testing method according to any one of the above technical solutions, optionally, the step of connecting the data source according to the configuration parameters specifically includes: connecting the data source server according to the relevant information of the data source server read from the configuration parameters; The detection command is executed on the server to detect whether the data source has been started. If the data source server is started, the data source connection is performed. If the data source server is not started, the data source server is started and the data source connection is performed.
在该技术方案中,配置参数包括数据源的服务器地址、数据源名、用户名和密码,根据这些信息自动连接数据源服务器,在数据源服务器上执行检测命令,检测数据源是否已经启动,如果已经启动则进行数据源连接,如果未启动则启动数据源并进行数据源连接。自动进行数据源连接,减少了人工操作步骤,提高了测试效率。In this technical solution, the configuration parameters include the server address of the data source, the name of the data source, the user name and the password. According to these information, the data source server is automatically connected, and a detection command is executed on the data source server to detect whether the data source has been started. Start the data source connection, if not start the data source and start the data source connection. Automatic data source connection reduces manual operation steps and improves test efficiency.
根据上述任一项技术方案的接口自动化测试方法,可选地,根据参数生成规则生成接口参数的步骤,具体包括:根据参数生成规则编写数据源操作语句,返回数据结果;若返回的数据结果为空,则根据参数生成规则以及数据源中的数据之间的结构关系重新生成数据并插入到数据源中;若返回的数据结果不为空,则根据接口的输入要求格式化数据结果,记为接口参数。According to the automatic interface testing method of any one of the above technical solutions, optionally, the step of generating interface parameters according to the parameter generation rules specifically includes: writing a data source operation statement according to the parameter generation rules, and returning data results; if the returned data results are If it is empty, the data will be regenerated according to the parameter generation rules and the structural relationship between the data in the data source and inserted into the data source; if the returned data result is not empty, the data result will be formatted according to the input requirements of the interface, recorded as interface parameters.
在该技术方案中,参数的生成规则来源于接口的定义文档、业务需求文档及用例设计(编写用例的过程),能够保证生成参数符合业务逻辑,根据不同的业务需求生成符合业务逻辑的参数作为接口的输入,并根据接口的输出判断接口的准确性。当数据源中没有符合条件的数据(返回的数据结果为空),这时需要根据数据库中各数据之间的关联关系及具体的业务逻辑,使用符合数据源语法的语句添加符合逻辑的业务数据后再进行数据的提取,提取到数据后格式化后输入到接口,作为接口参数。In this technical solution, the parameter generation rules are derived from the interface definition document, the business requirement document and the use case design (the process of writing use cases), which can ensure that the generated parameters conform to the business logic, and the parameters conforming to the business logic are generated according to different business requirements as The input of the interface, and the accuracy of the interface is judged according to the output of the interface. When there is no qualified data in the data source (the returned data result is empty), then it is necessary to add logical business data using statements that conform to the syntax of the data source according to the relationship between the data in the database and the specific business logic. Then extract the data, format the extracted data and input it to the interface as interface parameters.
根据上述任一项技术方案的接口自动化测试方法,可选地,根据接口进行调用操作后对数据源的操作的正确性确定接口是否通过测试的步骤,具体包括:在接口进行调用操作前查询数据源中相应的数据表,在接口进行调用操作后查询数据表,判断接口在调用前后对数据表的增加、删除和修改操作是否符合业务需求文档,若符合则确定接口测试通过。According to the automatic interface testing method according to any one of the above technical solutions, optionally, the step of determining whether the interface passes the test according to the correctness of the operation on the data source after the interface performs the calling operation, specifically includes: querying data before the interface performs the calling operation For the corresponding data table in the source, query the data table after the call operation of the interface, and judge whether the addition, deletion and modification of the data table by the interface before and after the call conform to the business requirement document, and if so, the interface test is determined to pass.
在该技术方案中,通过在接口进行调用操作前查询数据源中相应的数据表,在接口进行调用操作后查询数据表,判断接口在调用前后对数据表的增加、删除和修改操作是否符合业务需求文档,对接口的返回值进行进一步的验证,提高了测试准确度。In this technical solution, by querying the corresponding data table in the data source before the interface performs the calling operation, and querying the data table after the interface calling operation, it is judged whether the addition, deletion and modification of the data table before and after the calling operation by the interface conforms to the business. Requirements document, further verification of the return value of the interface, and improved test accuracy.
根据上述任一项技术方案的接口自动化测试方法,可选地,根据接口进行调用操作后返回值是否符合业务逻辑确定接口是否通过测试的步骤,具体包括:根据业务逻辑在数据源中查询数据,将查询到的数据与返回值中的相应数据进行比较,比较结果若一致则确定接口测试通过。According to the interface automatic testing method according to any one of the above technical solutions, optionally, the step of determining whether the interface passes the test according to whether the returned value conforms to the business logic after the calling operation is performed on the interface specifically includes: querying data in the data source according to the business logic, Compare the queried data with the corresponding data in the returned value, and if the comparison results are consistent, it is determined that the interface test has passed.
在该技术方案中,通过根据业务逻辑直接在数据源中查询数据,将查询到的数据与接口的返回值中的相应数据进行比较,进一步检查返回值中的数据是否符合业务逻辑,提高了测试准确度。In this technical solution, by directly querying data in the data source according to business logic, comparing the queried data with the corresponding data in the return value of the interface, and further checking whether the data in the return value conforms to the business logic, the test is improved. Accuracy.
根据本发明的第二方面的技术方案,提供了一种接口自动化测试装置,包括:存储器、处理器及存储在存储器上并可在处理器上运行的程序,程序被处理器执行时实现如上述任一项技术方案的接口自动化测试方法的步骤。该接口自动化测试装置包括如上述任一项技术方案的接口自动化测试方法的全部有益效果,在此不再赘述。According to the technical solution of the second aspect of the present invention, an automatic interface testing device is provided, including: a memory, a processor, and a program stored in the memory and running on the processor. When the program is executed by the processor, the above-mentioned The steps of the interface automation testing method of any one of the technical solutions. The interface automatic testing apparatus includes all the beneficial effects of the interface automatic testing method according to any one of the above technical solutions, which will not be repeated here.
根据本发明的第三方面的技术方案,还提供了一种终端,包括:上述第二方面技术方案所述的接口自动化测试装置。该终端包括如上述任一项技术方案的接口自动化测试方法的全部有益效果,在此不再赘述。According to the technical solution of the third aspect of the present invention, a terminal is further provided, comprising: the interface automatic testing device described in the technical solution of the second aspect. The terminal includes all the beneficial effects of the interface automatic testing method according to any one of the above technical solutions, which will not be repeated here.
根据本发明的第四方面的技术方案,还提供了一种计算机可读存储介质,其上存储有计算机程序,上述计算机程序被执行时实现上述第一方面的任一项技术方案限定的接口自动化测试方法。According to the technical solution of the fourth aspect of the present invention, there is also provided a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the interface automation defined in any one of the technical solutions of the first aspect is realized. testing method.
本发明的附加方面和优点将在下面的描述部分中给出,部分将从下面的描述中变得明显,或通过本发明的实践了解到。Additional aspects and advantages of the present invention will be presented in the sections of the description which follow, and some will become apparent from the description below, or may be learned by practice of the invention.
附图说明Description of drawings
本发明的上述和/或附加的方面和优点从结合下面附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of embodiments taken in conjunction with the accompanying drawings, wherein:
图1示出了根据本发明的一个实施例的接口自动化测试方法的示意流程图;1 shows a schematic flowchart of an interface automated testing method according to an embodiment of the present invention;
图2示出了根据本发明的另一个实施例的接口自动化测试方法的示意框图;2 shows a schematic block diagram of an interface automated testing method according to another embodiment of the present invention;
图3示出了根据本发明的一个实施例的接口自动化测试装置的示意框图;3 shows a schematic block diagram of an interface automated testing apparatus according to an embodiment of the present invention;
图4示出了根据本发明的一个实施例的终端的示意框图。FIG. 4 shows a schematic block diagram of a terminal according to an embodiment of the present invention.
具体实施方式Detailed ways
为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图和具体实施方式对本发明进行进一步的详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。In order to be able to understand the above objects, features and advantages of the present invention more clearly, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments may be combined with each other in the case of no conflict.
在下面的描述中阐述了很多具体细节以便于充分理解本发明,但是,本发明还可以采用其他不同于在此描述的其他方式来实施,因此,本发明的保护范围并不受下面公开的具体实施例的限制。Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited by the specific details disclosed below. Example limitations.
实施例一Example 1
如图1所示,根据本发明的一个实施例的接口自动化测试方法,包括:As shown in FIG. 1, an interface automated testing method according to an embodiment of the present invention includes:
步骤102,自动获取配置参数;Step 102, automatically acquiring configuration parameters;
步骤104,根据配置参数连接数据源;Step 104, connect the data source according to the configuration parameters;
步骤106,根据待测试的接口的定义文档、业务需求文档以及测试用例,确定参数生成规则;Step 106, according to the definition document of the interface to be tested, the business requirement document and the test case, determine the parameter generation rule;
步骤108,根据参数生成规则生成接口参数;Step 108, generate interface parameters according to the parameter generation rule;
步骤110,根据接口参数调用接口,并记录接口的返回值;Step 110, calling the interface according to the interface parameters, and recording the return value of the interface;
步骤112,根据返回值确定接口是否通过测试。Step 112: Determine whether the interface passes the test according to the return value.
在该实施例中,该接口自动化测试方法可应用于单一接口的测试和业务流程的测试中,对于单一接口的自动化测试倾向于对接口的参数、接口的业务进行测试,对于业务流程测试倾向于同一测试项目及不同测试项目间的接口数据流转是否正确。通过自动获取配置参数,自动连接数据源,自动生成对应于待测接口的输入参数(接口参数)并根据接口的返回值确定测试是否通过,减少了修改配置以及参数拼接的时间,能够提高接口参数输入的准确性以及测试效率。其中,对于同一个接口,自动生成的接口参数不止一组,根据不同的业务需求及不同的接口规范,以及根据测试用例的需要,生成的接口参数可以是多组参数的组合,旨在能够覆盖业务逻辑,覆盖接口正常用例以及异常用例,以达到接口测试的代码覆盖率。In this embodiment, the interface automated testing method can be applied to the testing of a single interface and the testing of business processes. The automated testing of a single interface tends to test the parameters of the interface and the services of the interface, while the automated testing of a single interface tends to test the parameters of the interface and the business of the interface. Whether the interface data flow between the same test item and different test items is correct. By automatically acquiring configuration parameters, automatically connecting to data sources, automatically generating input parameters (interface parameters) corresponding to the interface to be tested, and determining whether the test passes or not according to the return value of the interface, the time for configuration modification and parameter splicing is reduced, and the interface parameters can be improved. Input accuracy and test efficiency. Among them, for the same interface, there are more than one set of automatically generated interface parameters. According to different business requirements, different interface specifications, and the needs of test cases, the generated interface parameters can be a combination of multiple sets of parameters, aiming to cover Business logic covers normal use cases and abnormal use cases of the interface to achieve code coverage of interface testing.
此外,本发明提供的接口自动化测试方法的测试用例能够根据业务需要,嵌入到测试系统中,测试执行时,可以通过配置界面添加指定的测试用例来指定需要执行的测试用例,不需要在测试前反复重新编写测试用例,减少了测试用例编写或者将测试用例导入系统的工作,提高了测试效率。In addition, the test case of the interface automatic testing method provided by the present invention can be embedded in the test system according to business needs. When the test is executed, the specified test case can be added through the configuration interface to specify the test case to be executed. Repeatedly rewriting test cases reduces the work of writing test cases or importing test cases into the system, and improves test efficiency.
在上述实施例中,可选地,还包括:根据业务逻辑以及测试用例自动生成接口的输出期望值,其中,对于非查询功能的接口,输出期望值包括:带有成功标志的关键词或带有失败标志的关键词以及对数据源进行符合业务逻辑的操作;对于查询类的接口,输出期望值包括:带有成功标志的关键词或带有失败标志的关键词以及返回符合业务逻辑的数据结果。In the above-mentioned embodiment, optionally, it also includes: automatically generating the expected output value of the interface according to the business logic and the test case, wherein, for the interface of the non-query function, the expected output value includes: a keyword with a success sign or a keyword with a failure The keyword of the flag and the operation of the data source in line with the business logic; for the interface of the query class, the output expected value includes: the keyword with the success flag or the keyword with the failure flag, and the data result conforming to the business logic is returned.
在该实施例中,接口的返回值对应的期望结果(输出期望值)能够根据业务自动生成,该输出期望值中包括对数据源进行符合业务逻辑的期望操作或根据业务逻辑确定的期望数据结果,在该输出期望值的基础上,判断测试通过的依据不仅是状态码及返回信息内容,而是通过自动检查接口调用后对数据源的操作是否正确(如:增加、删除、修改等),或根据被测接口及业务逻辑从数据源中直接查询符合条件的数据并自动与返回值进行比较等方法对接口测试结果(返回值)进行更深层次的判断,提高了接口测试的准确率。In this embodiment, the expected result (output expected value) corresponding to the return value of the interface can be automatically generated according to the business, and the output expected value includes the expected operation on the data source that conforms to the business logic or the expected data result determined according to the business logic. On the basis of the expected output value, the basis for judging the passing of the test is not only the status code and the content of the returned information, but also whether the operation of the data source after the interface is called is correct (such as: adding, deleting, modifying, etc.) The test interface and business logic directly query the qualified data from the data source and automatically compare it with the return value to make a deeper judgment on the interface test result (return value), which improves the accuracy of the interface test.
在上述任一项实施例中,可选地,根据返回值确定接口是否通过测试的步骤,具体包括:根据接口进行调用操作后对数据源的操作的正确性确定接口是否通过测试;或者根据接口进行调用操作后返回值是否符合业务逻辑确定接口是否通过测试。In any of the above embodiments, optionally, the step of determining whether the interface passes the test according to the return value specifically includes: determining whether the interface passes the test according to the correctness of the operation of the data source after the calling operation is performed on the interface; or according to the interface Whether the return value conforms to the business logic after the calling operation determines whether the interface passes the test.
在该实施例中,基于输出期望值中包含的对数据源进行符合业务逻辑的操作,对接口参数输入接口后得到的返回值进行判断,若返回值反映的对数据源的操作与输出期望值中记录的对数据源进行符合业务逻辑的操作相一致则说明接口功能正常(通过测试)。基于输出期望值中包含的符合业务逻辑的数据结果,对接口参数输入接口后得到的返回值进行判断,若返回值反映的数据符合业务逻辑则说明接口功能正常(通过测试)。判断测试通过的依据不是简单的状态码及返回信息内容,而是在此基础上对返回值进行了更深层次的判断,提高了测试准确率。In this embodiment, based on the operation of the data source contained in the output expectation value that conforms to the business logic, the return value obtained after the interface parameter is input into the interface is judged. If the return value reflects the operation of the data source and the output expectation value, it is recorded in If the operation of the data source is consistent with the business logic, it means that the interface function is normal (pass the test). Based on the data result that conforms to the business logic contained in the output expected value, the return value obtained after the interface parameter is input into the interface is judged. If the data reflected by the return value conforms to the business logic, it means that the interface function is normal (passed the test). The basis for judging the passing of the test is not a simple status code and the content of the returned information, but a deeper judgment on the return value on this basis, which improves the test accuracy.
在上述任一项实施例中,可选地,还包括:记录用例信息、接口信息、接口参数信息和接口的返回值信息,并统计通过测试的用例数量以及失败的用例数量,生成测试报告。In any of the above embodiments, optionally, the method further includes: recording use case information, interface information, interface parameter information, and interface return value information, and counting the number of use cases that pass the test and the number of use cases that fail, and generate a test report.
在该实施例中,根据测试的结果自动生成测试报告,测试报告的内容需要包括通过的用例数,失败的用例数,并且能够对详细的测试结果进行查看,详细的测试结果包括用例信息、接口信息、接口参数信息及接口返回结果信息等,便于在执行结束后查看生成的测试报告并根据报告分析测试结果。In this embodiment, a test report is automatically generated according to the test result. The content of the test report needs to include the number of passed use cases and the number of failed use cases, and detailed test results can be viewed, including use case information, interface Information, interface parameter information, and interface return result information, etc., are convenient to view the generated test report after execution and analyze the test results according to the report.
在上述任一项实施例中,可选地,还包括:根据业务需求文档以及接口的定义文档编写测试用例;确定接口服务器的地址和指定执行的测试用例;根据接口的定义文档将接口的定义编写为带有输入参数的脚本,以供测试用例调用。In any of the above embodiments, optionally, it further includes: writing a test case according to the business requirement document and the interface definition document; determining the address of the interface server and the test case specified for execution; Written as a script with input parameters to be invoked by the test case.
在该实施例中,在自动获取配置参数之前,设立配置编辑界面,并根据业务需求文档以及接口的定义文档编写测试用例,在执行时通过配置编辑界面进行选择,选择相关的要执行的测试用例进行测试。配置编辑界面还用于确定接口服务器的地址和指定执行的测试用例。根据接口的定义文档将接口的定义进行封装,减少接口的重复定义,其中,接口的定义包括接口的名称、接口的输入、接口调用的路径及过程、接口的输出等,为后续用例中调用接口的方法提供了很好的支持。In this embodiment, before the configuration parameters are automatically acquired, a configuration editing interface is set up, and test cases are written according to the business requirement document and the interface definition document, and the configuration editing interface is selected during execution, and the relevant test cases to be executed are selected. carry out testing. The configuration editing interface is also used to determine the address of the interface server and specify the test cases to execute. The definition of the interface is encapsulated according to the definition document of the interface to reduce the repeated definition of the interface. The definition of the interface includes the name of the interface, the input of the interface, the path and process of the interface call, the output of the interface, etc. method provides good support.
此外,当测试环境改变时,接口的地址随之发生变化,将变化的内容提取到配置编辑界面中,在执行测试前进行相应配置,能够满足不同的测试需要,通过简单的配置就能够适应不同的测试环境,操作简单,效率高。根据测试需求,如果不需要每次都执行全部的测试用例,那么可以将测试用例也在配置编辑界面进行配置,添加要执行的测试用例,添加后在执行测试时就可以执行添加了的所有用例或者用例集,达到测试范围自定义的功能。测试用例可分为单一接口的测试用例和业务流程的测试用例。单一接口的测试用例测试对象是某个接口,需要包含接口的业务逻辑及参数规范的测试;业务流程的测试,需要涉及各个接口间的相互调用,倾向于对业务流程的多种正常及异常情况的测试。根据需求及接口的定义,编写测试用例时,要求每个测试用例与其他测试用例间相对独立,不存在相互调用及相互依赖的关系,要求用例必须包含正常情况和异常情况以提高用例对需求的覆盖率,达到对接口的逻辑、输入规则、异常操作等进行全面的验证。In addition, when the test environment changes, the address of the interface changes accordingly, and the changed content is extracted into the configuration editing interface, and the corresponding configuration is performed before the test is executed, which can meet different test needs, and can adapt to different needs through simple configuration. The test environment is simple, the operation is simple, and the efficiency is high. According to the test requirements, if you do not need to execute all the test cases every time, you can configure the test cases in the configuration editing interface, add the test cases to be executed, and then execute all the added test cases when the test is executed. Or use case set, to achieve the function of testing scope customization. Test cases can be divided into single interface test cases and business process test cases. The test object of a single interface test case is an interface, which needs to include the business logic of the interface and the test of parameter specifications; the test of the business process needs to involve the mutual calls between various interfaces, which tends to be a variety of normal and abnormal conditions of the business process. 's test. According to the definition of requirements and interfaces, when writing test cases, each test case is required to be relatively independent from other test cases, and there is no mutual invocation and interdependence. Coverage, to achieve comprehensive verification of interface logic, input rules, abnormal operations, etc.
在上述任一项实施例中,可选地,自动获取配置参数的步骤,具体包括:通过服务器地址获取服务器中的配置文件中的配置参数,根据参数名从配置参数中获取参数值。In any of the above embodiments, optionally, the step of automatically obtaining configuration parameters specifically includes: obtaining configuration parameters in a configuration file in the server through a server address, and obtaining parameter values from the configuration parameters according to parameter names.
在该实施例中,配置参数不需要手动配置,而是通过服务器地址获取服务器中的配置文件中的配置参数,根据参数名从配置参数中获取参数值。实现了接口参数值的自动生成,提高了测试效率。例如:通过SSH(Secure Shell,安全外壳)建立客户端的对象;根据服务器地址、端口号、用户名、密码建立SSH连接;在服务器上根据项目名称找到项目部署的配置文件位置,读取配置文件返回配置文件内容;在返回的内容中根据参数名获取参数值并保存。In this embodiment, the configuration parameters do not need to be manually configured, but the configuration parameters in the configuration file in the server are obtained through the server address, and the parameter values are obtained from the configuration parameters according to the parameter names. The automatic generation of interface parameter values is realized, and the test efficiency is improved. For example: establish a client object through SSH (Secure Shell); establish an SSH connection according to the server address, port number, user name, and password; find the location of the configuration file deployed by the project on the server according to the project name, read the configuration file and return The content of the configuration file; in the returned content, get the parameter value according to the parameter name and save it.
在上述任一项实施例中,可选地,根据配置参数连接数据源的步骤,具体包括:根据从配置参数中读取的数据源服务器相关信息连接数据源服务器;在数据源服务器上执行检测命令,检测数据源是否已经启动,若数据源服务器已启动则进行数据源连接,若数据源服务器未启动则启动数据源服务器并进行数据源连接。In any of the above embodiments, optionally, the step of connecting the data source according to the configuration parameters specifically includes: connecting the data source server according to the data source server related information read from the configuration parameters; performing detection on the data source server command to detect whether the data source has been started. If the data source server has been started, the data source connection is performed. If the data source server is not started, the data source server is started and the data source connection is performed.
在该实施例中,配置参数包括数据源的服务器地址、数据源名、用户名和密码,根据这些信息自动连接数据源服务器,在数据源服务器上执行检测命令,检测数据源是否已经启动,如果已经启动则进行数据源连接,如果未启动则启动数据源并进行数据源连接。自动进行数据源连接,减少了人工操作步骤,提高了测试效率。In this embodiment, the configuration parameters include the server address of the data source, the name of the data source, the user name and the password. According to these information, the data source server is automatically connected, and a detection command is executed on the data source server to detect whether the data source has been started. Start the data source connection, if not start the data source and start the data source connection. Automatic data source connection reduces manual operation steps and improves test efficiency.
在上述任一项实施例中,可选地,根据参数生成规则生成接口参数的步骤,具体包括:根据参数生成规则编写数据源操作语句,返回数据结果;若返回的数据结果为空,则根据参数生成规则以及数据源中的数据之间的结构关系重新生成数据并插入到数据源中;若返回的数据结果不为空,则根据接口的输入要求格式化数据结果,记为接口参数。In any of the above embodiments, optionally, the step of generating interface parameters according to the parameter generation rules specifically includes: compiling a data source operation statement according to the parameter generation rules, and returning a data result; if the returned data result is empty, according to The parameter generation rules and the structural relationship between the data in the data source regenerate the data and insert it into the data source; if the returned data result is not empty, format the data result according to the input requirements of the interface, and record it as an interface parameter.
在该实施例中,参数的生成规则来源于接口的定义文档、业务需求文档及用例设计(编写用例的过程),能够保证生成参数符合业务逻辑,根据不同的业务需求生成符合业务逻辑的参数作为接口的输入,并根据接口的输出判断接口的准确性。当数据源中没有符合条件的数据(返回的数据结果为空),这时需要根据数据库中各数据之间的关联关系及具体的业务逻辑,使用符合数据源语法的语句添加符合逻辑的业务数据后再进行数据的提取,提取到数据后格式化后输入到接口,作为接口参数。In this embodiment, the generation rules of parameters are derived from the definition document of the interface, the business requirement document and the use case design (the process of writing the use case), which can ensure that the generated parameters conform to the business logic, and the parameters conforming to the business logic are generated according to different business requirements as The input of the interface, and the accuracy of the interface is judged according to the output of the interface. When there is no qualified data in the data source (the returned data result is empty), then it is necessary to add logical business data using statements that conform to the syntax of the data source according to the relationship between the data in the database and the specific business logic. Then extract the data, format the extracted data and input it to the interface as interface parameters.
在上述任一项实施例中,可选地,根据接口进行调用操作后对数据源的操作的正确性确定接口是否通过测试的步骤,具体包括:在接口进行调用操作前查询数据源中相应的数据表,在接口进行调用操作后查询数据表,判断接口在调用前后对数据表的增加、删除和修改操作是否符合业务需求文档,若符合则确定接口测试通过。In any of the above-mentioned embodiments, optionally, the step of determining whether the interface passes the test according to the correctness of the operation on the data source after the calling operation is performed on the interface specifically includes: querying the corresponding data source in the data source before the calling operation is performed on the interface. Data table, query the data table after the interface is called, and determine whether the addition, deletion and modification of the data table by the interface before and after the invocation conform to the business requirement document. If so, the interface test is determined to pass.
在该实施例中,通过在接口进行调用操作前查询数据源中相应的数据表,在接口进行调用操作后查询数据表,判断接口在调用前后对数据表的增加、删除和修改操作是否符合业务需求文档,对接口的返回值进行进一步的验证,提高了测试准确度。In this embodiment, by querying the corresponding data table in the data source before the interface performs the calling operation, and querying the data table after the interface performs the calling operation, it is judged whether the operations of adding, deleting and modifying the data table by the interface before and after the calling are in line with the business Requirements document, further verification of the return value of the interface, and improved test accuracy.
在上述任一项实施例中,可选地,根据接口进行调用操作后返回值是否符合业务逻辑确定接口是否通过测试的步骤,具体包括:根据业务逻辑在数据源中查询数据,将查询到的数据与返回值中的相应数据进行比较,比较结果若一致则确定接口测试通过。In any of the above embodiments, optionally, the step of determining whether the interface passes the test according to whether the returned value conforms to the business logic after the calling operation is performed on the interface specifically includes: querying data in the data source according to the business logic, and querying the queried data. The data is compared with the corresponding data in the return value, and if the comparison results are consistent, it is determined that the interface test has passed.
在该实施例中,通过根据业务逻辑直接在数据源中查询数据,将查询到的数据与接口的返回值中的相应数据进行比较,进一步检查返回值中的数据是否符合业务逻辑,提高了测试准确度。In this embodiment, by directly querying the data in the data source according to the business logic, comparing the queried data with the corresponding data in the return value of the interface, and further checking whether the data in the return value conforms to the business logic, the test is improved. Accuracy.
实施例二Embodiment 2
如图2所示,根据本发明的另一个实施例的接口自动化测试方法,包括:步骤一:增加配置编辑界面;步骤二:编写接口定义;步骤三:设计测试用例;步骤四:自动生成参数;步骤五:生成测试报告。具体操作步骤如下所述:As shown in FIG. 2, an interface automated testing method according to another embodiment of the present invention includes: step 1: adding a configuration editing interface; step 2: writing an interface definition; step 3: designing a test case; step 4: automatically generating parameters ; Step 5: Generate a test report. The specific operation steps are as follows:
步骤一:增加配置编辑界面Step 1: Add configuration editing interface
配置编辑界面只需包括接口服务器的地址和指定执行的测试用例。当测试环境改变时,接口的地址随之发生变化,将变化的内容提取到配置界面中,在执行测试前进行相应配置,以满足不同的测试需要,通过简单的配置就能够适应不同的测试环境,操作简便,效率高。根据测试需求,如果不需要每次都执行全部的测试用例,那么可以将测试用例也在编辑界面进行配置,添加要执行的测试用例,添加后在执行测试时就可以执行添加了的所有用例或者用例集,达到测试范围自定义的功能。The configuration editing interface only needs to include the address of the interface server and the specified test case to be executed. When the test environment changes, the address of the interface changes accordingly. The changed content is extracted to the configuration interface, and the corresponding configuration is performed before the test is executed to meet different test needs. It can adapt to different test environments through simple configuration. , easy to operate and high efficiency. According to the test requirements, if you do not need to execute all the test cases every time, you can configure the test cases in the editing interface, add the test cases to be executed, and then execute all the added test cases or Use case set to achieve the function of testing scope customization.
步骤二:编写接口定义Step 2: Write the interface definition
由于同一接口在不同的测试用例中需要被调用多次,因此将接口的定义进行封装,减少接口的重复定义,具体过程为根据接口的定义文档将接口的定义编写为带有输入参数的脚本,供测试用例进行调用。接口的定义包括接口的名称、接口的输入、接口调用的路径及过程、接口的输出等,为后续用例中调用接口的方法提供了很好的支持。Since the same interface needs to be called multiple times in different test cases, the definition of the interface is encapsulated to reduce the repeated definition of the interface. The specific process is to write the definition of the interface as a script with input parameters according to the definition document of the interface. For test cases to call. The definition of the interface includes the name of the interface, the input of the interface, the path and process of the interface call, and the output of the interface, etc., which provides a good support for calling the method of the interface in the subsequent use cases.
步骤三:设计测试用例Step 3: Design Test Cases
本发明中的测试用例根据需求进行设计,并且编写为可实现的代码进行保存,在执行时通过配置界面进行选择,选择相关的要执行的测试用例进行测试。用例可分为单一接口的测试用例和业务流程的测试用例。单一接口的测试用例测试对象是某个接口,需要包含接口的业务逻辑及参数规范的测试;业务流程的测试,需要涉及各个接口间的相互调用,倾向于对业务流程的多种正常及异常情况的测试。根据需求及接口的定义,设计测试用例,要求每个测试用例与其他测试用例间相对独立,不存在相互调用及相互依赖的关系,要求用例必须包含正常情况和异常情况以提高用例对需求的覆盖率,达到对接口的逻辑、输入规则、异常操作等进行全面的验证。The test cases in the present invention are designed according to requirements, and are written as achievable codes for saving, and are selected through the configuration interface during execution, and the relevant test cases to be executed are selected for testing. Use cases can be divided into single interface test cases and business process test cases. The test object of a single interface test case is an interface, which needs to include the business logic of the interface and the test of parameter specifications; the test of the business process needs to involve the mutual calls between various interfaces, which tends to be a variety of normal and abnormal conditions of the business process. 's test. Design test cases according to the definition of requirements and interfaces. Each test case is required to be relatively independent from other test cases, and there is no mutual invocation and interdependence. It is required that the use cases must contain normal and abnormal conditions to improve the coverage of the use case to the requirements. rate, to achieve comprehensive verification of interface logic, input rules, abnormal operations, etc.
步骤四:自动生成参数Step 4: Automatically generate parameters
在用例中需要调用接口,这时就用到步骤一中接口的定义,由于不同用例的测试重点及要测试的业务逻辑不同,因此不同的用例中输入参数是不同的,与其他自动化测试方法不同的是参数不需要是手动生成,而是根据业务需求及用例的设计自动生成不要过多的人工干预,生成过程如下:The interface needs to be called in the use case, then the definition of the interface in step 1 is used. Since the test focus of different use cases and the business logic to be tested are different, the input parameters in different use cases are different, which is different from other automated testing methods. The point is that the parameters do not need to be generated manually, but are automatically generated according to the business requirements and the design of the use case without too much manual intervention. The generation process is as follows:
1.自动获取配置参数。1. Automatically obtain configuration parameters.
与其他测试方法不同的是,配置参数可自动获取,而不是手动配置,方法是通过服务器地址获取服务器中配置文件中的相关配置,包括但是不限于数据源的配置,实现步骤为:Different from other test methods, the configuration parameters can be obtained automatically instead of manually. The method is to obtain the relevant configuration in the configuration file of the server through the server address, including but not limited to the configuration of the data source. The implementation steps are:
(1)建立SSH一个Clinet的对象;(1) Create SSH a Clinet object;
(2)根据服务器地址、端口号、用户名、密码建立ssh连接;(2) Establish an ssh connection according to the server address, port number, user name, and password;
(3)在服务器上根据项目名称找到项目部署的配置文件位置,读取配置文件返回配置文件内容;(3) Find the location of the configuration file deployed by the project on the server according to the project name, read the configuration file and return the content of the configuration file;
(4)在返回的内容中根据参数名获取参数值并保存,参数根据业务需要包括但不限于数据源(data_source)的信息、城市(city)、相关接口(relation_interface)等。(4) Obtain and save the parameter value according to the parameter name in the returned content. The parameter includes but is not limited to the information of the data source (data_source), city (city), and related interface (relation_interface) according to business needs.
2.自动数据源连接。2. Automatic data source connection.
(1)根据1中获得的数据源data_source的服务器地址及数据源名、用户名、密码,连接数据源服务器;(1) Connect to the data source server according to the server address, data source name, user name and password of the data source data_source obtained in 1;
(2)在数据源服务器上执行进行检测命令,检测数据源是否已经启动;(2) Execute the detection command on the data source server to detect whether the data source has been started;
(3)如果已经启动则进行数据源连接;(3) If it has been started, make a data source connection;
(4)如果未启动则启动数据源并进行数据源连接。(4) If it is not started, start the data source and connect the data source.
3.自动参数生成。3. Automatic parameter generation.
(1)根据业务需求及用例设计编写参数生成规则para_rule;(1) Design and write parameter generation rule para_rule according to business requirements and use cases;
(2)根据规则para_rule编写数据源操作语句,并返回数据结果data_result;(2) Write the data source operation statement according to the rule para_rule, and return the data result data_result;
(3)如果返回的data_result为空,进行3中的步骤(4)(3) If the returned data_result is empty, go to step (4) in 3
(4)根据3中的步骤(1)中规则及数据源中的数据之间的结构关系重新生成数据并插入到数据源中,继续3中的步骤(2);(4) regenerate data according to the structural relationship between the rules in step (1) in 3 and the data in the data source and insert it into the data source, continue step (2) in 3;
(5)如果返回的data_result不为空,根据接口输入要求格式化数据结果,并保存。(5) If the returned data_result is not empty, format the data result according to the interface input requirements and save it.
4.期望结果自动生成。4. Expected results are automatically generated.
使用3中自动生成的接口的输入参数,调用用例中需要调用的接口,并记录接口的返回值。每个接口的输出存在着一个期望值,这个期望值是根据业务逻辑及用例设计而得出的,在每个接口返回时,将期望值与实际结果值进行比较,如果接口的实际返回值符合期望则接口测试通过,否则接口测试不通过,与其他测试方法不同的是,本发明方法中的期望操作及期望返回值不需要手动输入,而是根据业务自动生成的。对于非查询功能的接口,其期望值可能是是带有成功或失败标志的关键词的结果,并对数据源进行一些符合业务流程及规范的操作;对于查询类接口会返回带有成功或失败标志的关键词,并返回符合业务逻辑的数据结果。对于上述非查询功能的接口,首先是通过判断返回结果中是否包含我们期望的关键词及返回的状态码是否正确能够初步确定接口是否通过测试,更进一步地我们还需要确定对数据源的增加修改及删除操作是否正确,因此需要在调用接口前后查询数据源中相应的数据表,判断接口调用前后数据源的数据增、删、改等操作是否符合业务需求,如果符合则可进一步确定接口测试通过;对于查询类的接口,首先是通过判断返回结果中是否包含我们期望的关键词及返回的状态码是否正确进行初步判断接口测试是否通过,更进一步地我们还需要确定返回的查询数据是否符合业务需求,因此需要根据查询的业务逻辑在数据源中查询数据,并将查询到的数据与接口的返回的数据进行比较,如果一致则进一步确定接口测试通过。Use the input parameters of the automatically generated interface in 3, call the interface that needs to be called in the use case, and record the return value of the interface. The output of each interface has an expected value, which is obtained according to the business logic and use case design. When each interface returns, the expected value is compared with the actual result value. If the actual return value of the interface meets the expectations, the interface If the test passes, otherwise the interface test fails. Different from other test methods, the expected operation and expected return value in the method of the present invention do not need to be manually input, but are automatically generated according to the business. For the interface of non-query function, the expected value may be the result of the keyword with a success or failure flag, and perform some operations on the data source that conform to the business process and specifications; for the query interface, it will return with a success or failure flag. keywords, and return data results that conform to business logic. For the above interface of non-query function, firstly, we can preliminarily determine whether the interface passes the test by judging whether the returned result contains the keywords we expect and whether the returned status code is correct. Furthermore, we also need to determine the addition and modification of the data source. Therefore, it is necessary to query the corresponding data table in the data source before and after calling the interface, and determine whether the data addition, deletion, and modification of the data source before and after the interface call meet the business requirements. If so, it can be further determined that the interface test passes. ; For the interface of the query class, we firstly judge whether the returned result contains the keywords we expect and whether the returned status code is correct to make a preliminary judgment on whether the interface test has passed, and further we need to determine whether the returned query data conforms to the business. Therefore, it is necessary to query the data in the data source according to the business logic of the query, and compare the queried data with the data returned by the interface. If they are consistent, it is further determined that the interface test has passed.
步骤五:生成测试报告Step 5: Generate test report
根据测试的结果自动生成测试报告,测试报告的内容需要包括通过的用例数,失败的用例数,并且能够对详细的测试结果进行查看,详细的测试结果需包括用例信息、接口信息、接口参数信息及接口返回结果信息等。综上述步骤生成基于参数自动生成的自动化测试方法及系统,在执行该方法前,需要在配置界面配置测试环境的地址、数据源的地址、指定执行的测试用例或者测试用例集,配置完成后就可以执行测试,并可以在执行结束后查看生成的测试报告并根据报告分析测试结果。The test report is automatically generated according to the test results. The content of the test report needs to include the number of passed use cases and the number of failed use cases, and the detailed test results can be viewed. The detailed test results need to include use case information, interface information, and interface parameter information. And the interface returns the result information, etc. In summary, the above steps generate an automatic test method and system based on automatic parameter generation. Before executing the method, you need to configure the address of the test environment, the address of the data source, and the specified test case or test case set in the configuration interface. The test can be executed, and the generated test report can be viewed after the execution and the test results can be analyzed according to the report.
实施例三Embodiment 3
根据本发明的又一个实施例的接口自动化测试方法,基于实施例二提供的技术方案,在“BOMS接口”项目的测试中进行使用。According to another embodiment of the present invention, the interface automatic testing method is used in the test of the "BOMS interface" project based on the technical solution provided in the second embodiment.
项目背景介绍:“BOMS接口”为“BOMS平台”及“基础业务平台”间提供了接口服务。“BOMS平台”是面向用户的服务平台,用户可以在该平台进行自助宽带业务,而用户在该平台上进行的业务办理等操作都要在“基础业务平台”上进行用户相关数据的增加、修改及更新等,这些操作是通过“BOMS接口”进行实现的。Project background introduction: "BOMS interface" provides interface services between "BOMS platform" and "basic business platform". "BOMS platform" is a user-oriented service platform. Users can conduct self-service broadband services on this platform, and users need to add and modify user-related data on the "basic business platform" for business processing and other operations on the platform. And update, etc., these operations are implemented through the "BOMS interface".
测试的过程如下:The test process is as follows:
根据“接口文档”及“需求文档”编写测试用例设计并根据实际需求将指定测试用例和测试服务器地址的配置等提取出,并通过配置界面进行设置。Write test case design according to "interface document" and "requirement document", and extract the configuration of specified test case and test server address according to actual requirements, and set it through the configuration interface.
根据“BOMS接口”的接口文档及业务的需求文档将接口测试分为3个单一接口测试及3个业务流程测试。According to the interface document of "BOMS interface" and the business requirement document, the interface test is divided into 3 single interface tests and 3 business process tests.
仅以其中一个接口getAccountTypeListForOldCustomer作为单一接口的测试实例进行描述,接口描述如下:Only one of the interfaces, getAccountTypeListForOldCustomer, is described as a test instance of a single interface. The interface description is as follows:
接口名称:getAccountTypeListForOldCustomerInterface name: getAccountTypeListForOldCustomer
接口功能:老用户续费时查询可交费的基本账户类型Interface function: When old users renew their subscription, they can query the basic account types that can be paid.
接口路径:****/***/getAccountTypeListForOldCustomerInterface path: ****/***/getAccountTypeListForOldCustomer
接口参数:如下表所示Interface parameters: as shown in the following table
(1)根据接口文档提取可配置数据(1) Extract configurable data according to the interface document
从接口文档中提取可变的内容,首先,接口路径是已知的,但是接口的服务器地址是可变的,需要在配置界面进行设置;其次,关于该接口需求及接口参数的规范需要编写测试用例并将测试用例编写到测试脚本中,执行时可在配置界面添加要指定执行的测试用例。Extract the variable content from the interface document. First, the interface path is known, but the server address of the interface is variable and needs to be set in the configuration interface; secondly, the specification of the interface requirements and interface parameters needs to be tested Use case and write the test case into the test script. When executing, you can add the test case to be specified for execution in the configuration interface.
(2)编写测试用例:(2) Write test cases:
测试用例需要考虑测试参数及测试需求,如参数classification分为“基础”及“套餐”,applicationStatusLIst分为“网上”“平台”“手机”是否可用等等,正常用例需要包含上述各个参数不同取值的组合,同时需包含异常用例。Test cases need to consider test parameters and test requirements. For example, parameter classification is divided into "basic" and "package", applicationStatusLIst is divided into "online", "platform", "mobile phone" availability, etc. Normal use cases need to include different values of the above parameters. , and include exception use cases.
(3)自动生成参数(3) Automatically generate parameters
(3.1)自动获取参数配置:(3.1) Automatically obtain parameter configuration:
为了达到接口的自动运行,减少参数配置过程,接口参数中可配置的部分采用在配置文件中自动获取的方式进行获取。如本实例getAccountTypeListForOldCustomer的接口中“city”参数是可变化的,具体参数city的值可以在配置文件中进行读取,而配置文件的名称及路径通常是已知的,因此通过说明中的“具体实施”的“步骤四”中的“1”的方法获取参数的值,如服务器地址为“x”端口号为“y”。In order to achieve the automatic operation of the interface and reduce the parameter configuration process, the configurable part of the interface parameters is obtained automatically in the configuration file. For example, the "city" parameter in the interface of getAccountTypeListForOldCustomer in this example can be changed. The value of the specific parameter city can be read in the configuration file, and the name and path of the configuration file are usually known. Implement the method "1" in "Step 4" to obtain the value of the parameter, for example, the server address is "x" and the port number is "y".
根据服务器地址x和端口y建立SSH连接,并到已知的配置文件所在路径下读取配置文件,根据配置文件中参数的名称获取参数的值(这里是city参数的值)、根据数据源的名称(如data_source)获取数据源的服务器地址、用户名、密码、数据库名等信息。Establish an SSH connection according to the server address x and port y, and read the configuration file in the path where the known configuration file is located, obtain the value of the parameter according to the name of the parameter in the configuration file (here is the value of the city parameter), according to the data source Name (such as data_source) to obtain the server address, user name, password, database name and other information of the data source.
(3.2)自动连接数据源(3.2) Automatically connect the data source
根据“步骤四中”的“3”的方法,根据服务器地址连接数据源服务器,连接成功后,检测数据源是否启动,如果启动则通过数据源的用户名、密码、数据库名等信息连接数据源;如果没有启动,则通过命令远程操作数据库启动,启动后使用同样的方法进行数据源连接。According to the method of "3" in "Step 4", connect the data source server according to the server address. After the connection is successful, check whether the data source is started. If it is started, connect the data source through the user name, password, database name and other information of the data source. ; If it is not started, start by commanding the remote operation database, and use the same method to connect to the data source after startup.
(3.3)自动参数生成(3.3) Automatic parameter generation
数据库连接成功后进入参数自动生成的步骤,根据用例及接口文档等进行规则的指定并生成参数。以该实例为例,部分用例描述如下(用例仅做示意,不是全部用例):After the database connection is successful, enter the step of automatic parameter generation, specify rules and generate parameters according to the use case and interface documents. Taking this example as an example, some use cases are described as follows (the use cases are only for illustration, not all use cases):
用例一:查询状态为断网的用户交费,并且所选账户类型可适用于平台的基本账户类型的情况。Use case 1: Query the payment of users whose status is disconnected from the network, and the selected account type can be applied to the basic account type of the platform.
用例二:查询状态为开通的用户交费,并且所选账户类型可适用于网络及平台的套餐账户类型的情况。Use case 2: The query status is that the user who is activated has paid the fee, and the selected account type can be applied to the package account type of the network and platform.
根据以上用例及数据源的数据关系,编写查询语句查询符合条件的参数,并格式化参数后作为接口的参数调用接口。According to the above use cases and the data relationship of the data source, write a query statement to query the parameters that meet the conditions, and format the parameters as the parameters of the interface to call the interface.
以“用例一”为例需要到用户表查询断网的用户的accountid,账户类型classification参数为“基本”,applicationStatusLIst参数为用户可适用方式的列表(这里只适用于平台),将参数格式化后作为接口输入调用接口,并接收接口的返回值。Taking "use case 1" as an example, you need to query the accountid of the disconnected user in the user table, the account type classification parameter is "basic", and the applicationStatusLIst parameter is a list of applicable methods for the user (this is only applicable to the platform). After formatting the parameters Call the interface as the interface input, and receive the return value of the interface.
当数据源中没有符合条件的数据,如不能查询到断网的用户,这时需要根据数据库中各数据之间的关联关系及具体的业务逻辑,使用符合数据源语法的语句添加符合逻辑的业务数据后再依据上述方法进行数据的提取并格式化后输入到接口,接收接口的返回值。When there is no qualified data in the data source, such as users who are disconnected from the network cannot be queried, then it is necessary to add logical services using statements that conform to the syntax of the data source according to the relationship between the data in the database and the specific business logic. After the data is extracted and formatted according to the above method, it is input to the interface, and the return value of the interface is received.
(3.4)自动生成期望结果并判断接口返回是否正确(3.4) Automatically generate expected results and judge whether the interface returns are correct
首先,判断接口返回的状态码是否符合期望,一般地,当接口调用成功并且正确返回时,状态码为200;判断接口的返回内容中是否包含期望的标志成功的关键词。First, judge whether the status code returned by the interface meets the expectations. Generally, when the interface is called successfully and returns correctly, the status code is 200; judge whether the return content of the interface contains the expected keyword indicating success.
其次,判断接口查询到的数据值是否符合业务需求。根据具体业务,查询出的用户可以续费的账户类型应该满足以下条件:Second, determine whether the data value queried by the interface meets the business requirements. According to the specific business, the queried account types that the user can renew should meet the following conditions:
符合“用户可续费账户规则”,该规则与业务密切相关,并且是用户在各个平台进行续费都需要遵守的一个规则;Comply with the "User Renewable Account Rules", which is closely related to business and is a rule that users need to abide by when renewing fees on various platforms;
账户类型必须是基本而非套餐的;Account type must be Basic and not Package;
账户类型只适用于平台交费的。Account type is only applicable to platform payment.
根据这些业务规则在数据源中查询出符合条件的账户类型数据,与接口返回的账户类型数据进行比较,如果返回数据相同则判断接口测试通过,否则接口测试失败。According to these business rules, the qualified account type data is queried in the data source and compared with the account type data returned by the interface. If the returned data is the same, the interface test is judged to pass, otherwise the interface test fails.
该方法也可用于测试复杂的业务流程,一个业务流程通常会调用若干个接口或者多个项目的接口,可能会涉及到多个测试环境,例如:测试“员工版”开户的用户,在“boms”平台进行开通,需要先调用“员工版”的“开户:的接口,再调用“boms”的“用户开通”的接口,并通过数据源中用户数据的插入及用户状态等的变更,确定业务流程测试是否测试通过。上述发明中的参数自动获取的方法同样适用于业务流程的测试过程,其中参数配置自动获取、数据源自动连接、参数自动生成、期望结果自动生成等方法都可通过实施例二的“步骤四”(自动生成参数的方法)进行实现。This method can also be used to test complex business processes. A business process usually calls several interfaces or interfaces of multiple projects, which may involve multiple test environments. To activate the platform, you need to call the "Account Opening:" interface of "Staff Edition" first, and then call the "User activation" interface of "boms", and determine the business through the insertion of user data in the data source and the change of user status, etc. Whether the test is passed through the process test. The method for the automatic acquisition of parameters in the above-mentioned invention is equally applicable to the test process of the business process, and the methods such as the automatic acquisition of parameter configuration, the automatic connection of data sources, the automatic generation of parameters, the automatic generation of expected results can all pass through the embodiments The second "step 4" (method of automatically generating parameters) is implemented.
(4)最后以用例为单位生成并记录测试报告。(4) Finally, a test report is generated and recorded in units of use cases.
实施例四Embodiment 4
如图3所示,根据本发明的一个实施例的接口自动化测试装置300,包括:存储器302、处理器304及存储在存储器302上并可在处理器304上运行的程序,程序被处理器304执行时实现如上述任一实施例的接口自动化测试方法的步骤。该接口自动化测试装置300包括如上述任一项实施例的接口自动化测试方法的全部有益效果,在此不再赘述。As shown in FIG. 3 , the interface automated testing apparatus 300 according to an embodiment of the present invention includes: a memory 302 , a processor 304 and a program stored in the memory 302 and executable on the processor 304 , and the program is executed by the processor 304 During execution, the steps of the interface automatic testing method according to any of the foregoing embodiments are implemented. The interface automatic testing apparatus 300 includes all the beneficial effects of the interface automatic testing method according to any one of the above embodiments, which will not be repeated here.
实施例五Embodiment 5
如图4所示,根据本发明的一个实施例的终端400,包括:实施例四所述的接口自动化测试装置300。该终端400运行时能够实现:自动获取配置参数;根据配置参数连接数据源;根据待测试的接口的定义文档、业务需求文档以及测试用例,确定参数生成规则;根据参数生成规则生成接口参数;根据接口参数调用接口,并记录接口的返回值;根据返回值确定接口是否通过测试。该终端400包括如上述任一实施例的接口自动化测试方法的全部有益效果,在此不再赘述。As shown in FIG. 4 , a terminal 400 according to an embodiment of the present invention includes: the interface automated testing apparatus 300 described in the fourth embodiment. When the terminal 400 is running, it can realize: automatically obtain configuration parameters; connect data sources according to configuration parameters; determine parameter generation rules according to the definition document, business requirement document and test case of the interface to be tested; generate interface parameters according to the parameter generation rules; The interface parameters call the interface and record the return value of the interface; determine whether the interface passes the test according to the return value. The terminal 400 includes all the beneficial effects of the interface automated testing method according to any of the above embodiments, and details are not described herein again.
实施例六Embodiment 6
根据本发明的一个实施例,还提供了一种计算机可读存储介质,其上存储有计算机程序,上述计算机程序被执行时实现上述任一实施例限定的接口自动化测试方法。According to an embodiment of the present invention, there is also provided a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the automatic interface testing method defined in any of the foregoing embodiments is implemented.
上述实施例的技术方案可在带有系统的电脑上实施,电脑的系统包括但不限于windows、linux、ios等,需要在这样的电脑上安装具有程序编写功能的IDE进行程序编写,程序编写的语言包括但不限于python、java、c++、c。The technical solutions of the above-mentioned embodiments can be implemented on a computer with a system. The computer system includes but is not limited to windows, linux, ios, etc. It is necessary to install an IDE with a program writing function on such a computer for program writing. Languages include but are not limited to python, java, c++, c.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.
应当注意的是,在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的部件或步骤。位于部件之前的单词“一”或“一个”不排除存在多个这样的部件。本发明可以借助于包括有若干不同部件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that, 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 preclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different components 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.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。Although preferred embodiments of the present invention have been described, additional changes and modifications to these embodiments may occur to those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be construed to include the preferred embodiment and all changes and modifications that fall within the scope of the present invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the scope of the claims of the present invention and its equivalent technology, and the present invention is also intended to include these changes and modifications.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910710107.8A CN112306855B (en) | 2019-08-02 | 2019-08-02 | Interface automation test method, device, terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910710107.8A CN112306855B (en) | 2019-08-02 | 2019-08-02 | Interface automation test method, device, terminal and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112306855A CN112306855A (en) | 2021-02-02 |
CN112306855B true CN112306855B (en) | 2022-06-17 |
Family
ID=74485514
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910710107.8A Expired - Fee Related CN112306855B (en) | 2019-08-02 | 2019-08-02 | Interface automation test method, device, terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112306855B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113010413B (en) * | 2021-02-20 | 2023-04-25 | 烽火通信科技股份有限公司 | Automatic interface testing method and device |
CN112948195B (en) * | 2021-03-31 | 2023-04-25 | 建信金融科技有限责任公司 | Interface testing method, device, electronic equipment and storage medium |
CN113407445B (en) * | 2021-06-03 | 2022-11-22 | 拉扎斯网络科技(上海)有限公司 | End-to-end automatic testing method and device and electronic equipment |
CN113535565B (en) * | 2021-07-19 | 2022-10-04 | 工银科技有限公司 | Interface use case generation method, device, equipment and medium |
CN113515287B (en) * | 2021-07-27 | 2024-10-11 | 上海工业自动化仪表研究院有限公司 | Automatic checking and correcting method for Restful interface return value |
CN113740781B (en) * | 2021-08-30 | 2022-05-24 | 广州文远知行科技有限公司 | Interface looseness detection method and device, vehicle and storage medium |
CN114691519A (en) * | 2022-04-15 | 2022-07-01 | 艺龙网信息技术(北京)有限公司 | Interface automation test method, device, equipment and storage medium |
CN116578497A (en) * | 2023-07-11 | 2023-08-11 | 苏州浪潮智能科技有限公司 | Automatic interface testing method, system, computer equipment and storage medium |
CN117171056B (en) * | 2023-11-02 | 2024-01-09 | 绿城科技产业服务集团有限公司 | Test method and device based on automatic interface |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105681126A (en) * | 2015-12-30 | 2016-06-15 | 合一网络技术(北京)有限公司 | Automatic test method and system based on protocol interface |
CN108415846A (en) * | 2018-04-19 | 2018-08-17 | 挖财网络技术有限公司 | A kind of method and apparatus generating minimal automation test use cases |
CN108897687A (en) * | 2018-06-29 | 2018-11-27 | 泰华智慧产业集团股份有限公司 | A kind of API automated testing method and system based on data-driven |
CN109101415A (en) * | 2018-06-25 | 2018-12-28 | 平安科技(深圳)有限公司 | Interface test method, system, equipment and the storage medium compared based on database |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9959200B2 (en) * | 2012-09-06 | 2018-05-01 | Red Hat Israel, Ltd. | User interface for composing test scenarios |
-
2019
- 2019-08-02 CN CN201910710107.8A patent/CN112306855B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105681126A (en) * | 2015-12-30 | 2016-06-15 | 合一网络技术(北京)有限公司 | Automatic test method and system based on protocol interface |
CN108415846A (en) * | 2018-04-19 | 2018-08-17 | 挖财网络技术有限公司 | A kind of method and apparatus generating minimal automation test use cases |
CN109101415A (en) * | 2018-06-25 | 2018-12-28 | 平安科技(深圳)有限公司 | Interface test method, system, equipment and the storage medium compared based on database |
CN108897687A (en) * | 2018-06-29 | 2018-11-27 | 泰华智慧产业集团股份有限公司 | A kind of API automated testing method and system based on data-driven |
Also Published As
Publication number | Publication date |
---|---|
CN112306855A (en) | 2021-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112306855B (en) | Interface automation test method, device, terminal and storage medium | |
CN112256558B (en) | Test case generation method and device, computer equipment and storage medium | |
CN102831052B (en) | Test exemple automation generating apparatus and method | |
US8151247B2 (en) | Test data management | |
CN104360920B (en) | A kind of automatic interface testing method and device | |
CN105389256B (en) | A kind of unit test method and system | |
KR101579493B1 (en) | Staging control method for source code, Computer program for the same, Recording medium storing computer program for the same | |
CN112181854B (en) | Method, device, equipment and storage medium for generating process automation script | |
US8078924B2 (en) | Method and system for generating a global test plan and identifying test requirements in a storage system environment | |
CN108111364B (en) | Service system testing method and device | |
CN115080398A (en) | An interface automated testing system and method | |
CN108459961A (en) | The method, client and server of examination are resurveyed after a kind of failure of testing case | |
CN110063042A (en) | A kind of response method and its terminal of database failure | |
CN113535141A (en) | Database operation code generation method and device | |
CN111881020A (en) | Payment center interface testing method, device and system | |
CN111240981A (en) | Interface testing method, system and platform | |
CN115563002A (en) | Data import method, device, storage medium and computer equipment | |
CN116107892A (en) | Automatic test method, device, equipment and storage medium | |
CN109446077A (en) | A kind of data library test method and device | |
CN112256554B (en) | Method and equipment for testing based on scene test cases | |
CN112069082A (en) | Automatic testing method and system | |
US12197316B2 (en) | Automated decoupling of unit tests | |
CN116861887A (en) | Back-end interface data verification method and system | |
CN111352824B (en) | Test method, device and computer equipment | |
CN112380142A (en) | Interface document management method and device and test equipment |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20220617 |
|
CF01 | Termination of patent right due to non-payment of annual fee |