CN116401173A - Test case generation method and device, medium and electronic equipment - Google Patents

Test case generation method and device, medium and electronic equipment Download PDF

Info

Publication number
CN116401173A
CN116401173A CN202310436578.0A CN202310436578A CN116401173A CN 116401173 A CN116401173 A CN 116401173A CN 202310436578 A CN202310436578 A CN 202310436578A CN 116401173 A CN116401173 A CN 116401173A
Authority
CN
China
Prior art keywords
test
scene
tested
page
application program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310436578.0A
Other languages
Chinese (zh)
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 Co Ltd
Original Assignee
Douyin Vision 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 Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202310436578.0A priority Critical patent/CN116401173A/en
Publication of CN116401173A publication Critical patent/CN116401173A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR 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; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3698Environments for analysis, debugging or testing of software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04842Selection of displayed objects or displayed text elements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to a test case generation method, a test case generation device, a test case generation medium and an electronic device. The method comprises the following steps: displaying a test scene configuration interface aiming at an application program to be tested, and determining a target test scene configured aiming at the application program to be tested; the configuration interface supports a target test scene for executing selection operation on the interface to configure the coverage required by the test; invoking a test map which is generated in advance for an application program to be tested, and generating a corresponding test case based on a target test scene; the test map is a scene relation knowledge graph constructed by clustering information obtained by performing scene clustering on page information of the application program to be tested. Therefore, a user can configure a target test scene required to be covered by the test by clicking the scene on the test scene configuration interface, the test is convenient and quick, then the test case can be automatically generated according to the test map, the test case does not need to be manually written, the complexity of obtaining the test case is reduced, and the generation efficiency of the test case and the test efficiency of the application program are improved.

Description

测试用例生成方法、装置、介质及电子设备Test case generation method, device, medium and electronic equipment

技术领域technical field

本公开涉及计算机技术领域,具体地,涉及一种测试用例生成方法、装置、介质及电子设备。The present disclosure relates to the field of computer technology, and in particular, to a test case generation method, device, medium and electronic equipment.

背景技术Background technique

随着终端设备的功能的不断增多,应用在终端设备上的应用程序也越来越多。在应用程序的开发阶段,开发人员为了测试应用程序的功能是否正常以及是否能够达到预期效果,需要在应用程序上线前,对开发的应用程序进行测试。另外,应用程序新版本发布后,针对新版本的应用程序也需要进行功能测试。现阶段,在进行应用程序测试时,通常需要人工编写测试用例,导致得到测试用例的复杂度较高,耗时较长,并且用户体验较低。As the functions of the terminal equipment continue to increase, more and more application programs are applied on the terminal equipment. In the development stage of the application program, in order to test whether the function of the application program is normal and whether the expected effect can be achieved, the developer needs to test the developed application program before the application program goes online. In addition, after a new version of the application program is released, a functional test is also required for the application program of the new version. At this stage, when testing applications, it is usually necessary to manually write test cases, resulting in high complexity, time-consuming test cases, and low user experience.

发明内容Contents of the invention

提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。This Summary is provided to introduce a simplified form of concepts that are described in detail later in the Detailed Description. This summary of the invention is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to be used to limit the scope of the claimed technical solution.

第一方面,本公开提供一种测试用例生成方法,包括:In a first aspect, the present disclosure provides a test case generation method, including:

显示针对待测应用程序的测试场景配置界面,确定针对所述待测应用程序配置的目标测试场景;所述测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的所述目标测试场景;Displaying the test scenario configuration interface for the application to be tested, determining the target test scenario configured for the application to be tested; the test scenario configuration interface supports performing selection operations on the interface to configure the target test that the test needs to cover Scenes;

调用针对所述待测应用程序预先生成的测试地图,基于所述目标测试场景生成对应的测试用例,所述测试用例用于对所述待测应用程序进行测试;其中,所述测试地图是针对所述待测应用程序的页面信息进行场景聚类所得的聚类信息构建的场景关系知识图谱,所述场景关系知识图谱中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。Invoking the pre-generated test map for the application under test, generating a corresponding test case based on the target test scenario, the test case is used to test the application under test; wherein, the test map is for The scene relationship knowledge graph constructed by the clustering information obtained from the scene clustering of the page information of the application to be tested, the nodes in the scene relationship knowledge graph are used to represent the scene abstracted from the page, and the edges connected by the nodes are used to represent Controls, actions and jump information supported by the node.

第二方面,本公开提供一种测试用例生成装置,包括:In a second aspect, the present disclosure provides a test case generation device, including:

确定模块,用于显示针对待测应用程序的测试场景配置界面,确定针对所述待测应用程序配置的目标测试场景;所述测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的所述目标测试场景;A determination module, configured to display a test scenario configuration interface for the application to be tested, and determine a target test scenario configured for the application to be tested; the test scenario configuration interface supports performing selection operations on the interface to configure the coverage required for the test The target test scenario of ;

生成模块,用于调用针对所述待测应用程序预先生成的测试地图,基于所述目标测试场景生成对应的测试用例,所述测试用例用于对所述待测应用程序进行测试;其中,所述测试地图是针对所述待测应用程序的页面信息进行场景聚类所得的聚类信息构建的场景关系知识图谱,所述场景关系知识图谱中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。A generating module, configured to invoke a pre-generated test map for the application under test, and generate a corresponding test case based on the target test scenario, the test case is used to test the application under test; wherein, the The test map is a scene relationship knowledge graph constructed from the clustering information obtained by performing scene clustering on the page information of the application to be tested. The nodes in the scene relationship knowledge graph are used to represent the scenes abstracted from the page, and the nodes are connected The edges of are used to represent the controls, actions and jump information supported by the node.

第三方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现本公开第一方面提供的所述测试用例生成方法的步骤。In a third aspect, the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the test case generation method provided in the first aspect of the present disclosure are implemented.

第四方面,本公开提供一种电子设备,包括:In a fourth aspect, the present disclosure provides an electronic device, including:

存储装置,其上存储有计算机程序;a storage device on which a computer program is stored;

处理装置,用于执行所述存储装置中的所述计算机程序,以实现本公开第一方面提供的所述测试用例生成方法的步骤。A processing device configured to execute the computer program in the storage device to implement the steps of the method for generating test cases provided in the first aspect of the present disclosure.

在上述技术方案中,首先,显示针对待测应用程序的测试场景配置界面,确定针对待测应用程序配置的目标测试场景,其中,测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的目标测试场景;然后,调用针对待测应用程序预先生成的测试地图,基于目标测试场景生成对应的测试用例。这样,用户只需在测试场景配置界面上进行场景的点选,即可配置测试所需覆盖的目标测试场景,方便快捷,之后,可以根据预先生成的测试地图,基于目标测试场景自动生成测试用例,而不需要人工编写测试用例,从而降低了得到测试用例的复杂度,进而可以提升测试用例的生成效率和应用程序的测试效率,并且可以提升用户体验。In the above technical solution, firstly, a test scenario configuration interface for the application to be tested is displayed, and a target test scenario configured for the application to be tested is determined, wherein the test scenario configuration interface supports performing a selection operation on the interface to configure the required test scenario for the test. Covered target test scenarios; then, call the pre-generated test map for the application under test, and generate corresponding test cases based on the target test scenarios. In this way, the user only needs to click the scene on the test scene configuration interface to configure the target test scene to be covered by the test, which is convenient and fast. After that, the test case can be automatically generated based on the target test scene according to the pre-generated test map , instead of manually writing test cases, thereby reducing the complexity of obtaining test cases, thereby improving the efficiency of test case generation and application testing, and improving user experience.

本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。Other features and advantages of the present disclosure will be described in detail in the detailed description that follows.

附图说明Description of drawings

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

图1是根据一示例性实施例示出的一种测试用例生成方法的步骤。Fig. 1 shows the steps of a test case generation method according to an exemplary embodiment.

