[go: up one dir, main page]

CN114996152A - Unit testing method, device, equipment and medium - Google Patents

Unit testing method, device, equipment and medium Download PDF

Info

Publication number
CN114996152A
CN114996152A CN202210692374.9A CN202210692374A CN114996152A CN 114996152 A CN114996152 A CN 114996152A CN 202210692374 A CN202210692374 A CN 202210692374A CN 114996152 A CN114996152 A CN 114996152A
Authority
CN
China
Prior art keywords
unit
unit test
software
test case
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210692374.9A
Other languages
Chinese (zh)
Other versions
CN114996152B (en
Inventor
刘晋荥
曾智辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Beijing Co Ltd
Original Assignee
Douyin Vision Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Douyin Vision Beijing Co Ltd filed Critical Douyin Vision Beijing Co Ltd
Priority to CN202210692374.9A priority Critical patent/CN114996152B/en
Publication of CN114996152A publication Critical patent/CN114996152A/en
Application granted granted Critical
Publication of CN114996152B publication Critical patent/CN114996152B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Landscapes

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

Abstract

本公开实施例涉及一种单元测试方法、装置、设备及介质,其中该方法包括:获取单元测试用例的基础数据;将基础数据采用预设格式表示,得到目标数据;在待测软件运行的过程中,基于目标数据补充上下文环境信息之后生成单元测试用例,并基于单元测试用例对待测软件执行单元测试。采用上述技术方案,通过获取单元测试用例所需的基础数据,并将基础数据采用预设格式表示,在软件运行过程中基于预设格式的基础数据可以生成完整的单元测试用例并执行单元测试,在迭代和维护时仅仅需要对单元测试用例的基础数据进行迭代和维护,无需再修改代码,极大降低了单元测试用例的迭代和维护成本,进而提升了单元测试的覆盖率及质量,提升了软件的迭代速度。

Figure 202210692374

The embodiments of the present disclosure relate to a unit testing method, device, equipment and medium, wherein the method includes: acquiring basic data of a unit test case; expressing the basic data in a preset format to obtain target data; , after supplementing the context information based on the target data, a unit test case is generated, and a unit test is performed on the software under test based on the unit test case. By adopting the above technical solution, by acquiring the basic data required by the unit test case and expressing the basic data in a preset format, a complete unit test case can be generated and executed based on the basic data in the preset format during the software running process, and the unit test can be executed. During iteration and maintenance, it is only necessary to iterate and maintain the basic data of the unit test case without modifying the code, which greatly reduces the iteration and maintenance cost of the unit test case, thereby improving the coverage and quality of the unit test. Software iteration speed.

Figure 202210692374

Description

一种单元测试方法、装置、设备及介质A unit testing method, device, equipment and medium

技术领域technical field

本公开涉及软件测试技术领域,尤其涉及一种单元测试方法、装置、设备及介质。The present disclosure relates to the technical field of software testing, and in particular, to a unit testing method, apparatus, device and medium.

背景技术Background technique

单元测试能够在开发阶段前置阶段发现软件缺陷,在软件开发过程的早期就能发现问题,保障软件的开发质量,避免引起线上事故,降低解决问题的成本,因此单元测试是测试流程中非常重要的一步。Unit testing can find software defects in the pre-development stage, and can find problems in the early stage of the software development process, ensure the quality of software development, avoid online accidents, and reduce the cost of solving problems. Therefore, unit testing is a very important part of the testing process. important step.

单元测试普遍需要手动编写代码和设计单元测试用例,并且软件代码发生变化时需要修改单元测试用例的代码,编写和维护的成本较高。相关技术中可以在代码层面自动生成单元测试用例,但是单元测试用例的迭代和维护依然需要通过修改代码实现,需要耗费大量人力,仍然存在成本较高的缺陷。Unit testing generally requires manually writing code and designing unit test cases, and when the software code changes, the code of the unit test cases needs to be modified, and the cost of writing and maintaining is relatively high. In related technologies, unit test cases can be automatically generated at the code level, but the iteration and maintenance of unit test cases still need to be implemented by modifying the code, which requires a lot of manpower and still has the defect of high cost.

发明内容SUMMARY OF THE INVENTION

为了解决上述技术问题,本公开提供了一种单元测试方法、装置、设备及介质。In order to solve the above technical problems, the present disclosure provides a unit testing method, apparatus, device and medium.

本公开实施例提供了一种单元测试方法,所述方法包括:An embodiment of the present disclosure provides a unit testing method, the method includes:

获取单元测试用例的基础数据;Get the basic data of unit test cases;

将所述基础数据采用预设格式表示,得到目标数据;The basic data is represented in a preset format to obtain target data;

在待测软件运行的过程中,基于所述目标数据补充上下文环境信息之后生成所述单元测试用例,并基于所述单元测试用例对所述待测软件执行单元测试。During the running of the software under test, the unit test case is generated after supplementing the context information based on the target data, and the unit test is performed on the software under test based on the unit test case.

本公开实施例还提供了一种单元测试装置,所述装置包括:Embodiments of the present disclosure also provide a unit testing device, the device comprising:

获取模块,用于获取单元测试用例的基础数据;Get module, used to get the basic data of unit test case;

格式模块,用于将所述基础数据采用预设格式表示,得到目标数据;a format module for representing the basic data in a preset format to obtain target data;

测试模块,用于在待测软件运行的过程中,基于所述目标数据补充上下文环境信息之后生成所述单元测试用例,并基于所述单元测试用例对所述待测软件执行单元测试。The testing module is used for generating the unit test case after supplementing the context information based on the target data during the running of the software under test, and performing unit testing on the software under test based on the unit test case.

本公开实施例还提供了一种电子设备,所述电子设备包括:处理器;用于存储所述处理器可执行指令的存储器;所述处理器,用于从所述存储器中读取所述可执行指令,并执行所述指令以实现如本公开实施例提供的单元测试方法。An embodiment of the present disclosure further provides an electronic device, the electronic device includes: a processor; a memory for storing instructions executable by the processor; the processor for reading the memory from the memory The instructions are executable, and the instructions are executed to implement the unit testing method provided by the embodiments of the present disclosure.

本公开实施例还提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序用于执行如本公开实施例提供的单元测试方法。An embodiment of the present disclosure further provides a computer-readable storage medium, where the storage medium stores a computer program, and the computer program is used to execute the unit testing method provided by the embodiment of the present disclosure.

本公开实施例提供的技术方案与现有技术相比具有如下优点:本公开实施例提供的单元测试方案,获取单元测试用例的基础数据;将基础数据采用预设格式表示,得到目标数据;在待测软件运行的过程中,基于目标数据补充上下文环境信息之后生成单元测试用例,并基于单元测试用例对待测软件执行单元测试。采用上述技术方案,通过获取单元测试用例所需的基础数据,并将基础数据采用预设格式表示,在软件运行过程中基于预设格式的基础数据补充上下文环境信息之后可以生成完整的单元测试用例并执行单元测试,在迭代和维护时仅仅需要对单元测试用例的基础数据进行迭代和维护,无需再修改代码,极大降低了单元测试用例的迭代和维护成本,进而提升了单元测试的覆盖率及质量,提升了软件的迭代速度。Compared with the prior art, the technical solution provided by the embodiment of the present disclosure has the following advantages: the unit testing solution provided by the embodiment of the present disclosure obtains the basic data of the unit test case; expresses the basic data in a preset format to obtain the target data; During the running of the software under test, a unit test case is generated after supplementing the context information based on the target data, and the unit test is performed on the software under test based on the unit test case. With the above technical solution, by acquiring the basic data required by the unit test case and expressing the basic data in a preset format, a complete unit test case can be generated after supplementing the contextual environment information based on the basic data in the preset format during the software running process And execute unit tests. During iteration and maintenance, it is only necessary to iterate and maintain the basic data of unit test cases without modifying the code, which greatly reduces the iteration and maintenance costs of unit test cases, thereby improving the coverage of unit tests. and quality, improving the iteration speed of the software.

附图说明Description of drawings

结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent when taken in conjunction with the accompanying drawings and with reference to the following detailed description. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.

图1为本公开实施例提供的一种单元测试方法的流程示意图;1 is a schematic flowchart of a unit testing method provided by an embodiment of the present disclosure;

图2为本公开实施例提供的另一种单元测试方法的流程示意图;2 is a schematic flowchart of another unit testing method provided by an embodiment of the present disclosure;

图3为本公开实施例提供的一种单元测试的示意图;3 is a schematic diagram of a unit test provided by an embodiment of the present disclosure;

图4为本公开实施例提供的一种单元测试装置的结构示意图;4 is a schematic structural diagram of a unit testing apparatus provided by an embodiment of the present disclosure;

图5为本公开实施例提供的一种电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for the purpose of A more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes, and are not intended to limit the protection scope of the present disclosure.

应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and/or in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this regard.

本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。As used herein, the term "including" and variations thereof are open-ended inclusions, ie, "including but not limited to". The term "based on" is "based at least in part on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below.

需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or interdependence.

需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "a" and "a plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, they should be understood as "one or a plurality of". multiple".

本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of these messages or information.

单元测试普遍需要手动编写代码和设计单元测试用例,当代码设计较为复杂时,单元测试代码编写前需要先重构代码,另外原始代码发生变化需要修改单元测试代码,维护成本很高,与快速需求迭代冲突。例如,以IOS系统目提供的原生测试套件XCTest为例,开发人员在编写和维护单元测试用例的过程中,需要为单元测试用例提供上下文环境、声明构造输入及输出变量、调用测试方法以及比较输出结果等,对于开发人员往往只关心被测方法的输入及输出,而不关心这些输入变量如何构造以及方法如何调用等问题,因此目前的方案不可避免地需要编写很多冗余代码,这种冗余代码不可避免地提高了单元测试用例的编写及维护成本。此外,目前单元测试用例都需要开发人员专门编写及维护,在软件需求快速迭代的过程中,想要保证有高质量的单元测试,单元测试用例的迭代和维护需耗费大量人力,成为阻塞快速迭代的绊脚石。相关技术中可以在代码层面自动生成单元测试用例,但是单元测试用例的迭代和维护依然需要通过修改代码实现,需要耗费大量人力,仍然存在成本较高的缺陷。Unit testing generally requires manually writing code and designing unit test cases. When the code design is complex, the code needs to be refactored before the unit test code is written. In addition, the original code needs to be modified to modify the unit test code. The maintenance cost is high, and the rapid demand Iterative conflict. For example, taking the native test suite XCTest provided by the IOS system as an example, in the process of writing and maintaining unit test cases, developers need to provide context for unit test cases, declare and construct input and output variables, call test methods, and compare outputs. As a result, developers often only care about the input and output of the method under test, but not how these input variables are constructed and how the method is called. Therefore, the current solution inevitably needs to write a lot of redundant code. This redundancy Code inevitably increases the cost of writing and maintaining unit test cases. In addition, at present, unit test cases need to be specially written and maintained by developers. In the process of rapid iteration of software requirements, in order to ensure high-quality unit tests, the iteration and maintenance of unit test cases requires a lot of manpower, which becomes blocking rapid iteration. stumbling block. In related technologies, unit test cases can be automatically generated at the code level, but the iteration and maintenance of unit test cases still need to be implemented by modifying the code, which requires a lot of manpower and still has the defect of high cost.

为了解决上述问题,本公开实施例提供了一种单元测试方法,下面结合具体的实施例对该方法进行介绍。In order to solve the above problem, an embodiment of the present disclosure provides a unit testing method, which is described below with reference to specific embodiments.

图1为本公开实施例提供的一种单元测试方法的流程示意图,该方法可以由单元测试装置执行,其中该装置可以采用软件和/或硬件实现,一般可集成在电子设备中。如图1所示,该方法包括:1 is a schematic flowchart of a unit testing method provided by an embodiment of the present disclosure. The method may be executed by a unit testing apparatus, where the apparatus may be implemented by software and/or hardware, and may generally be integrated into an electronic device. As shown in Figure 1, the method includes:

步骤101、获取单元测试用例的基础数据。Step 101: Acquire basic data of the unit test case.

其中,单元测试用例可以理解为针对软件单元的具体功能,为了有效验证软件单元的特性、发现软件单元代码的缺陷而编写的代码或特定集合,特定集合可以包括用例名称、上下文环境、测试对象、测试目的、输入数据、预期结果等。软件单元可以是组成软件的函数、方法、模块等,一个软件通常由多个上述软件单元组成,每个软件单元分别实现各自确定的功能,并通过其提供的输入、输出接口与其他软件单元相互调用,共同实现软件的整体功能。本公开实施例的单元测试方法可以由一个单元测试套件执行,该单元测试套件可以理解为能够对一个或多个软件实现单元测试的一个综合功能模块。Among them, a unit test case can be understood as a code or a specific collection for the specific functions of the software unit, in order to effectively verify the characteristics of the software unit and discover the defects of the software unit code. Test purpose, input data, expected results, etc. Software units can be functions, methods, modules, etc. that make up the software. A software usually consists of a plurality of the above-mentioned software units. Each software unit realizes its own determined function and communicates with other software units through the input and output interfaces provided by it. Call to realize the overall function of the software together. The unit testing method of the embodiment of the present disclosure may be executed by a unit test suite, and the unit test suite may be understood as a comprehensive functional module capable of unit testing one or more softwares.

基础数据可以是单元测试用例在测试时所需的必要数据,也是开发人员针对单元测试用例所关心的数据,本公开实施例中基础数据可以包括单元测试方法的名称、类信息、测试对象、输入参数和输出预期结果;类信息可以是单元测试方法所属的类,类信息在待测软件的代码语言为Objective-C代码语言时具有,在待测软件的代码语言是其他语言时可以适应修改为其他函数或上层模块;测试对象可以是调用单元测试方法的对象,输入参数对应具体软件单元的输入变量,输出预期结果对应软件单元的输出变量。The basic data may be the necessary data required by the unit test case when testing, and also the data that the developer cares about for the unit test case. In the embodiment of the present disclosure, the basic data may include the name of the unit test method, class information, test object, input Parameters and output expected results; class information can be the class to which the unit test method belongs. The class information is available when the code language of the software under test is Objective-C code language, and can be adapted to be modified when the code language of the software under test is other languages. Other functions or upper-level modules; the test object can be the object that calls the unit test method, the input parameters correspond to the input variables of the specific software unit, and the output expected results correspond to the output variables of the software unit.

在一些实施例中,获取单元测试用例的基础数据,可以包括以下至少一种:通过采集模块采集所述待测软件的软件运行数据,并解析所述软件运行数据得到所述单元测试用例的基础数据;基于所述待测软件的已有的单元测试用例的基础数据,采用启发式算法生成所述单元测试用例的基础数据;响应于用户的输入操作,获取所述单元测试用例的基础数据。In some embodiments, acquiring the basic data of the unit test case may include at least one of the following: collecting the software operation data of the software under test through a collection module, and analyzing the software operation data to obtain the basis of the unit test case data; based on the basic data of the existing unit test case of the software to be tested, use a heuristic algorithm to generate the basic data of the unit test case; in response to the user's input operation, obtain the basic data of the unit test case.

其中,采集模块可以是用于采集软件运行数据的功能模块,在单元测试套件中设置,软件运行数据可以是软件日常运行时不同软件单元所产生的数据,具体数据类型不限。启发式算法可以是一个基于直观或经验构造的算法,在可接受的计算时间和空间下给出待解决组合优化问题每一个实例的一个可行解,在本公开实施例中可以通过启发式算法生成新的单元测试用例的基础数据,启发式算法可以包括多个,本公开实施例不限,例如启发式算法可以包括遗传算法、模拟退火算法、蚁群算法等等。The acquisition module may be a functional module for collecting software operation data, and is set in the unit test suite. The software operation data may be data generated by different software units during the daily operation of the software, and the specific data type is not limited. The heuristic algorithm can be an algorithm constructed based on intuition or experience, which provides a feasible solution for each instance of the combinatorial optimization problem to be solved under acceptable computing time and space, and can be generated by the heuristic algorithm in the embodiment of the present disclosure. The basic data of the new unit test case may include multiple heuristic algorithms, and the embodiment of the present disclosure is not limited. For example, the heuristic algorithm may include a genetic algorithm, a simulated annealing algorithm, an ant colony algorithm, and the like.

单元测试装置在获取单元测试用例的基础数据时,一种方式可以通过采集模块采集待测软件的软件运行数据,并通过解析软件运行数据得到单元测试用例的基础数据,例如以Objective-C语言的待测软件为例,采集模块可以为hook objc_msgSend函数,采集OC方法的寄存器及堆栈上下文数据,并解析上下文数据得到OC法的实参列表及结果,也即单元测试用例的基础数据;而针对C/C++等静态语言则可以通过插桩的方式达到类似的效果;另一种方式可以基于待测软件的已有的单元测试用例的基础数据,采用启发式算法生成新的单元测试用例的基础数据,例如以启发式算法为遗传算法为例,将每个已有的单元测试用例的基础数据看成一个基因片段,以覆盖率作为适应度,通过遗传因子的随机生成、杂交、变异等行为,不断生成新的单元测试用例的基础数据;再一种方式可以响应于用户的输入操作,获取用户输入的单元测试用例的基础数据,用户即为开发人员,也即开发人员可以手动录入单元测试用例的基础数据,具体输入的方式不限,例如可以由开发人员直接编写,也可以通过预设的交互系统输入。When the unit testing device obtains the basic data of the unit test case, one method can collect the software operation data of the software under test through the acquisition module, and obtain the basic data of the unit test case by analyzing the software operation data, for example, in Objective-C language. Taking the software under test as an example, the acquisition module can be the hook objc_msgSend function, which collects the registers and stack context data of the OC method, and parses the context data to obtain the actual parameter list and results of the OC method, that is, the basic data of the unit test case; /C++ and other static languages can achieve a similar effect through instrumentation; another method can be based on the basic data of the existing unit test cases of the software under test, using a heuristic algorithm to generate the basic data of new unit test cases For example, taking the heuristic algorithm as the genetic algorithm as an example, the basic data of each existing unit test case is regarded as a gene segment, and the coverage rate is used as the fitness. The basic data of new unit test cases is continuously generated; another way can respond to the user's input operation to obtain the basic data of the unit test case input by the user. The user is the developer, that is, the developer can manually enter the unit test case. The basic data of , the specific input method is not limited, for example, it can be directly written by the developer, or input through a preset interactive system.

上述三种方式均可以实现单元测试用例的基础数据的获取,提升了基础数据获取的效率和多样性。The above three methods can all realize the acquisition of basic data of unit test cases, which improves the efficiency and diversity of basic data acquisition.

步骤102、将基础数据采用预设格式表示,得到目标数据。Step 102: Represent the basic data in a preset format to obtain target data.

其中,预设格式可以是一种通用的数据规范或数据格式,本公开实施例中预设格式可以为一种具有可读性的数据格式,也即可读性较强,有助于维护和迭代,预设格式的具体格式可以根据实际情况设置,具体不限,例如预设格式可以设置为JSON格式或表格格式。目标数据可以转换为预设格式的基础数据,并且目标数据支持以下至少一种操作:增加、删除、修改。The preset format may be a general data specification or data format, and the preset format in the embodiment of the present disclosure may be a readable data format, that is, the readability is strong, which is helpful for maintaining and Iteration, the specific format of the preset format can be set according to the actual situation, and the specific format is not limited. For example, the preset format can be set to JSON format or table format. The target data can be converted into basic data in a preset format, and the target data supports at least one of the following operations: adding, deleting, and modifying.

本公开实施例中,单元测试装置在获取单元测试用例的基础数据之后,可以采用预设格式表示该基础数据获得对应的目标数据。In the embodiment of the present disclosure, after acquiring the basic data of the unit test case, the unit testing apparatus may use a preset format to represent the basic data to obtain corresponding target data.

示例性的,当预设格式为JSON格式,目标数据可以表示如下:Exemplarily, when the preset format is JSON format, the target data can be represented as follows:

{{

Figure BDA0003700628390000071
Figure BDA0003700628390000071

Figure BDA0003700628390000081
Figure BDA0003700628390000081

本方案中通过将单元测试用例的基础数据采用预设格式表示,一方面由于通用的数据存储格式方便存储至数据库,例如当预设格式为JSON格式,很多基于文档存储的非关系型数据库都支持JSON格式作为其数据存储格式,例如MongoDB、CouchDB、RavenDB等;另一方面基于预设格式的目标数据,例如基于JSON格式的目标数据,可以快速检索属于类及方法的所有测试用例,方便选择性地针对某些类和方法进行局部单元测试。In this solution, the basic data of the unit test case is represented in a preset format. On the one hand, because the general data storage format is convenient to store in the database, for example, when the default format is JSON format, many non-relational databases based on document storage support JSON format is used as its data storage format, such as MongoDB, CouchDB, RavenDB, etc.; on the other hand, based on target data in preset formats, such as target data based on JSON format, all test cases belonging to classes and methods can be quickly retrieved, which is convenient for selection. Locally unit tests certain classes and methods.

步骤103、在待测软件运行的过程中,基于目标数据补充上下文环境信息之后生成单元测试用例,并基于单元测试用例对待测软件执行单元测试。Step 103 , in the process of running the software under test, generate a unit test case after supplementing the context environment information based on the target data, and perform a unit test on the software under test based on the unit test case.

其中,待测软件可以是任意的需要进行单元测试的软件,本公开实施例对待测软件的类型和数量不作限定。The software to be tested may be any software that needs to be unit tested, and the type and quantity of the software to be tested are not limited in the embodiments of the present disclosure.

本公开实施例中,单元测试装置在将基础数据采用预设格式表示,、得到目标数据并存储之后,可以运行待测软件,并在待测软件运行的过程中,可以自动根据待测软件的语言特性获取对应的目标数据,并通过解析目标数据补充单元测试所需的上下文环境信息之后生成完整的单元测试用例,并执行各软件单元的单元测试方法,得到输出测试结果,之后根据目标数据中的输出期望结果与输出测试结果进行对比,判断是否符合预期,得到单元测试结果。In the embodiment of the present disclosure, the unit testing device can run the software to be tested after expressing the basic data in a preset format, obtain and store the target data, and automatically according to the software to be tested during the running process of the software to be tested. The language feature obtains the corresponding target data, and supplements the context information required by the unit test by parsing the target data to generate a complete unit test case, and executes the unit test method of each software unit to obtain the output test result, and then according to the target data. The expected output results are compared with the output test results to determine whether they meet the expectations, and the unit test results are obtained.

本公开的单元测试方案可以是一种无代码的自动化执行单元测试的方案,能够在软件运行的过程中自动获取预设格式的基础数据并生成单元测试用例,通过动态注入单元测试用例,减少单元测试用例的编写及维护成本,帮助开发人员节省人力,提升单元测试覆盖率及质量。The unit testing solution of the present disclosure can be a code-free automatic execution unit testing solution, which can automatically obtain basic data in a preset format and generate unit test cases during the software running process. The writing and maintenance costs of test cases help developers save manpower and improve unit test coverage and quality.

本公开实施例提供的单元测试方案,获取单元测试用例的基础数据;将基础数据采用预设格式表示,得到目标数据;在待测软件运行的过程中,基于目标数据补充上下文环境信息之后生成单元测试用例,并基于单元测试用例对待测软件执行单元测试。采用上述技术方案,通过获取单元测试用例所需的基础数据,并将基础数据采用预设格式表示,在软件运行过程中基于预设格式的基础数据补充上下文环境信息之后可以生成完整的单元测试用例并执行单元测试,在迭代和维护时仅仅需要对单元测试用例的基础数据进行迭代和维护,无需再修改代码,极大降低了单元测试用例的迭代和维护成本,进而提升了单元测试的覆盖率及质量,提升了软件的迭代速度。The unit testing solution provided by the embodiment of the present disclosure obtains the basic data of the unit test case; expresses the basic data in a preset format to obtain the target data; in the process of running the software under test, the unit is generated after supplementing the contextual environment information based on the target data Test cases, and perform unit testing of the software under test based on the unit test cases. With the above technical solution, by acquiring the basic data required by the unit test case and expressing the basic data in a preset format, a complete unit test case can be generated after supplementing the contextual environment information based on the basic data in the preset format during the software running process And execute unit tests. During iteration and maintenance, it is only necessary to iterate and maintain the basic data of unit test cases without modifying the code, which greatly reduces the iteration and maintenance costs of unit test cases, thereby improving the coverage of unit tests. and quality, improving the iteration speed of the software.

示例性的,图2为本公开实施例提供的另一种单元测试方法的流程示意图,如图2所示,在一种可行的实施方式中,当待测软件的代码语言为动态调用类型,上下文环境信息包括临时变量,上述步骤103可以包括如下步骤:Exemplarily, FIG. 2 is a schematic flowchart of another unit testing method provided by an embodiment of the present disclosure. As shown in FIG. 2 , in a feasible implementation manner, when the code language of the software to be tested is a dynamic call type, The context information includes temporary variables, and the above step 103 may include the following steps:

步骤201、获取并解析目标数据,获得测试对象的参数类型、输入参数的参数类型以及参数值。Step 201: Acquire and parse the target data, and obtain the parameter type of the test object, the parameter type of the input parameter, and the parameter value.

其中,待测软件的代码语言为动态调用类型表示待测软件的代码中的函数、方法等可以互相动态调用,例如Objective-C语言和Python语言等都属于动态调用类型。测试对象可以是调用单元测试方法的对象,也属于一种参数;输入参数对应具体软件单元的输入变量。Among them, the code language of the software under test is a dynamic call type, which means that functions, methods, etc. in the code of the software under test can dynamically call each other. For example, the Objective-C language and the Python language belong to the dynamic call type. The test object can be the object that calls the unit test method, and also belongs to a kind of parameter; the input parameter corresponds to the input variable of the specific software unit.

单元测试装置在待测软件运行的过程中基于目标数据补充上下文环境信息之后生成单元测试用例时,可以先判断待测软件的代码语言是否为动态调用类型,若是,则可以基于语言特性从数据库中获取所需的目标数据,也即基于该代码语言下的函数等获取目标数据并解析,获得测试对象的参数类型、输入参数的参数类型以及参数值,以备后用。例如,当代码语言为Objective-C语言为例,可以基于Objective-C语言的NSInvocation类获取目标数据并解析。When the unit testing device generates a unit test case after supplementing the context information based on the target data during the running of the software to be tested, it can first determine whether the code language of the software to be tested is a dynamic call type, and if so, it can retrieve the data from the database based on the language characteristics. Obtain the required target data, that is, obtain and parse the target data based on functions in the code language, etc., and obtain the parameter type of the test object, the parameter type of the input parameter, and the parameter value for later use. For example, when the code language is the Objective-C language as an example, the target data can be obtained and parsed based on the NSInvocation class of the Objective-C language.

步骤202、基于测试对象的参数类型构造对应的第一临时变量,并基于输入参数的参数类型以及参数值,构造输入参数的第二临时变量。Step 202 , construct a corresponding first temporary variable based on the parameter type of the test object, and construct a second temporary variable of the input parameter based on the parameter type and parameter value of the input parameter.

其中,临时变量可以是单元测试执行时所需的变量,软件执行时需要在内存中分配一块内存来存储测试时的参数,临时变量可以是对应这块内存的一个变量,并且上述构造上下文环境的含义即为构造临时变量。临时变量可以包括第一临时变量和第二临时变量。第一临时变量可以是指测试对象的临时变量,第二临时变量可以是输入参数的临时变量,通过第一和第二来进行区分。Among them, the temporary variable can be a variable required when the unit test is executed. When the software is executed, a piece of memory needs to be allocated in the memory to store the parameters during the test. The temporary variable can be a variable corresponding to this piece of memory, and the above construction context environment The meaning is to construct a temporary variable. The temporary variables may include a first temporary variable and a second temporary variable. The first temporary variable may refer to the temporary variable of the test object, and the second temporary variable may be the temporary variable of the input parameter, which is distinguished by the first and the second.

具体地,单元测试装置可以根据测试对象的参数类型构造对应的第一临时变量,并可以根据输入参数的参数类型和参数值构造对应的第二临时变量,构造方式可以采用相关技术,例如,当测试对象的参数类型为int类型的话,可以构造一个int变量。Specifically, the unit testing device can construct a corresponding first temporary variable according to the parameter type of the test object, and can construct a corresponding second temporary variable according to the parameter type and parameter value of the input parameter, and the construction method can adopt related technologies, for example, when If the parameter type of the test object is of type int, you can construct an int variable.

步骤203、将第一临时变量、第二临时变量以及从目标数据中提取的单元测试方法的名称、类信息、输出预期结果,组合确定为单元测试用例。Step 203: Determine the combination of the first temporary variable, the second temporary variable, and the name, class information, and output expected result of the unit test method extracted from the target data as a unit test case.

步骤204、将第一临时变量和第二临时变量作为单元测试方法的实参,基于单元测试方法的名称和类信息执行单元测试方法,得到输出测试结果。Step 204: Use the first temporary variable and the second temporary variable as actual parameters of the unit test method, execute the unit test method based on the name and class information of the unit test method, and obtain an output test result.

其中,实参可以理解为调用函数或方法时传输的参数,实参可以时常量、变量、表达式等。输出测试结果可以当前经过测试得到的一个结果。Among them, the actual parameter can be understood as the parameter transmitted when the function or method is called, and the actual parameter can be constant, variable, expression, etc. The output test result can be a result obtained by the current test.

具体地,单元测试装置在生成单元测试用例之后,基于单元测试用例对待测软件执行单元测试时,可以将上述第一临时变量和第二临时变量作为单元测试方法的实参,基于单元测试方法的名称和类信息获取单元测试方法并自动传参至单元测试方法并执行,得到输出测试结果。Specifically, after generating the unit test case, the unit test apparatus may use the above-mentioned first temporary variable and second temporary variable as the actual parameters of the unit test method when the unit test is performed on the software to be tested based on the unit test case. The name and class information are obtained from the unit test method, and parameters are automatically passed to the unit test method and executed, and the output test result is obtained.

步骤205、将输出测试结果与输出预启结果进行对比,得到单元测试结果。Step 205: Compare the output test result with the output pre-start result to obtain the unit test result.

其中,单元测试结果可以是表征单元测试是否符合预期的结果。Wherein, the unit test result may be a result that characterizes whether the unit test meets the expectations.

本公开实施例中,单元测试装置在得到输出测试结果之后,可以根据目标数据中的输出期望结果与输出测试结果进行对比,判断是否符合预期,进而得到单元测试结果。In the embodiment of the present disclosure, after obtaining the output test result, the unit testing apparatus can compare the output expected result in the target data with the output test result to determine whether it meets the expectation, and then obtain the unit test result.

上述方案中,针对动态调用类型的代码语言,可以基于语言特性自动补充单元测试所需的上下文环境信息,执行单元测试收集结果,提升单元测试效率,并减少单元测试用例的编写及维护成本。In the above solution, for the code language of the dynamic call type, the context information required by the unit test can be automatically supplemented based on the language characteristics, the unit test is executed to collect the results, the unit test efficiency is improved, and the writing and maintenance cost of the unit test case can be reduced.

在一些实施例中,当待测软件的代码语言为非动态调用类型,上下文环境信息为上下文环境代码,在待测软件运行的过程中,基于目标数据补充上下文环境信息之后生成单元测试用例,并基于单元测试用例对待测软件执行单元测试,可以包括:通过预设转换模块将目标数据转换为待测软件的代码语言对应的代码格式数据,并在所述代码格式数据中添加上下文环境代码生成代码格式的单元测试用例,并将代码格式的单元测试用例汇编嵌入待测软件的代码中;在待测软件的运行过程中,基于代码格式的单元测试用例执行单元测试。In some embodiments, when the code language of the software under test is a non-dynamic calling type, and the context information is the context code, during the running of the software under test, the unit test case is generated after supplementing the context information based on the target data, and Performing a unit test on the software under test based on the unit test case may include: converting target data into code format data corresponding to the code language of the software under test through a preset conversion module, and adding a contextual environment code generation code to the code format data Format unit test cases, and assemble and embed the code format unit test cases into the code of the software under test; during the running process of the software under test, unit tests are performed based on the code format unit test cases.

其中,待测软件的代码语言为非动态调用类型表示待测软件的代码中的函数、方法等不支持动态调用,例如C语言、C++语言等都属于非动态调用类型。预设转换模块可以是用于对目标数据进行语言转换并补充上下文环境代码生成单元测试用例的功能模块,为代码语言为非动态调用类型的待测软件设置,该模块对于单元测试用例的开发人员来说可以是一个黑盒的功能模块,不影响开发人员对单元测试用例的维护。Among them, the code language of the software under test is a non-dynamic calling type, which means that the functions and methods in the code of the software under test do not support dynamic calling. For example, C language and C++ language are all non-dynamic calling types. The preset conversion module can be a functional module used to perform language conversion on target data and supplement the context code to generate unit test cases. It is set for the software under test whose code language is a non-dynamic call type. For example, it can be a black box function module, which does not affect the maintenance of unit test cases by developers.

具体地,当待测软件的代码语言为非动态调用类型,单元测试装置可以通过预先设置的预设转换模块将目标数据转换与待测软件的代码语言相同的或者中间代码的代码格式数据,并在该代码格式数据中添加上下文环境代码得到代码格式的单元测试用例,并汇编待测软件的代码的算法,将代码格式的单元测试用例临时嵌入到软件中,以在待测软件的运行过程中,基于该代码格式的单元测试用例来自动执行单元测试。Specifically, when the code language of the software to be tested is of a non-dynamic calling type, the unit testing device can convert the target data into data in the same code language as the code language of the software to be tested or the code format data of the intermediate code through a preset preset conversion module, and Add context code to the code format data to obtain unit test cases in code format, assemble the algorithm of the code of the software under test, and temporarily embed the unit test cases in code format into the software, so that during the running process of the software under test , to automatically execute unit tests based on unit test cases in this code format.

上述方案中,针对非动态调用类型的代码语言,可以通过转换模块自动生成代码形式的单元测试用例并在待测软件的代码中内部封装起来,In the above solution, for the non-dynamic calling type code language, the unit test case in the form of code can be automatically generated by the conversion module and encapsulated in the code of the software to be tested.

针对非动态语言,可以设计一套基于测试用例的输入输出自动生成测试代码的方案,测试用例编写人员可以不关心测试代码只关心测试用例的输入输出。将自动生成的测试代码内部封装起来,在迭代和维护时也仅仅需要对单元测试用例的基础数据进行迭代和维护,无需再修改代码,减少了单元测试用例的迭代和维护成本。For non-dynamic languages, a scheme can be designed to automatically generate test code based on the input and output of test cases. Test case writers can only care about the input and output of test cases without caring about test code. The automatically generated test code is encapsulated internally, and only the basic data of the unit test case needs to be iterated and maintained during iteration and maintenance, without the need to modify the code, which reduces the iteration and maintenance cost of the unit test case.

接下来通过一个具体的示例对本公开实施例的单元测试方法进行进一步说明。示例性的,图3为本公开实施例提供的一种单元测试的示意图,如图3所示,图中展示了一个完整的单元测试过程,图中无填充的部分表示需要开发人员人工干预的流程,具有灰色填充的部分表示可实现自动化的流程,具体可以包括:单元测试用例的基础数据的获取,可以通过图中三种方式获取,包括:开发人员录入、采集软件运行数据并解析以及启发式算法自动生成,之后可以将基础数据采用符合规范也即预设格式表示得到的目标数据存储在单元测试用例数据库中;针对需要进行单元测试的待测软件,在待测软件运行的过程中,可以自动获取目标数据,并基于目标数据补充上下文环境信息之后生成的单元测试用例定期自动针对待测软件执行单元测试;根据收集到的各个单元测试用例的单元测试结果,计算单元测试用例的通过率,收集单元测试执行的代码覆盖率;执行完单元测试后,软件开发人员可以针对执行失败的单元测试用例进行核对,评估是否符合软件新版本要求,最后可以根据单元测试用例的通过率来对软件质量进行评估。Next, the unit testing method of the embodiment of the present disclosure will be further described through a specific example. Exemplarily, FIG. 3 is a schematic diagram of a unit test provided by an embodiment of the present disclosure. As shown in FIG. 3 , a complete unit test process is shown in the figure, and the unfilled part in the figure indicates that the manual intervention of the developer is required. Process, the part with gray fill indicates the process that can be automated, which can include: acquisition of basic data of unit test cases, which can be acquired in three ways in the figure, including: developer input, collection of software operation data and analysis, and inspiration After that, the target data obtained from the basic data can be stored in the unit test case database in the unit test case database; for the software under test that needs to be unit tested, in the process of running the software under test, The target data can be automatically obtained, and the unit test cases generated after supplementing the contextual environment information based on the target data regularly and automatically perform unit tests on the software under test; calculate the pass rate of the unit test cases according to the collected unit test results of each unit test case , to collect the code coverage of unit test execution; after the unit test is executed, software developers can check the unit test cases that fail to execute, evaluate whether they meet the requirements of the new software version, and finally can evaluate the software according to the pass rate of the unit test cases. quality is assessed.

本方案中,通过提供一种无代码自动化的单元测试套件,通过自动采集线上软件运行数据生成单元测试用例的基础数据,结合基于启发式算法生成随机的基础数据和人工部分录入,能够全面覆盖单元测试用例所需的基础数据,之后自动补充上下文环境信息生成单元测试用例并执行单元测试,对于开发人员来说只需要基于约定的格式录入即可进行单元测试,无需编写单元测试代码和依赖原生代码测试套件,降低单元测试用例的编写成本,并且具有自动生成单元测试用例的能力,在迭代和维护时仅仅需要对单元测试用例的基础数据进行迭代和维护,无需再修改代码,能有效节省单元测试用例维护及迭代人员的人力物力,极大降低了单元测试用例的迭代和维护成本,进而能够有效提升软件单元测试的覆盖率及质量,有效保障软件质量。In this solution, by providing a code-free automated unit test suite, the basic data of unit test cases is generated by automatically collecting online software operation data, and combined with the generation of random basic data and manual partial input based on heuristic algorithm, it can comprehensively cover The basic data required by the unit test case, and then automatically supplement the context information to generate the unit test case and execute the unit test. For the developer, the unit test only needs to be entered based on the agreed format. There is no need to write unit test code and rely on native The code test suite reduces the cost of writing unit test cases, and has the ability to automatically generate unit test cases. During iteration and maintenance, only the basic data of the unit test cases need to be iterated and maintained, without the need to modify the code, which can effectively save units The manpower and material resources of test case maintenance and iteration personnel greatly reduce the iteration and maintenance costs of unit test cases, which can effectively improve the coverage and quality of software unit testing, and effectively ensure software quality.

图4为本公开实施例提供的一种单元测试装置的结构示意图,该装置可由软件和/或硬件实现,一般可集成在电子设备中。如图4所示,该装置包括:FIG. 4 is a schematic structural diagram of a unit testing apparatus provided by an embodiment of the present disclosure. The apparatus may be implemented by software and/or hardware, and may generally be integrated into an electronic device. As shown in Figure 4, the device includes:

获取模块401,用于获取单元测试用例的基础数据;an acquisition module 401, used for acquiring basic data of a unit test case;

格式模块402,用于将所述基础数据采用预设格式表示,得到目标数据;a format module 402, configured to represent the basic data in a preset format to obtain target data;

测试模块403,用于在待测软件运行的过程中,基于所述目标数据补充上下文环境信息之后生成所述单元测试用例,并基于所述单元测试用例对所述待测软件执行单元测试。The testing module 403 is configured to generate the unit test case after supplementing the context information based on the target data during the running process of the software under test, and perform unit testing on the software under test based on the unit test case.

可选的,所述获取模块401包括以下至少一个:Optionally, the obtaining module 401 includes at least one of the following:

第一单元,用于通过采集模块采集所述待测软件的软件运行数据,并解析所述软件运行数据得到所述单元测试用例的基础数据;The first unit is used to collect the software operation data of the software to be tested through the acquisition module, and analyze the software operation data to obtain the basic data of the unit test case;

第二单元,用于基于所述待测软件的已有的单元测试用例的基础数据,采用启发式算法生成所述单元测试用例的基础数据;The second unit is used to generate the basic data of the unit test case by adopting a heuristic algorithm based on the basic data of the existing unit test case of the software to be tested;

第三单元,用于响应于用户的输入操作,获取所述单元测试用例的基础数据。The third unit is configured to acquire the basic data of the unit test case in response to the user's input operation.

可选的,所述基础数据包括单元测试方法的名称、类信息、测试对象、输入参数和输出预期结果。Optionally, the basic data includes the name of the unit test method, class information, test objects, input parameters, and output expected results.

可选的,当所述待测软件的代码语言为动态调用类型,所述上下文环境信息包括临时变量,所述测试模块403包括生成单元,用于:Optionally, when the code language of the software under test is a dynamic call type, the context information includes a temporary variable, and the test module 403 includes a generating unit for:

获取并解析所述目标数据,获得所述测试对象的参数类型、所述输入参数的参数类型以及参数值;Obtain and parse the target data, and obtain the parameter type of the test object, the parameter type of the input parameter and the parameter value;

基于所述测试对象的参数类型构造对应的第一临时变量,并基于所述输入参数的参数类型以及参数值,构造所述输入参数的第二临时变量,所述临时变量包括所述第一临时变量和所述第二临时变量;A corresponding first temporary variable is constructed based on the parameter type of the test object, and a second temporary variable of the input parameter is constructed based on the parameter type and parameter value of the input parameter, and the temporary variable includes the first temporary variable variable and the second temporary variable;

将所述第一临时变量、所述第二临时变量以及从所述目标数据中提取的所述单元测试方法的名称、所述类信息、所述输出预期结果,组合确定为所述单元测试用例。Determining a combination of the first temporary variable, the second temporary variable, the name of the unit test method extracted from the target data, the class information, and the expected output result as the unit test case .

可选的,所述测试模块403包括执行单元,用于:Optionally, the test module 403 includes an execution unit for:

将所述第一临时变量和所述第二临时变量作为所述单元测试方法的实参,基于所述单元测试方法的名称和所述类信息执行所述单元测试方法,得到输出测试结果;The first temporary variable and the second temporary variable are used as the actual parameters of the unit test method, and the unit test method is executed based on the name of the unit test method and the class information to obtain an output test result;

将所述输出测试结果与所述输出预启结果进行对比,得到单元测试结果。The output test result is compared with the output pre-start result to obtain a unit test result.

可选的,当所述待测软件的代码语言为非动态调用类型,所述上下文环境信息为上下文环境代码,所述测试模块403用于:Optionally, when the code language of the software under test is a non-dynamic calling type, the context information is a context code, and the test module 403 is used for:

通过预设转换模块将所述目标数据转换为所述待测软件的代码语言对应的代码格式数据,并在所述代码格式数据中添加上下文环境代码生成代码格式的单元测试用例,将所述代码格式的单元测试用例汇编嵌入所述待测软件的代码中;The target data is converted into the code format data corresponding to the code language of the software to be tested by the preset conversion module, and the context environment code is added to the code format data to generate a unit test case in the code format, and the code The unit test case assembly in the format is embedded in the code of the software to be tested;

在所述待测软件的运行过程中,基于所述代码格式的单元测试用例执行单元测试。During the running process of the software under test, a unit test is performed based on the unit test case in the code format.

可选的,所述预设格式为一种具有可读性的数据格式,所述目标数据支持以下至少一种操作:增加、删除、修改。Optionally, the preset format is a readable data format, and the target data supports at least one of the following operations: adding, deleting, and modifying.

本公开实施例所提供的单元测试装置可执行本公开任意实施例所提供的单元测试方法,具备执行方法相应的功能模块和有益效果。The unit testing apparatus provided by the embodiment of the present disclosure can execute the unit testing method provided by any embodiment of the present disclosure, and has functional modules and beneficial effects corresponding to the execution method.

本公开实施例还提供了一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时本公开任意实施例所提供的单元测试方法。An embodiment of the present disclosure also provides a computer program product, including a computer program/instruction, when the computer program/instruction is executed by a processor, the unit testing method provided by any embodiment of the present disclosure.

图5为本公开实施例提供的一种电子设备的结构示意图。下面具体参考图5,其示出了适于用来实现本公开实施例中的电子设备500的结构示意图。本公开实施例中的电子设备500可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图5示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. Referring specifically to FIG. 5 below, it shows a schematic structural diagram of an electronic device 500 suitable for implementing an embodiment of the present disclosure. The electronic device 500 in the embodiment of the present disclosure may include, but is not limited to, such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), an in-vehicle terminal ( For example, mobile terminals such as car navigation terminals) and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in FIG. 5 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.

如图5所示,电子设备500可以包括处理装置(例如中央处理器、图形处理器等)501,其可以根据存储在只读存储器(ROM)502中的程序或者从存储装置508加载到随机访问存储器(RAM)503中的程序而执行各种适当的动作和处理。在RAM 503中,还存储有电子设备500操作所需的各种程序和数据。处理装置501、ROM 502以及RAM 503通过总线504彼此相连。输入/输出(I/O)接口505也连接至总线504。As shown in FIG. 5 , an electronic device 500 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 501 that may be loaded into random access according to a program stored in a read only memory (ROM) 502 or from a storage device 508 Various appropriate actions and processes are executed by the programs in the memory (RAM) 503 . In the RAM 503, various programs and data necessary for the operation of the electronic device 500 are also stored. The processing device 501 , the ROM 502 , and the RAM 503 are connected to each other through a bus 504 . An input/output (I/O) interface 505 is also connected to bus 504 .

通常,以下装置可以连接至I/O接口505:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置506;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置507;包括例如磁带、硬盘等的存储装置508;以及通信装置509。通信装置509可以允许电子设备500与其他设备进行无线或有线通信以交换数据。虽然图5示出了具有各种装置的电子设备500,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Typically, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 507 such as a computer; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509 . Communication means 509 may allow electronic device 500 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 5 shows electronic device 500 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置509从网络上被下载和安装,或者从存储装置508被安装,或者从ROM 502被安装。在该计算机程序被处理装置501执行时,执行本公开实施例的单元测试方法中限定的上述功能。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication device 509 , or from the storage device 508 , or from the ROM 502 . When the computer program is executed by the processing device 501, the above-mentioned functions defined in the unit testing method of the embodiment of the present disclosure are executed.

需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.

在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText TransferProtocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and server can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium (eg, a communications network) interconnected. Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device.

上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取单元测试用例的基础数据;将所述基础数据采用预设格式表示,得到目标数据;在待测软件运行的过程中,基于所述目标数据补充上下文环境信息之后生成所述单元测试用例,并基于所述单元测试用例对所述待测软件执行单元测试。The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: acquires the basic data of the unit test case; represents the basic data in a preset format , to obtain target data; in the process of running the software under test, the unit test case is generated after supplementing the context information based on the target data, and the unit test is performed on the software under test based on the unit test case.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and This includes conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.

描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。The units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner. Among them, the name of the unit does not constitute a limitation of the unit itself under certain circumstances.

本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, and should also cover, without departing from the above-mentioned disclosed concept, the technical solutions formed by the above-mentioned technical features or Other technical solutions formed by any combination of its equivalent features. For example, a technical solution is formed by replacing the above features with the technical features disclosed in the present disclosure (but not limited to) with similar functions.

此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。Additionally, although operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, although the above discussion contains several implementation-specific details, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.

尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。Although the subject matter has been described in language specific to structural features and/or logical acts of method, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.

Claims (10)

1. A method of unit testing, comprising:
acquiring basic data of a unit test case;
expressing the basic data by adopting a preset format to obtain target data;
and in the running process of the software to be tested, generating the unit test case after supplementing context environment information based on the target data, and executing unit test on the software to be tested based on the unit test case.
2. The method of claim 1, wherein obtaining the base data of the unit test case comprises at least one of:
acquiring software running data of the software to be tested through an acquisition module, and analyzing the software running data to obtain basic data of the unit test case;
generating basic data of the unit test cases by adopting a heuristic algorithm based on the basic data of the existing unit test cases of the software to be tested;
and responding to the input operation of the user, and acquiring basic data of the unit test case.
3. The method of claim 1, wherein the base data includes a name of a unit test method, class information, a test object, input parameters, and an output expected result.
4. The method of claim 3, wherein when the code language of the software under test is a dynamic call type, the context information includes a temporary variable, and generating a unit test case after supplementing the context information based on the target data comprises:
acquiring and analyzing the target data to acquire the parameter type of the test object, the parameter type of the input parameter and the parameter value;
constructing a corresponding first temporary variable based on the parameter type of the test object, and constructing a second temporary variable of the input parameter based on the parameter type and the parameter value of the input parameter, wherein the temporary variable comprises the first temporary variable and the second temporary variable;
and combining the first temporary variable, the second temporary variable, the name of the unit test method extracted from the target data, the class information and the output expected result to determine the unit test case.
5. The method of claim 4, wherein performing unit testing on the software under test based on the unit test cases comprises:
taking the first temporary variable and the second temporary variable as actual parameters of the unit testing method, and executing the unit testing method based on the name of the unit testing method and the class information to obtain an output testing result;
and comparing the output test result with the output pre-starting result to obtain a unit test result.
6. The method of claim 1, wherein when the code language of the software to be tested is a non-dynamic call type, and the context environment information is context environment code, in a process of running the software to be tested, generating the unit test case after supplementing the context environment information based on the target data, and performing unit test on the software to be tested based on the unit test case includes:
converting the target data into code format data corresponding to the code language of the software to be tested through a preset conversion module, adding context environment codes into the code format data to generate unit test cases in a code format, and compiling the unit test cases in the code format to be embedded into the codes of the software to be tested;
and executing unit test based on the unit test case of the code format in the running process of the software to be tested.
7. The method according to any one of claims 1-6, wherein the predetermined format is a data format with readability, and the target data supports at least one of: addition, deletion and modification.
8. A unit testing apparatus, comprising:
the acquisition module is used for acquiring basic data of the unit test case;
the format module is used for representing the basic data by adopting a preset format to obtain target data;
and the test module is used for generating the unit test case after supplementing the context environment information based on the target data in the running process of the software to be tested, and testing the unit execution unit of the software to be tested based on the unit test case.
9. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the unit testing method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program for performing the unit testing method of any of the preceding claims 1-7.
CN202210692374.9A 2022-06-17 2022-06-17 A unit testing method, device, equipment and medium Active CN114996152B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210692374.9A CN114996152B (en) 2022-06-17 2022-06-17 A unit testing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210692374.9A CN114996152B (en) 2022-06-17 2022-06-17 A unit testing method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN114996152A true CN114996152A (en) 2022-09-02
CN114996152B CN114996152B (en) 2024-12-20

Family

ID=83034778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210692374.9A Active CN114996152B (en) 2022-06-17 2022-06-17 A unit testing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114996152B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112841A (en) * 2023-08-30 2023-11-24 赛力斯汽车有限公司 Data processing method and device based on use case data and computer readable storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101165658A (en) * 2006-10-18 2008-04-23 国际商业机器公司 Method and system for automatically generating unit test case of reproduced operation problem
US20080120602A1 (en) * 2006-11-21 2008-05-22 Microsoft Corporation Test Automation for Business Applications
CN102819488A (en) * 2012-06-29 2012-12-12 用友软件股份有限公司 Test processing device and test processing method
US20150007138A1 (en) * 2013-06-26 2015-01-01 Sap Ag Method and system for incrementally updating a test suite utilizing run-time application executions
CN107368406A (en) * 2016-05-11 2017-11-21 阿里巴巴集团控股有限公司 The method, apparatus and equipment of test application program
US20180210823A1 (en) * 2017-01-25 2018-07-26 Wipro Limited System and method for performing script-less unit testing
CN109726128A (en) * 2018-12-29 2019-05-07 亚信科技(中国)有限公司 A test case generation method, device and server
CN109992511A (en) * 2019-03-25 2019-07-09 口碑(上海)信息技术有限公司 Obtain the device and method of code tester coverage rate
US20200285563A1 (en) * 2019-03-08 2020-09-10 Fujitsu Limited Generating inputs for computer-program testing
CN113778849A (en) * 2021-03-15 2021-12-10 北京沃东天骏信息技术有限公司 Method, apparatus, device and storage medium for testing code
CN114168454A (en) * 2021-11-23 2022-03-11 叶嵩 Asynchronous testing method based on dynamic pile inserting-pile pinning technology

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101165658A (en) * 2006-10-18 2008-04-23 国际商业机器公司 Method and system for automatically generating unit test case of reproduced operation problem
US20080120602A1 (en) * 2006-11-21 2008-05-22 Microsoft Corporation Test Automation for Business Applications
CN102819488A (en) * 2012-06-29 2012-12-12 用友软件股份有限公司 Test processing device and test processing method
US20150007138A1 (en) * 2013-06-26 2015-01-01 Sap Ag Method and system for incrementally updating a test suite utilizing run-time application executions
CN107368406A (en) * 2016-05-11 2017-11-21 阿里巴巴集团控股有限公司 The method, apparatus and equipment of test application program
US20180210823A1 (en) * 2017-01-25 2018-07-26 Wipro Limited System and method for performing script-less unit testing
CN109726128A (en) * 2018-12-29 2019-05-07 亚信科技(中国)有限公司 A test case generation method, device and server
US20200285563A1 (en) * 2019-03-08 2020-09-10 Fujitsu Limited Generating inputs for computer-program testing
CN109992511A (en) * 2019-03-25 2019-07-09 口碑(上海)信息技术有限公司 Obtain the device and method of code tester coverage rate
CN113778849A (en) * 2021-03-15 2021-12-10 北京沃东天骏信息技术有限公司 Method, apparatus, device and storage medium for testing code
CN114168454A (en) * 2021-11-23 2022-03-11 叶嵩 Asynchronous testing method based on dynamic pile inserting-pile pinning technology

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
FWEIGL: "Getting context in AndroidTestCase or InstrumentationTestCase in Android Studio\'s Unit Test feature", Retrieved from the Internet <URL:https://stackoverflow.com/questions/28960898/getting-context-in-androidtestcase-or-instrumentationtestcase-in-android-studio> *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112841A (en) * 2023-08-30 2023-11-24 赛力斯汽车有限公司 Data processing method and device based on use case data and computer readable storage medium
CN117112841B (en) * 2023-08-30 2024-07-16 赛力斯汽车有限公司 Data processing method and device based on use case data and computer readable storage medium

Also Published As

Publication number Publication date
CN114996152B (en) 2024-12-20

Similar Documents

Publication Publication Date Title
CN111625473B (en) Interface test case generation method and device, storage medium and electronic equipment
CN111367791B (en) Method, device, medium and electronic equipment for generating test case
CN112596738B (en) Method and device for determining front-end page to be tested, storage medium and electronic equipment
CN112596720B (en) Business operation method, platform, electronic device and computer storage medium
CN111752834A (en) Automated testing method and device
CN112445820A (en) Data conversion method and device
CN114996152A (en) Unit testing method, device, equipment and medium
CN111797009B (en) Method and device for detecting code compatibility and electronic equipment
CN117910850B (en) Index data analysis engine, index data calculation device and calculation method
CN118916042A (en) Large language model analysis method, device and related equipment
CN112286808B (en) Application program testing method and device, electronic equipment and medium
CN118193353A (en) A method, device, electronic device and storage medium for determining difference information
CN115454956A (en) Log generation method, device, electronic device and storage medium
CN110471667A (en) A kind of method, apparatus, medium and electronic equipment for auditing source program
CN114036053B (en) Test method, device, readable medium and electronic device
CN119938533B (en) Test result analysis method, device, equipment and storage medium
CN116561015B (en) Map application testing method, electronic device and computer readable medium
CN111913737B (en) A method, device, equipment and storage medium for constructing a data service interface
CN117555542A (en) Transcoding method, transcoding device, electronic device and computer readable medium
CN119149411A (en) Code repairing method and device, electronic equipment and readable storage medium
CN120631425A (en) Code processing method, device, electronic device, storage medium and program product based on large language model
CN117271301A (en) Test method, test device, electronic equipment and medium
CN114328166A (en) Method, device and storage medium for acquiring performance information of AB test algorithm
CN119938533A (en) Test result analysis method, device, equipment and storage medium
CN116467178A (en) Database detection method, apparatus, electronic device and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant