CN116257444A - Method, device and equipment for generating test cases - Google Patents

Method, device and equipment for generating test cases Download PDF

Info

Publication number
CN116257444A
CN116257444A CN202310143179.5A CN202310143179A CN116257444A CN 116257444 A CN116257444 A CN 116257444A CN 202310143179 A CN202310143179 A CN 202310143179A CN 116257444 A CN116257444 A CN 116257444A
Authority
CN
China
Prior art keywords
page
components
tested
component
test case
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
CN202310143179.5A
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.)
Peoples Insurance Company of China
Original Assignee
Peoples Insurance Company of China
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 Peoples Insurance Company of China filed Critical Peoples Insurance Company of China
Priority to CN202310143179.5A priority Critical patent/CN116257444A/en
Publication of CN116257444A publication Critical patent/CN116257444A/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/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The method, the device and the equipment for generating the test case provided by the application comprise the following steps: responding to the received test instruction, and acquiring page information of a page to be tested indicated by the test instruction; the page information includes: the page to be tested comprises component identification of components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used for indicating the components with jump relationship with the components; determining an operation word corresponding to the component according to the operation type of the component; and determining the test case corresponding to the page to be tested according to the hierarchical relation information of the components, the operation words of the components and the component identifiers of the components contained in the page to be tested. By the method for generating the test user, the problem that the time consumption is long corresponding to the test case further manually written based on the component functions obtained by manual operation can be avoided, wherein the functions of the components are determined by manually operating the components in the page one by one in the related technology.

Description