图2是根据一示例性实施例示出的一种待测应用程序中各页面之间的跳转信息和页面跳转的触发条件的示意图。Fig. 2 is a schematic diagram showing jump information between pages in an application program to be tested and trigger conditions for page jumps according to an exemplary embodiment.

图3是根据一示例性实施例示出的一种根据图2构建出的测试地图的示意图。Fig. 3 is a schematic diagram of a test map constructed according to Fig. 2 according to an exemplary embodiment.

图4是根据一示例性实施例示出的一种测试用例的示意图。Fig. 4 is a schematic diagram of a test case according to an exemplary embodiment.

图5是根据一示例性实施例示出的一种测试用例生成装置的框图。Fig. 5 is a block diagram of a device for generating test cases according to an exemplary embodiment.

图6是根据一示例性实施例示出的一种电子设备的结构示意图。Fig. 6 is a schematic structural diagram of an electronic device according to an exemplary embodiment.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the drawings, it should be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein; A more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only, 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 implementations of the present disclosure may be executed in different orders, and/or executed in parallel. Additionally, method embodiments may include additional steps and/or omit performing illustrated steps. The scope of the present disclosure is not limited in this respect.

本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。As used herein, the term "comprise" and its variations are open-ended, 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 further 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 this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the sequence of functions performed by these devices, modules or units or interdependence.

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

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

可以理解的是,在使用本公开各实施例公开的技术方案之前,均应当依据相关法律法规通过恰当的方式对本公开所涉及个人信息的类型、使用范围、使用场景等告知用户并获得用户的授权。It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the user should be informed of the type, scope of use, and use scenarios of the personal information involved in the present disclosure in an appropriate manner in accordance with relevant laws and regulations, and the authorization of the user should be obtained. .

例如,在响应于接收到用户的主动请求时,向用户发送提示信息,以明确地提示用户,其请求执行的操作将需要获取和使用到用户的个人信息。从而,使得用户可以根据提示信息来自主地选择是否向执行本公开技术方案的操作的电子设备、应用程序、服务器或存储介质等软件或硬件提供个人信息。For example, in response to receiving the user's active request, send prompt information to the user to clearly remind the user that the requested operation will require the acquisition and use of the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as electronic devices, application programs, servers, or storage media that perform the operations of the technical solution of the present disclosure according to the prompt information.

作为一种可选的但非限定性的实现方式,响应于接收到用户的主动请求,向用户发送提示信息的方式例如可以是弹窗的方式,弹窗中可以以文字的方式呈现提示信息。此外,弹窗中还可以承载供用户选择“同意”或者“不同意”向电子设备提供个人信息的选择控件。As an optional but non-limiting implementation, in response to receiving the active request of the user, the way of sending the prompt information to the user may be, for example, a pop-up window, and the prompt information may be presented in text in the pop-up window. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

可以理解的是,上述通知和获取用户授权过程仅是示意性的,不对本公开的实现方式构成限定,其它满足相关法律法规的方式也可应用于本公开的实现方式中。It can be understood that the above process of notifying and obtaining user authorization is only illustrative and does not limit the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.

同时,可以理解的是,本技术方案所涉及的数据(包括但不限于数据本身、数据的获取或使用)应当遵循相应法律法规及相关规定的要求。At the same time, it can be understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of data) should comply with the requirements of corresponding laws and regulations and relevant regulations.

图1是根据一示例性实施例示出的一种测试用例生成方法的步骤。如图1所示,该方法可以包括以下S101~S104。Fig. 1 shows the steps of a test case generation method according to an exemplary embodiment. As shown in FIG. 1 , the method may include the following S101-S104.

在S101中,显示针对待测应用程序的测试场景配置界面,确定针对待测应用程序配置的目标测试场景。In S101, a test scenario configuration interface for the application to be tested is displayed, and a target test scenario configured for the application to be tested is determined.

在本公开中,测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的目标测试场景,即用户可以通过在测试场景配置界面上进行场景点选来配置测试所需覆盖的目标测试场景。In this disclosure, the test scenario configuration interface supports performing selection operations on the interface to configure the target test scenario that the test needs to cover, that is, the user can configure the target test that the test needs to cover by clicking the scene on the test scenario configuration interface Scenes.

在S102中,调用针对待测应用程序预先生成的测试地图,基于目标测试场景生成对应的测试用例。In S102, the pre-generated test map for the application program to be tested is invoked, and corresponding test cases are generated based on the target test scenario.

在本公开中,测试用例用于对待测应用程序进行测试。测试地图是针对待测应用程序的页面信息进行场景聚类所得的聚类信息构建的场景关系知识图谱,场景关系知识图谱中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。In this disclosure, test cases are used to test the application under test. The test map is a scene relational knowledge map constructed from the clustering information obtained by scene clustering of the page information of the application to be tested. The nodes in the scene relational knowledge map are used to represent the scene abstracted from the page, and the edges connected by the nodes are used to represent Controls, actions and jump information supported by the node.

待测应用程序通常包括很多的应用功能,例如,视频类应用程序会包括登录、视频录制、视频编辑、配音、聊天等多个功能模块,每种功能都会体现在待测应用程序的各个页面中,即各个页面的场景,或者也可以说是各个页面的特性。为了实现待测应用程序的全面的测试,需要确定待测应用程序中每个页面的场景,即需要将待测应用程序中的页面聚类抽象成多个场景。The application under test usually includes many application functions. For example, a video application will include multiple functional modules such as login, video recording, video editing, dubbing, chat, etc., and each function will be reflected in each page of the application under test , that is, the scene of each page, or it can also be said to be the characteristics of each page. In order to implement a comprehensive test of the application under test, it is necessary to determine the scene of each page in the application under test, that is, it is necessary to abstract the clustering of pages in the application under test into multiple scenarios.

场景之间的跳转信息指的是从一个场景能够跳转到另一个场景的场景跳转关系,例如,场景A跳转到场景B为一个场景跳转关系。场景之间的跳转信息可以包括单向跳转关系和双向跳转关系。其中,当两个场景可以相互跳转时,确定该两个场景之间存在双向跳转关系,当两个场景中、只能从一个场景跳转到另一个场景时,确定该两个场景之间存在单向跳转关系。Jump information between scenes refers to a scene jump relationship that can jump from one scene to another scene, for example, jumping from scene A to scene B is a scene jump relationship. The jump information between scenes may include a one-way jump relationship and a two-way jump relationship. Among them, when two scenes can jump to each other, it is determined that there is a two-way jump relationship between the two scenes, and when two scenes can only jump from one scene to another scene, it is determined that the two scenes There is a one-way jump relationship between them.

待测应用程序的页面的场景中通常设置有若干用于实现场景跳转的控件(即跳转控件),用于控制待测应用程序从一个场景跳转到另一个场景。通过在一个场景中的跳转控件上或者场景中任意位置施加相应的动作(也即跳转动作,例如,单击动作、长按动作等),可以实现从该场景跳转到另一场景。The scene of the page of the application to be tested is usually provided with several controls (ie, jump controls) for implementing scene jumps, which are used to control the application to be tested to jump from one scene to another. By applying a corresponding action (that is, a jump action, such as a click action, a long press action, etc.) on the jump control in a scene or at any position in the scene, it is possible to jump from this scene to another scene.

在上述技术方案中,首先,显示针对待测应用程序的测试场景配置界面,确定针对待测应用程序配置的目标测试场景,其中,测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的目标测试场景;然后,调用针对待测应用程序预先生成的测试地图,基于目标测试场景生成对应的测试用例。这样,用户只需在测试场景配置界面上进行场景的点选,即可配置测试所需覆盖的目标测试场景,方便快捷,之后,可以根据预先生成的测试地图,基于目标测试场景自动生成测试用例,而不需要人工编写测试用例,从而降低了得到测试用例的复杂度,进而可以提升测试用例的生成效率和应用程序的测试效率,并且可以提升用户体验。In the above technical solution, firstly, a test scenario configuration interface for the application to be tested is displayed, and a target test scenario configured for the application to be tested is determined, wherein the test scenario configuration interface supports performing a selection operation on the interface to configure the required test scenario for the test. Covered target test scenarios; then, call the pre-generated test map for the application under test, and generate corresponding test cases based on the target test scenarios. In this way, the user only needs to click the scene on the test scene configuration interface to configure the target test scene to be covered by the test, which is convenient and fast. After that, the test case can be automatically generated based on the target test scene according to the pre-generated test map , instead of manually writing test cases, thereby reducing the complexity of obtaining test cases, thereby improving the efficiency of test case generation and application testing, and improving user experience.

