技术领域Technical Field
本申请涉及软件自动测试技术领域,尤其涉及一种测试用例自动生成方法、装置、电子设备及存储介质。The present application relates to the technical field of software automatic testing, and in particular to a method, device, electronic device and storage medium for automatically generating test cases.
背景技术Background Art
随着移动互联网的发展,Android应用程序的数量和复杂性不断增加,测试这些应用程序的工作量也随之增加。传统的测试用例生成方式依赖于手工编写,既费时又费力,且容易遗漏细节,影响测试覆盖率和准确性。为了提高测试效率和覆盖率,自动化生成测试用例成为迫切需要解决的问题。With the development of mobile Internet, the number and complexity of Android applications are increasing, and the workload of testing these applications is also increasing. The traditional test case generation method relies on manual writing, which is time-consuming and laborious, and it is easy to miss details, affecting test coverage and accuracy. In order to improve test efficiency and coverage, automatic test case generation has become an urgent problem to be solved.
相关技术中,自动化生成测试用例的实现方式对界面元素和交互逻辑的识别不够智能,存在测试覆盖不全面、效率低、适应性差等问题。In the related art, the implementation method of automatically generating test cases is not intelligent enough in identifying interface elements and interaction logic, and has problems such as incomplete test coverage, low efficiency, and poor adaptability.
发明内容Summary of the invention
本申请旨在至少在一定程度上解决相关技术中的技术问题之一。The present application aims to solve one of the technical problems in the related art at least to some extent.
为此,本申请的第一个目的在于提出一种测试用例自动生成方法,以提高测试效率和测试覆盖率,解决相关技术中测试效率低的问题。To this end, the first purpose of this application is to propose a method for automatically generating test cases to improve test efficiency and test coverage and solve the problem of low test efficiency in related technologies.
本申请的第二个目的在于提出一种测试用例自动生成装置。The second objective of this application is to provide a test case automatic generation device.
本申请的第三个目的在于提出一种电子设备。The third objective of the present application is to provide an electronic device.
本申请的第四个目的在于提出一种计算机可读存储介质。A fourth objective of the present application is to provide a computer-readable storage medium.
本申请的第五个目的在于提出一种计算机程序产品。A fifth object of the present application is to provide a computer program product.
为达上述目的,本申请第一方面实施例提出了一种测试用例自动生成方法,包括:To achieve the above-mentioned purpose, the first embodiment of the present application proposes a method for automatically generating test cases, including:
识别应用界面中的界面布局,提取所述界面布局中各元素的属性信息;Identify the interface layout in the application interface, and extract attribute information of each element in the interface layout;
基于所述界面布局和所述各元素的属性信息,获取多个用户操作路径;Based on the interface layout and the attribute information of each element, obtaining multiple user operation paths;
基于所述多个用户操作路径,生成测试用例。Based on the multiple user operation paths, test cases are generated.
在一些实现方式中,所述识别应用界面中的界面布局,提取所述界面布局中各元素的属性信息;包括:In some implementations, the step of identifying an interface layout in an application interface and extracting attribute information of each element in the interface layout includes:
识别所述应用界面中的界面布局,获取UI层次结构;Identify the interface layout in the application interface and obtain the UI hierarchy;
解析所述UI层次结构,得到所述界面布局中各元素的属性信息。The UI hierarchy is parsed to obtain attribute information of each element in the interface layout.
在一些实现方式中,所述基于所述界面布局和所述各元素的属性信息,获取多个用户操作路径;包括:In some implementations, the acquiring multiple user operation paths based on the interface layout and the attribute information of each element includes:
基于所述界面布局和所述各元素的属性信息,识别所述各元素之间的交互逻辑;Based on the interface layout and the attribute information of each element, identifying the interaction logic between the elements;
基于所述交互逻辑,获取多个用户操作路径。Based on the interaction logic, multiple user operation paths are obtained.
在一些实现方式中,所述基于所述界面布局和所述各元素的属性信息,识别所述各元素之间的交互逻辑;包括:In some implementations, the identifying the interaction logic between the elements based on the interface layout and the attribute information of the elements includes:
基于所述界面布局和所述各元素的属性信息,获取所述各元素之间的相对关系和所述各元素的操作模式;其中,所述相对关系包括相对位置关系、依赖关系和触发条件;Based on the interface layout and the attribute information of each element, the relative relationship between the elements and the operation mode of each element are obtained; wherein the relative relationship includes a relative position relationship, a dependency relationship and a trigger condition;
基于所述各元素之间的相对关系和所述各元素对应的操作模式,识别所述各元素之间的交互逻辑。Based on the relative relationship between the elements and the operation modes corresponding to the elements, the interaction logic between the elements is identified.
在一些实现方式中,所述基于所述交互逻辑,获取多个用户操作路径,包括:In some implementations, obtaining multiple user operation paths based on the interaction logic includes:
基于所述各元素之间的相对关系和所述各元素对应的操作模式,获取用户行为模式;Based on the relative relationship between the elements and the operation modes corresponding to the elements, obtaining the user behavior mode;
基于所述交互逻辑和所述用户行为模式,获取多个用户操作路径。Based on the interaction logic and the user behavior pattern, multiple user operation paths are obtained.
在一些实现方式中,所述基于所述多个用户操作路径,生成测试用例;包括:In some implementations, the generating test cases based on the multiple user operation paths includes:
基于所述多个用户操作路径,生成多个测试路径;每个所述测试路径包括多个测试步骤,每个所述测试步骤对应一个用户操作;Based on the multiple user operation paths, multiple test paths are generated; each of the test paths includes multiple test steps, and each of the test steps corresponds to a user operation;
为所述测试路径中的关键测试步骤添加断言,所述断言用于验证操作结果是否符合预期;Add assertions to key test steps in the test path, where the assertions are used to verify whether the operation results meet expectations;
基于所述测试路径,生成测试用例结构;Based on the test path, generate a test case structure;
基于测试脚本模板和所述测试用例结构,生成测试用例脚本。Based on the test script template and the test case structure, a test case script is generated.
在一些实现方式中,所述生成测试用例之后,包括:In some implementations, after generating the test case, the following steps are performed:
对所述测试用例中测试路径中测试步骤进行去重操作,得到去重后的测试用例;Deduplication is performed on the test steps in the test path in the test case to obtain a deduplicated test case;
去除所述去重后的测试用例中的无效操作步骤,得到优化后的测试用例。Invalid operation steps in the deduplicated test case are removed to obtain an optimized test case.
为达上述目的,本申请第二方面实施例提出了一种测试用例自动生成装置,包括:To achieve the above-mentioned purpose, the second embodiment of the present application proposes a test case automatic generation device, comprising:
界面识别模块,用于识别应用界面中的界面布局,提取所述界面布局中各元素的属性信息;An interface recognition module, used to recognize the interface layout in the application interface and extract attribute information of each element in the interface layout;
路径获取模块,用于基于所述界面布局和所述各元素的属性信息,获取多个用户操作路径;A path acquisition module, used to acquire multiple user operation paths based on the interface layout and the attribute information of each element;
用例生成模块,用于基于所述多个用户操作路径,生成测试用例。The use case generation module is used to generate test cases based on the multiple user operation paths.
在一些实现方式中,所述界面识别模块,具体用于:In some implementations, the interface identification module is specifically used to:
识别所述应用界面中的界面布局,获取UI层次结构;Identify the interface layout in the application interface and obtain the UI hierarchy;
解析所述UI层次结构,得到所述界面布局中各元素的属性信息。The UI hierarchy is parsed to obtain attribute information of each element in the interface layout.
在一些实现方式中,所述路径获取模块,具体用于:In some implementations, the path acquisition module is specifically used to:
基于所述界面布局和所述各元素的属性信息,识别所述各元素之间的交互逻辑;Based on the interface layout and the attribute information of each element, identifying the interaction logic between the elements;
基于所述交互逻辑,获取多个用户操作路径。Based on the interaction logic, multiple user operation paths are obtained.
在一些实现方式中,所述路径获取模块,用于在基于所述界面布局和所述各元素的属性信息,识别所述各元素之间的交互逻辑时;用于:In some implementations, the path acquisition module is used to, when identifying the interaction logic between the elements based on the interface layout and the attribute information of the elements, to:
基于所述界面布局和所述各元素的属性信息,获取所述各元素之间的相对关系和所述各元素的操作模式;其中,所述相对关系包括相对位置关系、依赖关系和触发条件;Based on the interface layout and the attribute information of each element, the relative relationship between the elements and the operation mode of each element are obtained; wherein the relative relationship includes a relative position relationship, a dependency relationship and a trigger condition;
基于所述各元素之间的相对关系和所述各元素对应的操作模式,识别所述各元素之间的交互逻辑。Based on the relative relationship between the elements and the operation modes corresponding to the elements, the interaction logic between the elements is identified.
在一些实现方式中,所述路径获取模块,用于在基于所述交互逻辑,获取多个用户操作路径时,用于:In some implementations, the path acquisition module is used to, when acquiring multiple user operation paths based on the interaction logic,:
基于所述各元素之间的相对关系和所述各元素对应的操作模式,获取用户行为模式;Based on the relative relationship between the elements and the operation modes corresponding to the elements, obtaining the user behavior mode;
基于所述交互逻辑和所述用户行为模式,获取多个用户操作路径。Based on the interaction logic and the user behavior pattern, multiple user operation paths are obtained.
在一些实现方式中,所述用例生成模块,具体用于:In some implementations, the use case generation module is specifically used to:
基于所述多个用户操作路径,生成多个测试路径;每个所述测试路径包括多个测试步骤,每个所述测试步骤对应一个用户操作;Based on the multiple user operation paths, multiple test paths are generated; each of the test paths includes multiple test steps, and each of the test steps corresponds to a user operation;
为所述测试路径中的关键测试步骤添加断言,所述断言用于验证操作结果是否符合预期;Add assertions to key test steps in the test path, where the assertions are used to verify whether the operation results meet expectations;
基于所述测试路径,生成测试用例结构;Based on the test path, generate a test case structure;
基于测试脚本模板和所述测试用例结构,生成测试用例脚本。Based on the test script template and the test case structure, a test case script is generated.
在一些实现方式中,所述用例生成模块,还用于:In some implementations, the use case generation module is further configured to:
对所述测试用例中测试路径中测试步骤进行去重操作,得到去重后的测试用例;Deduplication is performed on the test steps in the test path in the test case to obtain a deduplicated test case;
去除所述去重后的测试用例中的无效操作步骤,得到优化后的测试用例。Invalid operation steps in the deduplicated test case are removed to obtain an optimized test case.
为达上述目的,本申请第三方面实施例提出了一种电子设备,包括:处理器,以及与所述处理器通信连接的存储器;所述存储器存储计算机执行指令;所述处理器执行所述存储器存储的计算机执行指令,以实现第一方面所述的方法。To achieve the above-mentioned purpose, the third aspect embodiment of the present application proposes an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect.
为达上述目的,本申请第四方面实施例提出了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现第一方面所述的方法。To achieve the above-mentioned purpose, the fourth aspect of the present application proposes a computer-readable storage medium, in which computer-readable storage medium is stored computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
为达上述目的,本申请第五方面实施例提出了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现第一方面所述的方法。To achieve the above-mentioned purpose, the fifth aspect of the present application proposes a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
本申请提供的测试用例自动生成方法、装置、电子设备及存储介质,通过识别应用界面中的界面布局,提取界面布局中各元素的属性信息;根据界面布局和各元素属性信息,自动生成测试用例。大大减少了手工编写测试用例的时间和人力成本,提高了测试效率。通过全面识别界面元素和交互逻辑,生成覆盖全面的测试用例,确保应用程序各功能和操作路径得到充分测试。The test case automatic generation method, device, electronic device and storage medium provided in the present application can automatically generate test cases based on the interface layout and the attribute information of each element in the interface layout by identifying the interface layout in the application interface. This greatly reduces the time and labor cost of manually writing test cases and improves the test efficiency. By comprehensively identifying the interface elements and interaction logic, comprehensive test cases are generated to ensure that all functions and operation paths of the application are fully tested.
本申请附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到。Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
图1为本申请实施例所提供的一种测试用例自动生成方法的流程示意图;FIG1 is a schematic diagram of a flow chart of a method for automatically generating test cases provided in an embodiment of the present application;
图2为本申请实施例所提供的一种测试用例自动生成装置的框图;FIG2 is a block diagram of a test case automatic generation device provided in an embodiment of the present application;
图3为本申请实施例所提供的一种电子设备的框图。FIG3 is a block diagram of an electronic device provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
下面详细描述本申请的实施例,实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本申请,而不能理解为对本申请的限制。The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
相关技术中,现有的自动化测试工具主要依赖于代码分析和手工录制回放的方法。例如,Appium和Robotium等工具,通过在应用中插入测试代码,记录用户操作并生成相应的测试脚本。还有一些工具通过静态代码分析来生成测试用例,分析应用程序的源代码,提取界面元素和交互逻辑,并生成相应的测试用例。这些方法在一定程度上提高了测试效率,但仍然存在不足,尤其是在界面复杂的应用程序中,难以保证全面的测试覆盖。此外,这些工具对测试人员的技术要求较高,需要测试人员熟悉编程和代码结构,对于缺乏技术背景的测试人员来说,使用起来较为困难。In the related art, existing automated testing tools mainly rely on code analysis and manual recording and playback methods. For example, tools such as Appium and Robotium insert test code into the application, record user operations and generate corresponding test scripts. There are also some tools that generate test cases through static code analysis, analyze the source code of the application, extract interface elements and interaction logic, and generate corresponding test cases. These methods have improved the testing efficiency to a certain extent, but there are still shortcomings, especially in applications with complex interfaces, it is difficult to ensure comprehensive test coverage. In addition, these tools have high technical requirements for testers, requiring testers to be familiar with programming and code structure, which is difficult to use for testers who lack technical background.
现有技术的主要缺点在于,依赖于手工标注和录制回放,存在以下几个具体问题对界面元素和交互逻辑的识别不够智能:The main disadvantage of the existing technology is that it relies on manual annotation and recording and playback, and has the following specific problems: the recognition of interface elements and interaction logic is not intelligent enough:
a.测试覆盖不全面:由于手工编写和录制回放的方法,容易遗漏某些操作路径和边界情况,导致测试覆盖率不足。a. Incomplete test coverage: Due to the manual writing and recording and playback methods, some operation paths and boundary conditions are easily missed, resulting in insufficient test coverage.
b.效率低下:手工编写测试用例需要大量的时间和人力资源,且每次应用更新后都需要重新编写或录制,工作量巨大。b. Inefficiency: Manually writing test cases requires a lot of time and human resources, and they need to be rewritten or recorded every time the application is updated, which is a huge workload.
c.依赖技术背景:现有自动化测试工具通常需要测试人员具备一定的编程技能,对非技术背景的人员不友好,增加了学习和使用的门槛。c. Dependence on technical background: Existing automated testing tools usually require testers to have certain programming skills, which is not friendly to people with non-technical backgrounds and increases the threshold for learning and use.
d.动态界面适应性差:对于界面频繁变化或动态生成的应用程序,现有技术难以适应,需要频繁更新测试脚本,维护成本高。d. Poor adaptability to dynamic interfaces: For applications with frequently changing or dynamically generated interfaces, existing technologies are difficult to adapt and require frequent updates of test scripts, resulting in high maintenance costs.
针对上述问题中的至少一个问题,本申请实施例提供了测试用例自动生成方法和装置,以提高测试效率和测试覆盖率,解决相关技术中测试效率低的问题。In response to at least one of the above problems, the embodiments of the present application provide a method and device for automatically generating test cases to improve test efficiency and test coverage and solve the problem of low test efficiency in related technologies.
下面参考附图描述本申请实施例的测试用例自动生成方法、装置及设备。The following describes the test case automatic generation method, device and equipment of the embodiments of the present application with reference to the accompanying drawings.
图1为本申请实施例所提供的一种测试用例自动生成方法的流程示意图。FIG1 is a flow chart of a method for automatically generating test cases provided in an embodiment of the present application.
需要说明的是,本申请实施例的测试用例自动生成方法的执行主体为本申请实施例的测试用例自动生成装置,该测试用例自动生成装置可被配置于电子设备中,以使该电子设备可以执行测试用例自动生成功能。It should be noted that the executor of the test case automatic generation method of the embodiment of the present application is the test case automatic generation device of the embodiment of the present application, and the test case automatic generation device can be configured in an electronic device so that the electronic device can execute the test case automatic generation function.
如图1所示,该测试用例自动生成方法包括以下步骤:As shown in FIG1 , the test case automatic generation method includes the following steps:
步骤101,识别应用界面中的界面布局,提取界面布局中各元素的属性信息。Step 101, identifying the interface layout in the application interface, and extracting attribute information of each element in the interface layout.
在一些实施例中,识别应用界面中的界面布局,提取界面布局中各元素的属性信息的方法,包括:识别应用界面中的界面布局,获取UI层次结构;解析UI层次结构,得到界面布局中各元素的属性信息。In some embodiments, a method for identifying an interface layout in an application interface and extracting attribute information of each element in the interface layout includes: identifying the interface layout in the application interface and obtaining a UI hierarchy; parsing the UI hierarchy to obtain attribute information of each element in the interface layout.
在一些实施例中,识别应用界面中的界面元素的实现方式,包括:通过工具获取当前应用界面的界面布局,识别出界面布局中的各种UI元素。In some embodiments, the implementation method of identifying interface elements in an application interface includes: obtaining an interface layout of the current application interface through a tool, and identifying various UI elements in the interface layout.
这里的界面元素即UI元素。The interface elements here are UI elements.
示例性的,通过uiautomatorviewer工具来捕捉并解析应用的UI界面。uiautomatorviewer工具可以抓取设备屏幕并生成UI层次结构的XML文件。该文件包含应用界面中所有UI元素的详细信息,例如ID、类型、位置等。Exemplarily, the UI interface of the application is captured and parsed by the uiautomatorviewer tool. The uiautomatorviewer tool can capture the device screen and generate an XML file of the UI hierarchy. The file contains detailed information of all UI elements in the application interface, such as ID, type, location, etc.
其中,uiautomatorviewer是Android SDK提供的一个工具,可以获取当前设备屏幕的布局,并生成一个XML格式的UI层次结构。Among them, uiautomatorviewer is a tool provided by Android SDK, which can obtain the layout of the current device screen and generate a UI hierarchy in XML format.
通过uiautomatorviewer 工具抓取当前设备屏幕的 UI 布局,生成一个包含所有界面元素的 XML 文件。该文件详细描述了界面元素的层次结构和各自的属性。The UI layout of the current device screen is captured by the uiautomatorviewer tool, and an XML file containing all interface elements is generated. This file describes in detail the hierarchy of interface elements and their respective properties.
在一些实施例中,提取界面元素的属性信息的实现方式,包括:In some embodiments, the method for extracting the attribute information of the interface element includes:
通过XML解析器读取并解析XML文件,提取界面元素的属性信息。示例性的,XML解析器可以为Java的DocumentBuilder或Python的ElementTree。The XML file is read and parsed by an XML parser to extract the attribute information of the interface elements. Exemplarily, the XML parser may be DocumentBuilder of Java or ElementTree of Python.
通过XML 解析器加载 uiautomatorviewer 生成的 XML 文件,XML解析器将XML文件解析成可遍历的节点树结构。通过遍历节点树结构的节点,每个节点代表一个界面元素(即每个节点为元素节点),节点包含该界面元素的属性信息,如类型、位置、大小、文本内容等。The XML file generated by uiautomatorviewer is loaded through the XML parser, and the XML parser parses the XML file into a traversable node tree structure. By traversing the nodes of the node tree structure, each node represents an interface element (that is, each node is an element node), and the node contains the attribute information of the interface element, such as type, position, size, text content, etc.
解析XML文件中的各个元素节点,提取各界面元素的各项属性信息。例如,使用getAttribute方法获取界面元素的bounds(位置和大小)、text(文本内容)等属性。Parse each element node in the XML file and extract the attribute information of each interface element. For example, use the getAttribute method to obtain the bounds (position and size), text (text content) and other attributes of the interface element.
需要说明的是,可以从属性信息中获取关键属性信息,这些关键属性信息是后续步骤中进行交互逻辑分析和生成测试用例的基础。It should be noted that key attribute information can be obtained from the attribute information, and the key attribute information is the basis for interactive logic analysis and test case generation in subsequent steps.
通过遍历各节点,可以从各节点的属性信息中获取关键属性信息,例如,类型、位置和大小、文本内容和可见性等。其中:By traversing each node, key attribute information can be obtained from the attribute information of each node, such as type, position and size, text content and visibility, etc. Among them:
a.元素类型:识别元素的类型(如按钮、文本框、下拉菜单等),通过读取节点的class 属性确定。因为不同类型的元素有不同的交互方式。例如,按钮通常是点击操作,文本框是输入操作。由此,可以根据元素类型推导对应的用户操作。a. Element type: Identify the type of element (such as button, text box, drop-down menu, etc.) by reading the class attribute of the node. Because different types of elements have different interaction methods. For example, buttons are usually click operations, and text boxes are input operations. Therefore, the corresponding user operation can be deduced based on the element type.
b.坐标和尺寸:获取元素的 bounds 属性,确定其在屏幕上的位置。b. Coordinates and dimensions: Get the bounds property of the element to determine its position on the screen.
c.文本内容:提取元素的 text 属性,获取元素显示的文本内容。c. Text content: Extract the text attribute of the element and obtain the text content displayed by the element.
d.可见性:判断元素是否可见,通过 visibility 或其他相关属性确定。d. Visibility: Determine whether an element is visible, determined by visibility or other related attributes.
在一些实施例中,获取各界面元素的位置和大小之后,可以进行坐标转换,将位置和大小属性(通常为字符串格式)转换为具体的坐标值和尺寸,即将UI元素的边界框(bounds)信息转换为具体的坐标和尺寸,以便进行精确的操作模拟。In some embodiments, after obtaining the position and size of each interface element, coordinate conversion can be performed to convert the position and size attributes (usually in string format) into specific coordinate values and dimensions, that is, converting the bounding box (bounds) information of the UI element into specific coordinates and dimensions to facilitate accurate operation simulation.
e. 是否可点击等。e. Whether it is clickable, etc.
在一些实施例中,获取属性信息之后,对该属性信息进行校验,确保属性信息的完整性和准确性。例如,检查位置和大小的坐标值是否合理,文本内容是否符合预期格式等。In some embodiments, after the attribute information is obtained, the attribute information is verified to ensure the integrity and accuracy of the attribute information, for example, checking whether the coordinate values of the position and size are reasonable, whether the text content conforms to the expected format, etc.
在一些实施例中,获取属性信息之后,对属性信息进行清洗:清洗属性信息,去除可能存在的噪声或错误数据,确保后续步骤能够依赖这些属性信息进行准确的操作。In some embodiments, after the attribute information is acquired, the attribute information is cleaned: the attribute information is cleaned to remove possible noise or erroneous data to ensure that subsequent steps can rely on the attribute information to perform accurate operations.
在一些实施例中,获取属性信息之后,对属性信息进行扩展,根据需要,可能对某些属性信息进行计算或扩展,例如,计算元素的相对位置,确定元素的层级关系等。In some embodiments, after the attribute information is acquired, the attribute information is expanded. As needed, some attribute information may be calculated or expanded, for example, calculating the relative position of the elements, determining the hierarchical relationship of the elements, etc.
在一些实施例中,获取属性信息之后,对属性信息进行优化,对提取的数据进行优化,去除冗余信息,确保数据的高效使用。In some embodiments, after acquiring the attribute information, the attribute information is optimized, the extracted data is optimized, redundant information is removed, and efficient use of the data is ensured.
在一些实施例中,获取关键属性信息之后,可以将提取的关键属性信息存储在适当的数据结构中,例如,字典或对象,便于后续处理和操作。In some embodiments, after acquiring the key attribute information, the extracted key attribute information may be stored in an appropriate data structure, such as a dictionary or an object, to facilitate subsequent processing and operation.
步骤102,基于界面布局和各元素的属性信息,获取多个用户操作路径。Step 102: Acquire multiple user operation paths based on the interface layout and attribute information of each element.
在一些实施例中,基于界面布局和各元素的属性信息,获取多个用户操作路径的方法,包括:基于界面布局和各元素的属性信息,识别各元素之间的交互逻辑;基于交互逻辑,获取多个用户操作路径。In some embodiments, a method for obtaining multiple user operation paths based on an interface layout and attribute information of each element includes: identifying the interaction logic between each element based on the interface layout and attribute information of each element; and obtaining multiple user operation paths based on the interaction logic.
在一些实施例中,基于界面布局和各元素的属性信息,识别各元素之间的交互逻辑;包括:基于界面布局和各元素的属性信息,获取各元素之间的相对关系和各元素的操作模式;其中,相对关系包括相对位置关系、依赖关系和触发条件;基于各元素之间的相对关系和各元素对应的操作模式,识别各元素之间的交互逻辑。In some embodiments, based on the interface layout and the attribute information of each element, the interaction logic between the elements is identified; including: based on the interface layout and the attribute information of each element, the relative relationship between the elements and the operation mode of each element are obtained; wherein the relative relationship includes a relative position relationship, a dependency relationship and a trigger condition; based on the relative relationship between the elements and the operation mode corresponding to each element, the interaction logic between the elements is identified.
在一些实施例中,获取各元素之间的父子关系的方法,包括:根据 XML 文件的UI层次结构,确定元素之间的父子关系。父元素可能包含子元素,子元素的交互通常依赖于父元素的状态。In some embodiments, the method for obtaining the parent-child relationship between elements includes: determining the parent-child relationship between elements according to the UI hierarchy of the XML file. The parent element may contain child elements, and the interaction of the child elements usually depends on the state of the parent element.
在一些实施例中,获取各元素之间的相对位置关系的方法,包括:基于各元素的属性信息中的位置信息,得到各元素之间的相对位置关系。例如,可以根据相对位置确定某个按钮是否在另一个按钮的右侧或下方。In some embodiments, the method for obtaining the relative position relationship between elements includes: obtaining the relative position relationship between elements based on the position information in the attribute information of each element. For example, it can be determined whether a button is to the right or below another button based on the relative position.
在一些实施例中,基于各元素的属性信息,获取各元素对应的操作模式的方法,包括:基于各元素的属性信息中的元素类型,获取各元素对应的操作模式。例如,按钮、链接等交互元素通常会触发点击操作,文本框和文本区域通常会涉及文本输入操作,下拉菜单、复选框、单选按钮等元素涉及选择操作。In some embodiments, based on the attribute information of each element, the method for obtaining the operation mode corresponding to each element includes: based on the element type in the attribute information of each element, obtaining the operation mode corresponding to each element. For example, interactive elements such as buttons and links usually trigger click operations, text boxes and text areas usually involve text input operations, and elements such as drop-down menus, check boxes, and radio buttons involve selection operations.
由此,根据各元素之间的相对关系和各元素的操作模式,可以推断用户可能的操作顺序。例如,用户通常会先点击菜单项,然后在新页面中进行操作。Therefore, based on the relative relationship between the elements and the operation mode of each element, the possible operation sequence of the user can be inferred. For example, the user usually clicks the menu item first and then operates in the new page.
需要说明的是,获取元素之间的依赖关系指的是确定某些操作是否依赖于其他操作。例如,某个按钮只有在文本框输入内容后才能点击。识别元素之间的触发条件。例如,点击某个按钮可能会显示或隐藏其他元素。It should be noted that obtaining dependencies between elements refers to determining whether certain operations depend on other operations. For example, a button can only be clicked after a text box has been entered. Identifying trigger conditions between elements. For example, clicking a button may display or hide other elements.
在一些实施例中,基于交互逻辑,获取多个用户操作路径;包括:基于各元素之间的相对关系和各元素对应的操作模式,获取用户行为模式;基于用户行为模式,获取多个用户操作路径。In some embodiments, based on the interaction logic, multiple user operation paths are obtained; including: based on the relative relationship between each element and the operation mode corresponding to each element, a user behavior pattern is obtained; based on the user behavior pattern, multiple user operation paths are obtained.
示例性的,多个用户操作路径的推导,包括:Exemplarily, the derivation of multiple user operation paths includes:
确定初始路径:从应用的初始状态开始,识别用户可能的第一步操作(如点击按钮、输入文本)。Determine the initial path: Start from the initial state of the app and identify the first possible actions the user may take (e.g., clicking a button, entering text).
递归分析:递归分析每一步操作后的界面状态,推断后续可能的操作路径。Recursive analysis: Recursively analyze the interface status after each operation step to infer the possible subsequent operation paths.
边界条件:考虑各操作的边界条件,如输入错误数据、无效点击等,确保覆盖所有可能的操作场景。Boundary conditions: Consider the boundary conditions of each operation, such as inputting incorrect data, invalid clicks, etc., to ensure that all possible operation scenarios are covered.
在一些实施例中,用户行为模式的模拟。In some embodiments, simulation of user behavior patterns.
1)基于界面布局和元素属性,模拟可能的用户行为模式。例如,用户可能会点击所有可见的按钮,尝试输入文本,或选择下拉菜单中的选项。1) Based on the interface layout and element attributes, simulate possible user behavior patterns. For example, users may click all visible buttons, try to enter text, or select options in a drop-down menu.
2)使用自动化工具模拟用户操作,记录操作路径和结果。自动化工具可以帮助验证推断的操作路径和交互逻辑。2) Use automated tools to simulate user operations and record operation paths and results. Automated tools can help verify inferred operation paths and interaction logic.
根据元素之间的相对位置和层次结构,确定可能的用户操作路径。通过分析元素的类型和属性,推断可能的操作模式。基于元素间的交互逻辑,生成一系列可能的用户操作路径。可以使用图论或状态机等方法来表示和处理这些用户操作路径。Determine possible user operation paths based on the relative positions and hierarchical structures between elements. Infer possible operation modes by analyzing the types and attributes of elements. Generate a series of possible user operation paths based on the interaction logic between elements. These user operation paths can be represented and processed using methods such as graph theory or state machines.
示例性的,使用状态机模型,将界面各个可能的状态和状态之间的转换表示出来。每个状态对应界面的一个特定布局,每个转换对应用户的一次操作。或者,使用图论方法,将界面元素和用户操作路径表示为节点和边。节点代表界面状态或元素,边代表用户的操作路径。通过遍历图,识别所有可能的用户操作路径。Exemplarily, a state machine model is used to represent each possible state of the interface and the transitions between states. Each state corresponds to a specific layout of the interface, and each transition corresponds to an operation of the user. Alternatively, a graph theory method is used to represent interface elements and user operation paths as nodes and edges. Nodes represent interface states or elements, and edges represent user operation paths. By traversing the graph, all possible user operation paths are identified.
步骤103,基于多个用户操作路径,生成测试用例。Step 103: Generate test cases based on multiple user operation paths.
在一些实施例中,基于多个用户操作路径,生成测试用例;包括:In some embodiments, based on multiple user operation paths, a test case is generated; including:
基于所述多个用户操作路径,生成多个测试路径;每个测试路径包括多个测试步骤,每个测试步骤对应一个用户操作;为测试路径中的关键测试步骤添加断言,断言用于验证操作结果是否符合预期;基于测试路径,生成测试用例结构;基于测试脚本模板和测试用例结构,生成测试用例脚本。Based on the multiple user operation paths, multiple test paths are generated; each test path includes multiple test steps, and each test step corresponds to a user operation; assertions are added to key test steps in the test path, and the assertions are used to verify whether the operation results meet expectations; based on the test path, a test case structure is generated; based on the test script template and the test case structure, a test case script is generated.
需要说明的是,首先需要确定测试框架和编程语言,根据具体的测试需求和项目环境,选择适合的测试框架。例如:Appium:支持多种编程语言(如Python、Java、JavaScript),常用于跨平台的移动应用测试。Espresso:主要使用Java,专用于Android应用的UI测试。根据所选测试框架,确定测试脚本的编写语言。例如,使用Appium时可以选择Python或Java。It should be noted that you first need to determine the test framework and programming language, and choose a suitable test framework based on the specific test requirements and project environment. For example: Appium: supports multiple programming languages (such as Python, Java, JavaScript), and is often used for cross-platform mobile application testing. Espresso: Mainly uses Java and is dedicated to UI testing of Android applications. Determine the writing language of the test script based on the selected test framework. For example, you can choose Python or Java when using Appium.
在一些实现方式中,生成测试用例结构的方法,包括:生成测试脚本的初始化部分,包括设置测试环境、初始化驱动等。根据用户操作路径,生成具体的测试步骤;每个测试步骤对应一个用户操作,如点击、输入文本、选择菜单等。在关键操作步骤后添加断言,验证操作结果是否符合预期。其中,测试步骤包括正常操作路径和边界情况,例如,针对每个按钮点击、文本输入等操作生成对应的测试步骤;考虑特殊和边界情况,如输入无效数据、点击不可用按钮等,确保测试用例的全面性。In some implementations, the method for generating a test case structure includes: generating an initialization portion of a test script, including setting up a test environment, initializing a driver, etc. Generate specific test steps based on the user operation path; each test step corresponds to a user operation, such as clicking, entering text, selecting a menu, etc. Add assertions after key operation steps to verify whether the operation results meet expectations. Among them, the test steps include normal operation paths and boundary conditions. For example, corresponding test steps are generated for each button click, text input, and other operations; special and boundary conditions are considered, such as entering invalid data, clicking unavailable buttons, etc., to ensure the comprehensiveness of the test cases.
在本申请实施例中,基于测试脚本模板生成测试用例脚本,定义测试脚本模板,包括初始化部分、操作部分和结束部分。脚本生成模板中预留变量位置,用于插入具体的测试步骤和断言。根据用户操作路径,填充脚本生成模板中的变量位置,生成完整的测试用例脚本。例如,插入具体的点击操作、输入操作等。In an embodiment of the present application, a test case script is generated based on a test script template, and a test script template is defined, including an initialization part, an operation part, and an end part. Variable positions are reserved in the script generation template for inserting specific test steps and assertions. According to the user operation path, the variable positions in the script generation template are filled to generate a complete test case script. For example, specific click operations, input operations, etc. are inserted.
在一些实现方式中,生成测试用例的方法,包括:In some implementations, a method for generating a test case includes:
1)初始化脚本生成器:1) Initialize the script generator:
配置测试环境:设置测试环境参数,如设备信息、应用路径、初始状态等。Configure the test environment: Set test environment parameters, such as device information, application path, initial status, etc.
初始化驱动:根据所选测试框架,初始化测试驱动,如Appium的WebDriver、Espresso的UIAutomator等。Initialize the driver: Initialize the test driver according to the selected test framework, such as Appium's WebDriver, Espresso's UIAutomator, etc.
2)生成测试步骤:2) Generate test steps:
示例性的,生成点击操作的代码,指定元素的定位方式(如ID、XPath)和点击操作的指令。生成文本输入操作的代码,指定输入框元素和输入内容。生成选择菜单项、点击复选框等操作的代码。For example, the code for click operation is generated, and the element location method (such as ID, XPath) and the instruction of click operation are specified. The code for text input operation is generated, and the input box element and input content are specified. The code for selecting menu items, clicking checkboxes, etc. is generated.
确保生成的测试用例覆盖所有识别出的用户操作路径,包括正常用户操作和边界情况(如异常输入、无效操作等)。Ensure that the generated test cases cover all identified user operation paths, including normal user operations and edge cases (such as abnormal input, invalid operations, etc.).
3)添加断言和验证:3) Add assertions and verifications:
在每个关键操作后,添加断言代码,验证操作结果是否符合预期。例如,检查按钮点击后是否跳转到预期页面,输入框输入后是否显示正确的提示信息。生成异常处理代码,确保在操作失败时能够捕获异常并记录。After each key operation, add assertion code to verify whether the operation results meet expectations. For example, check whether the expected page is redirected after clicking a button, and whether the correct prompt information is displayed after input in the input box. Generate exception handling code to ensure that exceptions can be captured and recorded when the operation fails.
4)生成完整测试脚本:4) Generate a complete test script:
合并脚本生成模板和测试步骤:将生成的测试步骤和断言代码插入到预定义的脚本生成模板中,生成完整的测试脚本。将生成的测试脚本保存为可执行的文件格式,如Python的.py文件或Java的.java文件。Merge script generation templates and test steps: Insert the generated test steps and assertion code into the predefined script generation template to generate a complete test script. Save the generated test script in an executable file format, such as Python's .py file or Java's .java file.
使用编程语言(如Python、Java)生成自动化的测试脚本。测试脚本中包含具体的测试步骤,如点击、输入、选择等。Use programming languages (such as Python and Java) to generate automated test scripts. Test scripts contain specific test steps, such as clicks, inputs, selections, etc.
使用自动化的测试框架执行生成的测试用例。测试框架提供了操作设备和验证结果的API。The generated test cases are executed using an automated test framework. The test framework provides an API for operating the device and verifying the results.
在一些实施例中,生成测试用例之后,包括优化测试用例,即对生成的测试用例进行优化,去除冗余操作,确保测试的高效性和准确性。优化后的测试用例应尽可能减少不必要的测试步骤,提高测试执行的速度和可靠性。In some embodiments, after generating the test case, the test case is optimized, that is, the generated test case is optimized to remove redundant operations to ensure the efficiency and accuracy of the test. The optimized test case should reduce unnecessary test steps as much as possible to improve the speed and reliability of test execution.
在一些实施例中,优化测试用例,包括:对测试用例中测试路径中测试步骤进行去重操作,得到去重后的测试用例。In some embodiments, optimizing a test case includes: performing a deduplication operation on test steps in a test path in the test case to obtain a deduplicated test case.
作为一种实现方式,分析测试用例中的操作序列,识别并标记重复出现的测试步骤;比对不同用户测试路径中的操作序列,发现并去除重复出现的操作。As an implementation method, the operation sequence in the test case is analyzed to identify and mark the repeated test steps; the operation sequence in different user test paths is compared to find and remove repeated operations.
例如,同一页面上的多次点击可以合并为一次操作。For example, multiple clicks on the same page can be combined into a single action.
在一些实施例中,优化测试用例,还包括:识别测试用例中的操作之间的依赖关系,去除不必要的依赖操作;简化操作路径,保留仅在特定条件下触发的操作。In some embodiments, optimizing the test cases further includes: identifying dependencies between operations in the test cases and removing unnecessary dependent operations; simplifying the operation path and retaining operations that are only triggered under specific conditions.
在一些实施例中,优化测试用例,还包括:去除去重后的测试用例中的无效操作步骤,得到优化后的测试用例。即识别测试用例中的无效操作,如无效的点击、输入等;去除测试路径中的无效操作,确保每个操作都是有效的。In some embodiments, optimizing the test case further includes: removing invalid operation steps in the test case after deduplication to obtain an optimized test case, that is, identifying invalid operations in the test case, such as invalid clicks, inputs, etc.; removing invalid operations in the test path to ensure that each operation is valid.
下面对减少不必要测试步骤的依据进行描述:The following describes the basis for reducing unnecessary test steps:
1). 覆盖率分析1). Coverage analysis
a.代码覆盖率:分析测试用例对应的代码覆盖率,去除未被覆盖的代码路径或操作。a. Code coverage: Analyze the code coverage corresponding to the test cases and remove uncovered code paths or operations.
b.功能覆盖率:评估测试用例对应的功能覆盖率,确保涵盖了所有关键功能的测试路径。b. Functional coverage: Evaluate the functional coverage of the test cases to ensure that the test paths of all key functions are covered.
2). 边界情况考虑2) Considering Boundary Cases
a.边界情况分析:分析测试用例是否覆盖了各种边界情况,去除未涵盖的边界情况。a. Boundary case analysis: Analyze whether the test cases cover various boundary cases and remove those that are not covered.
b.异常情况处理:确保测试用例包含了针对异常情况的处理步骤,但避免重复的异常处理。b. Exception handling: Make sure the test case includes steps to handle exceptions, but avoid repeated exception handling.
3). 操作路径优化3). Operation path optimization
a.路径剪枝:使用路径优化算法,剪枝测试路径中的冗余或不必要的操作,简化操作序列。a. Path pruning: Use path optimization algorithms to prune redundant or unnecessary operations in the test path and simplify the operation sequence.
b.路径覆盖分析:分析测试路径之间的覆盖情况,去除重复覆盖或相似覆盖的测试路径。b. Path coverage analysis: Analyze the coverage between test paths and remove test paths with repeated coverage or similar coverage.
示例性的,去除冗余操作,假设有如下两个测试路径:For example, to remove redundant operations, assume that there are two test paths as follows:
路径1.打开应用 ->点击按钮A ->输入文本 ->点击按钮B ->点击按钮D ->验证结果。Path 1. Open the app -> click button A -> enter text -> click button B -> click button D -> verify the result.
路径2.打开应用 ->点击按钮A ->输入文本 ->点击按钮B ->点击按钮D ->点击按钮C ->验证结果。Path 2. Open the app -> click button A -> enter text -> click button B -> click button D -> click button C -> verify the result.
通过分析发现,路径2中的点击按钮D操作与路径1中的操作重复,可以将其去除,优化后的测试路径为:Through analysis, it is found that the operation of clicking button D in path 2 is repeated in path 1, so it can be removed. The optimized test path is:
打开应用 ->点击按钮A ->输入文本 ->点击按钮B ->点击按钮C ->验证结果。Open the app -> click button A -> enter text -> click button B -> click button C -> verify the result.
通过这种方式,去除了冗余操作,简化了测试路径,提高了测试效率和准确性。In this way, redundant operations are removed, the test path is simplified, and the test efficiency and accuracy are improved.
通过测试路径简化,确保每个测试用例只包含必要的操作步骤,可以使用测试路径优化算法(如剪枝算法)来实现。By simplifying the test path, we ensure that each test case only contains necessary operation steps. This can be achieved by using test path optimization algorithms (such as pruning algorithms).
还可以优化测试用例脚本的执行顺序和方式,减少测试执行的时间。例如,优先执行高风险测试路径或并行执行多个测试用例。You can also optimize the execution order and method of test case scripts to reduce the test execution time, for example, by giving priority to high-risk test paths or executing multiple test cases in parallel.
本申请实施例的测试用例自动生成方法,通过识别应用界面中的界面布局,提取界面布局中各元素的属性信息;根据界面布局和各元素属性信息,自动生成测试用例。大大减少了手工编写测试用例的时间和人力成本,提高了测试效率。通过全面识别界面元素和交互逻辑,生成覆盖全面的测试用例,确保应用程序各功能和操作路径得到充分测试。降低技术门槛,不需要测试人员具备编程技能,简单易用,适用于广泛的测试人员,提高了自动化测试工具的普及性。能够快速适应界面变化,自动更新测试用例,减少了维护成本,特别适用于界面频繁变化的应用程序。通过智能识别和分析,避免了手工编写测试用例时可能出现的遗漏和错误,提高了测试的准确性和可靠性。The test case automatic generation method of the embodiment of the present application, by identifying the interface layout in the application interface, extracts the attribute information of each element in the interface layout; according to the interface layout and the attribute information of each element, the test case is automatically generated. The time and labor cost of manually writing test cases are greatly reduced, and the test efficiency is improved. By comprehensively identifying the interface elements and interaction logic, comprehensive test cases are generated to ensure that all functions and operation paths of the application are fully tested. The technical threshold is lowered, and the tester does not need to have programming skills. It is simple and easy to use, suitable for a wide range of testers, and improves the popularity of automated testing tools. It can quickly adapt to interface changes, automatically update test cases, reduce maintenance costs, and is particularly suitable for applications with frequently changing interfaces. Through intelligent identification and analysis, omissions and errors that may occur when manually writing test cases are avoided, and the accuracy and reliability of the test are improved.
为了实现上述实施例,本申请还提出一种测试用例自动生成装置。图2为本申请实施例提供的一种测试用例自动生成装置的结构示意图。如图2所示,该测试用例自动生成装置可以包括:界面识别模块201、路径获取模块202和用例生成模块203。In order to implement the above embodiment, the present application also proposes a test case automatic generation device. FIG2 is a structural schematic diagram of a test case automatic generation device provided by an embodiment of the present application. As shown in FIG2, the test case automatic generation device may include: an interface recognition module 201, a path acquisition module 202 and a test case generation module 203.
其中,界面识别模块201,用于识别应用界面中的界面布局,提取界面布局中各元素的属性信息;The interface recognition module 201 is used to recognize the interface layout in the application interface and extract the attribute information of each element in the interface layout;
路径获取模块202,用于基于界面布局和各元素的属性信息,获取多个用户操作路径;A path acquisition module 202, used to acquire multiple user operation paths based on the interface layout and attribute information of each element;
用例生成模块203,用于基于多个用户操作路径,生成测试用例。The use case generation module 203 is used to generate test cases based on multiple user operation paths.
在一些实现方式中,界面识别模块201,具体用于:In some implementations, the interface identification module 201 is specifically configured to:
识别应用界面中的界面布局,获取UI层次结构;Identify the interface layout in the application interface and obtain the UI hierarchy;
解析UI层次结构,得到界面布局中各元素的属性信息。Parse the UI hierarchy and obtain the attribute information of each element in the interface layout.
在一些实现方式中,路径获取模块202,具体用于:In some implementations, the path acquisition module 202 is specifically configured to:
基于界面布局和各元素的属性信息,识别各元素之间的交互逻辑;Based on the interface layout and attribute information of each element, identify the interaction logic between elements;
基于交互逻辑,获取多个用户操作路径。Based on the interaction logic, multiple user operation paths are obtained.
在一些实现方式中,路径获取模块202,用于在基于界面布局和各元素的属性信息,识别各元素之间的交互逻辑时;用于:In some implementations, the path acquisition module 202 is used to identify the interaction logic between the elements based on the interface layout and the attribute information of each element;
基于界面布局和各元素的属性信息,获取各元素之间的相对关系和各元素的操作模式;其中,相对关系包括相对位置关系、依赖关系和触发条件;Based on the interface layout and the attribute information of each element, the relative relationship between the elements and the operation mode of each element are obtained; wherein the relative relationship includes relative position relationship, dependency relationship and trigger condition;
基于各元素之间的相对关系和各元素对应的操作模式,识别各元素之间的交互逻辑。Based on the relative relationships between the elements and the corresponding operation modes of the elements, the interaction logic between the elements is identified.
在一些实现方式中,路径获取模块202,用于在基于交互逻辑,获取多个用户操作路径时,用于:In some implementations, the path acquisition module 202 is used to, when acquiring multiple user operation paths based on the interaction logic,:
基于各元素之间的相对关系和各元素对应的操作模式,获取用户行为模式;Based on the relative relationship between the elements and the operation modes corresponding to the elements, the user behavior patterns are obtained;
基于交互逻辑和用户行为模式,获取多个用户操作路径。Based on interaction logic and user behavior patterns, multiple user operation paths are obtained.
在一些实现方式中,用例生成模块203,具体用于:In some implementations, the use case generation module 203 is specifically configured to:
基于多个用户操作路径,生成多个测试路径;每个测试路径包括多个测试步骤,每个测试步骤对应一个用户操作;Based on multiple user operation paths, multiple test paths are generated; each test path includes multiple test steps, and each test step corresponds to a user operation;
为测试路径中的关键测试步骤添加断言,断言用于验证操作结果是否符合预期;Add assertions to key test steps in the test path. Assertions are used to verify whether the operation results meet expectations.
基于测试路径,生成测试用例结构;Generate test case structure based on test path;
基于测试脚本模板和测试用例结构,生成测试用例脚本。Generate test case scripts based on test script templates and test case structures.
在一些实现方式中,用例生成模块203,还用于:In some implementations, the use case generation module 203 is further configured to:
对测试用例中测试路径中测试步骤进行去重操作,得到去重后的测试用例;De-duplicate the test steps in the test path in the test case to obtain the de-duplicated test case;
去除去重后的测试用例中的无效操作步骤,得到优化后的测试用例。Remove invalid operation steps from the deduplicated test cases to obtain optimized test cases.
需要说明的是,前述对测试用例自动生成方法实施例的解释说明也适用于该实施例的测试用例自动生成装置,此处不再赘述。It should be noted that the above explanation of the embodiment of the test case automatic generation method is also applicable to the test case automatic generation device of this embodiment, and will not be repeated here.
为了实现上述实施例,本申请还提出一种电子设备。请参见图3,图3是本申请实施例提供的电子设备的结构示意图。如图3所示,电子设备300包括:处理器301,以及与处理器301通信连接的存储器302;存储器302存储计算机执行指令;处理器301执行存储器存储的计算机执行指令,以实现执行前述实施例所提供的方法。In order to implement the above-mentioned embodiments, the present application also proposes an electronic device. Please refer to Figure 3, which is a schematic diagram of the structure of the electronic device provided by the embodiment of the present application. As shown in Figure 3, the electronic device 300 includes: a processor 301, and a memory 302 connected to the processor 301 in communication; the memory 302 stores computer-executable instructions; the processor 301 executes the computer-executable instructions stored in the memory to implement the method provided by the above-mentioned embodiment.
为了实现上述实施例,本申请还提出一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现前述实施例所提供的方法。In order to implement the above embodiments, the present application also proposes a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the methods provided by the above embodiments.
为了实现上述实施例,本申请还提出一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现前述实施例所提供的方法。In order to implement the above embodiments, the present application also proposes a computer program product, including a computer program, which implements the methods provided by the above embodiments when executed by a processor.
本申请中所涉及的用户个人信息的收集、存储、使用、加工、传输、提供和公开等处理,均符合相关法律法规的规定,且不违背公序良俗。The collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in this application are in compliance with relevant laws and regulations and do not violate public order and good morals.
需要说明的是,来自用户的个人信息应当被收集用于合法且合理的用途,并且不在这些合法使用之外共享或出售。此外,应在收到用户知情同意后进行此类采集/共享,包括但不限于在用户使用该功能前,通知用户阅读用户协议/用户通知,并签署包括授权相关用户信息的协议/授权。此外,还需采取任何必要步骤,保卫和保障对此类个人信息数据的访问,并确保有权访问个人信息数据的其他人遵守其隐私政策和流程。It should be noted that personal information from users should be collected for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. In addition, such collection/sharing should be carried out after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement/user notice and sign the agreement/authorization including authorization of relevant user information before the user uses the function. In addition, any necessary steps should be taken to protect and safeguard access to such personal information data and ensure that others who have access to personal information data comply with its privacy policy and procedures.
本申请预期可提供用户选择性阻止使用或访问个人信息数据的实施方案。即本公开预期可提供硬件和/或软件,以防止或阻止对此类个人信息数据的访问。一旦不再需要个人信息数据,通过限制数据收集和删除数据可最小化风险。此外,在适用时,对此类个人信息去除个人标识,以保护用户的隐私。The present application is expected to provide an implementation scheme for users to selectively block the use or access of personal information data. That is, the present disclosure is expected to provide hardware and/or software to prevent or block access to such personal information data. Once the personal information data is no longer needed, the risk can be minimized by limiting data collection and deleting the data. In addition, when applicable, such personal information is de-identified to protect the privacy of the user.
在前述各实施例描述中,参考术语“一个实施例”、“一些实施例”、 “示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of the aforementioned embodiments, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现定制逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本申请的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本申请的实施例所属技术领域的技术人员所理解。Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。The logic and/or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
应当理解,本申请的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。如,如果用硬件来实现和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
此外,在本申请各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
上述提到的存储介质可以是只读存储器,磁盘或光盘等。尽管上面已经示出和描述了本申请的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本申请的限制,本领域的普通技术人员在本申请的范围内可以对上述实施例进行变化、修改、替换和变型。The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
| Application Number | Priority Date | Filing Date | Title | 
|---|---|---|---|
| CN202411245345.3ACN118760613A (en) | 2024-09-06 | 2024-09-06 | Test case automatic generation method, device, electronic device and storage medium | 
| Application Number | Priority Date | Filing Date | Title | 
|---|---|---|---|
| CN202411245345.3ACN118760613A (en) | 2024-09-06 | 2024-09-06 | Test case automatic generation method, device, electronic device and storage medium | 
| Publication Number | Publication Date | 
|---|---|
| CN118760613Atrue CN118760613A (en) | 2024-10-11 | 
| Application Number | Title | Priority Date | Filing Date | 
|---|---|---|---|
| CN202411245345.3APendingCN118760613A (en) | 2024-09-06 | 2024-09-06 | Test case automatic generation method, device, electronic device and storage medium | 
| Country | Link | 
|---|---|
| CN (1) | CN118760613A (en) | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN119669027A (en)* | 2025-02-19 | 2025-03-21 | 广州虎牙信息科技有限公司 | Test case generation method, device, equipment and medium | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN118193376A (en)* | 2024-03-15 | 2024-06-14 | 中国第一汽车股份有限公司 | A test method, system, electronic device, storage medium and test terminal | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN118193376A (en)* | 2024-03-15 | 2024-06-14 | 中国第一汽车股份有限公司 | A test method, system, electronic device, storage medium and test terminal | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN119669027A (en)* | 2025-02-19 | 2025-03-21 | 广州虎牙信息科技有限公司 | Test case generation method, device, equipment and medium | 
| Publication | Publication Date | Title | 
|---|---|---|
| CN108170611B (en) | Automated testing method and device, storage medium, electronic equipment | |
| US9251046B2 (en) | Method and system for generating and processing black box test cases | |
| CN106844217B (en) | Method and device for embedding point of applied control and readable storage medium | |
| CN110147317B (en) | Code testing method and device, electronic device and storage medium | |
| US8448146B2 (en) | Generation of functional tests for re-hosted applications | |
| US8402434B2 (en) | Graphical user interface (GUI) script generation and documentation | |
| CN105843734B (en) | A kind of automated testing method, device and calculate equipment | |
| US11074162B2 (en) | System and a method for automated script generation for application testing | |
| WO2018010552A1 (en) | Test method and device | |
| CN104809056B (en) | A kind of generation method and device of interface testing code | |
| CN102541740A (en) | Android-based automatic test method for mobile phone notes | |
| JP6440895B2 (en) | Software analysis apparatus and software analysis method | |
| US20140214396A1 (en) | Specification properties creation for a visual model of a system | |
| US7275231B2 (en) | High level validation of designs and products | |
| CN118760613A (en) | Test case automatic generation method, device, electronic device and storage medium | |
| CN118467032A (en) | Automated UI interaction exploration method based on multimodal large model | |
| CN113326193A (en) | Applet testing method and device | |
| CN115481025A (en) | Script recording method and device for automatic test, computer equipment and medium | |
| CN101776993B (en) | System and method automatically generating software interactive interface | |
| CN114490337A (en) | Commissioning method, commissioning platform, equipment and storage medium | |
| CN118193376A (en) | A test method, system, electronic device, storage medium and test terminal | |
| CN118779228A (en) | Vehicle OTA platform testing method, device, electronic equipment and storage medium | |
| CN117215552A (en) | Interactive component generation method and device, storage medium and computer equipment | |
| JP2021015481A (en) | Information processing program, information processing method, and information processing device | |
| CN112329124B (en) | CAE model error checking method, device, computer equipment and storage medium | 
| Date | Code | Title | Description | 
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20241011 | |
| RJ01 | Rejection of invention patent application after publication |