Method, device and equipment for generating test cases
Technical Field
The present invention relates to the field of testing, and in particular, to a method, an apparatus, and a device for generating a test case.
Background
Currently, in a software development process, a newly developed software product is usually required to be tested, and a test case refers to a description of a test task performed on a specific software product, for example, the test case includes a test step, a test expected result, and the like, so that a tester can test the developed software product based on the test case.
In the related art, a manually written manner may be generally used to generate test cases, however, the efficiency of the foregoing manner is low.
Thus, how to generate test cases is a solution.
Disclosure of Invention
The method, the device and the equipment for generating the test cases are used for solving the problem that the time consumption is long in a mode of manually generating the test cases in the related technology.
In a first aspect, the present application provides a method for generating a test case, including:
responding to a received test instruction, and acquiring page information of a page to be tested indicated by the test instruction; the page information includes: the page to be tested comprises component identification of the components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used for indicating components with jump relationship with the components;
Determining operation words corresponding to the components according to the operation types of the components;
and determining the test case corresponding to the page to be tested according to the hierarchical relation information of the components contained in the page to be tested, the operation words of the components and the component identifiers of the components.
In one possible implementation manner, the test instruction is used for indicating at least one format of a test case corresponding to a page to be tested; according to the hierarchical relation information of the components contained in the page to be tested, the operation words of the components and the component identifiers of the components, determining the test cases corresponding to the page to be tested comprises the following steps:
acquiring processing rule information corresponding to a test case format indicated by the test instruction;
and processing the hierarchical relation information of the components, the operation words of the components and the component identifiers of the components contained in the page to be tested based on the processing rule information to obtain the test cases corresponding to the page to be tested, wherein the processing rule information is used for indicating the test cases in the test case format indicated by the test instruction.
In one possible implementation manner, if the test case format indicated by the test instruction is a tree format, processing, based on the processing rule information, hierarchical relationship information of the component included in the page to be tested, an operation word of the component, and a component identifier of the component to obtain a test case corresponding to the page to be tested, where the processing rule information includes:
Generating a test case tree according to the hierarchical relation information of the components contained in the page to be tested and the component identifications of the components based on the processing rule information, wherein nodes in the test case tree are used for indicating the component identifications of the page to be tested;
based on the processing rule information, marking nodes in the test case tree according to the operation words of the components to obtain a marked test case tree; the marking processes corresponding to the components with the same operation words are the same; the marking processes corresponding to the components with different operation words are different;
and determining the marked test case tree as the test case corresponding to the page to be tested.
In one possible implementation manner, if the test case format indicated by the test instruction is a text format, processing, based on the processing rule information, hierarchical relationship information of the component included in the page to be tested, an operation word of the component, and a component identifier of the component to obtain a test case corresponding to the page to be tested, where the processing rule information includes:
based on the processing rule information, performing splicing processing on the operation words of the components and the component identifiers of the components according to the jump relation before and after the components indicated by the hierarchical relation information of the components contained in the page to be tested, so as to obtain spliced texts;
And determining the spliced text as a test case corresponding to the page to be tested.
In one possible implementation manner, responding to a received test instruction, obtaining page information of a page to be tested indicated by the test instruction includes:
responding to a received test instruction, and acquiring a page code corresponding to a current page to be tested indicated by the test instruction;
and determining the page information of the page to be tested according to the page code.
In one possible implementation, the method further includes:
and acquiring the page identification of the page to be tested, and determining the naming of the test case corresponding to the page to be tested according to the page identification.
In one possible implementation, the component identifier of the component is a component name of the component or a display image of the component in the page to be tested.
In a second aspect, the present application provides a test case generating device, including:
the first acquisition unit is used for responding to the received test instruction and acquiring page information of a to-be-tested page indicated by the test instruction; the page information includes: the page to be tested comprises component identification of the components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used for indicating components with jump relationship with the components;
The first determining unit is used for determining operation words corresponding to the components according to the operation types of the components;
and the second determining unit is used for determining the test case corresponding to the page to be tested according to the hierarchical relation information of the components contained in the page to be tested, the operation words of the components and the component identifiers of the components.
In one possible implementation manner, the test instruction is used for indicating at least one format of a test case corresponding to a page to be tested; a first determination unit including:
the first acquisition module is used for processing rule information corresponding to the test case format indicated by the test instruction;
the processing module is used for processing the hierarchical relation information of the components, the operation words of the components and the component identifiers of the components contained in the page to be tested based on the processing rule information to obtain the test cases corresponding to the page to be tested, and the processing rule information is used for indicating the test cases in the test case format indicated by the test instruction.
In one possible implementation manner, if the test case format indicated by the test instruction is a tree format, the processing module is specifically configured to:
Generating a test case tree according to the hierarchical relation information of the components contained in the page to be tested and the component identifications of the components based on the processing rule information, wherein nodes in the test case tree are used for indicating the component identifications of the page to be tested;
based on the processing rule information, marking nodes in the test case tree according to the operation words of the components to obtain a marked test case tree; the marking processes corresponding to the components with the same operation words are the same; the marking processes corresponding to the components with different operation words are different;
and determining the marked test case tree as the test case corresponding to the page to be tested.
In one possible implementation manner, if the test case format indicated by the test instruction is a text format, the processing module is specifically configured to:
based on the processing rule information, performing splicing processing on the operation words of the components and the component identifiers of the components according to the jump relation before and after the components indicated by the hierarchical relation information of the components contained in the page to be tested, so as to obtain spliced texts;
And determining the spliced text as a test case corresponding to the page to be tested.
In one possible implementation manner, the first obtaining unit includes:
the second acquisition module is used for responding to the received test instruction and acquiring a page code corresponding to the current page to be tested indicated by the test instruction;
and the determining module is used for determining the page information of the page to be tested according to the page code.
In one possible implementation, the apparatus further includes:
the second acquisition unit is used for acquiring the page identification of the page to be tested;
and the third determining unit is used for determining the naming of the test case corresponding to the page to be tested according to the page identification.
In one possible implementation, the component identifier of the component is a component name of the component or a display image of the component in the page to be tested.
In a third aspect, the present application provides an electronic device, comprising: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the method according to any of the first aspects according to the executable instructions.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for performing the method of any of the first aspects when executed by a processor.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method of any one of the first aspects.
The method, the device and the equipment for generating the test case provided by the application comprise the following steps: responding to a received test instruction, and acquiring page information of a page to be tested indicated by the test instruction; the page information includes: the page to be tested comprises component identification of the components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used for indicating components with jump relationship with the components; determining operation words corresponding to the components according to the operation types of the components; and determining the test case corresponding to the page to be tested according to the hierarchical relation information of the components contained in the page to be tested, the operation words of the components and the component identifiers of the components. By the method for generating the test user, the problem that the time consumption is long corresponding to the test case further manually written based on the component functions obtained by manual operation can be avoided, wherein the functions of the components are determined by manually operating the components in the page one by one in the related technology.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a schematic flow chart of a method for generating test cases according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for generating test cases according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a device for generating test cases according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a generating device for another test case according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with aspects of the present application.
Currently, during the software development process, the developed software product is typically tested to ensure the accuracy of the functionality of the developed software product. In the related art, when a tester performs a software product test, the tester is required to manually operate a display interface of a newly developed software product at this time, so as to determine component functions in the display interface to be tested, and write a test case based on the component functions therein, so as to perform a subsequent test.
However, the above manual writing method is low in efficiency of generating test cases, and is easy to consume more manpower and time, and further increases the time consumption of the test.
The method, the device and the equipment for generating the test case are used for solving the technical problems.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 is a flow chart of a method for generating a test case according to an embodiment of the present application, as shown in fig. 1, the method includes the following steps:
S101, responding to a received test instruction, and acquiring page information of a page to be tested indicated by the test instruction; the page information includes: the page to be tested comprises component identification of components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used to indicate components that have a jump relationship with the components.
The execution body of the embodiment may be a generating device of a test case, where the generating device may be a server (such as a cloud server or a local server), or may be a computer, or may be a terminal device, or may be a processor, or may be a chip, or the like, and the embodiment is not limited.
The generating device can be used for receiving a test instruction, wherein the test instruction can be manually input by a user or input by voice; or, the test instruction can be sent by other devices, for example, when the developer determines that the development of the current page is completed or the other devices determine that the developer has completed the development of the current page, the other devices can generate the test instruction and send the test instruction to the generating device, so that the test case corresponding to the test page can be generated in time, and the test efficiency is improved; in this embodiment, the input mode and the generation mode of the test instruction are not particularly limited. Moreover, the test instruction in this embodiment may be used to indicate which page to test is currently required to be developed, that is, indicate the page to be tested.
And after the generating device receives the test instruction, acquiring page information of the page to be tested indicated by the test instruction. The page information may include a component identifier corresponding to each component included in the page, an operation type corresponding to each component, and a hierarchical relationship of components for indicating a skip relationship between each component in the page, that is, the hierarchical relationship of components may indicate components before and after the component is skipped, for example, components corresponding to a previous level before the component is skipped, and further components to which the component may be skipped under the operation of the user. In one example, page information of a page to be tested may be obtained according to a component list stored in advance by a developer.
In practical applications, the operation types of the components specifically may include: click, slide, input, etc., that is, the operation mode corresponding to the user when using the component is the operation type of the component.
The component identification of the component may be used to indicate the corresponding component in the page to be tested.
S102, determining operation words corresponding to the components according to the operation types of the components.
In this embodiment, when the generating device obtains the operation type corresponding to the page to be tested, at this time, the operation word corresponding to the component may be generated. For example, the operation word may be understood as the words such as clicking, sliding, inputting, etc. so that the operation word corresponding to the component may be written into the test case later to prompt the tester about the operation mode of the component. In one example, the operation type corresponding to a component may be determined according to a field value of an operation type field corresponding to each component in code corresponding to a page to be tested, for example, when the operation type in page information is 1, the component is represented as a component of a click operation; when the value is 2, the component is characterized as a sliding type component; when the operation type is 3, the component is characterized as the component of the input operation. At this time, when the operation type of each component in the page information is the value of 1-3, the value can be converted into the corresponding operation word at this time, so that the testers can accurately understand the operation mode of each component.
S103, determining a test case corresponding to the page to be tested according to the hierarchical relation information of the components, the operation words of the components and the component identification of the components contained in the page to be tested.
In this embodiment, after the generating device obtains the operation words corresponding to the components in the to-be-tested page, the generating device may combine the component identifiers corresponding to the components and the hierarchical relationship information of the components to generate the test case corresponding to the to-be-tested page.
For example, in one example, when a test case corresponding to a page to be tested is generated, component identifiers of all components may be sequentially arranged according to a hierarchical relationship between the components in a current interface to be displayed, and operation words corresponding to all components may be set at preset positions of the component identifiers corresponding to all components, for example, may be set at an upper right corner of the component identifiers, so as to generate the test case corresponding to the page to be tested.
In one example, when it is determined that the component in the page to be tested and the components in the other pages to be tested also have a jump relationship, then the page identifier of the other pages to be tested may be used as the expected test result corresponding to the component. In one example, if the component does not have the next jump component, that is, the expected response result corresponding to the component during the operation process does not relate to any component, at this time, the function information corresponding to the component is used as the expected result corresponding to the component, for example, information such as a date and a login name input by the user is displayed, and the setting of the expected result in the test case may refer to the description in the related art, which is not repeated herein.
It can be understood that, in this embodiment, after receiving the test instruction, by acquiring the page information of the test interface indicated by the test instruction, and converting the operation type corresponding to the component indicated in the page information into the corresponding operation word, so that the subsequent tester can accurately understand the operation mode of each component, and further, the obtained hierarchical relationship information in the page information and the component identifier of the component can be combined to further generate the test case corresponding to the page to be tested, so that the subsequent tester can implement the test of the page to be tested based on the obtained test case. By the method for generating the test user, the problem that the time consumption is long corresponding to the test case further manually written based on the component functions obtained by manual operation can be avoided, wherein the functions of the components are determined by manually operating the components in the page one by one in the related technology.
Fig. 2 is a flow chart of another method for generating a test case according to an embodiment of the present application, as shown in fig. 2, the method includes the following steps:
s201, responding to a received test instruction, and acquiring a page code corresponding to a current page to be tested indicated by the test instruction. The test instruction is used for indicating at least one format of the test case corresponding to the page to be tested.
The generating device for executing the main test case in this embodiment may be a server (such as a cloud server, or a local server), or may be a computer, or may be a terminal device, or may be a processor, or may be a chip, or the like.
In this embodiment, the test instruction received by the generating device may indicate at least one format of the test case corresponding to the page to be tested. That is, the format of the test case corresponding to the test case when the test case of the page to be tested is generated can be specified by the test instruction.
In addition, in this embodiment, after the generating device receives the test instruction, the generating device first searches the page code corresponding to the page to be tested indicated by the current test instruction.
In one example, when generating the test instruction, the tester may select a format of the test case desired by the tester in a format selection list provided by the generating device, where at least one format option available for the tester to select is present in the format selection list.
In one example, the generating device may also determine a format of a test case commonly used by the tester by acquiring a format of the test case used in the historical test record of the tester, and further generate the test instruction according to the determined format of the commonly used test case.
In one example, when generating the test instruction, the test instruction may carry formats of various test cases supported by the generating device, so that a subsequent tester may choose a test case desired by the tester.
S202, determining page information of a page to be tested according to a page code; the page information includes: the page to be tested comprises component identification of components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used to indicate components that have a jump relationship with the components.
For example, when the generating device obtains the page code corresponding to the page to be tested currently, at this time, the page code may be processed according to the page code to obtain the page information corresponding to the page to be tested. Specifically, the specific implementation manner of determining the page information of the page to be tested by the page code may refer to the description in the related art, and the embodiment is not particularly limited.
It can be understood that in this embodiment, when the page information corresponding to the page to be tested is obtained, the page information of the page to be tested may be determined by the real-time code currently corresponding to the page to be tested, so that the problem of obtaining the page information by an error caused by that the memory table corresponding to the page information is not updated in time when the page code is updated is avoided compared with searching according to the page information stored in the page information memory table, and further, the accuracy of the finally generated test case is ensured by the method.
In one possible implementation, the component identifier of the component may be a component name of the component or a display image of the component in the page to be tested. For example, when the component of the component is identified as the component name, the component name of each component in the page code may be directly obtained at this time; when the component of the component is identified as the display image corresponding to the component, the display image corresponding to the component can be generated by the display code corresponding to the component in the page code at this time or the display image of the component can be obtained directly according to the mode of capturing the page image corresponding to the page to be tested.
It can be appreciated that, in this example, the component identifier of the component may be a component name of the component to reduce the space occupied by the test case when the display image of the component is used as the identifier; or, the display image corresponding to the component can be used as the component identification of the component, so that a user can directly determine the position of the component through the comparison of the display image and the page to be tested in the test process, and the user can conveniently test.
S203, determining operation words corresponding to the components according to the operation types of the components.
For example, the technical principle of step S203 may refer to the technical principle of step S102, which is not described herein.
S204, obtaining processing rule information corresponding to the test case format indicated by the test instruction; the processing rule information is used for indicating the test cases in the test case format indicated by the generated test instruction.
For example, in this embodiment, a plurality of pieces of processing rule information may be stored in advance, where the processing rule information corresponds one-to-one to the test case format that can be generated by the generating means. Each piece of processing rule information is used for indicating a method for generating the test case in the format corresponding to the processing rule information. After the generating device receives the test instruction, the processing rule information corresponding to the format can be selected according to the format of the test case indicated by the test instruction, so that the test case can be generated based on the processing rule information.
S205, processing the hierarchical relation information of the components, the operation words of the components and the component identifiers of the components contained in the page to be tested based on the processing rule information to obtain the test cases corresponding to the page to be tested, wherein the processing rule information is used for indicating the test cases in the test case format indicated by the generated test instruction.
For example, after the generating device obtains the processing rule information, the hierarchical relationship information of the component, the component identifier of the component and the operation word corresponding to the component obtained by the generating device may be processed according to the processing method indicated in the processing rule information, so as to obtain the test case corresponding to the page to be tested.
It may be understood that, in this embodiment, processing rule information corresponding to at least one test case format may be preset, so that the generating device may generate, for a page to be tested, a test case in at least one format indicated by the test instruction. Further, the subsequent testers can select the test cases in the format expected by the user from the test cases generated by the generating device, so that the user can conveniently test.
In one example, if the test case format indicated by the test instruction is in a tree format, the step "based on the processing rule information, the hierarchical relationship information of the component included in the page to be tested, the operation word of the component, and the component identifier of the component" in step S205 is performed to obtain the test case corresponding to the page to be tested "may be implemented by the following steps:
The first step, based on the processing rule information, a test case tree is generated according to the hierarchical relation information of the components and the component identifications of the components contained in the page to be tested, and nodes in the test case tree are used for indicating the component identifications of the page to be tested.
The second step, based on the processing rule information, marking the nodes in the test case tree according to the operation words of the components to obtain a marked test case tree; the marking processes corresponding to the components with the same operation words are the same; the label processing corresponding to the components with different operation words is different.
And thirdly, determining the test case tree after the marking processing as the test case corresponding to the page to be tested.
Illustratively, in this embodiment, the generating device may be configured to generate the test cases in the tree format. When the generating device receives the test instruction to instruct the generation of the test cases in the tree format, the processing rule information of the test cases corresponding to the tree format can be acquired at first. And then generating a test case tree based on the obtained processing rule information, the obtained hierarchical relation of the components of the page to be tested and the component identifications of the components, namely taking the component identifications of the components as tree nodes in the test case tree, and determining the hierarchical connection relation among the tree nodes according to the hierarchical relation information of the components so as to obtain the test case tree.
After the test case tree is obtained, the node may be further marked according to an operation word corresponding to the node, that is, an operation word of a component corresponding to the node, for example, the operation word may be set in an upper right corner of a component identifier in each node, or different colors, fonts, and the like may be set for different component identifiers according to the operation word, which is not specifically limited in this embodiment.
And then, taking the test case tree obtained after the marking processing as the test case corresponding to the page to be tested.
It can be understood that in this embodiment, a tree-format test case may be generated by processing rule information, and different nodes may be further labeled by an operation word, so that a tester may intuitively determine a hierarchical relationship between each component, and test is convenient for the tester to perform a test.
In one example, in the process of executing step S205, if the test case format indicated by the test instruction is in a text format, processing the hierarchical relationship information of the component, the operation word of the component and the component identifier of the component included in the page to be tested based on the processing rule information in step S205 to obtain the test case corresponding to the page to be tested, including the following steps: based on the processing rule information, splicing the operation words of the components and the component identifiers of the components according to the jump relation before and after the components indicated by the hierarchical relation information of the components contained in the page to be tested, so as to obtain spliced texts; and determining the spliced text as a test case corresponding to the page to be tested.
In this embodiment, if the test case format corresponding to the test instruction received by the generating device is a text format, the processing rule information of the test case corresponding to the text format may be obtained first. And then, based on the acquired processing rule information and the hierarchical relation information of the components, performing splicing processing on the operation words corresponding to the components and the component identifiers of the components, namely, for example, after splicing the operation words corresponding to the components and the component identifiers of the components, obtaining spliced text segments corresponding to the components, and then, sequentially performing splicing processing on the spliced text segments according to the hierarchical relation information corresponding to the components to obtain spliced texts.
It can be understood that in this embodiment, the test case in text format may be generated by processing rule information, and in the processing process, operation words and component identifiers may be directly performed based on hierarchical relationship information, so as to improve the efficiency of generating the test case.
S206, acquiring page identification of the page to be tested, and determining the naming of the test case corresponding to the page to be tested according to the page identification.
In this embodiment, after the test case corresponding to the page to be tested is generated, the name of the generated test case may further be further determined by obtaining the page identifier corresponding to the page to be tested. For example, when determining the name corresponding to the test case, the page identifier may be used as a prefix in the named name of the test case, so that the user may find the test case corresponding to the page to be tested in time.
In this embodiment, processing rule information corresponding to at least one test case format may be preset, so that the generating device may generate, for a page to be tested, a test case in at least one format indicated by the test instruction. Further, the subsequent testers can select the test cases in the format expected by the user from the test cases generated by the generating device, so that the user can conveniently test. In addition, when the page information corresponding to the page to be tested is acquired, the page information of the page to be tested can be determined through the real-time code currently corresponding to the page to be tested, compared with the method for searching according to the page information stored in the page information storage table, the method for acquiring the page information is capable of avoiding the problem of page information acquisition errors caused by the fact that the storage table corresponding to the page information is not updated in time when the page code is updated, and further the accuracy of the finally generated test case is ensured through the method.
Fig. 3 is a schematic structural diagram of a device for generating a test case according to an embodiment of the present application, where, as shown in fig. 3, the device includes:
the first obtaining unit 301 is configured to obtain page information of a page to be tested indicated by a test instruction in response to the received test instruction; the page information includes: the page to be tested comprises component identification of components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used to indicate components that have a jump relationship with the components.
The first determining unit 302 is configured to determine, according to the operation type of the component, an operation word corresponding to the component.
The second determining unit 303 is configured to determine a test case corresponding to the page to be tested according to the hierarchical relationship information of the component, the operation word of the component, and the component identifier of the component included in the page to be tested.
The device provided in this embodiment is configured to implement the technical scheme provided by the method, and the implementation principle and the technical effect are similar and are not repeated.
Fig. 4 is a schematic structural diagram of another device for generating test cases according to an embodiment of the present application, where, as shown in fig. 4, in the embodiment, a test instruction is used to indicate at least one format of a test case corresponding to a page to be tested on the basis of the device shown in fig. 3; the first determining unit 302 includes:
a first obtaining module 3021, configured to test processing rule information corresponding to a test case format indicated by the test instruction;
the processing module 3022 is configured to process, based on the processing rule information, the hierarchical relationship information of the components, the operation words of the components, and the component identifiers of the components included in the page to be tested, to obtain a test case corresponding to the page to be tested, where the processing rule information is used to indicate a test case in a test case format indicated by the generating test instruction.
In one possible implementation, if the test case format indicated by the test instruction is a tree format, the processing module 3022 is specifically configured to:
based on the processing rule information, generating a test case tree according to the hierarchical relation information of the components and the component identifiers of the components contained in the page to be tested, wherein nodes in the test case tree are used for indicating the component identifiers of the page to be tested;
based on the processing rule information, marking nodes in the test case tree according to the operation words of the components to obtain a marked test case tree; the marking processes corresponding to the components with the same operation words are the same; the marking processes corresponding to the components with different operation words are different;
and determining the marked test case tree as the test case corresponding to the page to be tested.
In one possible implementation, if the test case format indicated by the test instruction is a text format, the processing module 3022 is specifically configured to:
based on the processing rule information, splicing the operation words of the components and the component identifiers of the components according to the jump relation before and after the components indicated by the hierarchical relation information of the components contained in the page to be tested, so as to obtain spliced texts;
And determining the spliced text as a test case corresponding to the page to be tested.
In one possible implementation, the first obtaining unit 301 includes:
the second obtaining module 3011 is configured to obtain, in response to the received test instruction, a page code corresponding to a current page to be tested indicated by the test instruction;
and the determining module 3012 is used for determining page information of the page to be tested according to the page code.
In one possible implementation, the apparatus further includes:
a second obtaining unit 304, configured to obtain a page identifier of a page to be tested;
and a third determining unit 305, configured to determine, according to the page identifier, a naming of the test case corresponding to the page to be tested.
In one possible implementation, the component identification of the component is the component name of the component or the display image of the component in the page to be tested.
The device provided in this embodiment is configured to implement the technical scheme provided by the method, and the implementation principle and the technical effect are similar and are not repeated.
The application provides an electronic device, comprising: a memory, a processor;
a memory; a memory for storing processor-executable instructions;
the processor is used for executing the method according to the executable instructions.
Fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present application, as shown in fig. 5, where the electronic device includes:
a processor 291, the electronic device further comprising a memory 292; a communication interface (Communication Interface) 293 and bus 294 may also be included. The processor 291, the memory 292, and the communication interface 293 may communicate with each other via the bus 294. Communication interface 293 may be used for information transfer. The processor 291 may call logic instructions in the memory 294 to perform the methods of the above embodiments.
Further, the logic instructions in memory 292 described above may be implemented in the form of software functional units and stored in a computer-readable storage medium when sold or used as a stand-alone product.
The memory 292 is a computer readable storage medium, and may be used to store a software program, a computer executable program, and program instructions/modules corresponding to the methods in the embodiments of the present application. The processor 291 executes functional applications and data processing by running software programs, instructions and modules stored in the memory 292, i.e., implements the methods of the method embodiments described above.
Memory 292 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the terminal device, etc. Further, memory 292 may include high-speed random access memory, and may also include non-volatile memory.
The present application provides a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, perform the method of any one of the above.
The present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method of any one of the claims.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (17)

