WO2020019490A1 - Interface testing method, electronic device and storage medium - Google Patents

Interface testing method, electronic device and storage medium Download PDF

Info

Publication number
WO2020019490A1
WO2020019490A1 PCT/CN2018/107912 CN2018107912W WO2020019490A1 WO 2020019490 A1 WO2020019490 A1 WO 2020019490A1 CN 2018107912 W CN2018107912 W CN 2018107912W WO 2020019490 A1 WO2020019490 A1 WO 2020019490A1
Authority
WO
WIPO (PCT)
Prior art keywords
test
target
interface
target interface
module
Prior art date
Application number
PCT/CN2018/107912
Other languages
French (fr)
Chinese (zh)
Inventor
王翼
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020019490A1 publication Critical patent/WO2020019490A1/en

Links

Images

Classifications

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

Definitions

  • the present application relates to the technical field of software testing, and in particular, to an interface testing method, an electronic device, and a storage medium.
  • Interface test is a test for testing the interface between system components. Interface test is mainly used to detect the interaction points between external systems and systems and internal subsystems. The focus of the test is to check the exchange of data, transfer and control management Processes, and the mutual logical dependencies between systems. Due to the increasing complexity of today's systems, the cost of traditional test methods has increased dramatically and test efficiency has decreased dramatically, so interface testing is required. At present, the front-end and back-end architectures of many systems are separated. From a security perspective, relying only on the front-end to restrict the system cannot meet the system's security requirements. The back-end also needs to be controlled. In this case, interface-level verification is required.
  • test tools For different interfaces, different test tools need to be used, and preparations need to be performed separately on each test tool. Testers need to manually write a large number of program cases one by one for testing. The process of writing is prone to errors, which leads to the complexity of the interface test process. Test efficiency is low.
  • the embodiments of the present application provide an interface test method, an electronic device, and a storage medium.
  • an embodiment of the present application provides an interface test method.
  • the method includes:
  • an embodiment of the present application provides an electronic device including: a determining module, a testing module, a test report generating module, and a scanning module, where:
  • the determining module is configured to determine a target interface to be tested
  • the test module is configured to obtain a target test case and execute the target test case to test the target interface
  • the test report generating module is configured to obtain a test report of the target interface
  • the scanning module is configured to perform static scanning on the target interface definition code to obtain a scanning report.
  • an embodiment of the present application further provides an electronic device including a processor, an input device, an output device, and a memory.
  • the processor, the input device, the output device, and the memory are connected to each other.
  • the memory is used for A computer program is stored, where the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to the first aspect and any possible implementation manner thereof.
  • an embodiment of the present application provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause all the The processor executes the method of the first aspect and any possible implementation manners.
  • the embodiments of the present application can realize the automatic testing of the interface, reduce the workload of testers, improve the testing efficiency, and at the same time, monitor the potential risks of the interface down to the code level.
  • FIG. 1 is a schematic flowchart of an interface test method according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of an interface test method according to another embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of another electronic device according to an embodiment of the present application.
  • the electronic devices mentioned in the embodiments of the present application may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices (such as smart watches, smart bracelets, pedometers, etc.), computing devices, or connected to a wireless modem Other processing equipment, as well as various forms of user equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal equipment (terminal device), and so on.
  • UE User Equipment
  • MS Mobile Station
  • terminal device terminal device
  • FIG. 1 is a schematic flowchart of an interface test method according to an embodiment of the present application.
  • the method may be applied to an electronic device. As shown in FIG. 1, the method may include:
  • the selection and determination of the target interface may be manually set, that is, first, a tester may set one or more interfaces on an interface test platform on an electronic device, and select an interface to be tested among these interfaces.
  • the target interface can automatically start the execution of the test function; testers can also set the execution method, including: setting the test execution time, that is, the platform can immediately start executing the test task, or automatically execute the target interface at the set test execution time Test; set the background execution, set the number of test cycles and so on.
  • the selection and determination of the target interface for performing the test in this step can also be automatic.
  • the platform can store the above test conditions.
  • the platform has a detection function. When a preset change condition is detected, the test can be triggered, such as detecting the interface.
  • the parameters change and the parameter changes meet the preset test conditions.
  • the platform for executing the interface test method in this application can be understood as an automation environment.
  • the code warehouse where the interface is placed can be connected to the automation environment.
  • the code for the interface test can be placed in the code warehouse (an open source version control system), such as git or svn, then submit, that is, the tester chooses to enable monitoring, and the platform can periodically detect whether the code warehouse has changed to trigger the test of the interface.
  • step 102 may be performed.
  • Test cases can be written by developers based on actual projects. Each project needs to use the interface test cases that match it. Test cases can be provided to testers on the platform. Test cases can be set to popular expressions. , Such as modifying the naming or annotating, categorizing, etc., for testers to choose.
  • the platform can also run the selected interface test case according to the selected execution method. For example, the tester sets the test execution time, and the platform can execute the target interface test at the set test execution time. Set the number of test cycles to be performed in the background or to follow the test.
  • the request parameters of the test case can be set according to the normal input parameter format of the interface. If multiple test case parameters of an interface need to achieve data separation, it can be achieved by unifying the data format in the specified file, which can be stored in the form of a data format table (such as what parameters are represented in the first column of the table, and the second column What parameters represent, etc.).
  • test cases for interfaces can be added or deleted. Users can add new interface test cases as needed. If you need to add new interface test cases, you only need to add new interface test cases to the interface test case project and upload them, and delete similar ones.
  • the method before using the target test case to test the target interface, the method further includes: obtaining test configuration parameters of the target interface.
  • test configuration parameters may include: system domain name and / or port, http implementation version and protocol type, input parameters, and response.
  • any website is accessed through the combination of the server's IP (xxx.xxx.xxx) and port number (xx). Because the server's IP number is too difficult to remember and is not visual, the term "domain name" appears.
  • the meaning of a domain name is to represent a server IP address in the form of a string such as xxx.xxx.xx. In essence, they use mapping binding resolution to handle this. Domain names need to be specially registered and registered, and they must not conflict. In the embodiment of the present application, a domain name is used for setting, which is convenient for testers to manage.
  • a port can be considered as an outlet for communication between the device and the outside world.
  • Ports can be divided into virtual ports and physical ports. What is referred to in this application are virtual ports, that is, ports inside a computer or a switch router, which are not visible. For example, 80 ports, 21 ports, 23 ports, etc. in the computer.
  • DNS Domain Name System
  • DNS port number is an abbreviation of port number.
  • Interface testing can include input parameter testing: testing the input parameters, or testing that assumes the incorrectness of the interface parameters, ensuring that the interface handles any type of input accordingly: input parameters are valid, input parameters Illegal, the input parameter is empty, the input parameter is null, and the input parameter is too long; therefore, you need to set the input parameter and the corresponding response to determine whether the interface is operating correctly.
  • the target interface can be tested using the target test case according to the test configuration parameters.
  • test cases for an interface There can be multiple test cases for an interface, and some or all of the test cases stored in the platform can be selected for execution.
  • the platform can also select appropriate test cases, such as prompting the user to choose a used test solution, that is, the tester can Set a shortcut to save the configured interface test configuration parameters and test cases. After this test is completed, you can use the historical test scheme with a one-click setting method, which simplifies the test operation steps.
  • test report can be generated, and the output report can be sent to the relevant responsible persons on a regular basis.
  • the corresponding contact information of the responsible person (email address, or the corresponding user account of the platform can be set on the platform. Users can use the terminal Log in to the user account and receive push messages).
  • the test report can be displayed in a graphical interface to clearly and intuitively find problems. For example, the test report can be displayed as a list of interface test conditions, which shows whether each interface has passed, and whether there are problems.
  • the target interface definition code is used to describe the target interface.
  • Static scanning refers to static source code scanning. It is one of the software application security solutions that have been mentioned in recent years. It means that in software engineering, programmers do not need to compile after compiling the source code. Scan it directly with some scanning tools to find solutions to some semantic defects and security vulnerabilities in the code.
  • Pattern matching Match token flow, abstract syntax tree (AST) and intermediate code during code compilation. According to experience, it is recognized that certain styles of code are vulnerabilities.
  • the static scanning mainly involved in this application is implemented by means of pattern matching, which can include lexical analysis, syntax analysis, and intermediate code analysis, as follows:
  • the lexical analysis phase is the first phase of the compilation process and is the basis of compilation.
  • the task of this stage is to read the source program one character from left to right, that is, to scan the character stream that constitutes the source program and then recognize words (also known as word symbols or symbols) according to the word formation rules, that is, you can scan and identify Words are given qualitative and fixed-length processing.
  • Grammar analysis is a logical stage of the compilation process.
  • the main task is to combine word sequences into various types of grammatical phrases, such as programs, statements, expressions, and so on, based on lexical analysis.
  • a parser determines whether the program is structurally correct.
  • the main principle is to match abstract syntax trees.
  • Intermediate code is where the writer hopes to generate an intermediate identification form closer to the target code from the syntax tree, or use such an intermediate representation instead of the syntax tree, and then execute this new intermediate representation to generate the target code.
  • the intermediate code serves as a bridge between the front-end and the back-end of the compiler.
  • the function of the intermediate code is to make the structure of the compiler more logical and simple. In particular, it makes the optimization of the target code easier to implement the intermediate code, that is, the intermediate language program.
  • the complexity of the intermediate language lies between the source language and the machine language. You can use the open source analysis tool findbugs to analyze Java code errors.
  • the analysis object of findbugs is java intermediate code-bytecode. Therefore, in the process of using the command line to call the tool, you need to pass in the compiled class file or jar package.
  • Step 103 in the embodiment of the present application may be performed simultaneously during the execution of step 102 to increase the speed of the entire interface test, obtain corresponding test reports and scan reports, and display the results to the user.
  • a target test case is obtained, the target interface is tested using the target test case, a test report of the target interface is obtained, and a static scan is performed on the target interface definition code to obtain a scan report.
  • FIG. 2 is a schematic flowchart of another interface test method provided by an embodiment of the present application.
  • the embodiment shown in FIG. 2 may be obtained based on the embodiment shown in FIG. 1, as shown in FIG. 2.
  • the method may include:
  • step 201 reference may be made to the detailed description in step 101 of the embodiment shown in FIG. 1, and details are not described herein again.
  • the tester can set the test execution time of the interface (for example, after 2 hours, 14:00 on the day, or immediately), and after obtaining the test execution time of the target interface, step 203 can be performed; optionally, the tester You can also set the target interface's test cycle (such as 1 hour). After obtaining the test execution time and test cycle of the target interface, you can use the target test case to test the target interface every time from the test execution time. Record the test results in a test report. Optionally, the tester can also set the number of test cycles for the interface test (for example, 3 times). After obtaining the above number of test cycles, the test can be performed according to the set number of test cycles. That is, the target test case can be run according to the execution mode selected by the user, which improves the test flexibility and test efficiency.
  • step 204 reference may be made to the detailed description in step 104 of the embodiment shown in FIG. 1, and details are not described herein again.
  • the coverage of the target test cases and target interfaces can also be detected, which can be reflected in what code is not covered after the test case is executed.
  • Code coverage can be injected into the bytecode file through a probe according to a certain injection strategy.
  • coverage data is generated in the JVM virtual machine, stored in memory, and the coverage data is dumped through a port. Form a report locally.
  • the target interface definition code specification can also be detected.
  • Code specification problems can use various rules of checkstyle to scan the code to get code specification reports.
  • the user can set a first email address for receiving the test report in advance, so that it can be sent to the first email address after generating the test report, and the user can set a second email address for receiving the scan report in advance, so that After the test report is generated, it can be sent to the second email address.
  • step 206 may be performed.
  • the first email address and the second email address may be the same or different, that is, the test report and the scan report may be sent to different persons in charge, or they may be integrated and sent together.
  • the above email can be sent at a preset time, that is, the email sending time can be set, and the above email including the test report and the email including the scan report can be sent to the user regularly.
  • the user can receive and view the interface test status at the preset time. .
  • the target execution time of the target interface is obtained, the target test case is obtained, the target test case is executed at the test execution time to test the target interface, the test report of the target interface is obtained, and the code of the target interface is defined.
  • Perform a static scan to obtain a scan report, perform a code coverage test on the target interface and the target test case, obtain a code coverage, obtain a first email address for receiving the test report, and a second email address for receiving the scan report.
  • An email address sending a first email containing the test report content to the first email address, and sending a second email containing the scan report content to the second email address, which can implement automated testing of the interface and facilitate regular reception by testers Viewing the test report by email reduces the workload of the tester and improves the testing efficiency. At the same time, the potential risks of the interface detail to the code level can be monitored.
  • FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the electronic device 300 includes a determining module 310, a testing module 320, a test report generating module 330, and a scanning module 340, where:
  • the determining module 310 is configured to determine a target interface to be tested
  • the test module 320 is configured to obtain a target test case and execute the target test case to test the target interface;
  • the test report generating module 330 is configured to obtain a test report of the target interface
  • the scanning module 340 is configured to perform static scanning on the target interface definition code to obtain a scanning report.
  • the above-mentioned electronic device 300 further includes a configuration module 350 for acquiring a test configuration parameter of the target interface;
  • the test module 320 is specifically configured to execute the target test case to test the target interface according to the test configuration parameters.
  • the electronic device 300 further includes:
  • a coverage test module 360 is configured to perform a code coverage test on the target interface and the target test case to obtain a code coverage rate when the target interface is tested using the target test case.
  • the configuration module 350 is further configured to obtain a test execution time of the target interface
  • the test module 320 is specifically configured to execute the target test case at the test execution time to test the target interface.
  • the configuration module 350 is further configured to obtain a test period of the target interface
  • the test module 320 is specifically configured to execute the target test case every test period to test the target interface from the test execution time.
  • the foregoing electronic device 300 further includes:
  • the mail sending module 370 is configured to obtain a first mail address used to receive the test report and a second mail address used to receive the scan report, and to send the test report to the first mail address including the test report. A first mail of the content, and a second mail including the content of the scan report is sent to the second mail address.
  • the foregoing determining module 310 is specifically configured to determine that an interface targeted by the test instruction is a target interface to be tested when a test instruction of the user against the interface is detected; or,
  • steps 101 to 104 and 201 to 207 related to the interface test method shown in FIG. 1 and FIG. 2 may be performed by each module in the electronic device 300 shown in FIG. 3.
  • steps 101 to 104 in FIG. 1 may be performed by the determination module 310, the test module 320, the test report generation module 330, and the scan module 340 shown in FIG. 3, respectively.
  • the electronic device 300 can determine a target interface to be tested, obtain a target test case, execute the target test case to test the target interface, obtain a test report of the target interface, and perform a test on the target interface. Defining code for static scanning and obtaining scanning reports can realize automatic testing of the interface, reduce the workload of testers, improve testing efficiency, and monitor the potential risks of the interface down to the code level.
  • FIG. 4 is a schematic structural diagram of another electronic device disclosed in an embodiment of the present application.
  • the electronic device 400 includes a processor 401 and a memory 402.
  • the electronic device 400 may further include a bus 403.
  • the processor 401 and the memory 402 may be connected to each other through the bus 403.
  • the bus 403 may be a peripheral component and each other. Connects to a standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industrial Architecture (EISA) bus).
  • PCI Peripheral Component Interconnect
  • EISA Extended Industrial Architecture
  • the bus 403 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only a thick line is used in FIG. 4, but it does not mean that there is only one bus or one type of bus.
  • the electronic device 400 may further include an input-output device 404, and the input-output device 404 may include a display screen, such as a liquid crystal display screen.
  • the memory 402 is configured to store one or more programs containing instructions; the processor 401 is configured to call the instructions stored in the memory 402 to execute some or all of the method steps mentioned in the embodiments of FIG. 1 and FIG. 2.
  • the processor 401 may be a central processing unit (CPU), and the processor may also be another general-purpose processor or a digital signal processor (DSP). , Application specific integrated circuit (ASIC), ready-made programmable gate array (Field-Programmable GateArray, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the input device 402 may include a touch panel, a fingerprint sensor (for collecting fingerprint information and orientation information of a user), a microphone, and the like, and the output device 403 may include a display (LCD, etc.), a speaker, and the like.
  • a fingerprint sensor for collecting fingerprint information and orientation information of a user
  • a microphone for collecting fingerprint information and orientation information of a user
  • the output device 403 may include a display (LCD, etc.), a speaker, and the like.
  • the memory 404 may include a read-only memory and a random access memory, and provide instructions and data to the processor 401. A portion of the memory 404 may also include non-volatile random access memory. For example, the memory 404 may also store device type information.
  • the electronic device 400 can determine a target interface to be tested, obtain a target test case, execute the target test case to test the target interface, obtain a test report of the target interface, and perform a test on the target interface. Defining code for static scanning and obtaining scanning reports can realize automatic testing of the interface, reduce the workload of testers, improve testing efficiency, and monitor the potential risks of the interface down to the code level.
  • An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute any one of the interfaces described in the foregoing method embodiments. Some or all steps of the test method.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the modules is only a logical function division.
  • multiple units or components may be combined or may be combined. Integration into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, and may be electrical or other forms.
  • the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objective of the solution of this embodiment.
  • the integrated module When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable memory.
  • the technical solution of the present application essentially or part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory.
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the foregoing memory includes: a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk, and other media that can store program codes.

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

Disclosed in the embodiments of the present application are an interface testing method, an electronic device and a storage medium. The method comprises: determining a target interface to be tested; acquiring a target test case, and executing the target test case to test the target interface; obtaining a test report concerning the target interface; performing static scanning on the target interface definition code to obtain a scan report. The present invention is able to realize an automated test of an interface, reduce the workload of a test person, improve test efficiency, and is able to monitor potential risks of the interface as well, in detail to a code level.

Description

一种接口测试方法、电子设备及存储介质Interface test method, electronic equipment and storage medium
本申请要求于2018年7月27日提交中国专利局、申请号为201810841915.3、申请名称为“一种接口测试方法、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed on July 27, 2018 with the Chinese Patent Office, with the application number 201810841915.3, and the application name being "An Interface Test Method, Electronic Equipment, and Storage Medium", the entire contents of which are incorporated by reference. In this application.
技术领域Technical field
本申请涉及软件测试技术领域,尤其涉及一种接口测试方法、电子设备及存储介质。The present application relates to the technical field of software testing, and in particular, to an interface testing method, an electronic device, and a storage medium.
背景技术Background technique
接口测试是测试系统组件间接口的一种测试,接口测试主要用于检测外部系统与系统之间以及内部各个子系统之间的交互点,测试的重点是要检查数据的交换,传递和控制管理过程,以及系统间的相互逻辑依赖关系等。由于如今的系统复杂度不断上升,传统的测试方法成本急剧增加且测试效率大幅下降,所以需要进行接口测试。现在很多系统前后端架构是分离的,从安全层面来说,只依赖前端进行限制已经完全不能满足系统的安全要求,需要后端同样进行控制,在这种情况下就需要从接口层面进行验证。Interface test is a test for testing the interface between system components. Interface test is mainly used to detect the interaction points between external systems and systems and internal subsystems. The focus of the test is to check the exchange of data, transfer and control management Processes, and the mutual logical dependencies between systems. Due to the increasing complexity of today's systems, the cost of traditional test methods has increased dramatically and test efficiency has decreased dramatically, so interface testing is required. At present, the front-end and back-end architectures of many systems are separated. From a security perspective, relying only on the front-end to restrict the system cannot meet the system's security requirements. The back-end also needs to be controlled. In this case, interface-level verification is required.
针对不同接口,需要使用不同的测试工具,并需在每个测试工具上单独进行准备工作,测试人员需逐一手动编写大量程序案例进行测试,编写过程中容易出错,从而导致接口测试的过程复杂、测试效率低。For different interfaces, different test tools need to be used, and preparations need to be performed separately on each test tool. Testers need to manually write a large number of program cases one by one for testing. The process of writing is prone to errors, which leads to the complexity of the interface test process. Test efficiency is low.
发明内容Summary of the Invention
本申请实施例提供一种接口测试方法、电子设备及存储介质。The embodiments of the present application provide an interface test method, an electronic device, and a storage medium.
第一方面,本申请实施例提供了一种接口测试方法,该方法包括:In a first aspect, an embodiment of the present application provides an interface test method. The method includes:
确定待测试的目标接口;Determine the target interface to be tested;
获取目标测试用例,执行所述目标测试用例以测试所述目标接口;Acquiring a target test case, and executing the target test case to test the target interface;
获得所述目标接口的测试报告;Obtaining a test report of the target interface;
对所述目标接口定义代码进行静态扫描,获得扫描报告。Perform a static scan on the target interface definition code to obtain a scan report.
第二方面,本申请实施例提供了一种电子设备,包括:确定模块、测试模块、测试报告生成模块和扫描模块,其中:In a second aspect, an embodiment of the present application provides an electronic device including: a determining module, a testing module, a test report generating module, and a scanning module, where:
所述确定模块,用于确定待测试的目标接口;The determining module is configured to determine a target interface to be tested;
所述测试模块,用于获取目标测试用例,执行所述目标测试用例以测试所述目标接口;The test module is configured to obtain a target test case and execute the target test case to test the target interface;
所述测试报告生成模块,用于获得所述目标接口的测试报告;The test report generating module is configured to obtain a test report of the target interface;
所述扫描模块,用于对所述目标接口定义代码进行静态扫描,获得扫描报告。The scanning module is configured to perform static scanning on the target interface definition code to obtain a scanning report.
第三方面,本申请实施例还提供了一种电子设备,包括:处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行如第一方面及其任一种可能的实施方式所述的方法。According to a third aspect, an embodiment of the present application further provides an electronic device including a processor, an input device, an output device, and a memory. The processor, the input device, the output device, and the memory are connected to each other. The memory is used for A computer program is stored, where the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to the first aspect and any possible implementation manner thereof.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行上述第一方面及其任一种可能的实施方式的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause all the The processor executes the method of the first aspect and any possible implementation manners.
本申请实施例可以实现对接口的自动化测试,减少测试人员的工作量,提高测试效率,同时可以监控接口详细至代码层面的潜在风险。The embodiments of the present application can realize the automatic testing of the interface, reduce the workload of testers, improve the testing efficiency, and at the same time, monitor the potential risks of the interface down to the code level.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本申请实施例提供的一种接口测试方法的流程示意图;FIG. 1 is a schematic flowchart of an interface test method according to an embodiment of the present application;
图2是本申请另一实施例提供的一种接口测试方法的流程示意图;2 is a schematic flowchart of an interface test method according to another embodiment of the present application;
图3是本申请实施例提供的一种电子设备的结构示意图;3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
图4是本申请实施例提供的另一种电子设备的结构示意图。FIG. 4 is a schematic structural diagram of another electronic device according to an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的 实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。In the following, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of them. Reference to "an embodiment" herein means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they separate or alternative embodiments that are mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
为了能够更好地理解本申请实施例,下面将对应用本申请实施例的方法进行介绍。In order to better understand the embodiments of the present application, the method of applying the embodiments of the present application will be described below.
本申请实施例中提到的电子设备可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备(例如智能手表、智能手环、计步器等)、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(User Equipment,UE),移动台(Mobile Station,MS),终端设备(terminal device)等等。为方便描述,上面提到的设备统称为电子设备。The electronic devices mentioned in the embodiments of the present application may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices (such as smart watches, smart bracelets, pedometers, etc.), computing devices, or connected to a wireless modem Other processing equipment, as well as various forms of user equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal equipment (terminal device), and so on. For ease of description, the devices mentioned above are collectively referred to as electronic devices.
请参见图1,是本申请实施例提供的一种接口测试方法的示意流程图,本方法可以应用于电子设备,如图1所示该方法可包括:Please refer to FIG. 1, which is a schematic flowchart of an interface test method according to an embodiment of the present application. The method may be applied to an electronic device. As shown in FIG. 1, the method may include:
101、确定待测试的目标接口。101. Determine a target interface to be tested.
在进行测试前需要确定待测试的接口,可以将接口添加到电子设备的测试平台中,在检测到测试指令时,确定上述测试指令针对的接口为待测试的目标接口;或者,Before testing, you need to determine the interface to be tested. You can add the interface to the test platform of the electronic device. When a test instruction is detected, determine that the interface targeted by the test instruction is the target interface to be tested; or,
在检测到参数发生变化的接口的参数变化符合测试条件时,确定上述参数发生变化的接口为待测试的目标接口When the parameter change of the interface where the parameter change is detected meets the test conditions, it is determined that the interface whose parameter is changed is the target interface to be tested
具体的,对上述目标接口的选取和确定,可以是人工设置的,即首先测试人员可以在电子设备上的接口测试平台设置好一个或者多个接口,在这些接口中选择需要进行测试的接口即目标接口,进而可以自动开启测试功能的执行;测试人员还可以对执行方式进行设置,包括:设置测试执行时间,即平台可以立即开始执行测试任务,或者在设置的测试执行时间时自动执行目标接口的测试;设置后台执行、设置测试循环次数等。Specifically, the selection and determination of the target interface may be manually set, that is, first, a tester may set one or more interfaces on an interface test platform on an electronic device, and select an interface to be tested among these interfaces. The target interface can automatically start the execution of the test function; testers can also set the execution method, including: setting the test execution time, that is, the platform can immediately start executing the test task, or automatically execute the target interface at the set test execution time Test; set the background execution, set the number of test cycles and so on.
本步骤中对执行测试的目标接口的选取和确定,还可以是自动的,平台可以存储上述测试条件,平台具有检测功能,当检测到发生预设变化条件时,可以触发测试,比如检测到接口的参数发生变化,并且参数的变化满足与预设的测试条件。本申请中执行接口测试方法的平台可以理解为一个自动化环境,放置接口的代码仓库可以连接到该自动化环境,接口测试的代码可以放到代码仓库(开放源代码的版本控制系统),例如git或者svn,然后提交,即测试人员选择开启监测,平台就可以周期性地检测代码仓库是否发生变化,以触发对接 口的测试。The selection and determination of the target interface for performing the test in this step can also be automatic. The platform can store the above test conditions. The platform has a detection function. When a preset change condition is detected, the test can be triggered, such as detecting the interface. The parameters change and the parameter changes meet the preset test conditions. The platform for executing the interface test method in this application can be understood as an automation environment. The code warehouse where the interface is placed can be connected to the automation environment. The code for the interface test can be placed in the code warehouse (an open source version control system), such as git or svn, then submit, that is, the tester chooses to enable monitoring, and the platform can periodically detect whether the code warehouse has changed to trigger the test of the interface.
确定上述目标接口之后,可以执行步骤102。After the target interface is determined, step 102 may be performed.
102、获取目标测试用例,执行上述目标测试用例以测试上述目标接口。102. Obtain a target test case and execute the target test case to test the target interface.
其中,上述测试用例可以由开发根据实际的项目进行编写,每个项目都需要使用与其匹配的接口测试用例,在平台中测试用例可以提供给测试人员使用,测试用例可以设置为通俗化的表现形式,比如修改命名或加批注、分类等方式,便于测试人员选择。The above test cases can be written by developers based on actual projects. Each project needs to use the interface test cases that match it. Test cases can be provided to testers on the platform. Test cases can be set to popular expressions. , Such as modifying the naming or annotating, categorizing, etc., for testers to choose.
具体的,平台还可以根据所选的执行方式自行运行选定的接口测试用例,比如,测试人员设置了测试执行时间,平台可以立在设置的测试执行时间时执行目标接口的测试;还可以按照设置在后台执行或者测试时遵循设置的测试循环次数等。Specifically, the platform can also run the selected interface test case according to the selected execution method. For example, the tester sets the test execution time, and the platform can execute the target interface test at the set test execution time. Set the number of test cycles to be performed in the background or to follow the test.
测试用例的请求参数可以按照接口正常的入参格式设置。如果一个接口的多个测试用例参数需要实现数据分离,可以通过在指定文件中统一数据格式的方式实现,具体可以通过数据格式表的形式存储(比如在表格第一列代表什么参数、第二列代表什么参数等)。The request parameters of the test case can be set according to the normal input parameter format of the interface. If multiple test case parameters of an interface need to achieve data separation, it can be achieved by unifying the data format in the specified file, which can be stored in the form of a data format table (such as what parameters are represented in the first column of the table, and the second column What parameters represent, etc.).
可选的,可以增加或删除接口的测试用例。用户可以根据需要增添新的接口测试用例,若需要增添新的接口测试用例,只需在接口测试用例工程中添加新的接口测试用例并上传即可,删除类似。Optionally, test cases for interfaces can be added or deleted. Users can add new interface test cases as needed. If you need to add new interface test cases, you only need to add new interface test cases to the interface test case project and upload them, and delete similar ones.
可选的,在使用上述目标测试用例测试上述目标接口之前,该方法还包括:获取上述目标接口的测试配置参数。Optionally, before using the target test case to test the target interface, the method further includes: obtaining test configuration parameters of the target interface.
在接口测试运行之前,测试人员可以对目标接口的测试配置参数进行配置,上述测试配置参数可包括:系统域名和/或端口、http实现版本及协议类型、输入参数及响应。Before the interface test runs, the tester can configure the test configuration parameters of the target interface. The test configuration parameters may include: system domain name and / or port, http implementation version and protocol type, input parameters, and response.
从本质来讲,任何一个网站的访问,都是通过服务器的IP(xxx.xxx.xxx)和端口号(xx)的组合来实现访问的。由于服务器的IP号码太难记,不形象,因此出现了所谓的“域名”一词。域名的含义就是通过一个xxx.xxx.xx这样的字符串的形式来表示某个服务器IP地址,实质上他们是采用映射绑定解析这样来处理的。域名需要专门注册和登记,不能冲突。在本申请实施例中使用域名来进行设置,便于测试人员管理。In essence, any website is accessed through the combination of the server's IP (xxx.xxx.xxx) and port number (xx). Because the server's IP number is too difficult to remember and is not visual, the term "domain name" appears. The meaning of a domain name is to represent a server IP address in the form of a string such as xxx.xxx.xx. In essence, they use mapping binding resolution to handle this. Domain names need to be specially registered and registered, and they must not conflict. In the embodiment of the present application, a domain name is used for setting, which is convenient for testers to manage.
端口(port)可以认为是设备与外界通讯交流的出口。端口可分为虚拟端口 和物理端口,本申请中涉及的为虚拟端口,即计算机内部或交换机路由器内的端口,不可见。例如计算机中的80端口、21端口、23端口等。域名系统(Domain Name System,DNS)用于命名组织到域层次结构中的计算机和网络服务。DNS端口号是端口号的缩写,在Internet上域名与IP地址之间是一一对应的,域名虽然便于人们记忆,但机器之间只能互相认识IP地址,它们之间的转换工作称为域名解析,域名解析需要由专门的域名解析服务器来完成。A port can be considered as an outlet for communication between the device and the outside world. Ports can be divided into virtual ports and physical ports. What is referred to in this application are virtual ports, that is, ports inside a computer or a switch router, which are not visible. For example, 80 ports, 21 ports, 23 ports, etc. in the computer. The Domain Name System (DNS) is used to name computers and network services that are organized into a domain hierarchy. DNS port number is an abbreviation of port number. There is a one-to-one correspondence between domain names and IP addresses on the Internet. Although domain names are easy for people to remember, machines can only recognize each other's IP addresses. The conversion between them is called the domain name. Resolution, domain name resolution needs to be completed by a dedicated domain name resolution server.
接口测试可以包括输入参数测试:针对输入的参数进行测试,也可以说是假定接口参数的不正确性进行的测试,确保接口对任意类型的输入都做了相应的处理:输入参数合法,输入参数不合法,输入参数为空,输入参数为null,输入参数超长;因此需要设置输入参数及对应的响应,以判断接口是否正确运行。Interface testing can include input parameter testing: testing the input parameters, or testing that assumes the incorrectness of the interface parameters, ensuring that the interface handles any type of input accordingly: input parameters are valid, input parameters Illegal, the input parameter is empty, the input parameter is null, and the input parameter is too long; therefore, you need to set the input parameter and the corresponding response to determine whether the interface is operating correctly.
在获取上述测试配置参数之后,可以根据上述测试配置参数,使用目标测试用例测试上述目标接口。After obtaining the test configuration parameters, the target interface can be tested using the target test case according to the test configuration parameters.
一个接口的测试用例可以有多个,可以选择平台中存储的测试用例部分或全部执行;也可以由平台推选出合适的测试用例,比如提示用户是否选择已使用过的测试方案,即测试人员可以设置一种快捷方式,保存设置好的接口测试的配置参数和测试用例,在本次测试完成之后,可以通过一键设置的方法使用历史测试方案,更加简化了测试操作步骤。There can be multiple test cases for an interface, and some or all of the test cases stored in the platform can be selected for execution. The platform can also select appropriate test cases, such as prompting the user to choose a used test solution, that is, the tester can Set a shortcut to save the configured interface test configuration parameters and test cases. After this test is completed, you can use the historical test scheme with a one-click setting method, which simplifies the test operation steps.
103、获得上述目标接口的测试报告。103. Obtain a test report of the target interface.
在接口测试完成之后,可以生成测试报告,产出的报告可以定期发送给相关责任人,需要在平台设置绑定相应的负责人联系方式(邮箱地址,或者平台相应的用户账号,用户可以在终端上登录该用户账号,接收推送信息)。测试报告可以以图形化界面展示,清晰直观发现问题,比如具体可以展示为接口测试情况列表,对应展示各接口是否通过,是否出现问题等。After the interface test is completed, a test report can be generated, and the output report can be sent to the relevant responsible persons on a regular basis. The corresponding contact information of the responsible person (email address, or the corresponding user account of the platform can be set on the platform. Users can use the terminal Log in to the user account and receive push messages). The test report can be displayed in a graphical interface to clearly and intuitively find problems. For example, the test report can be displayed as a list of interface test conditions, which shows whether each interface has passed, and whether there are problems.
104、对上述目标接口定义代码进行静态扫描,获得扫描报告。104. Perform static scanning on the target interface definition code to obtain a scanning report.
其中,上述目标接口定义代码用于描述该目标接口。静态扫描指的是静态源代码扫描,是近年被人提及较多的软件应用安全解决方案之一,它是指在软件工程中,程序员在写好源代码后,无需经过编译器编译,而直接使用一些扫描工具对其进行扫描,找出代码当中存在的一些语义缺陷、安全漏洞的解决方案。The target interface definition code is used to describe the target interface. Static scanning refers to static source code scanning. It is one of the software application security solutions that have been mentioned in recent years. It means that in software engineering, programmers do not need to compile after compiling the source code. Scan it directly with some scanning tools to find solutions to some semantic defects and security vulnerabilities in the code.
静态扫描一般可以分为两种:There are two general types of static scanning:
(1)模式匹配:匹配代码编译过程中的token流、抽象语法树(AST)和中间代码,根据经验认知某些样式的代码为漏洞。(1) Pattern matching: Match token flow, abstract syntax tree (AST) and intermediate code during code compilation. According to experience, it is recognized that certain styles of code are vulnerabilities.
(2)数据流分析:数据流分析技术基于控制流图(CFG),按照某种方式扫面控制流图的每一条指令,试图理解指令行为,以此判断程序中存在的漏洞。(2) Data flow analysis: Based on the control flow graph (CFG), the data flow analysis technology scans each instruction of the control flow graph in a certain way in an attempt to understand the behavior of the instruction to determine the loopholes in the program.
本申请中主要涉及的静态扫描为模式匹配的方式实现,可以包括词法分析、语法分析和中间代码分析,具体如下:The static scanning mainly involved in this application is implemented by means of pattern matching, which can include lexical analysis, syntax analysis, and intermediate code analysis, as follows:
词法分析阶段是编译过程的第一个阶段,是编译的基础。这个阶段的任务是从左到右一个字符一个字符地读入源程序,即对构成源程序的字符流进行扫描然后根据构词规则识别单词(也称单词符号或符号),即可以扫描、识别单词且对识别出的单词给出定性、定长的处理。可以通过静态代码扫描工具Cppcheck,使用词法分析进行代码扫描,支持C、C++代码,主要对token流进行匹配,在扫描时无需编译,执行速度较快。The lexical analysis phase is the first phase of the compilation process and is the basis of compilation. The task of this stage is to read the source program one character from left to right, that is, to scan the character stream that constitutes the source program and then recognize words (also known as word symbols or symbols) according to the word formation rules, that is, you can scan and identify Words are given qualitative and fixed-length processing. You can use the static code scanning tool Cppcheck to use lexical analysis for code scanning. It supports C and C ++ code. It mainly matches token streams. It does not need to be compiled during scanning, and the execution speed is fast.
语法分析是编译过程的一个逻辑阶段,主要任务是在词法分析的基础上将单词序列组合成各类语法短语,如程序、语句、表达式等等。语法分析程序判断程序在结构上是否正确。可以通过JAVA代码的代码错误分析工具PMD,使用语法分析进行扫描,PMD可以支持扫描文件夹,查找文件夹下的".java"文件进行分析。主要原理是匹配抽象语法树。Grammar analysis is a logical stage of the compilation process. The main task is to combine word sequences into various types of grammatical phrases, such as programs, statements, expressions, and so on, based on lexical analysis. A parser determines whether the program is structurally correct. You can use the code error analysis tool PMD of JAVA code to scan using syntax analysis. PMD can scan folders and find ".java" files under the folder for analysis. The main principle is to match abstract syntax trees.
中间代码是编写者希望可以从语法树生成一个更接近目标代码的中间标识形式,或者使用这样一个中间表示代替语法树,然后再行这个新的中间表示生成目标代码。中间代码作为编译器前端和后端的桥梁,中间代码的作用是可使编译程序的结构在逻辑上更为简单明确,特别是可使目标代码的优化比较容易实现中间代码,即为中间语言程序,中间语言的复杂性介于源程序语言和机器语言之间。可以使用开源分析Java代码错误的分析工具findbugs,findbugs的分析对象是java中间代码——字节码,因此在使用命令行调用工具的过程中,需要传入编译好的class文件或者jar包。Intermediate code is where the writer hopes to generate an intermediate identification form closer to the target code from the syntax tree, or use such an intermediate representation instead of the syntax tree, and then execute this new intermediate representation to generate the target code. The intermediate code serves as a bridge between the front-end and the back-end of the compiler. The function of the intermediate code is to make the structure of the compiler more logical and simple. In particular, it makes the optimization of the target code easier to implement the intermediate code, that is, the intermediate language program. The complexity of the intermediate language lies between the source language and the machine language. You can use the open source analysis tool findbugs to analyze Java code errors. The analysis object of findbugs is java intermediate code-bytecode. Therefore, in the process of using the command line to call the tool, you need to pass in the compiled class file or jar package.
通过静态扫描,测试人员只需接收静态扫描的扫描报告,即可得出代码层面的风险及出现的问题,将测试工作前置,可以缩短测试周期,使得代码风险降至最低。Through static scanning, the tester only needs to receive the scanning report of the static scanning to obtain the code-level risks and problems. Pre-testing can shorten the test cycle and minimize the code risk.
本申请实施例中的步骤103,可以在步骤102执行的过程中同时执行,提高整个接口测试的速度,获得相应的测试报告和扫描报告,将结果展示给用户。Step 103 in the embodiment of the present application may be performed simultaneously during the execution of step 102 to increase the speed of the entire interface test, obtain corresponding test reports and scan reports, and display the results to the user.
本申请实施例通过确定待测试的目标接口后,获取目标测试用例,使用上述目标测试用例测试目标接口,获得目标接口的测试报告,对所述目标接口定义代码进行静态扫描,获得扫描报告,可以实现对接口的自动化测试,减少测试人员的工作量,提高测试效率,同时可以监控接口详细至代码层面的潜在风险。In the embodiment of the present application, after the target interface to be tested is determined, a target test case is obtained, the target interface is tested using the target test case, a test report of the target interface is obtained, and a static scan is performed on the target interface definition code to obtain a scan report. Realize automated testing of interfaces, reduce the workload of testers, improve testing efficiency, and monitor the potential risks of interface details down to the code level.
参见图2,是本申请实施例提供的另一种接口测试方法的示意流程图,图2所示的实施例可以是在图1所示的实施例的基础上得到的,如图2所示该方法可包括:Referring to FIG. 2, which is a schematic flowchart of another interface test method provided by an embodiment of the present application. The embodiment shown in FIG. 2 may be obtained based on the embodiment shown in FIG. 1, as shown in FIG. 2. The method may include:
201、确定待测试的目标接口。201. Determine a target interface to be tested.
上述步骤201可以参考图1所示的实施例步骤101中的具体描述,此处不再赘述。For the foregoing step 201, reference may be made to the detailed description in step 101 of the embodiment shown in FIG. 1, and details are not described herein again.
202、获取上述目标接口的测试执行时刻,获取目标测试用例。202. Obtain a test execution time of the target interface, and obtain a target test case.
具体的,测试人员可以设置接口的测试执行时刻(比如2小时后、当日14点或者立刻执行),在获取到上述目标接口的测试执行时刻后,则可以执行步骤203;可选的,测试人员还可以设置目标接口的测试周期(比如1小时),在获取到上述目标接口的测试执行时刻和测试周期后,可以从上述测试执行时刻起,每隔上述测试周期使用目标测试用例测试该目标接口,将测试结果记录在测试报告中。可选的,测试人员还可以设置接口测试的测试循环次数(比如3次),在获取到上述测试循环次数之后,可以遵循设置的测试循环次数执行测试。即可以根据用户所选的执行方式运行目标测试用例,提高了测试的灵活性和测试效率。Specifically, the tester can set the test execution time of the interface (for example, after 2 hours, 14:00 on the day, or immediately), and after obtaining the test execution time of the target interface, step 203 can be performed; optionally, the tester You can also set the target interface's test cycle (such as 1 hour). After obtaining the test execution time and test cycle of the target interface, you can use the target test case to test the target interface every time from the test execution time. Record the test results in a test report. Optionally, the tester can also set the number of test cycles for the interface test (for example, 3 times). After obtaining the above number of test cycles, the test can be performed according to the set number of test cycles. That is, the target test case can be run according to the execution mode selected by the user, which improves the test flexibility and test efficiency.
203、在上述测试执行时刻执行上述目标测试用例以测试上述目标接口。203. Execute the target test case at the test execution time to test the target interface.
204、获得上述目标接口的测试报告。204. Obtain a test report of the target interface.
其中,上述使用上述目标测试用例测试上述目标接口,获得上述目标接口的测试报告的步骤,可以分别参考图1所示的实施例步骤102和步骤103中的具体描述,此处不再赘述。For the above steps of using the target test case to test the target interface and obtaining a test report of the target interface, reference may be made to specific descriptions in steps 102 and 103 of the embodiment shown in FIG. 1, and details are not described herein again.
205、对上述目标接口定义代码进行静态扫描,获得扫描报告。205: Perform a static scan on the target interface definition code to obtain a scan report.
上述步骤204可以参考图1所示的实施例步骤104中的具体描述,此处不再赘述。For the foregoing step 204, reference may be made to the detailed description in step 104 of the embodiment shown in FIG. 1, and details are not described herein again.
206、对上述目标接口和上述目标测试用例执行代码覆盖率测试,获得代码覆盖率。206. Perform a code coverage test on the target interface and the target test case to obtain code coverage.
在静态扫描的同时或者之后,还可以检测上述目标测试用例和目标接口的覆盖率,可以体现在测试案例执行完后,还有哪些代码没有被覆盖。At the same time or after the static scan, the coverage of the target test cases and target interfaces can also be detected, which can be reflected in what code is not covered after the test case is executed.
代码覆盖率可以通过探针根据一定的注入策略注入到字节码文件中,通过动态插桩,在jvm虚拟机中生成覆盖率数据,保存在内存中,并通过某个端口将覆盖率数据dump到本地形成报告。Code coverage can be injected into the bytecode file through a probe according to a certain injection strategy. Through dynamic instrumentation, coverage data is generated in the JVM virtual machine, stored in memory, and the coverage data is dumped through a port. Form a report locally.
可选的,还可以检测目标接口定义代码规范。代码规范问题可以使用checkstyle的各种规则对代码进行样式扫描,从而得出代码规范报告。Optionally, the target interface definition code specification can also be detected. Code specification problems can use various rules of checkstyle to scan the code to get code specification reports.
通过对上述代码覆盖率和代码规范的检测,可以详细地了解代码层的问题,以便增加或更改测试案例来完善测试任务,进一步保障了接口测试质量。上述指标依然可以体现在上述扫描报告中。Through the detection of the above code coverage and code specifications, you can understand the problems at the code layer in detail, so as to add or change test cases to improve the test task, and further ensure the quality of the interface test. The above indicators can still be reflected in the above scan report.
207、获取用于接收上述测试报告的第一邮件地址和用于接收上述扫描报告的第二邮件地址。207. Obtain a first email address for receiving the test report and a second email address for receiving the scan report.
用户可以提前设置用于接收上述测试报告的第一邮件地址,以便在生成上述测试报告之后可以发送到上述第一邮件地址,用户可以提前设置用于接收上述扫描报告的第二邮件地址,以便在生成上述测试报告之后可以发送到上述第二邮件地址。在获得上述测试报告和上述扫描报告之后,可以执行步骤206。其中,上述第一邮件地址和第二邮件地址可以相同或不同,即上述测试报告和扫描报告可以分开向不同的负责人发送,也可以整合到一起统一发送。The user can set a first email address for receiving the test report in advance, so that it can be sent to the first email address after generating the test report, and the user can set a second email address for receiving the scan report in advance, so that After the test report is generated, it can be sent to the second email address. After the test report and the scan report are obtained, step 206 may be performed. The first email address and the second email address may be the same or different, that is, the test report and the scan report may be sent to different persons in charge, or they may be integrated and sent together.
208、向上述第一邮件地址发送包含上述测试报告内容的第一邮件,向上述第二邮件地址发送包含上述扫描报告内容的第二邮件。208. Send a first email including the test report content to the first email address, and send a second email including the scan report content to the second email address.
可选的,上述邮件可以在预设时间发送,即可以设置邮件发送时间,定时向用户发送上述包含测试报告的邮件和包含扫描报告的邮件,用户可以在上述预设时间接收并查看接口测试情况。Optionally, the above email can be sent at a preset time, that is, the email sending time can be set, and the above email including the test report and the email including the scan report can be sent to the user regularly. The user can receive and view the interface test status at the preset time. .
本申请实施例通过获取上述目标接口的测试执行时刻,获取目标测试用例,在上述测试执行时刻执行上述目标测试用例以测试上述目标接口,获得上述目标接口的测试报告,以及对上述目标接口定义代码进行静态扫描,获得扫描报告,对上述目标接口和上述目标测试用例执行代码覆盖率测试,获得代码覆盖率,获取用于接收上述测试报告的第一邮件地址和用于接收上述扫描报告的第 二邮件地址,向上述第一邮件地址发送包含上述测试报告内容的第一邮件,向上述第二邮件地址发送包含上述扫描报告内容的第二邮件,可以实现对接口的自动化测试,便于测试人员定期接收邮件查看测试报告,减少了测试人员的工作量,提高测试效率,同时可以监控接口详细至代码层面的潜在风险。In the embodiment of the present application, the target execution time of the target interface is obtained, the target test case is obtained, the target test case is executed at the test execution time to test the target interface, the test report of the target interface is obtained, and the code of the target interface is defined. Perform a static scan to obtain a scan report, perform a code coverage test on the target interface and the target test case, obtain a code coverage, obtain a first email address for receiving the test report, and a second email address for receiving the scan report. An email address, sending a first email containing the test report content to the first email address, and sending a second email containing the scan report content to the second email address, which can implement automated testing of the interface and facilitate regular reception by testers Viewing the test report by email reduces the workload of the tester and improves the testing efficiency. At the same time, the potential risks of the interface detail to the code level can be monitored.
请参见图3,图3是本申请实施例提供的一种电子设备的结构示意图,该电子设备300包括确定模块310、测试模块320、测试报告生成模块330和扫描模块340,其中:Please refer to FIG. 3. FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 300 includes a determining module 310, a testing module 320, a test report generating module 330, and a scanning module 340, where:
所述确定模块310,用于确定待测试的目标接口;The determining module 310 is configured to determine a target interface to be tested;
所述测试模块320,用于获取目标测试用例,执行所述目标测试用例以测试所述目标接口;The test module 320 is configured to obtain a target test case and execute the target test case to test the target interface;
所述测试报告生成模块330,用于获得所述目标接口的测试报告;The test report generating module 330 is configured to obtain a test report of the target interface;
所述扫描模块340,用于对所述目标接口定义代码进行静态扫描,获得扫描报告。The scanning module 340 is configured to perform static scanning on the target interface definition code to obtain a scanning report.
作为一种可能的实施方式,上述电子设备300还包括配置模块350,用于获取所述目标接口的测试配置参数;As a possible implementation manner, the above-mentioned electronic device 300 further includes a configuration module 350 for acquiring a test configuration parameter of the target interface;
所述测试模块320,具体用于根据所述测试配置参数,执行所述目标测试用例以测试所述目标接口。The test module 320 is specifically configured to execute the target test case to test the target interface according to the test configuration parameters.
作为一种可能的实施方式,所述电子设备300还包括:As a possible implementation manner, the electronic device 300 further includes:
覆盖率测试模块360,用于在使用所述目标测试用例测试所述目标接口时,对所述目标接口和所述目标测试用例执行代码覆盖率测试,获得代码覆盖率。A coverage test module 360 is configured to perform a code coverage test on the target interface and the target test case to obtain a code coverage rate when the target interface is tested using the target test case.
作为一种可能的实施方式,上述配置模块350,还用于获取所述目标接口的测试执行时刻;As a possible implementation manner, the configuration module 350 is further configured to obtain a test execution time of the target interface;
所述测试模块320,具体用于在所述测试执行时刻执行所述目标测试用例以测试所述目标接口。The test module 320 is specifically configured to execute the target test case at the test execution time to test the target interface.
作为一种可能的实施方式,上述配置模块350,还用于获取所述目标接口的测试周期;As a possible implementation manner, the configuration module 350 is further configured to obtain a test period of the target interface;
所述测试模块320,具体用于从所述测试执行时刻起,每隔所述测试周期执行所述目标测试用例以测试所述目标接口。The test module 320 is specifically configured to execute the target test case every test period to test the target interface from the test execution time.
作为一种可能的实施方式,上述电子设备300还包括:As a possible implementation manner, the foregoing electronic device 300 further includes:
邮件发送模块370,用于获取用于接收所述测试报告的第一邮件地址和用于 接收所述扫描报告的第二邮件地址,以及用于向所述第一邮件地址发送包含所述测试报告内容的第一邮件,向所述第二邮件地址发送包含所述扫描报告内容的第二邮件。The mail sending module 370 is configured to obtain a first mail address used to receive the test report and a second mail address used to receive the scan report, and to send the test report to the first mail address including the test report. A first mail of the content, and a second mail including the content of the scan report is sent to the second mail address.
作为一种可能的实施方式,上述确定模块310,具体用于在检测到用户针对接口的测试指令时,确定所述测试指令针对的接口为待测试的目标接口;或者,As a possible implementation manner, the foregoing determining module 310 is specifically configured to determine that an interface targeted by the test instruction is a target interface to be tested when a test instruction of the user against the interface is detected; or,
在检测到参数发生变化的接口的参数变化符合测试条件时,确定所述参数发生变化的接口为待测试的目标接口。When the parameter change of the interface where the parameter change is detected meets the test conditions, it is determined that the interface where the parameter change is the target interface to be tested.
根据本申请实施例的具体实施方式,图1与图2所示的接口测试方法涉及的步骤101~104、201~207可以是由图3所示的电子设备300中的各个模块来执行的。例如,图1中的步骤101~104可以分别由图3中所示的确定模块310、测试模块320和、测试报告生成模块330和扫描模块340来执行。According to the specific implementation of the embodiment of the present application, steps 101 to 104 and 201 to 207 related to the interface test method shown in FIG. 1 and FIG. 2 may be performed by each module in the electronic device 300 shown in FIG. 3. For example, steps 101 to 104 in FIG. 1 may be performed by the determination module 310, the test module 320, the test report generation module 330, and the scan module 340 shown in FIG. 3, respectively.
通过本申请实施例的电子设备300,电子设备300可以确定待测试的目标接口,获取目标测试用例,执行上述目标测试用例以测试上述目标接口,获得上述目标接口的测试报告,以及对上述目标接口定义代码进行静态扫描,获得扫描报告,可以实现对接口的自动化测试,减少测试人员的工作量,提高测试效率,同时可以监控接口详细至代码层面的潜在风险。Through the electronic device 300 in the embodiment of the present application, the electronic device 300 can determine a target interface to be tested, obtain a target test case, execute the target test case to test the target interface, obtain a test report of the target interface, and perform a test on the target interface. Defining code for static scanning and obtaining scanning reports can realize automatic testing of the interface, reduce the workload of testers, improve testing efficiency, and monitor the potential risks of the interface down to the code level.
请参阅图4,图4是本申请实施例公开的另一种电子设备的结构示意图。如图4所示,该电子设备400包括处理器401和存储器402,其中,电子设备400还可以包括总线403,处理器401和存储器402可以通过总线403相互连接,总线403可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。总线403可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。其中,电子设备400还可以包括输入输出设备404,输入输出设备404可以包括显示屏,例如液晶显示屏。存储器402用于存储包含指令的一个或多个程序;处理器401用于调用存储在存储器402中的指令执行上述图1和图2实施例中提到的部分或全部方法步骤。Please refer to FIG. 4, which is a schematic structural diagram of another electronic device disclosed in an embodiment of the present application. As shown in FIG. 4, the electronic device 400 includes a processor 401 and a memory 402. The electronic device 400 may further include a bus 403. The processor 401 and the memory 402 may be connected to each other through the bus 403. The bus 403 may be a peripheral component and each other. Connects to a standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industrial Architecture (EISA) bus). The bus 403 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only a thick line is used in FIG. 4, but it does not mean that there is only one bus or one type of bus. The electronic device 400 may further include an input-output device 404, and the input-output device 404 may include a display screen, such as a liquid crystal display screen. The memory 402 is configured to store one or more programs containing instructions; the processor 401 is configured to call the instructions stored in the memory 402 to execute some or all of the method steps mentioned in the embodiments of FIG. 1 and FIG. 2.
应当理解,在本申请实施例中,所称处理器401可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific  Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable GateArray,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 401 may be a central processing unit (CPU), and the processor may also be another general-purpose processor or a digital signal processor (DSP). , Application specific integrated circuit (ASIC), ready-made programmable gate array (Field-Programmable GateArray, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
输入设备402可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出设备403可以包括显示器(LCD等)、扬声器等。The input device 402 may include a touch panel, a fingerprint sensor (for collecting fingerprint information and orientation information of a user), a microphone, and the like, and the output device 403 may include a display (LCD, etc.), a speaker, and the like.
该存储器404可以包括只读存储器和随机存取存储器,并向处理器401提供指令和数据。存储器404的一部分还可以包括非易失性随机存取存储器。例如,存储器404还可以存储设备类型的信息。The memory 404 may include a read-only memory and a random access memory, and provide instructions and data to the processor 401. A portion of the memory 404 may also include non-volatile random access memory. For example, the memory 404 may also store device type information.
通过本申请实施例的电子设备400,电子设备400可以确定待测试的目标接口,获取目标测试用例,执行上述目标测试用例以测试上述目标接口,获得上述目标接口的测试报告,以及对上述目标接口定义代码进行静态扫描,获得扫描报告,可以实现对接口的自动化测试,减少测试人员的工作量,提高测试效率,同时可以监控接口详细至代码层面的潜在风险。Through the electronic device 400 in the embodiment of the present application, the electronic device 400 can determine a target interface to be tested, obtain a target test case, execute the target test case to test the target interface, obtain a test report of the target interface, and perform a test on the target interface. Defining code for static scanning and obtaining scanning reports can realize automatic testing of the interface, reduce the workload of testers, improve testing efficiency, and monitor the potential risks of the interface down to the code level.
本申请实施例还提供一种计算机可读存储介质,其中,该计算机可读存储介质存储用于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任何一种接口测试方法的部分或全部步骤。An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute any one of the interfaces described in the foregoing method embodiments. Some or all steps of the test method.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For a part that is not described in detail in one embodiment, reference may be made to related descriptions in other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or may be combined. Integration into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, and may be electrical or other forms.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objective of the solution of this embodiment.
所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on such an understanding, the technical solution of the present application essentially or part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory, Several instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application. The foregoing memory includes: a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk, and other media that can store program codes.

Claims (20)

  1. 一种接口测试方法,其特征在于,所述方法包括:An interface testing method, characterized in that the method includes:
    确定待测试的目标接口;Determine the target interface to be tested;
    获取目标测试用例,执行所述目标测试用例以测试所述目标接口;Acquiring a target test case, and executing the target test case to test the target interface;
    获得所述目标接口的测试报告;Obtaining a test report of the target interface;
    对所述目标接口定义代码进行静态扫描,获得扫描报告。Perform a static scan on the target interface definition code to obtain a scan report.
  2. 根据权利要求1所述的方法,其特征在于,所述对所述目标接口定义代码进行静态扫描包括对所述目标接口定义代码进行词法分析、语法分析和/或中间代码分析。The method according to claim 1, wherein the static scanning of the target interface definition code comprises lexical analysis, syntax analysis, and / or intermediate code analysis of the target interface definition code.
  3. 根据权利要求2所述的方法,其特征在于,所述执行所述目标测试用例以测试所述目标接口之前,所述方法还包括:The method according to claim 2, wherein before the executing the target test case to test the target interface, the method further comprises:
    获取所述目标接口的测试配置参数;Obtaining test configuration parameters of the target interface;
    所述执行所述目标测试用例以测试所述目标接口,包括:The executing the target test case to test the target interface includes:
    根据所述测试配置参数,执行所述目标测试用例以测试所述目标接口。And execute the target test case to test the target interface according to the test configuration parameters.
  4. 根据权利要求3所述的方法,其特征在于,所述扫描报告的内容包括代码覆盖率,所述方法还包括:The method according to claim 3, wherein the content of the scan report includes code coverage, and the method further comprises:
    对所述目标接口和所述目标测试用例执行代码覆盖率测试,获得所述代码覆盖率。Perform a code coverage test on the target interface and the target test case to obtain the code coverage.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, further comprising:
    获取所述目标接口的测试执行时刻;Obtaining a test execution time of the target interface;
    所述执行所述目标测试用例以测试所述目标接口,包括:在所述测试执行时刻执行所述目标测试用例以测试所述目标接口。The executing the target test case to test the target interface includes executing the target test case at the test execution time to test the target interface.
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:The method according to claim 5, further comprising:
    获取所述目标接口的测试周期;Obtaining a test period of the target interface;
    所述在所述测试执行时刻执行所述目标测试用例以测试所述目标接口,包括:The executing the target test case to test the target interface at the test execution time includes:
    从所述测试执行时刻起,每隔所述测试周期执行所述目标测试用例以测试所述目标接口。From the test execution time, the target test case is executed every test cycle to test the target interface.
  7. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, further comprising:
    获取所述目标接口的测试循环次数;Obtaining the number of test cycles of the target interface;
    所述执行所述目标测试用例以测试所述目标接口,包括:遵循所述测试循环次数执行所述目标测试用例以测试所述目标接口。The executing the target test case to test the target interface includes executing the target test case in accordance with the number of test cycles to test the target interface.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method according to claim 7, further comprising:
    获取用于接收所述测试报告的第一邮件地址和用于接收所述扫描报告的第二邮件地址;Obtaining a first email address for receiving the test report and a second email address for receiving the scan report;
    向所述第一邮件地址发送包含所述测试报告内容的第一邮件,向所述第二邮件地址发送包含所述扫描报告内容的第二邮件。Send a first mail containing the test report content to the first mail address, and send a second mail containing the scan report content to the second mail address.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,对所述目标接口定义代码进行所述确定待测试的目标接口包括:The method according to any one of claims 1-8, wherein performing the determining the target interface to be tested on the target interface definition code comprises:
    在检测到测试指令时,确定所述测试指令针对的接口为待测试的目标接口;或者,When a test instruction is detected, determining that the interface targeted by the test instruction is a target interface to be tested; or
    在检测到参数发生变化的接口的参数变化符合测试条件时,确定所述参数发生变化的接口为待测试的目标接口。When the parameter change of the interface where the parameter change is detected meets the test conditions, it is determined that the interface where the parameter change is the target interface to be tested.
  10. 一种电子设备,其特征在于,包括:确定模块、测试模块、测试报告生成模块和扫描模块,其中:An electronic device, comprising: a determining module, a testing module, a test report generating module, and a scanning module, wherein:
    所述确定模块,用于确定待测试的目标接口;The determining module is configured to determine a target interface to be tested;
    所述测试模块,用于获取目标测试用例,执行所述目标测试用例以测试所述目标接口;The test module is configured to obtain a target test case and execute the target test case to test the target interface;
    所述测试报告生成模块,用于获得所述目标接口的测试报告;The test report generating module is configured to obtain a test report of the target interface;
    所述扫描模块,用于对所述目标接口定义代码进行静态扫描,获得扫描报告。The scanning module is configured to perform static scanning on the target interface definition code to obtain a scanning report.
  11. 根据权利要求10所述的电子设备,其特征在于,所述扫描模块具体用于,对所述目标接口定义代码进行词法分析、语法分析和/或中间代码分析。The electronic device according to claim 10, wherein the scanning module is specifically configured to perform lexical analysis, syntax analysis, and / or intermediate code analysis on the target interface definition code.
  12. 根据权利要求11所述的电子设备,其特征在于,还包括配置模块,用于获取所述目标接口的测试配置参数;The electronic device according to claim 11, further comprising a configuration module for acquiring a test configuration parameter of the target interface;
    所述测试模块,具体用于根据所述测试配置参数,执行所述目标测试用例以测试所述目标接口。The test module is specifically configured to execute the target test case to test the target interface according to the test configuration parameters.
  13. 根据权利要求12所述的电子设备,其特征在于,还包括覆盖率测试模 块,用于对所述目标接口和所述目标测试用例执行代码覆盖率测试,获得代码覆盖率。The electronic device according to claim 12, further comprising a coverage test module for performing a code coverage test on the target interface and the target test case to obtain a code coverage.
  14. 根据权利要求13所述的电子设备,其特征在于,所述配置模块还用于获取所述目标接口的测试执行时刻;The electronic device according to claim 13, wherein the configuration module is further configured to obtain a test execution time of the target interface;
    所述测试模块,具体用于在所述测试执行时刻执行所述目标测试用例以测试所述目标接口。The test module is specifically configured to execute the target test case at the test execution time to test the target interface.
  15. 根据权利要求14所述的电子设备,其特征在于,所述配置模块还用于获取所述目标接口的测试周期;The electronic device according to claim 14, wherein the configuration module is further configured to obtain a test cycle of the target interface;
    所述测试模块,具体用于从所述测试执行时刻起,每隔所述测试周期执行所述目标测试用例以测试所述目标接口。The test module is specifically configured to execute the target test case every test period to test the target interface from the test execution time.
  16. 根据权利要求13所述的电子设备,其特征在于,所述配置模块还用于获取所述目标接口的测试循环次数;The electronic device according to claim 13, wherein the configuration module is further configured to obtain the number of test cycles of the target interface;
    所述测试模块,具体用于遵循所述测试循环次数执行所述目标测试用例以测试所述目标接口。The test module is specifically configured to execute the target test case according to the number of test cycles to test the target interface.
  17. 根据权利要求16所述的电子设备,其特征在于,还包括邮件发送模块,用于:The electronic device according to claim 16, further comprising a mail sending module, configured to:
    获取用于接收所述测试报告的第一邮件地址和用于接收所述扫描报告的第二邮件地址;Obtaining a first email address for receiving the test report and a second email address for receiving the scan report;
    向所述第一邮件地址发送包含所述测试报告内容的第一邮件,向所述第二邮件地址发送包含所述扫描报告内容的第二邮件。Send a first mail containing the test report content to the first mail address, and send a second mail containing the scan report content to the second mail address.
  18. 根据权利要求10-17任一项所述的电子设备,其特征在于,所述确定模块具体用于:The electronic device according to any one of claims 10 to 17, wherein the determining module is specifically configured to:
    在检测到测试指令时,确定所述测试指令针对的接口为待测试的目标接口;或者,When a test instruction is detected, determining that the interface targeted by the test instruction is a target interface to be tested; or
    在检测到参数发生变化的接口的参数变化符合测试条件时,确定所述参数发生变化的接口为待测试的目标接口。When the parameter change of the interface where the parameter change is detected meets the test conditions, it is determined that the interface where the parameter change is the target interface to be tested.
  19. 一种电子设备,其特征在于,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行如权利要求1-9任一项所述的方法。An electronic device is characterized by comprising a processor, an input device, an output device, and a memory, and the processor, the input device, the output device, and the memory are mutually connected, wherein the memory is used to store a computer program, and the computer The program includes program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1-9.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行如权利要求1-9任一项所述的方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes A method according to any one of 1-9 is required.
PCT/CN2018/107912 2018-07-27 2018-09-27 Interface testing method, electronic device and storage medium WO2020019490A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810841915.3A CN109117368A (en) 2018-07-27 2018-07-27 A kind of interface test method, electronic equipment and storage medium
CN201810841915.3 2018-07-27

Publications (1)

Publication Number Publication Date
WO2020019490A1 true WO2020019490A1 (en) 2020-01-30

Family

ID=64863448

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/107912 WO2020019490A1 (en) 2018-07-27 2018-09-27 Interface testing method, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN109117368A (en)
WO (1) WO2020019490A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124864A (en) * 2019-12-24 2020-05-08 深圳我家云网络科技有限公司 Automatic interface testing method and related equipment
CN111884882A (en) * 2020-07-29 2020-11-03 北京千丁互联科技有限公司 Monitoring coverage rate detection method and device
CN112131113A (en) * 2020-09-23 2020-12-25 北京达佳互联信息技术有限公司 Method for automatically testing special effect and electronic equipment
CN112131131A (en) * 2020-10-10 2020-12-25 四川长虹电器股份有限公司 Automatic interface testing framework system for pre-constructed domain name and request body
CN112199300B (en) * 2020-11-13 2022-08-19 新华三大数据技术有限公司 Interface testing method and device, electronic equipment and storage medium
CN112597001B (en) * 2020-12-07 2023-03-28 长沙市到家悠享网络科技有限公司 Interface test method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106951364A (en) * 2017-02-08 2017-07-14 深圳国泰安教育技术股份有限公司 Method of testing and device
CN107480066A (en) * 2017-08-18 2017-12-15 网易(杭州)网络有限公司 Code coverage statistical method, device, storage medium, processor and terminal
US20180095867A1 (en) * 2016-10-04 2018-04-05 Sap Se Software testing with minimized test suite
CN107977312A (en) * 2017-11-21 2018-05-01 北京临近空间飞行器系统工程研究所 A kind of software system test verification method based on complex interface sequential
CN107992306A (en) * 2017-12-03 2018-05-04 中国直升机设计研究所 A kind of avionics software interface realizes uniformity automatic check method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8893087B2 (en) * 2011-08-08 2014-11-18 Ca, Inc. Automating functionality test cases
CN107807877B (en) * 2016-09-08 2021-12-07 北京京东尚科信息技术有限公司 Code performance testing method and device
CN106844209A (en) * 2017-01-18 2017-06-13 广州唯品会信息科技有限公司 Code coverage method of testing and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180095867A1 (en) * 2016-10-04 2018-04-05 Sap Se Software testing with minimized test suite
CN106951364A (en) * 2017-02-08 2017-07-14 深圳国泰安教育技术股份有限公司 Method of testing and device
CN107480066A (en) * 2017-08-18 2017-12-15 网易(杭州)网络有限公司 Code coverage statistical method, device, storage medium, processor and terminal
CN107977312A (en) * 2017-11-21 2018-05-01 北京临近空间飞行器系统工程研究所 A kind of software system test verification method based on complex interface sequential
CN107992306A (en) * 2017-12-03 2018-05-04 中国直升机设计研究所 A kind of avionics software interface realizes uniformity automatic check method

Also Published As

Publication number Publication date
CN109117368A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
WO2020019490A1 (en) Interface testing method, electronic device and storage medium
CN106649084B (en) The acquisition methods and device of function call information, test equipment
US10761963B2 (en) Object monitoring in code debugging
WO2021017735A1 (en) Smart contract formal verification method, electronic apparatus and storage medium
US8752023B2 (en) System, method and program product for executing a debugger
CN108664380B (en) After-execution software debugging system with performance display and debugging method
US11568044B2 (en) Method and apparatus for vetting universal serial bus device firmware
CN104572463A (en) Method and device for testing interface information
CN104050080A (en) Method and system for debugging linux kernel in user mode
US20160077831A1 (en) Accurate and performant code design using memoization
Chang et al. An android behavior-based malware detection method using machine learning
US20150143342A1 (en) Functional validation of software
CN112395843A (en) PHP code-based service processing method, device, equipment and medium
CN107102950A (en) A kind of applied program testing method and device
US11580228B2 (en) Coverage of web application analysis
CN113032273A (en) Application program debugging method and device, computer equipment and storage medium
CN110727476B (en) Method, device, equipment and storage medium for generating authorization configuration file
US20080010536A1 (en) Breakpoints with Separate Conditions
US9723489B1 (en) Automated vulnerability discovery in mobile device applications
US10496524B2 (en) Separating test coverage in software processes using shared memory
US11675584B1 (en) Visualizing dependent relationships in computer program analysis trace elements
CN111385661A (en) Method and terminal for controlling full-screen playing through voice
US7318221B2 (en) Windows™ F-language interpreter
US11989291B2 (en) System, method, and apparatus for software verification
CN112306292B (en) Unified compatible method and device for multiple touch interfaces, storage medium and all-in-one machine

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18927392

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18927392

Country of ref document: EP

Kind code of ref document: A1