CN114579470A - A unit testing method, device, electronic device and storage medium - Google Patents
A unit testing method, device, electronic device and storage medium Download PDFInfo
- Publication number
- CN114579470A CN114579470A CN202210302354.6A CN202210302354A CN114579470A CN 114579470 A CN114579470 A CN 114579470A CN 202210302354 A CN202210302354 A CN 202210302354A CN 114579470 A CN114579470 A CN 114579470A
- Authority
- CN
- China
- Prior art keywords
- unit
- tested
- test
- data
- mock object
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
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/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
Description
技术领域technical field
本发明涉及应用测试技术领域,尤其涉及一种单元测试方法、装置、电子设备及存储介质。The present invention relates to the technical field of application testing, and in particular, to a unit testing method, device, electronic device and storage medium.
背景技术Background technique
当一个应用程序需要进行功能调整时,往往需要重构内部的执行代码。重构代码需要大量的单元测试用例。单元测试,是指对软件中的最小可测试单元进行检查和验证。对于单元测试中单元的含义,一般来说,要根据实际情况去判定其具体含义,如C语言中单元指一个函数,Java里单元指一个类,图形化的软件中可以指一个窗口或一个菜单等。总的来说,单元就是人为规定的最小的被测功能模块。单元测试是在软件开发过程中要进行的最低级别的测试活动,软件的独立单元将在与程序的其他部分相隔离的情况下进行测试。When an application needs to perform functional adjustments, it is often necessary to refactor the internal execution code. Refactoring code requires a lot of unit test cases. Unit testing refers to the inspection and verification of the smallest testable unit of software. For the meaning of a unit in unit testing, generally speaking, it is necessary to determine its specific meaning according to the actual situation. For example, a unit in C language refers to a function, in Java, a unit refers to a class, and graphical software can refer to a window or a menu. Wait. In general, a unit is the smallest human-defined functional module under test. Unit testing is the lowest level of testing activity to be performed during software development, where individual units of software are tested in isolation from the rest of the program.
在现有的单元测试的一般方案,有如下缺点:In the existing general scheme of unit testing, there are the following disadvantages:
1、由于单元测试彼此之间的“独立”特性,会导致一个复杂的测试方法可能需要很多单元测试才能去覆盖一个完成的业务场景,例如,小程序内部架构实现的任何改动(例如版本升级、添加新功能)也都需要独立地设置一个单元测试,从而对开发带来较大的工作量;1. Due to the "independent" nature of unit tests, a complex test method may require many unit tests to cover a completed business scenario, for example, any changes to the internal architecture of the applet (such as version upgrades, Adding new functions) also needs to set up a unit test independently, which brings a larger workload to the development;
2、在单元测试过程中需要很多依赖项,如数据库,因此需要去定义大量的原生jdbc接口来进行数据查询等,从而造成了开发人员的额外开销;2. Many dependencies are required in the unit testing process, such as databases, so it is necessary to define a large number of native jdbc interfaces for data query, etc., resulting in additional overhead for developers;
3、现有的单元测试中需要经常构造数据来完成单元测试,例如对支付模块的单元测试,需要预先频繁地构造待支付的订单数据作为测试数据,以该测试数据来测试支付模块是否正常,从而导致测试过程的开销过大。3. In the existing unit test, it is necessary to frequently construct data to complete the unit test. For example, for the unit test of the payment module, it is necessary to frequently construct the order data to be paid as the test data in advance, and use the test data to test whether the payment module is normal. As a result, the overhead of the testing process is too large.
发明内容SUMMARY OF THE INVENTION
本发明提供了一种单元测试方法、装置、电子设备及存储介质,用于解决现有的单元测试方法开销过大的技术问题。The present invention provides a unit testing method, device, electronic device and storage medium, which are used to solve the technical problem of excessive overhead of the existing unit testing method.
本发明提供了一种单元测试方法,包括:The present invention provides a unit testing method, comprising:
在预设业务中确定待测试单元和所述待测试单元的依赖单元;Determine the unit to be tested and the dependent unit of the unit to be tested in the preset service;
获取所述待测试单元的测试数据;Obtain the test data of the unit to be tested;
创建所述依赖单元的mock对象,以模拟执行所述依赖单元;Create a mock object of the dependency unit to simulate the execution of the dependency unit;
采用所述测试数据和所述mock对象测试所述待测试单元,得到测试结果。The unit to be tested is tested by using the test data and the mock object, and a test result is obtained.
可选地,所述获取所述待测试单元的测试数据的步骤,包括:Optionally, the step of obtaining the test data of the unit to be tested includes:
获取所述预设业务的业务数据;obtaining service data of the preset service;
获取所述待测试单元的配置文件;Obtain the configuration file of the unit to be tested;
根据所述业务数据和所述配置文件,生成所述待测试单元的测试数据。According to the service data and the configuration file, test data of the unit to be tested is generated.
可选地,所述根据所述业务数据和所述配置文件,生成所述待测试单元的测试数据的步骤,包括:Optionally, the step of generating the test data of the unit to be tested according to the business data and the configuration file includes:
从所述配置文件中提取存储数据结构;extract the storage data structure from the configuration file;
在所述存储数据结构中填充所述业务数据,并通过所填充的业务数据生成所述待测试单元的测试数据。The business data is filled in the storage data structure, and the test data of the unit to be tested is generated by the filled business data.
可选地,所述创建所述依赖单元的mock对象,以模拟执行所述依赖单元的步骤,包括:Optionally, the creating a mock object of the dependency unit to simulate the steps of executing the dependency unit includes:
确定所述依赖单元的API接口,并获取所述API接口的数据结构;Determine the API interface of the dependent unit, and obtain the data structure of the API interface;
基于所述API接口的数据结构,生成所述依赖单元的mock对象,以模拟执行所述依赖单元。Based on the data structure of the API interface, a mock object of the dependency unit is generated to simulate the execution of the dependency unit.
可选地,所述采用所述测试数据和所述mock对象测试所述待测试单元,得到测试结果的步骤,包括:Optionally, the step of using the test data and the mock object to test the unit to be tested to obtain a test result includes:
获取所述mock对象基于所述待测试单元的调用请求所返回的返回数据;Obtain the return data returned by the mock object based on the call request of the unit to be tested;
采用所述测试数据和所述返回数据,基于所述待测试单元的执行流程测试所述待测试单元,得到测试结果。Using the test data and the returned data, the unit to be tested is tested based on the execution flow of the unit to be tested, and a test result is obtained.
可选地,所述采用所述测试数据和所述mock对象测试所述待测试单元,得到测试结果的步骤之后,还包括:Optionally, after the step of using the test data and the mock object to test the unit to be tested and obtaining the test result, the method further includes:
对所述测试结果进行验证,得到所述待测试单元的验证结果。The test result is verified to obtain the verification result of the unit to be tested.
可选地,所述对测试结果进行验证,得到所述待测试单元的验证结果的步骤,包括:Optionally, the step of verifying the test result to obtain the verification result of the unit to be tested includes:
获取所述待测试单元的目标结果;Obtain the target result of the unit to be tested;
采用所述目标结果对所述测试结果进行验证;Use the target result to verify the test result;
当所述目标结果与所述测试结果相同时,判定所述待测试单元通过测试。When the target result is the same as the test result, it is determined that the unit to be tested passes the test.
本发明还提供了一种单元测试装置,包括:The present invention also provides a unit testing device, comprising:
单元确定模块,用于在预设业务中确定待测试单元和所述待测试单元的依赖单元;a unit determination module, used for determining the unit to be tested and the dependent units of the unit to be tested in the preset service;
测试数据获取模块,用于获取所述待测试单元的测试数据;a test data acquisition module for acquiring the test data of the unit to be tested;
mock对象创建模块,用于创建所述依赖单元的mock对象,以模拟执行所述依赖单元;A mock object creation module is used to create a mock object of the dependency unit to simulate the execution of the dependency unit;
测试模块,用于采用所述测试数据和所述mock对象测试所述待测试单元,得到测试结果。A test module is used to test the unit to be tested by using the test data and the mock object to obtain a test result.
可选地,所述测试数据获取模块,包括:Optionally, the test data acquisition module includes:
因为数据获取子模块,用于获取所述预设业务的业务数据;Because the data acquisition sub-module is used to acquire the business data of the preset business;
配置文件获取子模块,用于获取所述待测试单元的配置文件;a configuration file obtaining submodule, used to obtain the configuration file of the unit to be tested;
测试数据生成子模块,用于根据所述业务数据和所述配置文件,生成所述待测试单元的测试数据。A test data generating sub-module is configured to generate test data of the unit to be tested according to the business data and the configuration file.
本发明还提供了一种电子设备,所述设备包括处理器以及存储器:The present invention also provides an electronic device, the device includes a processor and a memory:
所述存储器用于存储程序代码,并将所述程序代码传输给所述处理器;the memory is used to store program code and transmit the program code to the processor;
所述处理器用于根据所述程序代码中的指令执行如上任一项所述的单元测试方法。The processor is configured to execute the unit testing method described in any one of the above according to the instructions in the program code.
本发明还提供了一种计算机可读存储介质,所述计算机可读存储介质用于存储程序代码,所述程序代码用于执行如上任一项所述的单元测试方法。The present invention also provides a computer-readable storage medium, where the computer-readable storage medium is used for storing program codes, and the program codes are used for executing the unit testing method described in any one of the above.
从以上技术方案可以看出,本发明具有以下优点:本发明通过创建待测试单元的依赖单元的mock对象,来模拟依赖单元的执行以获取待测试单元需要的返回数据,并结合测试数据对待测试单元进行测试,从而无需执行依赖单元的执行流程,减少了单元测试的执行过程,简化了测试程序,降低了单元测试的开销。As can be seen from the above technical solutions, the present invention has the following advantages: the present invention simulates the execution of the dependent unit by creating a mock object of the dependent unit of the unit to be tested to obtain the return data required by the unit to be tested, and combines the test data to be tested The unit is tested, so that the execution process of the dependent unit need not be executed, the execution process of the unit test is reduced, the test procedure is simplified, and the overhead of the unit test is reduced.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1为本发明实施例提供的一种单元测试方法的步骤流程图;1 is a flow chart of steps of a unit testing method provided by an embodiment of the present invention;
图2为本发明实施例提供的一种单元依赖关系示意图;2 is a schematic diagram of a unit dependency relationship provided by an embodiment of the present invention;
图3为本发明另一实施例提供的一种单元测试方法的步骤流程图;3 is a flowchart of steps of a unit testing method provided by another embodiment of the present invention;
图4为本发明实施例提供的一种单元测试方法的架构图;4 is an architecture diagram of a unit testing method provided by an embodiment of the present invention;
图5为本发明实施例提供的一种单元测试装置的结构框图。FIG. 5 is a structural block diagram of a unit testing apparatus provided by an embodiment of the present invention.
具体实施方式Detailed ways
本发明实施例提供了一种单元测试方法、装置、电子设备及存储介质,用于解决现有的单元测试方法开销过大的技术问题。Embodiments of the present invention provide a unit testing method, apparatus, electronic device, and storage medium, which are used to solve the technical problem of excessive overhead in the existing unit testing method.
为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本发明一部分实施例,而非全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the purpose, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the following The described embodiments are only some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
请参阅图1,图1为本发明实施例提供的一种单元测试方法的步骤流程图。Please refer to FIG. 1. FIG. 1 is a flowchart of steps of a unit testing method provided by an embodiment of the present invention.
本发明提供的一种单元测试方法,具体可以包括以下步骤:A unit testing method provided by the present invention may specifically include the following steps:
步骤101,在预设业务中确定待测试单元和待测试单元的依赖单元;
在本发明实施例中,预设业务可以任何一种应用程序。如支付小程序等。In this embodiment of the present invention, the preset service may be any application program. Such as payment mini-programs, etc.
依赖单元,是指待测试单元在执行过程中的关联单元。在本发明实施例中,待测试单元的依赖单元可以通过判断待测试单元与其他单元在业务执行过程中是否存在干涉来确定。如在待测试单元的执行过程中需要调用到的单元,便可以确定为待测试单元的依赖单元。例如,在一种业务场景中,在用户购买商品的下单过程中,下单和支付是两个服务,分别对应不同的单元,在下单的过程中,需要调用支付的服务,即下单的操作需要依赖到调用支付的这个服务。若下单服务是待测试单元,则支付服务就是下单服务的依赖单元。Dependent unit refers to the associated unit of the unit to be tested during the execution process. In this embodiment of the present invention, the dependent unit of the unit to be tested may be determined by judging whether there is interference between the unit to be tested and other units during service execution. For example, a unit that needs to be called during the execution of the unit to be tested can be determined as a dependent unit of the unit to be tested. For example, in a business scenario, in the process of placing an order for a user to purchase a product, ordering and payment are two services, which correspond to different units. The operation needs to depend on the service that calls the payment. If the ordering service is the unit to be tested, the payment service is the dependent unit of the ordering service.
为便于理解,请参阅图2,图2为本发明实施例提供的一种单元依赖关系示意图。For easy understanding, please refer to FIG. 2 , which is a schematic diagram of a unit dependency relationship provided by an embodiment of the present invention.
图2为一种支付小程序所涉及的部分单元,包括service、beanA、beanB、dao和outservice,service可以理解为一次购物操作,beanA表示与service关联的下单服务,beanB表示与service关联的支付服务,dao表示库存查询,用于在下单的时候查询订单状态,outservice表示外部支付服务。则会对service进行直接反馈的beanA和beanB,以及与beanA和beanB直接关联的dao和outservice均为service的依赖单元。Figure 2 shows some units involved in a payment applet, including service, beanA, beanB, dao and outservice. Service can be understood as a shopping operation, beanA represents the ordering service associated with the service, and beanB represents the payment associated with the service. Service, dao means inventory query, used to query the order status when placing an order, outservice means external payment service. BeanA and beanB that provide direct feedback to the service, as well as dao and outservice that are directly associated with beanA and beanB are the dependent units of the service.
步骤102,获取待测试单元的测试数据;
在本发明实施例中,要对待测试单元进行测试,首先需要获取测试数据。对于传统的单元测试,通常需要写很多原生的jdbc来连接数据库,而且数据库数据的变更一直是个难题。例如:下单付款过程中,需要写jdbc接口操作订单表,并且付款结束这笔订单就会从待支付转变为支付成功的状态。当需要再次测试下单付款的单元时,需要重新走流程生成待付款状态的订单才能测试付款,过程繁琐,资源占用较高。In this embodiment of the present invention, to test the unit to be tested, it is first necessary to acquire test data. For traditional unit testing, it is usually necessary to write a lot of native jdbc to connect to the database, and the change of database data has always been a problem. For example: in the process of placing an order and paying, it is necessary to write the jdbc interface to operate the order table, and after the payment is completed, the order will change from pending payment to successful payment. When you need to test the unit for placing an order for payment again, you need to go through the process again to generate an order in the pending payment state before you can test the payment. The process is cumbersome and the resource consumption is high.
由于对于下单付款单元而言,执行测试的必要数据是待付款的订单数据,因此,本申请可以通过预先生成配置文件,来直接生成代付款的订单数据,以减少写原生jdbc的过程。For the order payment unit, the necessary data to perform the test is the order data to be paid. Therefore, this application can generate the configuration file in advance to directly generate the payment order data to reduce the process of writing native jdbc.
jdbc(Java Database Connectivity,Java数据库连接)是Java语言中用来规范客户端程序如何访问数据库的应用程序接口,提供了诸如查询和更新数据库中数据的方法。jdbc (Java Database Connectivity, Java Database Connectivity) is an application program interface in the Java language used to standardize how client programs access the database, providing methods such as querying and updating data in the database.
步骤103,创建依赖单元的mock对象,以模拟执行所述依赖单元;
mock就是在测试过程中,对于某些不容易构造或者不容易获取的对象,创建一个虚拟的对象来替代以便测试的测试方法,这个虚拟的对象就是mock对象。Mock最大的功能是把单元测试的耦合分解开,如果你的代码对另一个类或者接口有依赖,它能够帮你模拟这些依赖,并帮你验证所调用的依赖的行为。Mock is a test method that creates a virtual object to replace the test method for testing for some objects that are not easy to construct or obtain during the testing process. This virtual object is the mock object. The biggest function of Mock is to separate the coupling of unit tests. If your code has dependencies on another class or interface, it can help you simulate these dependencies and help you verify the behavior of the called dependencies.
为了便于理解,以下通过具体示例对mock对象的功能进行说明:假设一个闹钟根据时间来进行提醒服务,过了下午5点钟就播放音频文件进行下班提醒。若要利用真实的对象来测试的话只能等到下午五点;而如果利用mock对象来进行测试,则可以对时间进行模拟,无需等待时钟转到下午5点钟。可以理解的是,mock对象可以将实际进行的环节进行模拟,从而直接获取需要的结果。若提醒服务是要测试的单元,则时间跟踪是该测试单元的依赖单元,建立时间跟踪的mock对象,可以减少依赖单元的数据处理过程,从而减少开发人员的测试开销。For ease of understanding, the function of the mock object is described below with a specific example: Suppose an alarm clock performs a reminder service according to the time, and after 5 o'clock in the afternoon, an audio file is played to remind the get off work. If you test with a real object, you can only wait until 5:00 PM; if you use a mock object for testing, you can simulate the time without waiting for the clock to turn to 5:00 PM. It can be understood that the mock object can simulate the actual process, so as to directly obtain the required results. If the reminder service is the unit to be tested, the time tracking is the dependent unit of the testing unit. Creating a mock object for time tracking can reduce the data processing process of the dependent unit, thereby reducing the testing overhead of developers.
步骤104,采用测试数据和mock对象测试待测试单元,得到测试结果。
在获取到测试数据和mock对象后,可以结合测试数据和mock对象对待测试单元进行单元测试。After the test data and the mock object are obtained, the unit to be tested can be unit tested by combining the test data and the mock object.
以用户购买商品的下单过程为例,在下单过程中,可以通过配置文件获取待支付订单来作为测试数据,通过mock来模拟支付单元(下单单元的依赖单元)的返回结果。从而完成对待测试单元的测试。Take the process of placing an order for a user to purchase a product as an example. During the ordering process, the order to be paid can be obtained through the configuration file as test data, and the return result of the payment unit (the dependent unit of the ordering unit) can be simulated by mocking. Thereby completing the test of the unit to be tested.
本发明通过创建待测试单元的依赖单元的mock对象,来模拟依赖单元的执行以获取待测试单元需要的返回数据,并结合测试数据对待测试单元进行测试,从而无需执行依赖单元的执行流程,减少了单元测试的执行过程,简化了测试程序,降低了单元测试的开销。此外,本发明可以通过预先生成配置文件,来直接生成测试数据,无需实际运行生成测试数据所需的单元,从而可以在业务实际运行前进行单元测试,预先暴露待测试模块可能出现的缺陷。The present invention simulates the execution of the dependent unit by creating a mock object of the dependent unit of the unit to be tested to obtain the return data required by the unit to be tested, and tests the unit to be tested in combination with the test data, thereby eliminating the need to execute the execution process of the dependent unit, reducing The execution process of the unit test is simplified, the test program is simplified, and the overhead of the unit test is reduced. In addition, the present invention can directly generate test data by generating configuration files in advance, without actually running the units required to generate test data, so that unit testing can be performed before the actual operation of the business, and possible defects of the modules to be tested can be exposed in advance.
请参阅图3,图3为本发明另一实施例提供的一种单元测试方法的步骤流程图。具体可以包括以下步骤:Please refer to FIG. 3 , which is a flowchart of steps of a unit testing method provided by another embodiment of the present invention. Specifically, the following steps can be included:
步骤301,在预设业务中确定待测试单元和待测试单元的依赖单元;
步骤301与步骤101相同,具体可以参考步骤101的描述,此处不再赘述。Step 301 is the same as
步骤302,获取预设业务的业务数据;
步骤303,获取待测试单元的配置文件;
步骤304,根据业务数据和配置文件,生成待测试单元的测试数据;
在本发明实施例中,预设业务的业务数据可以包括业务处理对象本身的客观信息以及依赖用户选择的主观信息。In this embodiment of the present invention, the service data of the preset service may include objective information of the service processing object itself and subjective information dependent on user selection.
以用户点击支付为例,要完成一个订单的支付操作,首先需要获取商品信息,商品就是业务处理对象,商品信息则是商品的客观信息。接着需要获取商品的购买数量,这点依赖用户的选择行为,即为用户选择的主观信息。基于这两点支付时便可计算得出实际的订单表,从而依据订单表执行相应的付款操作。Taking the user click to pay as an example, to complete the payment operation of an order, you first need to obtain the commodity information, the commodity is the business processing object, and the commodity information is the objective information of the commodity. Next, it is necessary to obtain the purchase quantity of the product, which depends on the user's selection behavior, that is, the subjective information selected by the user. When paying based on these two points, the actual order table can be calculated, and the corresponding payment operation can be performed according to the order table.
在常规操作中,要获取到这些数据,需要写很多原生的jdbc连接数据库来以获取相应的数据,并经过不同单元对数据进行处理,才能得到订单表作为测试数据。并且付款结束后这笔订单就会从待支付状态跳转到支付成功的状态;当需要再次测试时,又需要重新走流程生成待付款状态的订单表才能测试支付,过程及其繁琐。In normal operations, to obtain these data, it is necessary to write many native jdbc connection databases to obtain the corresponding data, and process the data through different units to obtain the order table as the test data. And after the payment is over, the order will jump from the pending payment state to the successful payment state; when it is necessary to test again, it is necessary to go through the process again to generate the pending payment status order table to test the payment, and the process is extremely cumbersome.
有鉴于此,本发明实施例引入MariaDB数据库来存储业务数据,以避开编写jdbc的流程。同时通过配置文件(如sql文件)为不同的待测试单元定义相应的存储数据结构来存储业务数据。In view of this, the embodiment of the present invention introduces a MariaDB database to store business data, so as to avoid the process of writing jdbc. At the same time, a corresponding storage data structure is defined for different units to be tested through a configuration file (such as a sql file) to store business data.
在一个示例中,可以建立待测试单元与配置文件的存储路径之间的索引关系,以在对待测试单元进行测试时,获取相应的配置文件进行测试数据的生成。根据待测试单元所执行的功能的区别,可以为其配置不同的存储数据结构。例如,当待测试单元为支付单元时,则测试数据可以为订单表,配置文件中的存储数据结构则可以为订单表中需要的数据排列结构、数据类型等。In one example, an index relationship between the unit to be tested and the storage path of the configuration file may be established, so that when the unit to be tested is tested, a corresponding configuration file is obtained to generate test data. According to the difference of the functions performed by the unit under test, different storage data structures can be configured for it. For example, when the unit to be tested is a payment unit, the test data may be the order table, and the storage data structure in the configuration file may be the data arrangement structure and data type required in the order table.
接着以存储的业务数据,在xml文件中构建测试数据。当需要对待测试单元进行单元测试时,可以调用sql文件和xml进行数据结构和测试数据的读取,并对存储数据结构和测试数据进行初始化和重置,从而不需要再去走繁琐的测试数据生成流程。Then use the stored business data to construct test data in the xml file. When the unit to be tested needs to be unit tested, the sql file and xml can be called to read the data structure and test data, and the stored data structure and test data can be initialized and reset, so that there is no need to go through the tedious test data. Generate process.
MariaDB数据库是一个采用Maria存储引擎的MySQL分支版本,主要由开源社区在维护,采用GPL授权许可MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB(英语:XtraDB)来代替MySQL的InnoDB。The MariaDB database is a MySQL branch version that uses the Maria storage engine. It is mainly maintained by the open source community. The purpose of using the GPL license MariaDB is to be fully compatible with MySQL, including API and command line, so that it can easily become a replacement for MySQL. In terms of storage engine, XtraDB (English: XtraDB) is used instead of MySQL's InnoDB.
sql(Structured Query Language,结构化查询语言),是一种高级的非过程化编程语言,允许用户在高层数据结构上工作。它不要求用户指定对数据的存放方法,也不需要用户了解具体的数据存放方式,所以具有完全不同底层结构的不同数据库系统,可以使用相同的结构化查询语言作为数据输入与管理的接口。结构化查询语言语句可以嵌套,这使它具有极大的灵活性和强大的功能。sql (Structured Query Language), is a high-level non-procedural programming language that allows users to work on high-level data structures. It does not require users to specify the storage method of data, nor does it require users to understand the specific data storage method, so different database systems with completely different underlying structures can use the same structured query language as the interface for data input and management. Structured query language statements can be nested, which makes them extremely flexible and powerful.
xml(Extensible Markup Language,可扩展标记语言),是一种用于标记电子文件使其具有结构性的标记语言。在电子计算机中,标记指计算机所能理解的信息符号,通过此种标记,计算机之间可以处理包含各种的信息比如文章等。它可以用来标记数据、定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言。它非常适合万维网传输,提供统一的方法来描述和交换独立于应用程序或供应商的结构化数据。是Internet环境中跨平台的、依赖于内容的技术,也是当今处理分布式结构信息的有效工具。xml (Extensible Markup Language, Extensible Markup Language) is a markup language used to mark electronic documents to make them structured. In an electronic computer, a mark refers to an information symbol that can be understood by a computer. Through this mark, a variety of information, such as articles, can be processed between computers. It can be used to mark data, define data types, and is a source language that allows users to define their own markup language. It is well suited for World Wide Web transport, providing a unified way to describe and exchange structured data independent of applications or vendors. It is a cross-platform, content-dependent technology in the Internet environment and an effective tool for processing distributed structural information today.
在一个示例中,根据业务数据和配置文件,生成待测试单元的测试数据的步骤,可以包括以下子步骤:In an example, the step of generating the test data of the unit to be tested according to the business data and the configuration file may include the following sub-steps:
S41,从配置文件中提取存储数据结构;S41, extract the storage data structure from the configuration file;
S42,在存储数据结构中填充业务数据,并通过所填充的业务数据生成待测试单元的测试数据。S42, fill in the business data in the storage data structure, and generate test data of the unit to be tested by using the filled business data.
在具体实现中,可以通过配置文件的存储数据结构来获取测试待测试单元所需的业务数据,并在xml文件中构造测试数据。In a specific implementation, the business data required for testing the unit to be tested can be obtained through the storage data structure of the configuration file, and the test data can be constructed in the xml file.
在一个示例中,以支付单元为例,其所需的测试数据可以为订单表。则存储数据结构可以以订单表为模板,依照订单表的结构以及组成参数来生成。如订单表的组成参数可以包括产品名称、产品单价、产品数量等参数类型。则在需要获取支付单元所需的业务数据时,可以通过存储数据结构所限定的参数类型在业务数据中进行匹配操作,以得到相应的业务数据。In one example, taking the payment unit as an example, the required test data can be an order table. Then, the storage data structure can take the order table as a template and be generated according to the structure and composition parameters of the order table. For example, the constituent parameters of the order table may include parameter types such as product name, product unit price, and product quantity. Then, when the business data required by the payment unit needs to be acquired, a matching operation can be performed in the business data by the parameter type defined by the storage data structure, so as to obtain the corresponding business data.
步骤305,创建依赖单元的mock对象,以模拟执行所述依赖单元;
mock就是在测试过程中,对于某些不容易构造或者不容易获取的对象,用一个虚拟的对象来创建已便测试的测试方法,这个虚拟的对象就是mock对象。Mock is a test method that uses a virtual object to create a test method that has been tested for some objects that are not easy to construct or obtain during the testing process. This virtual object is the mock object.
在本发明实施例中,为了减少依赖单元的执行对时间、资源的占用,可以创建依赖单元的mock对象,来模拟依赖单元的执行,从而快速得到依赖单元的反馈信息。In the embodiment of the present invention, in order to reduce the time and resource occupation of the execution of the dependent unit, a mock object of the dependent unit may be created to simulate the execution of the dependent unit, thereby quickly obtaining feedback information of the dependent unit.
在一个示例中,创建依赖单元的mock对象,以模拟执行依赖单元的步骤,包括:In one example, a mock object of the dependency unit is created to simulate the steps of executing the dependency unit, including:
S51,确定依赖单元的API接口,并获取API接口的数据结构;S51, determine the API interface of the dependent unit, and obtain the data structure of the API interface;
S52,基于API接口的数据结构,生成依赖单元的mock对象,以模拟执行依赖单元。S52, based on the data structure of the API interface, a mock object of the dependency unit is generated to simulate the execution of the dependency unit.
在实际应用中,依赖单元一般会存在一些API接口,用于与其他单元进行数据交互,从而使得依赖单元可以正常的执行。本发明实施例通过获取依赖单元的API接口的数据结构,并通过mock来对数据结构进行模拟,从而生成依赖单元的mock对象。该mock对象可以模拟依赖单元的执行,在接收到待测试单元的调用请求时,直接向待测试单元返回反馈结果,而无需实际执行依赖单元。In practical applications, the dependent unit generally has some API interfaces for data interaction with other units, so that the dependent unit can execute normally. The embodiment of the present invention generates a mock object of the dependent unit by acquiring the data structure of the API interface of the dependent unit, and simulating the data structure through mocking. The mock object can simulate the execution of the dependent unit, and when receiving the calling request of the unit to be tested, directly returns the feedback result to the unit to be tested without actually executing the dependent unit.
步骤306,采用测试数据和mock对象测试待测试单元,得到测试结果。
在获取到测试数据和mock对象后,可以结合测试数据和mock对象对待测试单元进行单元测试。After the test data and the mock object are obtained, the unit to be tested can be unit tested by combining the test data and the mock object.
在一个示例中,采用测试数据和mock对象测试待测试单元,得到测试结果的步骤,可以包括以下子步骤:In an example, the unit to be tested is tested by using test data and a mock object, and the step of obtaining the test result may include the following sub-steps:
S61,获取mock对象基于待测试单元的调用请求所返回的返回数据;S61, obtain the return data returned by the mock object based on the calling request of the unit to be tested;
S62,采用测试数据和返回数据,基于待测试单元的执行流程测试待测试单元,得到测试结果。S62, using the test data and the returned data, test the unit to be tested based on the execution flow of the unit to be tested, and obtain a test result.
在本发明实施例中,在获取到测试数据后,可以采用测试数据执行待测试单元的执行流程,并在需要调用依赖单元的返回数据时,向mock对象发送调用请求,以获取mock对象模拟依赖单元执行后产生的返回数据,从而完成整个待测试单元的执行流程,得到执行结果作为测试结果。In this embodiment of the present invention, after the test data is acquired, the test data can be used to execute the execution process of the unit to be tested, and when the return data of the dependent unit needs to be called, a call request is sent to the mock object to obtain the mock object to simulate the dependency The return data generated after the unit is executed, so as to complete the execution process of the entire unit to be tested, and obtain the execution result as the test result.
步骤307,对测试结果进行验证,得到待测试单元的验证结果。Step 307 , verify the test result, and obtain the verification result of the unit to be tested.
在一个示例中,步骤307可以包括以下子步骤:In one example, step 307 may include the following sub-steps:
S71,获取待测试单元的目标结果;S71, obtain the target result of the unit to be tested;
S72,采用目标结果对测试结果进行验证;S72, using the target result to verify the test result;
S73,当目标结果与测试结果相同时,判定待测试单元通过测试。S73, when the target result is the same as the test result, it is determined that the unit to be tested has passed the test.
在具体实现中,可以将以往正确执行的待测试单元的执行数据作为对比数据进行保存,对比数据可以以xml格式文件进行保存,也可以以其他方式进行保存,本发明对此不作具体限制。在对待测试单元进行测试时,可以通过测试数据在对比数据中匹配目标结果,并将目标结果与待测试单元的测试结果进行比对,从而判定待测试单元是否通过测试。In a specific implementation, the execution data of the unit to be tested that has been correctly executed in the past can be saved as comparison data, and the comparison data can be saved in an xml format file or in other ways, which is not specifically limited in the present invention. When the unit to be tested is tested, the target result can be matched in the comparison data through the test data, and the target result is compared with the test result of the unit to be tested, so as to determine whether the unit to be tested passes the test.
本发明通过创建待测试单元的依赖单元的mock对象,来模拟依赖单元的执行以获取待测试单元需要的返回数据,从而无需执行依赖单元的执行流程,减少了单元测试的执行过程,简化了测试程序,降低了单元测试的开销。并在MariaDB数据库中定义业务数据的数据存储结构,使得业务数据的获取无需通过编写很多原生jdbc来实现。此外,通过xml文件进行测试数据的构造,简化了测试数据的生成流程,降低了测试数据生成的时间成本和开销成本。The present invention simulates the execution of the dependent unit by creating a mock object of the dependent unit of the unit to be tested to obtain the return data required by the unit to be tested, so that the execution process of the dependent unit does not need to be executed, the execution process of the unit test is reduced, and the test is simplified program, reducing the overhead of unit testing. And define the data storage structure of business data in the MariaDB database, so that the acquisition of business data does not need to be realized by writing a lot of native jdbc. In addition, the construction of test data through xml file simplifies the generation process of test data, and reduces the time cost and overhead cost of test data generation.
为便于理解,以下通过具体示例对本发明进行说明。For ease of understanding, the present invention is described below through specific examples.
请参阅图4,图4为本发明实施例提供的一种单元测试方法的架构图。Please refer to FIG. 4. FIG. 4 is an architecture diagram of a unit testing method provided by an embodiment of the present invention.
如图4所示,该架构图包括五个环节,分别为:前置、参数、mock、执行和后置。As shown in Figure 4, the architecture diagram includes five links, namely: pre-, parameters, mock, execution and post.
其中,前置环节主要是通过MariaDB数据库存储业务数据,以及生成测试数据的过程。具体地,数据可以直接根据单元测试所对应的配置文件直接存储在MariaDB数据库中(主要针对业务对象相关的客观信息),还可以先通过xml等格式进行构造,然后通过配置文件来存储在MariaDB数据库中(主要针对用户通过选择确定的主观信息)。Among them, the pre-process is mainly to store business data and generate test data through MariaDB database. Specifically, the data can be directly stored in the MariaDB database according to the configuration file corresponding to the unit test (mainly for objective information related to business objects), or it can be constructed in formats such as xml, and then stored in the MariaDB database through the configuration file. Medium (mainly for the subjective information determined by the user through selection).
参数环节主要用于确定用户的主观信息,包括但不限于通过输入、点击等方式确定。参数格式可以为xml、json、testcase等。The parameter link is mainly used to determine the subjective information of the user, including but not limited to determination by input, click, etc. The parameter format can be xml, json, testcase, etc.
mock环节主要通过mockito创建依赖单元的mock对象。mockito是一个针对Java的mocking框架,通过在执行后校验什么已经被调用,来消除对期望行为(expectations)的需要。The mock link mainly creates mock objects of dependent units through mockito. Mockito is a mocking framework for Java that removes the need for expected behaviors by verifying what has been called after execution.
执行环节主要通过测试数据和mock对象的返回数据来运行待测试单元,得到测试结果。The execution link mainly runs the unit to be tested through the test data and the return data of the mock object, and obtains the test result.
后置环节主要通过已保存的目标结果来对测试结果进行验证。The post-link mainly verifies the test results through the saved target results.
请参阅图5,图5为本发明实施例提供的一种单元测试装置的结构框图。Please refer to FIG. 5 , which is a structural block diagram of a unit testing apparatus provided by an embodiment of the present invention.
本发明实施例提供了一种单元测试装置,包括:An embodiment of the present invention provides a unit testing device, including:
单元确定模块501,用于在预设业务中确定待测试单元和待测试单元的依赖单元;The
测试数据获取模块502,用于获取待测试单元的测试数据;A test
mock对象创建模块503,用于创建依赖单元的mock对象,以模拟执行所述依赖单元;The mock
测试模块504,用于采用测试数据和mock对象测试待测试单元,得到测试结果。The
在本发明实施例中,测试数据获取模块502,包括:In this embodiment of the present invention, the test
因为数据获取子模块,用于获取预设业务的业务数据;Because the data acquisition sub-module is used to acquire the business data of the preset business;
配置文件获取子模块,用于获取待测试单元的配置文件;The configuration file obtaining submodule is used to obtain the configuration file of the unit to be tested;
测试数据生成子模块,用于根据业务数据和配置文件,生成待测试单元的测试数据。The test data generation sub-module is used to generate the test data of the unit to be tested according to the business data and the configuration file.
在本发明实施例中,测试数据生成子模块,包括:In the embodiment of the present invention, the test data generation submodule includes:
存储数据结构提取单元,用于从配置文件中提取存储数据结构;The storage data structure extraction unit is used to extract the storage data structure from the configuration file;
测试数据生成单元,用于在存储数据结构中填充业务数据,并通过所填充的业务数据生成待测试单元的测试数据。The test data generating unit is used for filling the business data in the storage data structure, and generating the test data of the unit to be tested by the filled business data.
在本发明实施例中,mock对象创建模块503,包括:In this embodiment of the present invention, the mock
数据接口获取子模块,用于确定依赖单元的API接口,并获取API接口的数据结构;The data interface acquisition sub-module is used to determine the API interface of the dependent unit and obtain the data structure of the API interface;
mock对象生成子模块,用于基于API接口的数据结构,生成依赖单元的mock对象,以模拟执行依赖单元。The mock object generates a submodule, which is used to generate a mock object of the dependency unit based on the data structure of the API interface to simulate the execution of the dependency unit.
在本发明实施例中,测试模块504,包括:In this embodiment of the present invention, the
返回数据获取子模块,用于获取mock对象基于待测试单元的调用请求所返回的返回数据;The return data acquisition sub-module is used to obtain the return data returned by the mock object based on the calling request of the unit to be tested;
测试子模块,用于采用测试数据和返回数据,基于待测试单元的执行流程测试待测试单元,得到测试结果。The test submodule is used to test the unit to be tested based on the execution flow of the unit to be tested by using the test data and the returned data to obtain the test result.
在本发明实施例中,还包括:In the embodiment of the present invention, it also includes:
验证模块,用于对测试结果进行验证,得到待测试单元的验证结果。The verification module is used to verify the test result to obtain the verification result of the unit to be tested.
在本发明实施例中,验证模块,包括:In this embodiment of the present invention, the verification module includes:
目标结果获取子模块,用于获取待测试单元的目标结果;The target result obtaining sub-module is used to obtain the target result of the unit to be tested;
验证子模块,用于采用目标结果对测试结果进行验证;The verification sub-module is used to verify the test results with the target results;
判定子模块,用于当目标结果与测试结果相同时,判定待测试单元通过测试。The determination sub-module is used to determine that the unit to be tested passes the test when the target result is the same as the test result.
本发明实施例还提供了一种电子设备,设备包括处理器以及存储器:The embodiment of the present invention also provides an electronic device, the device includes a processor and a memory:
存储器用于存储程序代码,并将程序代码传输给处理器;The memory is used to store the program code and transmit the program code to the processor;
处理器用于根据程序代码中的指令执行本发明实施例的单元测试方法。The processor is configured to execute the unit testing method of the embodiment of the present invention according to the instructions in the program code.
本发明实施例还提供了一种计算机可读存储介质,计算机可读存储介质用于存储程序代码,程序代码用于执行本发明实施例的单元测试方法。Embodiments of the present invention further provide a computer-readable storage medium, where the computer-readable storage medium is used to store program codes, and the program codes are used to execute the unit testing method of the embodiments of the present invention.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above may refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments may be referred to each other.
本领域内的技术人员应明白,本发明实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本发明实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It should be understood by those skilled in the art that the embodiments of the embodiments of the present invention may be provided as a method, an apparatus, or a computer program product. Accordingly, embodiments of 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, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media having computer-usable program code embodied therein, including but not limited to disk storage, CD-ROM, optical storage, and the like.
本发明实施例是参照根据本发明实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。Embodiments of the present invention are described with reference to flowcharts and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present invention. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes 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 terminal equipment to produce a machine that causes the instructions to be executed by the processor of the computer or other programmable data processing terminal equipment Means are created for implementing the functions specified in the flow or flows of the flowcharts and/or the blocks or blocks of the block diagrams.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal equipment 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 The instruction means implement 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 terminal equipment, so that a series of operational steps are performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby executing on the computer or other programmable terminal equipment The instructions executed on the above provide steps for implementing the functions specified in the flowchart or blocks and/or the block or blocks of the block diagrams.
尽管已描述了本发明实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明实施例范围的所有变更和修改。While preferred embodiments of the embodiments of the present invention have been described, additional changes and modifications to these embodiments may be made by 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 embodiments as well as all changes and modifications that fall within the scope of the embodiments of the present invention.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should also be noted that in this document, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply these entities or that there is any such actual relationship or sequence between operations. Furthermore, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion such that a process, method, article or terminal device that includes a list of elements includes not only those elements, but also a non-exclusive list of elements. other elements, or also include elements inherent to such a process, method, article or terminal equipment. Without further limitation, an element defined by the phrase "comprises a..." does not preclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210302354.6A CN114579470A (en) | 2022-03-25 | 2022-03-25 | A unit testing method, device, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210302354.6A CN114579470A (en) | 2022-03-25 | 2022-03-25 | A unit testing method, device, electronic device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114579470A true CN114579470A (en) | 2022-06-03 |
Family
ID=81782544
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210302354.6A Pending CN114579470A (en) | 2022-03-25 | 2022-03-25 | A unit testing method, device, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114579470A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114968806A (en) * | 2022-06-16 | 2022-08-30 | 平安国际融资租赁有限公司 | Method, device, equipment and medium for generating unit test case |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150135158A1 (en) * | 2013-11-14 | 2015-05-14 | Dimitar Tenev | Isolated testing of distributed development projects |
CN109284222A (en) * | 2017-07-20 | 2019-01-29 | 阿里巴巴集团控股有限公司 | Project testing method, device and equipment in software unit, data processing system |
CN110806967A (en) * | 2018-08-06 | 2020-02-18 | 北京京东尚科信息技术有限公司 | A unit testing method and apparatus |
-
2022
- 2022-03-25 CN CN202210302354.6A patent/CN114579470A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150135158A1 (en) * | 2013-11-14 | 2015-05-14 | Dimitar Tenev | Isolated testing of distributed development projects |
CN109284222A (en) * | 2017-07-20 | 2019-01-29 | 阿里巴巴集团控股有限公司 | Project testing method, device and equipment in software unit, data processing system |
CN110806967A (en) * | 2018-08-06 | 2020-02-18 | 北京京东尚科信息技术有限公司 | A unit testing method and apparatus |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114968806A (en) * | 2022-06-16 | 2022-08-30 | 平安国际融资租赁有限公司 | Method, device, equipment and medium for generating unit test case |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11789715B2 (en) | Systems and methods for transformation of reporting schema | |
Reussner et al. | Modeling and simulating software architectures: The Palladio approach | |
CN112270149B (en) | Verification platform automatic integration method and system, electronic equipment and storage medium | |
CN111832236B (en) | A chip regression test method, system, electronic device and storage medium | |
US8056057B2 (en) | System and method for generating business process test elements | |
US8225288B2 (en) | Model-based testing using branches, decisions, and options | |
US7770151B2 (en) | Automatic generation of solution deployment descriptors | |
KR101645052B1 (en) | Debugging pipeline | |
US7797678B2 (en) | Automatic generation of license package for solution components | |
US9471282B2 (en) | System and method for using annotations to automatically generate a framework for a custom javaserver faces (JSF) component | |
CN112015399A (en) | Data processing method and device for generating intelligent contract | |
US20130007519A1 (en) | Test Framework Extension for Testing Logic on a Modeled User Interface | |
US8661356B2 (en) | Time application having an intergrated check engine | |
US20060026506A1 (en) | Test display module for testing application logic independent of specific user interface platforms | |
US8661414B2 (en) | Method and system for testing an order management system | |
US20070061780A1 (en) | Enterprise resource planning system test framework | |
CN116755669A (en) | Low code development method and tool based on DSL language operation model | |
US20100250228A1 (en) | Modeling a composite application | |
CN114579470A (en) | A unit testing method, device, electronic device and storage medium | |
Ribeiro et al. | Comparative analysis of workbenches to support DSMLs: Discussion with non-trivial Model-Driven Development needs | |
CN113504904A (en) | User-defined function implementation method and device, computer equipment and storage medium | |
US20080066005A1 (en) | Systems and Methods of Interfacing with Enterprise Resource Planning Systems | |
CN112559311B (en) | Interface adaptation method and device for mobile terminal automatic test | |
Lilius et al. | An architecture exploration environment for system on chip design | |
Mittal | No Code Test Recording for iOS Applications |
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 |