下面针对上述测试地图的生成方式进行详细说明。具体来说,可以通过以下步骤[1]~步骤[3]来实现:The method of generating the above test map will be described in detail below. Specifically, it can be achieved through the following steps [1] to [3]:

步骤[1]:遍历待测应用程序中页面的可扩展标记语言(Extensible MarkupLanguage,XML)信息,对全量页面的可扩展标记语言信息进行场景聚类得到多个场景。Step [1]: traverse the Extensible Markup Language (XML) information of the pages in the application to be tested, and perform scene clustering on the Extensible Markup Language information of all pages to obtain multiple scenes.

在本公开中,页面的XML信息可以包括该页面中各控件的排布、样式、名称等信息。需要说明的是,遍历待测应用程序中页面的XML信息,对全量页面的可扩展标记语言信息进行场景聚类得到多个场景的具体实施方式属于本领域技术人员公知的,这里不再赘述。In the present disclosure, the XML information of the page may include information such as arrangement, style, and name of each control in the page. It should be noted that the specific implementation of traversing the XML information of the pages in the application program under test, and performing scene clustering on the XML information of all pages to obtain multiple scenes is well known to those skilled in the art, and will not be repeated here.

步骤[2]:根据每一页面抽象成的场景和待测应用程序相关的历史测试数据进行边关系抽象,得到多个场景之间的边关系。Step [2]: According to the scene abstracted into each page and the historical test data related to the application to be tested, the edge relationship is abstracted to obtain the edge relationship between multiple scenes.

在本公开中,边关系包括场景之间的跳转信息和边关系的属性信息,其中,边关系的属性信息可以包括存在边关系的场景跳转的触发条件。In the present disclosure, the edge relationship includes jump information between scenes and attribute information of the edge relationship, wherein the attribute information of the edge relationship may include a trigger condition for jumping to a scene where the edge relationship exists.

其中,场景跳转的触发条件包括跳转控件和跳转动作,即通过在一个场景中的跳转控件上施加相应的跳转动作(例如,单击动作、长按动作等),实现从该场景跳转到另一场景。Wherein, the triggering condition of the scene jump includes a jump control and a jump action, that is, by applying a corresponding jump action (for example, a click action, a long press action, etc.) Scene jumps to another scene.

步骤[3]:根据多个场景之间的边关系,生成测试地图。Step [3]: Generate a test map according to the edge relationship between multiple scenes.

其中,在测试地图中,边关系中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。Among them, in the test map, the nodes in the edge relationship are used to represent the scenes abstracted from the page, and the edges connected by nodes are used to represent the controls, actions and jump information supported by the nodes.

下面针对上述步骤[2]中的根据每一页面抽象成的场景和待测应用程序相关的历史测试数据进行边关系抽象的的具体实施方式进行详细说明。具体来说,可以通过以下步骤[21]~步骤[23]来实现:The following describes in detail the specific implementation manner of abstracting the edge relationship according to the scene abstracted from each page and the historical test data related to the application program to be tested in the above step [2]. Specifically, it can be realized through the following steps [21] to [23]:

步骤[21]:根据待测应用程序相关的历史测试数据,确定待测应用程序的页面之间的跳转信息和页面跳转的触发条件。Step [21]: According to the historical test data related to the application to be tested, determine the jump information between the pages of the application to be tested and the triggering conditions for page jumps.

在本公开中,待测应用程序的各页面中通常设置有若干用于实现页面跳转的控件(即跳转控件),用于控制待测应用程序从一个页面跳转到另一个页面。页面之间的跳转信息指的是从一个页面能够跳转到另一个页面的页面跳转关系,例如,页面a跳转到页面b为一个页面跳转关系。页面之间的跳转信息可以包括单向跳转关系和双向跳转关系。其中,当两个页面可以相互跳转时,确定该两个页面之间存在双向跳转关系,当两个页面中、只能从一个页面跳转到另一个页面时,确定该两个页面之间存在单向跳转关系。In the present disclosure, each page of the application program to be tested is usually provided with several controls for realizing page jumps (ie, jump controls), which are used to control the application program to be tested to jump from one page to another. The jump information between pages refers to a page jump relationship that can jump from one page to another page, for example, page a jumps to page b is a page jump relationship. The jump information between pages may include a one-way jump relationship and a two-way jump relationship. Wherein, when two pages can jump to each other, it is determined that there is a bidirectional jump relationship between the two pages; There is a one-way jump relationship between them.

示例地,如图2所示,待测应用程序包括七个页面,分别为页面a1、页面a2、页面b、页面c1、页面c2、页面d以及页面e。其中:页面a1和页面a2之间存在双向跳转关系,实现页面a1和页面a2之间相互跳转的触发条件包括下滑动作,其中,跳转控件为空;页面a2和页面c1之间存在单向跳转关系,实现页面a2向页面c1跳转的触发条件包括页面a2中的控件a21(图2中未示出)和单击动作,即通过单击页面a2中的控件a21,实现页面a2向页面c1的跳转;页面a2和页面c2之间存在单向跳转关系,实现页面a2向页面c2跳转的触发条件包括页面a2中的控件a21和长按动作,即通过长按页面a2中的控件a21,实现页面a2向页面c2的跳转;页面a1和页面b之间存在单向跳转关系,实现页面a1向页面b跳转的触发条件包括页面a1中的控件a11(图2中未示出)和单击动作,即通过单击页面a1中的控件a11,实现页面a1向页面b的跳转;页面b和页面d之间存在单向跳转关系,实现页面b向页面d跳转的触发条件包括页面b中的控件b1(图2中未示出)和单击动作,即通过单击页面b中的控件b1,实现页面b向页面d的跳转;页面d和页面e之间存在单向跳转关系,实现页面d向页面e跳转的触发条件包括页面d中的控件d1(图2中未示出)和单击动作,即通过单击页面d中的控件d1,实现页面d向页面e的跳转。Exemplarily, as shown in FIG. 2 , the application program to be tested includes seven pages, namely page a1 , page a2 , page b, page c1 , page c2 , page d, and page e. Among them: there is a two-way jump relationship between page a1 and page a2, and the trigger condition for realizing the mutual jump between page a1 and page a2 includes a sliding action, wherein the jump control is empty; there is a single link between page a2 and page c1 To the jump relationship, the trigger conditions for realizing the jump from page a2 to page c1 include the control a21 in page a2 (not shown in Figure 2) and the click action, that is, by clicking the control a21 in page a2, the page a2 is realized Jump to page c1; there is a one-way jump relationship between page a2 and page c2, and the trigger conditions to realize the jump from page a2 to page c2 include the control a21 in page a2 and the long-press action, that is, by long-pressing page a2 The control a21 in the page realizes the jump from page a2 to page c2; there is a one-way jump relationship between page a1 and page b, and the trigger condition for realizing the jump from page a1 to page b includes the control a11 in page a1 (Figure 2 not shown in ) and click actions, that is, by clicking the control a11 in page a1, the jump from page a1 to page b is realized; there is a one-way jump relationship between page b and page d, and page b to page The triggering conditions for the d jump include the control b1 (not shown in Figure 2) and the click action in page b, that is, by clicking the control b1 in page b, the jump from page b to page d is realized; page d and There is a one-way jump relationship between pages e, and the trigger conditions for realizing the jump from page d to page e include the control d1 (not shown in Figure 2) in page d and the click action, that is, by clicking the Control d1 realizes the jump from page d to page e.