1. The method for generating the test case is characterized by comprising the following steps:
responding to a received test instruction, and acquiring page information of a page to be tested indicated by the test instruction; the page information includes: the page to be tested comprises component identification of the components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used for indicating components with jump relationship with the components;
determining operation words corresponding to the components according to the operation types of the components;
and determining the test case corresponding to the page to be tested according to the hierarchical relation information of the components contained in the page to be tested, the operation words of the components and the component identifiers of the components.
2. The method of claim 1, wherein the test instruction is configured to indicate at least one format of a test case corresponding to a page to be tested; according to the hierarchical relation information of the components contained in the page to be tested, the operation words of the components and the component identifiers of the components, determining the test cases corresponding to the page to be tested comprises the following steps:
Acquiring processing rule information corresponding to a test case format indicated by the test instruction;
and processing the hierarchical relation information of the components, the operation words of the components and the component identifiers of the components contained in the page to be tested based on the processing rule information to obtain the test cases corresponding to the page to be tested, wherein the processing rule information is used for indicating the test cases in the test case format indicated by the test instruction.
3. The method according to claim 2, wherein if the test case format indicated by the test instruction is a tree format, processing, based on the processing rule information, hierarchical relationship information of the component included in the page to be tested, an operation word of the component, and a component identifier of the component to obtain a test case corresponding to the page to be tested, includes:
generating a test case tree according to the hierarchical relation information of the components contained in the page to be tested and the component identifications of the components based on the processing rule information, wherein nodes in the test case tree are used for indicating the component identifications of the page to be tested;
based on the processing rule information, marking nodes in the test case tree according to the operation words of the components to obtain a marked test case tree; the marking processes corresponding to the components with the same operation words are the same; the marking processes corresponding to the components with different operation words are different;
And determining the marked test case tree as the test case corresponding to the page to be tested.
4. The method of claim 2, wherein if the test case format indicated by the test instruction is a text format, processing, based on the processing rule information, hierarchical relationship information of the component included in the page to be tested, the operation word of the component, and the component identifier of the component to obtain the test case corresponding to the page to be tested, includes:
based on the processing rule information, performing splicing processing on the operation words of the components and the component identifiers of the components according to the jump relation before and after the components indicated by the hierarchical relation information of the components contained in the page to be tested, so as to obtain spliced texts;
and determining the spliced text as a test case corresponding to the page to be tested.
5. The method of claim 1, wherein in response to a received test instruction, obtaining page information of a page to be tested indicated by the test instruction comprises:
responding to a received test instruction, and acquiring a page code corresponding to a current page to be tested indicated by the test instruction;
And determining the page information of the page to be tested according to the page code.
6. The method according to claim 1, wherein the method further comprises:
and acquiring the page identification of the page to be tested, and determining the naming of the test case corresponding to the page to be tested according to the page identification.
7. The method according to any of claims 1-6, characterized in that the component identification of the component is the component name of the component or the display image of the component in the page to be tested.
8. A test case generating apparatus, comprising:
the first acquisition unit is used for responding to the received test instruction and acquiring page information of a to-be-tested page indicated by the test instruction; the page information includes: the page to be tested comprises component identification of the components, operation types of the components and hierarchical relation information of the components; the hierarchical relationship information is used for indicating components with jump relationship with the components;
the first determining unit is used for determining operation words corresponding to the components according to the operation types of the components;
and the second determining unit is used for determining the test case corresponding to the page to be tested according to the hierarchical relation information of the components contained in the page to be tested, the operation words of the components and the component identifiers of the components.
9. The apparatus of claim 8, wherein the test instruction is configured to indicate at least one format of a test case corresponding to a page to be tested; a first determination unit including:
the first acquisition module is used for processing rule information corresponding to the test case format indicated by the test instruction;
the processing module is used for processing the hierarchical relation information of the components, the operation words of the components and the component identifiers of the components contained in the page to be tested based on the processing rule information to obtain the test cases corresponding to the page to be tested, and the processing rule information is used for indicating the test cases in the test case format indicated by the test instruction.
10. The apparatus of claim 9, wherein if the test case format indicated by the test instruction is a tree format, the processing module is specifically configured to:
generating a test case tree according to the hierarchical relation information of the components contained in the page to be tested and the component identifications of the components based on the processing rule information, wherein nodes in the test case tree are used for indicating the component identifications of the page to be tested;
Based on the processing rule information, marking nodes in the test case tree according to the operation words of the components to obtain a marked test case tree; the marking processes corresponding to the components with the same operation words are the same; the marking processes corresponding to the components with different operation words are different;
and determining the marked test case tree as the test case corresponding to the page to be tested.
11. The apparatus of claim 9, wherein if the test case format indicated by the test instruction is a text format, the processing module is specifically configured to:
based on the processing rule information, performing splicing processing on the operation words of the components and the component identifiers of the components according to the jump relation before and after the components indicated by the hierarchical relation information of the components contained in the page to be tested, so as to obtain spliced texts;
and determining the spliced text as a test case corresponding to the page to be tested.
12. The apparatus of claim 8, wherein the first acquisition unit comprises:
the second acquisition module is used for responding to the received test instruction and acquiring a page code corresponding to the current page to be tested indicated by the test instruction;
And the determining module is used for determining the page information of the page to be tested according to the page code.
13. The apparatus of claim 8, wherein the apparatus further comprises:
the second acquisition unit is used for acquiring the page identification of the page to be tested;
and the third determining unit is used for determining the naming of the test case corresponding to the page to be tested according to the page identification.
14. The apparatus according to any of claims 9-13, wherein a component of the component is identified as a component name of the component or as a display image of the component in the page to be tested.
15. An electronic device, comprising: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the method of any of claims 1-7 in accordance with the executable instructions.
16. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are for implementing the method of any of claims 1-7.
17. A computer program product comprising a computer program which, when executed by a processor, implements the method of any of claims 1-7.
CN202310143179.5A 2023-02-08 2023-02-08 Method, device and equipment for generating test cases Pending CN116257444A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310143179.5A CN116257444A (en) 2023-02-08 2023-02-08 Method, device and equipment for generating test cases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310143179.5A CN116257444A (en) 2023-02-08 2023-02-08 Method, device and equipment for generating test cases