步骤[22]:根据待测应用程序的页面之间的跳转信息和每一页面抽象成的场景,确定多个场景之间的跳转信息。Step [22]: According to the jump information between the pages of the application program to be tested and the scenes abstracted from each page, determine the jump information between multiple scenes.

具体来说,可以针对待测应用程序中每一存在跳转关系的页面对,可以将该页面对之间的跳转信息,确定为该页面对对应的场景对之间的跳转信息。Specifically, for each page pair that has a jump relationship in the application program to be tested, the jump information between the page pair can be determined as the jump information between the scene pair corresponding to the page pair.

示例地,如图2所示,页面a1和页面a2之间存在双向跳转关系,页面a1和页面a2的场景均为场景A,页面对a1-a2对应的场景对为场景A-A,因此,场景A自身存在单向跳转关系。For example, as shown in Figure 2, there is a two-way jump relationship between page a1 and page a2, the scenes of page a1 and page a2 are both scene A, and the scene pair corresponding to page a1-a2 is scene A-A, therefore, scene A itself has a one-way jump relationship.

又示例地,如图2所示,页面对a2-c1之间存在从页面a2向页面c1跳转的单向跳转关系,页面a2的场景为场景A,页面c1的场景为场景C,页面对a2-c1对应场景对A-C,因此,场景A和场景C之间存在从场景A向场景C跳转的关系。As another example, as shown in Figure 2, there is a one-way jump relationship from page a2 to page c1 between the page pair a2-c1, the scene of page a2 is scene A, the scene of page c1 is scene C, and the scene of page c1 is scene C. The pair a2-c1 corresponds to the scene pair A-C, therefore, there is a relationship between scene A and scene C that jumps from scene A to scene C.

步骤[23]:根据页面跳转的触发条件和每一页面抽象成的场景,确定场景跳转的触发条件。Step [23]: Determine the triggering conditions for scene jumping according to the triggering conditions for page jumping and the scenes abstracted from each page.

具体来说,可以针对待测应用程序中每一存在跳转关系的页面对,可以将实现该页面对之间的跳转的触发条件,确定为实现该页面对对应的场景对之间的跳转的触发条件。Specifically, for each page pair that has a jump relationship in the application to be tested, the trigger condition for realizing the jump between the page pair can be determined as realizing the jump between the scene pairs corresponding to the page pair Turn trigger conditions.

示例地,如图2所示,页面a1和页面a2之间存在双向跳转关系,实现页面a1和页面a2之间相互跳转的触发条件包括下滑动作,页面a1和页面a2的场景均为场景A,页面对a1-a2对应场景对A-A,因此,实现场景A向自身跳转的触发条件包括下滑动作,其中,跳转控件为空。For example, as shown in Figure 2, there is a two-way jump relationship between page a1 and page a2, and the trigger condition for realizing the mutual jump between page a1 and page a2 includes a sliding action, and the scenes of page a1 and page a2 are both scenes A, the page pair a1-a2 corresponds to the scene pair A-A, therefore, the trigger condition for realizing the jump from scene A to itself includes a sliding action, wherein the jump control is empty.

又示例地,如图2中所示,页面对a2-c1之间存在从页面a2向页面c1跳转的单向跳转关系,实现页面a2向页面c1跳转的触发条件包括页面a2中的控件a21和单击动作,页面a2的场景为场景A,页面c1的场景为场景C,页面对a2-c1对应的场景对A-C,因此,实现场景A向场景C跳转的触发条件包括页面a2中的控件a21和单击动作。As another example, as shown in Figure 2, there is a one-way jump relationship from page a2 to page c1 between the page pair a2-c1, and the trigger condition for realizing the jump from page a2 to page c1 includes the Control a21 and click action, the scene of page a2 is scene A, the scene of page c1 is scene C, and the scene pair A-C corresponding to page pair a2-c1, therefore, the triggering conditions to realize the jump from scene A to scene C include page a2 Control a21 in and click action.

下面针对上述步骤[21]中的根据待测应用程序相关的历史测试数据,确定待测应用程序的页面之间的跳转信息和页面跳转的触发条件的具体实施方式进行详细说明。具体来说,可以通过以下步骤[211]和步骤[212]来实现:The specific implementation of determining the jump information between pages of the application to be tested and the triggering conditions for page jumps according to the historical test data related to the application to be tested in the above step [21] will be described in detail below. Specifically, it can be realized through the following steps [211] and steps [212]:

步骤[211]:获取预设测试工具针对待测试应用程序的随机测试数据,作为待测应用程序相关的历史测试数据。Step [211]: Obtain the random test data of the preset test tool for the application to be tested as historical test data related to the application to be tested.

步骤[212]:根据历史测试数据,确定待测应用程序的页面之间的跳转信息和页面跳转的触发条件。Step [212]: According to the historical test data, determine the jump information between the pages of the application to be tested and the triggering conditions of the page jump.

在本公开中,预设测试工具用于对待测试应用程序进行多次随机测试,得到随机测试数据,作为待测应用程序相关的历史测试数据。在每次随机测试时,可以先启动待测试应用程序,当待测试应用程序运行之后,通过点击待测试应用程序中各页面内的跳转控件,控制页面不断跳转,从而获取待测试应用程序中不同页面之间的跳转信息和页面跳转的触发条件。In the present disclosure, the preset testing tool is used to perform multiple random tests on the application program to be tested to obtain random test data as historical test data related to the application program to be tested. In each random test, you can first start the application to be tested, and when the application to be tested is running, click the jump control in each page of the application to be tested to control the continuous jump of the page, thereby obtaining the application to be tested Jump information between different pages in , and trigger conditions for page jumps.

其中,上述预设测试工具可以为测试的安装包,例如,快速启动(Fastbot)客户端。Wherein, the above-mentioned preset testing tool may be a testing installation package, for example, a Fastbot client.

下面针对上述步骤[3]的根据多个场景之间的边关系,生成测试地图的具体实施方式进行详细说明。具体来说,可以以多个场景中的每一场景为节点,将存在边关系的场景节点用有向线段连接起来,表示二者之间的跳转关系,其中,有向线段的起点为跳转前的场景节点(即源场景),有向线段的终点为跳转后的场景节点(即目标场景),并在该有向线段上标注该边关系的属性信息,从而得到待测应用程序对应的测试地图。其中,目标场景可以理解为基于源场景中的跳转动作将跳转至的场景。The specific implementation manner of generating the test map according to the edge relationship between multiple scenes in the above step [3] will be described in detail below. Specifically, each scene in multiple scenes can be used as a node, and the scene nodes with edge relationship can be connected with directed line segments to represent the jump relationship between the two, where the starting point of the directed line segment is jump The scene node before the transfer (i.e. the source scene), the end point of the directed line segment is the scene node after the jump (i.e. the target scene), and the attribute information of the edge relationship is marked on the directed line segment, so as to obtain the application program under test Corresponding test map. Wherein, the target scene can be understood as a scene to be jumped to based on a jump action in the source scene.

示例地,根据图2所示的页面之间的跳转信息和页面跳转的触发条件,构建出的待测应用程序对应的测试地图如图3所示。Exemplarily, according to the jump information between pages shown in FIG. 2 and the triggering conditions of page jumps, the test map corresponding to the application program to be tested is constructed as shown in FIG. 3 .

另外,为了使得测试地图覆盖更多的场景,提升测试地图的完整性,从而尽可能实现待测应用程序的全面测试,上述测试地图可以随着测试数据的更新而更新。In addition, in order to make the test map cover more scenarios and improve the integrity of the test map, so as to realize the comprehensive test of the application program under test as much as possible, the above test map can be updated with the update of the test data.

下面针对上述S101中的确定针对待测应用程序配置的目标测试场景的具体实施方式进行详细说明。The specific implementation manner of determining the target test scenario configured for the application program under test in the above S101 will be described in detail below.

具体来说,可以响应于接收到针对测试场景配置界面中、待测试场景的顺序选择操作,将选择操作依次选择的待测试场景确定为目标测试场景。Specifically, in response to receiving a sequential selection operation for the scenarios to be tested in the test scenario configuration interface, the scenarios to be tested sequentially selected by the selection operation may be determined as target test scenarios.

在本公开中,可以通过多种方式来触发上述选择操作,在一种实施方式中,在测试场景配置界面中展示针对待测应用程序预先生成的测试地图,这样,用户按照测试地图中场景之间的跳转关系,在展示的测试地图中依次选择需要参与测试的场景(即待测试场景),从而实现待测试场景的顺序选择,以配置测试所需覆盖的目标测试场景。In the present disclosure, the above-mentioned selection operation can be triggered in various ways. In one embodiment, a pre-generated test map for the application to be tested is displayed in the test scene configuration interface. In the displayed test map, select the scenarios that need to participate in the test (that is, the scenarios to be tested) in sequence, so as to realize the sequential selection of the scenarios to be tested, and configure the target test scenarios that the test needs to cover.

在另一种实施方式中,首先在测试场景配置界面中显示针对待测应用程序预先生成的测试地图中的所有场景节点,然后基于用户所选择的场景,根据测试地图,展示其所选择的场景的下游相邻场景,以供用户进一步选择,之后,基于用户重新选择的场景,根据测试地图,在测试场景配置界面中展示重新选择的场景的下游相邻场景,以供用户进一步选择,如此循环,直到满足选择终止条件时为止。具体来说,在上述将选择操作依次选择的待测试场景确定为目标测试场景的步骤之前,上述S101还可以包括以下步骤(1)~步骤(4)。In another embodiment, all the scene nodes in the pre-generated test map for the application to be tested are first displayed in the test scene configuration interface, and then based on the scene selected by the user, the scene selected by the user is displayed according to the test map The downstream adjacent scene of the selected scene is for the user to further select, and then, based on the scene re-selected by the user, according to the test map, the downstream adjacent scene of the re-selected scene is displayed in the test scene configuration interface for the user to further select, and so on. , until the selection termination condition is satisfied. Specifically, before the above step of determining the scene to be tested sequentially selected by the selection operation as the target test scene, the above S101 may further include the following steps (1) to (4).

步骤(1):响应于接收到针对测试场景配置界面中、待测试场景的选择操作,获取测试地图中、待测试场景的相邻下游场景。Step (1): In response to receiving a selection operation for the scene to be tested in the test scene configuration interface, acquire adjacent downstream scenes of the scene to be tested in the test map.

其中,待测试场景初始为待测应用程序的主页面。在测试场景配置界面中显示测试地图中的所有场景节点,这样,用户可以通过点选操作来选择待测试场景。Wherein, the scene to be tested is initially the main page of the application program to be tested. All scene nodes in the test map are displayed in the test scene configuration interface, so that the user can select the scene to be tested by clicking.

待测试场景的相邻下游场景为测试地图中、与该待测试场景存在跳转关系的目标场景。The adjacent downstream scene of the scene to be tested is the target scene in the test map that has a jump relationship with the scene to be tested.

示例地,如图3所示,待测试场景为场景A,场景A的相邻下游场景包括:场景C、场景A、场景B。For example, as shown in FIG. 3 , the scene to be tested is scene A, and the adjacent downstream scenes of scene A include: scene C, scene A, and scene B.

又示例地,如图3所示,待测试场景为场景B,场景B的相邻下游场景包括场景D。For another example, as shown in FIG. 3 , the scene to be tested is scene B, and the adjacent downstream scene of scene B includes scene D.

步骤(2):判定是否满足选择终止条件。Step (2): Determine whether the selection termination condition is satisfied.

在本公开中,若接收到用于指示选择终止的指令或者待测试场景的相邻下游场景为空(即待测试场景不存在相邻下游场景),则确定满足选择终止条件。若未接收到用于指示选择终止的指令、且待测试场景的相邻下游场景非空,则确定不满足选择终止条件。In the present disclosure, if an instruction indicating termination of selection is received or the adjacent downstream scene of the scene to be tested is empty (that is, there is no adjacent downstream scene of the scene to be tested), it is determined that the selection termination condition is satisfied. If the instruction for indicating selection termination is not received and the adjacent downstream scene of the scene to be tested is not empty, it is determined that the selection termination condition is not satisfied.

若不满足选择终止条件,则执行以下步骤(3)和步骤(4),之后,返回上述获取测试地图中、待测试场景的相邻下游场景的步骤,即返回上述步骤(1);若满足选择终止条件,则执行上述将选择操作依次选择的待测试场景确定为目标测试场景的步骤。If the selection termination condition is not satisfied, then perform the following steps (3) and (4), after that, return to the above step of obtaining the adjacent downstream scene of the scene to be tested in the test map, that is, return to the above step (1); if satisfied If the termination condition is selected, the above-mentioned steps of determining the scene to be tested successively selected by the selection operation as the target test scene are executed.

步骤(3):在测试场景配置界面中展示相邻下游场景。Step (3): Display adjacent downstream scenarios in the test scenario configuration interface.

步骤(4):响应于接收到针对任一相邻下游场景的选择操作,将待测试场景更新为所选择的相邻下游场景。Step (4): In response to receiving a selection operation for any adjacent downstream scene, update the scene to be tested to the selected adjacent downstream scene.

下面针对上述S102中的调用针对待测应用程序预先生成的测试地图,基于目标测试场景生成对应的测试用例的具体实施方式进行详细说明。具体来说,可以通过多种实施方式来实现,在一种实施方式中,首先,将目标测试场景中的每一待测试场景按照被选择的先后顺序依次连接,得到测试路径;然后,根据测试地图,获取测试路径中各边的属性信息;接下来,将测试路径中各边的属性信息添加至测试路径中的边上,从而得到测试用例。The specific implementation manner of generating a corresponding test case based on the target test scenario based on the pre-generated test map of the application program to be tested by calling in the above S102 will be described in detail below. Specifically, it can be realized through various implementation modes. In one implementation mode, firstly, each scene to be tested in the target test scene is sequentially connected according to the selected sequence to obtain the test path; then, according to the test map to obtain the attribute information of each edge in the test path; next, add the attribute information of each edge in the test path to the edge in the test path to obtain a test case.

在另一个实施方式中,可以从测试地图中抽取目标测试场景所在的路径,作为测试用例。其中,目标测试场景所在的路径的有向关系基于目标测试场景中的每一待测试场景按照被选择的先后顺序确定。In another embodiment, the path where the target test scene is located may be extracted from the test map as a test case. Wherein, the directional relationship of the path where the target test scene is located is determined based on the order in which each scene to be tested in the target test scene is selected.

示例地,测试地图如图3所示,用户针对待测应用程序配置的目标测试场景包括场景A、场景B、场景D以及场景E,它们被选择的先后顺序依次为场景A、场景B、场景D、场景E,则测试路径为场景A→场景B→场景D→场景E,测试用例如图4所示(其未示出跳转控件)。Exemplarily, the test map is shown in Figure 3, and the target test scenarios configured by the user for the application to be tested include scenario A, scenario B, scenario D, and scenario E, and the order in which they are selected is scenario A, scenario B, scenario D. Scenario E, the test path is scenario A→scene B→scene D→scene E, and the test example is shown in Figure 4 (the jump control is not shown).

上述两种实施方式生成的测试用例均是结构化的,便于持久化保存,测试用例的维护性大大增强。并且,测试用例包括测试路径,能够实时追踪测试用例覆盖进度,便于接入多种断言能力,检测更多类型问题。The test cases generated by the above two implementation methods are all structured, which is convenient for persistent storage, and the maintainability of the test cases is greatly enhanced. In addition, test cases include test paths, which can track the progress of test case coverage in real time, facilitate access to multiple assertion capabilities, and detect more types of problems.

此外,在生成测试用例后,可以将其保存至数据库中,之后,可以从数据库中获取该测试用例,并对其进行测试。In addition, after the test case is generated, it can be saved in the database, and then the test case can be obtained from the database and tested.