Publications (1)

Publication Number Publication Date
CN116257444A true CN116257444A (en) 2023-06-13

Family

ID=86680472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310143179.5A Pending CN116257444A (en) 2023-02-08 2023-02-08 Method, device and equipment for generating test cases

Country Status (1)

Country Link
CN (1) CN116257444A (en)

Similar Documents

Publication Publication Date Title
CN108897724B (en) Function completion progress determining method and device
CN111970267B (en) Data protocol conversion method and device, electronic equipment and storage medium
CN109558525B (en) Test data set generation method, device, equipment and storage medium
CN110147364B (en) Data cleaning method, device, equipment and storage medium
CN109101228B (en) Application program execution method and device
CN111597110B (en) Page test method and device, electronic equipment and storage medium
CN110569194A (en) interface testing method and device, electronic equipment and storage medium
CN113127593A (en) Standard chart generation method and device
CN113467868A (en) Method and device for creating equipment resources
CN109614325B (en) Method and device for determining control attribute, electronic equipment and storage medium
CN114218072A (en) Test script generation method and device, storage medium and computer equipment
CN112685311A (en) Test script automatic generation method and device, computer equipment and storage medium
CN112181812A (en) Version testing method and device
CN109474822B (en) Android television multi-language automatic testing method and device
CN115543324B (en) Method, device, equipment and medium for generating interactive interface
CN116257444A (en) Method, device and equipment for generating test cases
CN116431467A (en) Page test method, device, equipment and medium
CN111290996A (en) Document format conversion method, device, equipment and readable storage medium
CN115016968A (en) Exception handling method, device, equipment and medium
CN114756183A (en) Data printing method, device, equipment and storage medium
CN113419959A (en) Method and equipment for generating coverage rate verification report
CN111444392A (en) Method, device and equipment for accessing cave library
CN111078574A (en) Method and device for generating influence analysis report
CN111581093B (en) Method, device, equipment and medium for generating test record list
CN113448746B (en) Configuration processing method, configuration platform and related 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