图5是根据一示例性实施例示出的一种测试用例生成装置的框图。如图5所示,该装置500包括:Fig. 5 is a block diagram of a device for generating test cases according to an exemplary embodiment. As shown in Figure 5, the device 500 includes:

确定模块501,用于显示针对待测应用程序的测试场景配置界面,确定针对所述待测应用程序配置的目标测试场景;所述测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的所述目标测试场景;The determination module 501 is used to display the test scenario configuration interface for the application to be tested, and determine the target test scenario configured for the application to be tested; the test scenario configuration interface supports performing selection operations on the interface to configure the required test scenarios. said target test scenarios covered;

生成模块502,用于调用针对所述待测应用程序预先生成的测试地图,基于所述目标测试场景生成对应的测试用例,所述测试用例用于对所述待测应用程序进行测试;其中,所述测试地图是针对所述待测应用程序的页面信息进行场景聚类所得的聚类信息构建的场景关系知识图谱,所述场景关系知识图谱中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。The generating module 502 is configured to invoke a test map pre-generated for the application under test, and generate a corresponding test case based on the target test scenario, and the test case is used to test the application under test; wherein, The test map is a scene relationship knowledge graph constructed from the clustering information obtained by performing scene clustering on the page information of the application to be tested. The nodes in the scene relationship knowledge graph are used to represent the scenes abstracted from the page, and the nodes The connected edges are used to represent the controls, actions and jump information supported by the nodes.

在上述技术方案中,首先,显示针对待测应用程序的测试场景配置界面,确定针对待测应用程序配置的目标测试场景,其中,测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的目标测试场景;然后,调用针对待测应用程序预先生成的测试地图,基于目标测试场景生成对应的测试用例。这样,用户只需在测试场景配置界面上进行场景的点选,即可配置测试所需覆盖的目标测试场景,方便快捷,之后,可以根据预先生成的测试地图,基于目标测试场景自动生成测试用例,而不需要人工编写测试用例,从而降低了得到测试用例的复杂度,进而可以提升测试用例的生成效率和应用程序的测试效率,并且可以提升用户体验。In the above technical solution, firstly, a test scenario configuration interface for the application to be tested is displayed, and a target test scenario configured for the application to be tested is determined, wherein the test scenario configuration interface supports performing a selection operation on the interface to configure the required test scenario for the test. Covered target test scenarios; then, call the pre-generated test map for the application under test, and generate corresponding test cases based on the target test scenarios. In this way, the user only needs to click the scene on the test scene configuration interface to configure the target test scene to be covered by the test, which is convenient and fast. After that, the test case can be automatically generated based on the target test scene according to the pre-generated test map , instead of manually writing test cases, thereby reducing the complexity of obtaining test cases, thereby improving the efficiency of test case generation and application testing, and improving user experience.

可选地,所述装置500还包括:Optionally, the device 500 also includes:

聚类子模块,用于遍历所述待测应用程序中页面的可扩展标记语言信息,对全量页面的可扩展标记语言信息进行场景聚类得到多个场景;The clustering sub-module is used to traverse the extensible markup language information of the pages in the application to be tested, and perform scene clustering on the extensible markup language information of all pages to obtain multiple scenes;

边关系抽象子模块,用于根据每一所述页面抽象成的场景和所述待测应用程序相关的历史测试数据进行边关系抽象,得到所述多个场景之间的边关系;The edge relationship abstraction submodule is used to perform edge relationship abstraction according to the scenes abstracted from each page and the historical test data related to the application to be tested, so as to obtain the edge relationship between the multiple scenes;

生成子模块,用于根据所述多个场景之间的边关系,生成所述测试地图,其中,所述边关系中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。A generation sub-module is used to generate the test map according to the edge relationship between the multiple scenes, wherein the nodes in the edge relationship are used to represent the scene abstracted from the page, and the edges connected by the nodes are used to represent the nodes Supported controls, actions and jump information.

可选地,所述测试地图随着测试数据的更新而更新。Optionally, the test map is updated as the test data is updated.

可选地,所述边关系抽象子模块包括:Optionally, the edge relationship abstraction submodule includes:

第一确定子模块,用于根据所述待测应用程序相关的历史测试数据,确定所述页面之间的跳转信息和页面跳转的触发条件,其中,所述触发条件包括所述控件和所述动作;The first determination submodule is configured to determine the jump information between the pages and the trigger conditions for page jumps according to the historical test data related to the application under test, wherein the trigger conditions include the controls and said action;

第二确定子模块,用于根据所述页面之间的跳转信息和每一所述页面抽象成的场景,确定所述多个场景之间的跳转信息;The second determining submodule is used to determine the jump information between the multiple scenes according to the jump information between the pages and the scenes abstracted from each page;

第三确定子模块,用于根据页面跳转的触发条件和每一所述页面抽象成的场景,确定场景跳转的触发条件。The third determining submodule is used to determine the triggering condition of the scene jumping according to the triggering condition of the page jumping and the scene abstracted from each page.

可选地,所述确定模块501包括:Optionally, the determining module 501 includes:

第四确定子模块,用于响应于接收到针对所述测试场景配置界面中、待测试场景的顺序选择操作,将所述选择操作依次选择的所述待测试场景确定为所述目标测试场景。The fourth determination sub-module is configured to, in response to receiving a sequence selection operation for the scenarios to be tested in the test scenario configuration interface, determine the scenarios to be tested sequentially selected by the selection operation as the target test scenario.

可选地,所述确定模块501还包括:Optionally, the determining module 501 also includes:

获取子模块,用于在所述第四确定子模块将所述选择操作依次选择的所述待测试场景确定为所述目标测试场景之前,响应于接收到针对所述测试场景配置界面中、待测试场景的选择操作,获取所述测试地图中、所述待测试场景的相邻下游场景,其中,所述待测试场景初始为所述待测应用程序的主页面;The acquisition submodule is configured to respond to receiving the target test scenario in the configuration interface for the test scenario before the fourth determination submodule determines the scenario to be tested sequentially selected by the selection operation as the target test scenario. The selection operation of the test scene is to obtain the adjacent downstream scene of the scene to be tested in the test map, wherein the scene to be tested is initially the main page of the application to be tested;

展示子模块,用于若不满足选择终止条件,则在所述测试场景配置界面中展示所述相邻下游场景;The display submodule is used to display the adjacent downstream scene in the test scene configuration interface if the selection termination condition is not satisfied;

第一触发子模块,用于响应于接收到针对任一所述相邻下游场景的选择操作,将所述待测试场景更新为所选择的相邻下游场景,触发所述获取子模块获取所述测试地图中、所述待测试场景的相邻下游场景;The first triggering submodule is configured to update the scene to be tested to the selected adjacent downstream scene in response to receiving a selection operation for any of the adjacent downstream scenes, and trigger the acquiring submodule to acquire the In the test map, adjacent downstream scenes of the scene to be tested;

第二触发子模块,用于若满足所述选择终止条件,则触发所述第四确定子模块将所述选择操作依次选择的所述待测试场景确定为所述目标测试场景。The second triggering submodule is configured to trigger the fourth determination submodule to determine the scene to be tested sequentially selected by the selection operation as the target test scene if the selection termination condition is met.

可选地,所述生成模块502用于从所述测试地图中抽取所述目标测试场景所在的路径,作为所述测试用例。Optionally, the generation module 502 is configured to extract the path where the target test scene is located from the test map as the test case.

本公开还提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现本公开提供的上述测试用例生成方法的步骤。The present disclosure also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the above-mentioned test case generation method provided by the present disclosure are realized.

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

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

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

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

需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(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 two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present 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 carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

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

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated 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: displays a test scenario configuration interface for the application program to be tested, and determines the The target test scene configured by the application program; the test scene configuration interface supports performing selection operations on the interface to configure the target test scene covered by the test; calling the pre-generated test map for the application to be tested, based on the The target test scenario generates a corresponding test case, and the test case is used to test the application to be tested; wherein, the test map is the clustering of the scene clustering for the page information of the application to be tested The scene relationship knowledge graph constructed by class information, the nodes in the scene relationship knowledge graph are used to represent the scene abstracted from the page, and the edges connecting the nodes are used to represent the controls, actions and jump information supported by the nodes.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as "C" 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 cases involving a remote computer, the remote computer may be connected to the user 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 (for example, using an Internet service provider to connected via the Internet).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。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 a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block 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 they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be 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 by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.

描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定,例如,确定模块还可以被描述为“显示针对待测应用程序的测试场景配置界面,确定针对所述待测应用程序配置的目标测试场景的模块”。The modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Among them, the name of the module does not constitute a limitation of the module itself under certain circumstances. For example, the determination module can also be described as "displaying the test scenario configuration interface for the application under test, and determining the configuration interface for the application under test. Modules for the configured target test scenarios".

本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(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), System on Chips (SOCs), Complex Programmable Logical device (CPLD) and so on.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(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 conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, 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 discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

根据本公开的一个或多个实施例,示例1提供了一种测试用例生成方法,包括:显示针对待测应用程序的测试场景配置界面,确定针对所述待测应用程序配置的目标测试场景;所述测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的所述目标测试场景;调用针对所述待测应用程序预先生成的测试地图,基于所述目标测试场景生成对应的测试用例,所述测试用例用于对所述待测应用程序进行测试;其中,所述测试地图是针对所述待测应用程序的页面信息进行场景聚类所得的聚类信息构建的场景关系知识图谱,所述场景关系知识图谱中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。According to one or more embodiments of the present disclosure, Example 1 provides a test case generation method, including: displaying a test scenario configuration interface for the application to be tested, and determining a target test scenario configured for the application to be tested; The test scenario configuration interface supports performing selection operations on the interface to configure the target test scenario to be covered by the test; call the pre-generated test map for the application to be tested, and generate a corresponding test based on the target test scenario Use case, the test case is used to test the application under test; wherein, the test map is a scene relationship knowledge graph constructed from the clustering information obtained by performing scene clustering on the page information of the application under test , the nodes in the scene relationship knowledge graph are used to represent the scene abstracted from the page, and the edges connected to the nodes are used to represent the controls, actions and jump information supported by the nodes.

根据本公开的一个或多个实施例,示例2提供了示例1的方法,所述方法还包括:遍历所述待测应用程序中页面的可扩展标记语言信息,对全量页面的可扩展标记语言信息进行场景聚类得到多个场景;根据每一所述页面抽象成的场景和所述待测应用程序相关的历史测试数据进行边关系抽象,得到所述多个场景之间的边关系;根据所述多个场景之间的边关系,生成所述测试地图,其中,所述边关系中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, and the method further includes: traversing the Extensible Markup Language information of the pages in the application to be tested, and performing the Extensible Markup Language performing scene clustering on the information to obtain a plurality of scenes; performing edge relationship abstraction according to the scene abstracted into each said page and the historical test data related to the application to be tested, to obtain the edge relationship between the multiple scenes; according to The edge relationship between the multiple scenes is used to generate the test map, wherein the nodes in the edge relationship are used to represent the scenes abstracted from the page, and the edges connected by nodes are used to represent the controls, actions and jumps supported by the nodes. transfer information.

根据本公开的一个或多个实施例,示例3提供了示例2的方法,所述测试地图随着测试数据的更新而更新。According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, and the test map is updated as the test data is updated.

根据本公开的一个或多个实施例,示例4提供了示例2的方法,所述根据每一所述页面抽象成的场景和所述待测应用程序相关的历史测试数据进行边关系抽象,包括:根据所述待测应用程序相关的历史测试数据,确定所述页面之间的跳转信息和页面跳转的触发条件,其中,所述触发条件包括所述控件和所述动作;根据所述页面之间的跳转信息和每一所述页面抽象成的场景,确定所述多个场景之间的跳转信息;根据页面跳转的触发条件和每一所述页面抽象成的场景,确定场景跳转的触发条件。According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 2, the abstraction of the edge relationship is performed according to the scene abstracted from each page and the historical test data related to the application under test, including : According to the historical test data related to the application to be tested, determine the jump information between the pages and the trigger conditions for page jumps, wherein the trigger conditions include the controls and the actions; according to the The jump information between pages and the scenes abstracted from each of the pages, determine the jump information between the multiple scenes; according to the trigger conditions of page jumps and the scenes abstracted from each of the pages, determine Trigger conditions for scene jumps.

根据本公开的一个或多个实施例,示例5提供了示例1-4中任一项的方法,所述确定针对所述待测应用程序配置的目标测试场景,包括:响应于接收到针对所述测试场景配置界面中、待测试场景的顺序选择操作,将所述选择操作依次选择的所述待测试场景确定为所述目标测试场景。According to one or more embodiments of the present disclosure, Example 5 provides the method of any one of Examples 1-4, the determining the target test scenario configured for the application under test includes: responding to receiving the In the test scenario configuration interface, the sequential selection operation of the scenarios to be tested is determined as the target test scenario.

根据本公开的一个或多个实施例,示例6提供了示例5的方法,在所述将所述选择操作依次选择的所述待测试场景确定为所述目标测试场景的步骤之前,所述确定针对所述待测应用程序配置的目标测试场景,还包括:响应于接收到针对所述测试场景配置界面中、待测试场景的选择操作,获取所述测试地图中、所述待测试场景的相邻下游场景,其中,所述待测试场景初始为所述待测应用程序的主页面;若不满足选择终止条件,则在所述测试场景配置界面中展示所述相邻下游场景;响应于接收到针对任一所述相邻下游场景的选择操作,将所述待测试场景更新为所选择的相邻下游场景,返回所述获取所述测试地图中、所述待测试场景的相邻下游场景的步骤;若满足所述选择终止条件,则执行所述将所述选择操作依次选择的所述待测试场景确定为所述目标测试场景的步骤。According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 5, before the step of determining the scene to be tested sequentially selected by the selection operation as the target test scene, the determining The target test scenario configured for the application program to be tested further includes: in response to receiving a selection operation for the scenario to be tested in the configuration interface of the test scenario, acquiring the corresponding scene of the scenario to be tested in the test map Adjacent to the downstream scene, wherein, the scene to be tested is initially the main page of the application to be tested; if the selection termination condition is not satisfied, the adjacent downstream scene is displayed in the test scene configuration interface; in response to receiving Up to the selection operation for any of the adjacent downstream scenes, update the scene to be tested to the selected adjacent downstream scene, and return to the acquisition of the adjacent downstream scene of the scene to be tested in the test map If the selection termination condition is satisfied, then execute the step of determining the scene to be tested sequentially selected by the selection operation as the target test scene.

根据本公开的一个或多个实施例,示例7提供了示例1-4中任一项所述的方法,所述调用针对所述待测应用程序预先生成的测试地图,基于所述目标测试场景生成对应的测试用例,包括:从所述测试地图中抽取所述目标测试场景所在的路径,作为所述测试用例。According to one or more embodiments of the present disclosure, Example 7 provides the method described in any one of Examples 1-4, the invoking the test map pre-generated for the application under test, based on the target test scenario Generating a corresponding test case includes: extracting a path where the target test scene is located from the test map as the test case.

根据本公开的一个或多个实施例,示例8提供了一种测试用例生成装置,包括:确定模块,用于显示针对待测应用程序的测试场景配置界面,确定针对所述待测应用程序配置的目标测试场景;所述测试场景配置界面支持在界面上执行选择操作以配置测试所需覆盖的所述目标测试场景;生成模块,用于调用针对所述待测应用程序预先生成的测试地图,基于所述目标测试场景生成对应的测试用例,所述测试用例用于对所述待测应用程序进行测试;其中,所述测试地图是针对所述待测应用程序的页面信息进行场景聚类所得的聚类信息构建的场景关系知识图谱,所述场景关系知识图谱中的节点用于表征页面抽象成的场景,节点连接的边用于表征节点支持的控件、动作以及跳转信息。According to one or more embodiments of the present disclosure, Example 8 provides a test case generation device, including: a determination module, configured to display a test scenario configuration interface for the application under test, and determine the configuration for the application under test The target test scenario; the test scenario configuration interface supports performing selection operations on the interface to configure the target test scenario covered by the test; the generation module is used to call the pre-generated test map for the application to be tested, Generate a corresponding test case based on the target test scenario, and the test case is used to test the application under test; wherein, the test map is obtained by performing scene clustering on the page information of the application under test The scene relationship knowledge graph constructed by the clustering information, the nodes in the scene relationship knowledge graph are used to represent the scene abstracted from the page, and the edges connecting the nodes are used to represent the controls, actions and jump information supported by the nodes.

根据本公开的一个或多个实施例,示例9提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现示例1-7中任一项所述方法的步骤。According to one or more embodiments of the present disclosure, Example 9 provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of any one of the methods described in Examples 1-7 are implemented .

根据本公开的一个或多个实施例,示例10提供了一种电子设备,包括:存储装置,其上存储有计算机程序;处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1-7中任一项所述方法的步骤。According to one or more embodiments of the present disclosure, Example 10 provides an electronic device, including: a storage device, on which a computer program is stored; a processing device, configured to execute the computer program in the storage device, to Implement the steps of any one of the methods described in Examples 1-7.

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

此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。In addition, while operations are depicted in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or performed in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while the above discussion contains several specific implementation details, these should not be construed as limitations on the scope of the 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 methodological acts, 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. Regarding the apparatus in the foregoing embodiments, the specific manner in which each module executes operations has been described in detail in the embodiments related to the method, and will not be described in detail here.

Claims (10)

1. A test case generation method, comprising:
displaying a test scene configuration interface aiming at an application program to be tested, and determining a target test scene configured aiming at the application program to be tested; the test scene configuration interface supports executing selection operation on the interface to configure the target test scene required to be covered by the test;
invoking a test map which is generated in advance for the application program to be tested, and generating a corresponding test case based on the target test scene, wherein the test case is used for testing the application program to be tested; the test map is a scene relation knowledge graph constructed by clustering information obtained by performing scene clustering on page information of the application program to be tested, nodes in the scene relation knowledge graph are used for representing scenes abstracted by pages, and edges connected with the nodes are used for representing control, action and jump information supported by the nodes.
2. The method according to claim 1, wherein the method further comprises:
traversing the extensible markup language information of the pages in the application program to be tested, and performing scene clustering on the extensible markup language information of the full-quantity pages to obtain a plurality of scenes;
performing side relation abstraction according to the scene abstracted by each page and the history test data related to the application program to be tested, so as to obtain side relation among the scenes;
and generating the test map according to the edge relation among the scenes, wherein nodes in the edge relation are used for representing the scene abstracted by the page, and edges connected by the nodes are used for representing the control, action and jump information supported by the nodes.
3. The method of claim 2, wherein the test map is updated as the test data is updated.
4. The method according to claim 2, wherein the performing the side relation abstraction according to the scenario abstracted by each page and the historical test data related to the application under test includes:
determining jump information between pages and trigger conditions of page jumps according to historical test data related to the application program to be tested, wherein the trigger conditions comprise the control and the action;
Determining the jump information among the scenes according to the jump information among the pages and the scenes abstracted by each page;
and determining the trigger condition of scene jump according to the trigger condition of page jump and the scene abstracted by each page.
5. The method of any of claims 1-4, wherein the determining a target test scenario configured for the application under test comprises:
and in response to receiving sequential selection operation of scenes to be tested in the test scene configuration interface, determining the scenes to be tested sequentially selected by the selection operation as the target test scene.
6. The method of claim 5, wherein prior to the step of determining the scene under test sequentially selected by the selecting operation as the target test scene, the determining a target test scene configured for the application under test further comprises:
in response to receiving a selection operation for a scene to be tested in the test scene configuration interface, acquiring an adjacent downstream scene of the scene to be tested in the test map, wherein the scene to be tested Jing Chushi is a main page of the application program to be tested;
If the selection termination condition is not met, displaying the adjacent downstream scenes in the test scene configuration interface;
in response to receiving a selection operation for any adjacent downstream scene, updating the scene to be tested into the selected adjacent downstream scene, and returning to the step of acquiring the adjacent downstream scene of the scene to be tested in the test map;
and if the selection termination condition is met, executing the step of determining the scene to be tested, which is sequentially selected by the selection operation, as the target test scene.
7. The method of any of claims 1-4, wherein the invoking the test map pre-generated for the application under test, generating a corresponding test case based on the target test scenario, comprises:
and extracting a path of the target test scene from the test map as the test case.
8. A test case generating apparatus, comprising:
the determining module is used for displaying a test scene configuration interface aiming at the application program to be tested and determining a target test scene configured aiming at the application program to be tested; the test scene configuration interface supports executing selection operation on the interface to configure the target test scene required to be covered by the test;
The generating module is used for calling a test map which is generated in advance for the application program to be tested, generating a corresponding test case based on the target test scene, and the test case is used for testing the application program to be tested; the test map is a scene relation knowledge graph constructed by clustering information obtained by performing scene clustering on page information of the application program to be tested, nodes in the scene relation knowledge graph are used for representing scenes abstracted by pages, and edges connected with the nodes are used for representing control, action and jump information supported by the nodes.
9. A computer readable medium on which a computer program is stored, characterized in that the program, when being executed by a processing device, carries out the steps of the method according to any one of claims 1-7.
10. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method according to any one of claims 1-7.
CN202310436578.0A 2023-04-21 2023-04-21 Test case generation method and device, medium and electronic equipment Pending CN116401173A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310436578.0A CN116401173A (en) 2023-04-21 2023-04-21 Test case generation method and device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310436578.0A CN116401173A (en) 2023-04-21 2023-04-21 Test case generation method and device, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116401173A true CN116401173A (en) 2023-07-07

Family

ID=87007367

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310436578.0A Pending CN116401173A (en) 2023-04-21 2023-04-21 Test case generation method and device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116401173A (en)

Similar Documents

Publication Publication Date Title
CN111694757B (en) Application program testing method and device, electronic equipment and computer readable storage medium
CN111400625B (en) Page processing method and device, electronic equipment and computer readable storage medium
CN111858381B (en) Application fault tolerance capability test method, electronic device and medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN114428925A (en) Page rendering method and device, electronic equipment and computer readable medium
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN111190657B (en) Activity configuration method and device, readable medium and electronic equipment
CN110347380B (en) Front-end and back-end development method and device
CN111290812B (en) Display method, device, terminal and storage medium of application control
CN111752644A (en) Interface simulation method, device, equipment and storage medium
WO2024212839A1 (en) Card layout method and apparatus, medium and electronic device
CN113849416B (en) Test method, device, storage medium and electronic device
WO2023109311A1 (en) Resource access method and apparatus, and storage medium and electronic device
CN112668194B (en) Automatic driving scene library information display method, device and equipment based on page
CN116401173A (en) Test case generation method and device, medium and electronic equipment
CN111309323B (en) Parameter initialization method and device and electronic equipment
CN116467178B (en) Database detection method, apparatus, electronic device and computer readable medium
CN112311842A (en) Method and device for information interaction
CN116360710B (en) Data storage method, electronic device and readable medium applied to server cluster
CN111857879B (en) Data processing method, device, electronic equipment and computer readable medium
CN112486826B (en) Test method, test device, electronic equipment and computer readable medium
CN109740100B (en) Webpage node sniffing method, device, equipment and storage medium
CN115292161A (en) Control tree information generation method, device, equipment and computer readable medium
CN117669511A (en) Code coverage report display method, information processing method, device and equipment
CN117130752A (en) Data processing method and device and electronic equipment

Legal Events

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