Service test processing method and device
Through business test processing methods and devices, business process classes and component functions are generated, which solves the problem of high requirements for testers and difficult maintenance of Web automation scripts, improves testing efficiency and system maintainability, and reduces automation script maintenance costs.
Patent Information
- Application Number
- CN202411050774.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-08
AI Technical Summary
In the existing technology, Web automation scripts have high requirements on testers and are difficult to maintain. Moreover, changes in the front-end page cause the automation script to need frequent modifications, resulting in a lot of repetitive work and high costs.
Provide a business test processing method and device that displays a page class list in response to a click operation on the business test operation interface, receives the logical relationship of the page class configuration, generates a business process class, determines the test value and expected value in the data table, and the page class Generated by component functions, component functions are generated by page elements, and page elements are implemented through steps for automated testing and maintenance.
Significantly improves test efficiency and coverage, simplifies process configuration, promotes code reuse, enhances system maintainability and flexibility, and enables faster, more accurate and cost-effective software testing and business process management.
Smart Images

Figure CN118747157A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a service test processing method and device. Background Art
[0002] With the rapid development of Web applications and the increasing use of applications, there is an increasing demand for Web front-end testing, and the requirements for Web automation testers are also getting higher and higher. However, in actual work, most testers do not have the ability to write Web automation scripts, and professional technicians are needed to write and maintain automation scripts. In addition, once the front-end page changes, a large number of automation scripts will be modified, which will result in a lot of repetitive work, difficult maintenance, and high costs. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a business test processing method and device, which can at least solve the problem in the prior art that Web automation scripts have high requirements on testers and are difficult to maintain.
[0004] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a business test processing method is provided, including: in response to a click operation on a business test operation interface, a page class list is displayed in the business test operation interface, and one or more page classes selected from the page class list are received; the logical relationship configured between different page classes in the one or more page classes is received, and a business process class is generated; a pre-configured data table is determined; wherein the data table includes test values and expected values configured for each step in each page element; the page class is generated by a component function, the component function is generated by a page element, and the page element is implemented by steps; the storage path of each step is obtained according to the page class, the test value of each step is read from the data table, and the read test value is written to the storage path of each step to test each step, compare the test results with the expected values, and perform corresponding operations on the business process class according to the comparison results.
[0005] Optionally, before displaying the page class list in the business test operation interface, the method also includes: in response to a click operation on the page class operation interface, displaying a component function name list in the page class operation interface; receiving one or more component function names selected from the component function name list, and for each of the one or more component function names, determining the component function corresponding to the each component function name; obtaining the page element name and step positioning element from each component function to generate a page class.
[0006] Optionally, before displaying the component function name list in the page class operation interface, the method also includes: displaying a page element list in the component operation interface in response to a click operation on the component operation interface; receiving one or more page elements selected from the page element list to generate a component, and receiving a name and a usage method for the component configuration; generating a component function based on the usage method, the name of each page element in the one or more page elements, and the positioning method and storage path of each step; encapsulating the component function, and naming the encapsulated component function with the component name to obtain a component function name.
[0007] Optionally, the method further includes: receiving a type of configuration for the component; and receiving one or more component function names selected from the component function name list, further including: receiving an input component type, querying a list of component function names that match the component type for display.
[0008] Optionally, before displaying the page element list in the component operation interface, the method also includes: in response to a click operation on the page element operation interface, displaying the page element operation interface, receiving the page elements and page element names configured in the page element operation interface; receiving a step document for configuring the page elements; wherein the step document includes one or more steps; receiving the logical relationships configured between different steps in the step document, and constructing a step tree structure according to the step document and the logical relationships; and receiving the storage location configured for each step to obtain the storage path of each step.
[0009] Optionally, the method also includes: receiving specific attributes configured for each step; wherein the specific attributes of different steps are different; the process of determining the storage path of the target step is: when the storage path of the target step is not obtained through a preset positioning method, determining the step tree structure according to the page element name to locate the position of the target step in the step tree structure, and determining the parent of the position; obtaining the storage path of the parent, and obtaining the storage path of the target step based on the storage path of the parent by positioning downward from the parent according to the specific attributes of the target step; when the storage path of the target step is not obtained by positioning downward from the parent, determining the parent of the parent through the step tree structure, obtaining the storage path of the parent of the parent, and obtaining the storage path of the target step based on the storage path of the parent of the parent by positioning downward from the parent according to the specific attributes of the target step.
[0010] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a business test processing device is provided, including: an interface module, which is used to display a page class list in the business test operation interface in response to a click operation on the business test operation interface, and receive one or more page classes selected from the page class list; a configuration module, which is used to receive the logical relationship configured between different page classes in the one or more page classes, and generate a business process class; a determination module, which is used to determine a pre-configured data table; wherein the data table includes test values and expected values configured for each step in each page element; the page class is generated by a component function, the component function is generated by a page element, and the page element is implemented by steps; a test module, which is used to obtain the storage path of each step according to the page class, read the test value of each step from the data table, write the read test value to the storage path of each step, so as to test each step, compare the test result with the expected value, and perform corresponding operations on the business process class according to the comparison result.
[0011] Optionally, the device also includes a page class configuration module, which is used to: display a component function name list in the page class operation interface in response to a click operation on the page class operation interface; receive one or more component function names selected from the component function name list, and for each of the one or more component function names, determine the component function corresponding to the each component function name; obtain the page element name and step positioning element from each component function to generate a page class.
[0012] Optionally, the device also includes a component configuration module, which is used to: display a page element list in the component operation interface in response to a click operation on the component operation interface; receive one or more page elements selected from the page element list to generate a component, and receive a name and usage method for the component configuration; generate a component function according to the usage method, the name of each page element in the one or more page elements, the positioning method and storage path of each step; encapsulate the component function, and name the encapsulated component function with the component name to obtain a component function name.
[0013] Optionally, the component configuration module is further used to: receive the type of component configuration; and the page class configuration module is further used to: receive an input component type, query a list of component function names that conform to the component type, and display them.
[0014] Optionally, the device also includes a page element configuration module, which is used to: display the page element operation interface in response to a click operation on the page element operation interface, receive the page elements and page element names configured in the page element operation interface; receive a step document for configuring the page elements; wherein the step document includes one or more steps; receive the logical relationships configured between different steps in the step document, and construct a step tree structure based on the step document and the logical relationships; and receive the storage location configured for each step to obtain the storage path of each step.
[0015] Optionally, the page element configuration module is also used to: receive specific attributes configured for each step; wherein the specific attributes of different steps are different; the process of determining the storage path of the target step is: when the storage path of the target step is not obtained through a preset positioning method, determine the step tree structure according to the page element name to locate the position of the target step in the step tree structure, and determine the parent of the position; obtain the storage path of the parent, and obtain the storage path of the target step based on the storage path of the parent by positioning downward from the parent according to the specific attributes of the target step; when the storage path of the target step is not obtained by positioning downward from the parent, determine the parent of the parent through the step tree structure, obtain the storage path of the parent of the parent, and obtain the storage path of the target step based on the storage path of the parent of the parent by positioning downward from the parent according to the specific attributes of the target step.
[0016] To achieve the above objective, according to another aspect of an embodiment of the present invention, a service test processing electronic device is provided.
[0017] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the business test processing methods described above.
[0018] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned service test processing methods is implemented.
[0019] To achieve the above object, according to another aspect of an embodiment of the present invention, a computer program product is provided. A computer program product according to an embodiment of the present invention includes a computer program, and when the program is executed by a processor, the service test processing method provided by the embodiment of the present invention is implemented.
[0020] According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: through automated testing, modular design and intuitive business testing operation interface, the test efficiency and coverage are significantly improved, while the process configuration is simplified, code reuse is promoted, and the maintainability and flexibility of the system are enhanced, ultimately achieving faster, more accurate and cost-effective software testing and business process management, solving the problem that existing automated scripts have high requirements for testers and difficult maintenance of automated scripts.
[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0023] Figure 1 This is a schematic diagram of the main flow of a service test processing method according to an embodiment of the present invention;
[0024] Figure 2 is a flow chart of an optional service test processing method according to an embodiment of the present invention;
[0025] Figure 3 is a flow chart of another optional service test processing method according to an embodiment of the present invention;
[0026] Figure 4 is a flowchart of another optional service test processing method according to an embodiment of the present invention;
[0027] Figure 5 is a flowchart of another optional service test processing method according to an embodiment of the present invention;
[0028] Figure 6 is a schematic diagram of main modules of a service test processing device according to an embodiment of the present invention;
[0029] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0030] Figure 8 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0032] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0033] In the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The acquisition, transmission, storage, use, and processing of data in the technical solution of the present invention are in compliance with the relevant provisions of national laws and regulations, and are used for legal and reasonable purposes, and are not shared, disclosed, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities.
[0034] For user information, necessary measures should be taken to prevent illegal access to such personal information data, ensure that persons who have access to personal information data comply with relevant laws and regulations, and ensure the security of user personal information. Once such user personal information data is no longer needed, risks should be minimized by limiting or even prohibiting data collection and / or deleting data. When applicable, including in certain relevant applications, protect user privacy by de-identifying data, such as by removing specific identifiers (e.g., date of birth, etc.), controlling the amount or specificity of stored data (e.g., collecting location data at the city level rather than at the specific address level), controlling how data is stored, and / or other methods of de-identification.
[0035] See also Figure 1 , which shows a main flow chart of a service test processing method provided by an embodiment of the present invention, comprising the following steps:
[0036] S101: In response to a click operation on a business test operation interface, displaying a page class list in the business test operation interface, and receiving one or more page classes selected from the page class list;
[0037] S102: receiving a logical relationship configured between different page classes in the one or more page classes, and generating a business process class;
[0038] S103: Determine a pre-configured data table; wherein the data table includes test values and expected values configured for each step in each page element; the page class is generated by the component function, the component function is generated by the page element, and the page element is implemented by the steps;
[0039] S104: Obtain the storage path of each step according to the page class, read the test value of each step from the data table, write the read test value to the storage path of each step to test each step, compare the test result with the expected value, and perform corresponding operations on the business process class according to the comparison result.
[0040] This embodiment is used to describe the test of business process class. The present invention converts the maintenance of Web automation script code into component maintenance. From the business perspective, when the page changes, especially when the text changes, only the file at a specific location needs to be modified or the component element needs to be modified, thereby achieving faster and more accurate maintenance of the automation script, reducing the maintenance difficulty of the Web automation script, and at the same time reducing the requirements for testers, thereby improving the testing and development efficiency.
[0041] For steps S101-S102, the solution preferably sets a business test operation interface, which provides an intuitive platform so that non-technical personnel can also participate in process design and test configuration, reducing configuration complexity. Developers can use this interface to select one or more page classes to generate business process classes. Developers can also customize the name of the business process class and change the business process name to text format for people with insufficient code experience to view.
[0042] Example 1: Order processing flow. Page class A: "Customer information" page class, responsible for collecting and verifying basic customer information, such as name, address, contact information, etc. Page class B: "Product selection" page class, allowing customers to browse and select products, add to shopping carts and confirm order details. Developers can select these two page classes through the interface, and then set the jump relationship between them to connect them in sequence to form a complete "order processing" business process class. This process class will include the entire process from customer information collection to product selection, ensuring the integrity of information and the accuracy of orders.
[0043] Example 2: Employee Onboarding Process. Page Class C: "Personal Information Entry" page class, used to collect personal details of new employees, such as education background, work experience, etc. Page Class D: "Contract Signing" page class, provides electronic contract signing function to ensure that new employees read and agree to company policies and terms. Similarly, developers can select these two page classes and configure the logical relationship between them through the interface tool to generate an "Employee Onboarding" business process class. This process class will guide the HR department and new employees to complete the entire onboarding process from information entry to contract signing.
[0044] In this way, developers do not need to write code from scratch, but can quickly build complex business processes by assembling predefined page classes, greatly improving development efficiency and flexibility.
[0045] For steps S103-S104, determine a pre-configured data table; wherein the data table includes the test value and expected value configured for each step in each page element. The page class is generated by one or more component functions, which are generated by one or more page elements. The page element is implemented by one or more steps. For details, see the following Figure 2~Figure 4 Description shown.
[0046] Read the storage path of each step from the page class, such as ["xpath", " / / *[text()="Enter the homepage of online banking"]"], where xpath is the positioning method, and [text()="Enter the homepage of online banking"] is the storage path, but the specific value is not entered at this time. Alternatively, the element.yaml file (element.yaml: a file in the public directory used to store acquired elements) includes the page class and the storage path and positioning method of each step. According to the storage path and positioning method of each step in the element.yaml file, enter the acquired test value into the storage path to test the step. Compare the test value with the expected value in the data table, and perform corresponding operations on the business process class according to the comparison results.
[0047] Embodiment 1: Automated testing of the login function. Data table: contains multiple combinations of user names and passwords, as well as expected login results (success or failure). Test steps: simulate the user login process, including entering user name, password, clicking the login button, etc. Storage path: the location where the actual login results are stored, such as a test report or database record. Operation process: 1. Read a set of user names and passwords from the data table. 2. Execute the login test step and use the read value as input. 3. Record the actual login result to the storage path. 4. Compare the actual login result with the expected value in the data table. 5. Based on the comparison result, if they are consistent, mark the test as passed; if they are inconsistent, mark the test as failed, and may trigger an error notification or log record.
[0048] Example 2: Purchase process test of e-commerce website. Data table: contains product ID, quantity, payment method, expected order status, etc. Test steps: simulate the process of adding products to the shopping cart, filling in the delivery address, selecting the payment method, submitting the order, etc. Storage path: record the actual order status and transaction results of each test. Operation process: 1. Read the product information and expected order status from the data table. 2. Execute the test steps of the purchase process, using the read product information. 3. Store the actual order status and transaction results to the specified path. 4. Compare the actual order status with the expected value in the data table. 5. If it matches, the test passes; otherwise, the test fails and further analysis and debugging may be required.
[0049] In this way, testers can use data-driven testing methods to efficiently test various scenarios and boundary conditions to ensure the accuracy and stability of software functions.
[0050] The method provided in the above embodiment selects page classes, configures logical relationships, generates business process classes, and performs automated testing based on data tables through a business test operation interface. The modular design of page classes, component functions, and page elements supports the reuse of components, reduces code redundancy, and improves development and maintenance efficiency. Moreover, due to the separation of page classes and business process classes, when business requirements change, only the page classes or logical relationships need to be adjusted without having to rewrite the entire process, thereby improving the maintainability and flexibility of the system. The overall process reduces the repetitive work of manual testing, speeds up testing, and makes regression testing and continuous integration more efficient. The test values and expected values in the data table can cover a variety of scenarios and boundary conditions to ensure the comprehensiveness and accuracy of the test.
[0051] See also Figure 2 , shows a schematic flow chart of an optional service test processing method according to an embodiment of the present invention, comprising the following steps:
[0052] S201: In response to a click operation on the component operation interface, displaying a page element list in the component operation interface;
[0053] S202: receiving one or more page elements selected from the page element list to generate a component, and receiving a name and a usage method configured for the component;
[0054] S203: Generate a component function according to the usage mode, the name of each page element in the one or more page elements, the positioning mode and storage path of each step;
[0055] S204: Encapsulate the component function, and name the encapsulated component function using the component name to obtain a component function name.
[0056] This embodiment is used to describe how to generate a component function. For steps S201 to S202, preferably, a component operation interface is set, and the developer can configure the component through the interface. When the component operation interface is opened, the interface will first display a list of page elements. The generation process of page elements can be found in Figure 3 The component operation interface provides an intuitive tool that simplifies the component creation and configuration process, lowers the development threshold, and improves development efficiency.
[0057] Components are composed of page elements, so developers first need to select one or more page elements. For example, HTML tags: , , <button>For example, style elements: use CSS classes or inline styles to define the appearance of elements, such as color, size, position, etc. For example, interactive elements: add dynamic behaviors through JavaScript, such as responding to user input, data binding, or animation effects. For example, form elements: such as <input> , <select>, < / select> <textarea> etc., used to collect user input. For example, images and icons: Use< / textarea> Tags or SVG graphics to enhance visual effects. For example, media elements: <video>and <audio>, used to embed multimedia content. For example, navigation elements: such as menus, breadcrumbs, pagers, etc., help users navigate the website. Developers will combine the above elements to build complex UI interfaces based on the functional requirements of the components.
[0058] After generating a component, you need to define its type, such as search, query, select, drop-down, input, pop-up, and submit. This makes it easier for subsequent developers to query the required components based on the component type. For example, if the types of component 1 and component 2 are both search, when the developer needs to search for a class component, he can directly enter the component type to quickly query component 1 and component 2 without manual searching, thereby improving query efficiency.
[0059] In addition, you also need to define a name for the component. Usually, the name defined by the developer is Chinese pinyin, abbreviation, English abbreviation, English full spelling, etc., but considering the developers who lack code experience, it is preferred to change the defined component name to a more descriptive text format, such as click, locate element, element wait, input text, to enhance readability and maintainability, and make it easy to understand the function of the component. You also need to configure the component using methods, such as the setattr method. The setattr() method is a built-in function in Python that is used to dynamically set the attribute value of an object at runtime. This function receives three parameters: object: This is the object to be modified. name: This is a string that represents the name of the attribute to be set. value: This is the value to be assigned to the attribute.
[0060] For step S203, for each component, a component function is generated according to a fixed format: using method (self, element_name, locator). In Python's object-oriented programming, self is a special keyword that represents a reference to the current object, that is, the object whose method is being called. Here, element_name is the name of each page element included in the component, and locator is the positioning element of each step in the page element, including the positioning method and storage path. Since a page element is implemented by one or more steps, the number of locators is one or more.
[0061] For example, setattr(self, element_name, locator) means assigning locator to an attribute of self, and the attribute name is element_name. For example, if element_name is search_box, then after execution, self.search_box will point to the step represented by locator. This design pattern helps to build a clear and structured automated testing framework, which is easy to maintain and expand.
[0062] For step S204, after the component function is generated, the component function is encapsulated, and the encapsulated component function is named based on the component name defined above, thereby obtaining the component function name. Since the component name has been converted into a text form that is easy to understand, the component function name does not need to be converted here.
[0063] Encapsulate component functions, that is, define each step of the operation in the component function. In software testing or web development, there are many components on the page, such as buttons, text boxes, drop-down lists, etc. Each component has its own function and a series of operation steps. For example, clicking a button may involve locating the element, determining whether the element is available, and then performing the click action. When these operations are encapsulated into component functions, these complex processes are actually simplified into a simple function call. For example, the click_button() function handles all the details related to clicking the button, including finding the button, waiting for the button to be clickable, and performing the click operation. When you need to click a button in the code, you only need to call the click_button() function without having to worry about the specific implementation details.
[0064] The method provided in the above embodiment selects page elements, configures component properties, generates component functions and encapsulates them through the component operation interface. By combining page elements into components, the modularization of the code is supported, which facilitates the reuse of components in different scenarios and reduces the workload of repeated development. Allowing users to customize the name, usage and other properties of the component increases the flexibility and adaptability of the component to meet diverse business needs. The generation and encapsulation of components follow unified standards, which helps to maintain consistency in code style and improve the efficiency of team collaboration. The entire process brings significant value to software development projects by improving development efficiency, enhancing code quality and promoting team collaboration.
[0065] See also Figure 3 , shows a schematic flow chart of another optional service test processing method according to an embodiment of the present invention, comprising the following steps:
[0066] S301: In response to a click operation on a page element operation interface, displaying the page element operation interface, and receiving a page element and a page element name configured in the page element operation interface;
[0067] S302: Receive a step document for configuring the page element; wherein the step document includes one or more steps;
[0068] S303: receiving the logical relationships configured between different steps in the step document, and constructing a step tree structure according to the step document and the logical relationships;
[0069] S304: Receive the storage location configured for each step, and obtain the storage path of each step.
[0070] This implementation is used to describe how to define page elements. This solution takes the system as the dimension and first defines the common page elements in the system, such as click, locate element, element wait, input text, get text value, clear text, etc. Preferably, a page element operation interface can be set, and the above-defined page element operations can be performed in this interface. Change the name of the page element to text form for people with insufficient code experience to view. The page element operation interface provides an intuitive configuration method, which reduces the technical threshold for configuring complex steps and logical relationships, allowing non-professional developers to participate in the configuration process.
[0071] The implementation of page elements usually involves one or more steps. For example, to enter text, you need to click to enter text, enter text content in the input box, or display options in the input box through a drop-down menu, then select a specific text from it, and finally echo the entered or selected text. Therefore, it is also necessary to configure a step document for each page element. The step document includes one or more steps, such as the above-mentioned click, input / drop-down box, and echo.
[0072] Although a step document is provided, which includes multiple steps, these steps are in text form at this time, and the logical relationship between them cannot be determined only by text form, such as nesting, iteration, sequential execution, etc. Therefore, the logical relationship between the steps is still manually configured here, and finally a step tree structure is constructed. The step tree structure includes multiple nodes, each node is a step, and there are parent-child relationships and sibling relationships between different nodes. Each step has its own storage location, which also needs to be pre-set, thereby obtaining the storage path of different steps.
[0073] The method provided in the above embodiment configures page elements, step documents, logical relationships and storage paths through a page element operation interface. The independent configuration of page elements and their steps supports modular development, so that each part can be tested and maintained independently, improving the scalability and reusability of the overall system. By constructing a step tree structure, the logical relationship between different steps is clearly displayed, which helps to understand and maintain complex business processes. By configuring a storage path for each step, the orderly storage and retrieval of step data is ensured, which is beneficial to data management and later analysis. The entire process effectively improves the efficiency and quality of software development and maintenance by enhancing logical clarity, promoting modular design, simplifying the configuration process, improving data management efficiency, and strengthening process control.
[0074] See also Figure 4 , shows a schematic flow chart of another optional service test processing method according to an embodiment of the present invention, comprising the following steps:
[0075] S401: In response to a click operation on the page type operation interface, a component function name list is displayed in the page type operation interface;
[0076] S402: receiving one or more component function names selected from the component function name list, and for each of the one or more component function names, determining a component function corresponding to each component function name;
[0077] S403: Obtain the page element name and step positioning element from each component function to generate a page class.
[0078] This implementation is used to describe how to generate a page class. Preferably, this solution sets a page class operation interface, through which developers can configure page classes. Each page class is in text format and inherits the base class (i.e., page element), such as class login page (BasePage), which means that the login page class inherits the properties and methods of the BasePage class. The name of the defined page operation function is also changed to text format. The page class operation interface provides an intuitive selection mechanism, which allows developers to quickly locate and select appropriate component functions, accelerate the creation of page classes, and improve development efficiency.
[0079] The page is generated by one or more components, the components are generated by one or more page elements, the page elements are generated by one or more steps, and all page elements are written in the yaml file. The yaml file format is: Class name 1: {page text: step positioning element} Class name 2: {page text: step positioning element} ....... Class name N: {page text: step positioning element}
[0080] Here, {page text} is a placeholder, which will be replaced by a specific element name when actually used. By reading the class name N and the self instance attribute, you can directly call self.page text when locating the element in the step, such as: self.enter login account. Figure 2 The values of element_name and locator in the code correspond to the page text and step positioning element in {page text: step positioning element}. The step positioning element consists of two parts, such as: ["xpath", " / / *[text()="Enter the homepage of online banking"]"] ["xpath", " / / *[text()="Enter login password"]"]
[0081] Among them, xpath is a language for finding information in XML documents, and its full name is XML Path Language. xpath provides a method for navigating and selecting nodes in XML data structures. It uses syntax similar to file system paths to locate elements and attributes in XML documents. The second part is the storage path, which needs to be obtained from the yaml file through xpath.
[0082] The method provided in the above embodiment selects component functions and generates page classes through the page class operation interface. By selecting components from the component function name list, component reuse is achieved, the modularization of the code is enhanced, the page class construction process is simplified, and the page class can adapt to different business needs, enhancing the flexibility and scalability of the system. The page element names and step positioning elements are automatically extracted from the component function, which simplifies the page class construction process and reduces the complexity of manual configuration. And generating page classes through component functions helps to maintain the consistency of code style, facilitates later maintenance and upgrades, and reduces maintenance costs. The whole process brings significant efficiency and quality improvements to software development projects.
[0083] See also Figure 5 , shows a schematic flow chart of another optional service test processing method according to an embodiment of the present invention, comprising the following steps:
[0084] S501: receiving specific attributes configured for each step; wherein the specific attributes of different steps are different;
[0085] S502: If the storage path of the target step is not obtained by the preset positioning method, determine the step tree structure according to the page element name, so as to locate the position of the target step in the step tree structure and determine the parent of the position;
[0086] S503: Acquire the storage path of the parent level, and acquire the storage path of the target step based on the storage path of the parent level by locating downward from the parent level according to the specific attributes of the target step;
[0087] S504: When the storage path of the target step is not obtained by locating downward through the parent, the parent of the parent is determined through the step tree structure, and the storage path of the parent of the parent is obtained. By locating downward through the parent of the parent, based on the storage path of the parent of the parent, the storage path of the target step is obtained according to the specific attributes of the target step.
[0088] In the above implementation, for step S501, in the case of subsequent failure to locate the storage path, it may be necessary to quickly locate it through step-specific attributes. Therefore, this solution also sets different specific attributes for different steps, that is, different attributes are set for different steps under the same element. The step attributes under different elements can be the same or different. The specific attributes of the step vary according to the field of its application. Here are examples 1) Test step attributes in software testing: Step ID: unique identifier. Action: specific operation performed, such as clicking a button, entering text, etc. 2) Task step attributes in project management: Task Name: name of the step. Assignee: person responsible for executing the step. 3) Step attributes in workflow: StepType: step type, such as approval, review, automatic processing, etc. Participants: users or roles participating in the step. Approval Level: required approval level. The step attributes in each field are intended to capture the key information required to execute the step for easy management and tracking.
[0089] For steps S502~S504, this solution preferably sets xpath as the preset positioning method. Ideally, the positioning element of each step can be obtained through xpath, but in actual situations, positioning may fail. When the step positioning element can be located directly, that is, the storage path of the step is obtained through xpath, xpath positioning can be used, such as ["xpath", " / / *[text()="Enter login password"]"]. However, when it cannot be located, that is, the positioning fails, seleniun can be used for positioning. Seleunium can locate all levels of the element. If it is not unique, it can be manually fine-tuned. For example, based on the aforementioned generated step tree structure, try to locate from the parent step.
[0090] For example, ["xpath", " / / *[text()="Enter login password"] / .. / / input"], / .. / / input means to search for the storage path of this step downwards based on the storage path of the parent. Input here is only an example and is used for unique positioning without limitation. There may be multiple steps under the parent, so specific attributes can be set for each step in advance. The specific attributes of different steps are different, so the storage path can be quickly located through specific attributes. If the location through the parent fails, then find the parent of the parent upwards and then locate the element to be located downwards until the element can be uniquely located and contains the page text. For example: ["xpath", " / / *[text()="Enter login password"] / .. / .. / / input"], here " / .. / .. / / input" adds " / .." compared to the aforementioned " / .. / / input", which means that the parent of the parent is passed, and so on.
[0091] The method provided in the above embodiment ensures correct access to data by configuring specific attributes, locating storage paths and hierarchical backtracking. Through the step tree structure and specific attributes, the storage path of the target step can be accurately located. Even if the preset positioning method fails, the correct path can be found through the hierarchical backtracking mechanism, ensuring accurate access to data and improving the flexibility and robustness of the system, enabling it to cope with complex and changing business scenarios. The hierarchical backtracking mechanism avoids global search, reduces unnecessary consumption of computing resources, and optimizes the performance of the system. The overall process effectively guarantees the accuracy of data access and the stable operation of the system, while improving the efficiency of development and maintenance.
[0092] The method provided by the embodiment of the present invention adopts an innovative business processing strategy to improve the maintenance efficiency and accuracy of Web automation scripts. The core of this strategy is to abandon traditional element positioning methods such as ID, Class, Name, etc., and instead use visible steps on the page as a new standard for positioning elements. For the case where the step positioning element can be directly located, it can be directly modified. If it is difficult to locate directly, it can be accurately located with the help of a multi-layer parent structure. This operation not only enhances the robustness of the script, but also simplifies the positioning process of complex pages.
[0093] The present invention encapsulates page elements into components, and encapsulates components into page classes. Taking into account the relatively fixed characteristics of page component types in a system, the automation script can be efficiently maintained by assembling, referencing and modifying these components. The advantages of this strategy are particularly obvious when the page structure changes. Since the components are independent and reusable, only local adjustments need to be made to the affected components without large-scale reconstruction of the entire automation script. This method greatly improves the adaptability and maintenance efficiency of the script, while also ensuring the accuracy of automated testing, and maintaining the stability and effectiveness of the script even in an environment where pages are frequently updated. In short, by focusing on visible text and componentized design ideas, the maintenance of Web automation scripts becomes simpler, more efficient and more reliable.
[0094] See also Figure 6 , shows a schematic diagram of main modules of a service test processing device 600 provided in an embodiment of the present invention, including:
[0095] The interface module 601 is used to display a page class list in the business test operation interface in response to a click operation on the business test operation interface, and receive one or more page classes selected from the page class list;
[0096] A configuration module 602, configured to receive a logical relationship configured between different page classes in the one or more page classes, and generate a business process class;
[0097] Determination module 603, used to determine a pre-configured data table; wherein the data table includes test values and expected values configured for each step in each page element; the page class is generated by the component function, the component function is generated by the page element, and the page element is implemented by the steps;
[0098] The test module 604 is used to obtain the storage path of each step according to the page class, read the test value of each step from the data table, write the read test value to the storage path of each step to test each step, compare the test result with the expected value, and perform corresponding operations on the business process class according to the comparison result.
[0099] The implementation device of the present invention also includes a page class configuration module, which is used to:
[0100] In response to a click operation on the page class operation interface, a component function name list is displayed in the page class operation interface;
[0101] receiving one or more component function names selected from the component function name list, and for each of the one or more component function names, determining a component function corresponding to each component function name;
[0102] Get the page element name and step location element from each component function to generate the page class.
[0103] The implementation device of the present invention also includes a component configuration module, which is used to:
[0104] In response to a click operation on the component operation interface, displaying a page element list in the component operation interface;
[0105] Receiving one or more page elements selected from the page element list to generate a component, and receiving a name and a usage method configured for the component;
[0106] Generate a component function according to the usage mode, the name of each page element in the one or more page elements, the positioning mode and storage path of each step;
[0107] The component function is encapsulated, and the encapsulated component function is named using the component name to obtain a component function name.
[0108] In the implementation device of the present invention, the component configuration module is further used to: receive the type of configuration of the component; and
[0109] The page class configuration module is also used to: receive an input component type, query a list of component function names that match the component type, and display them.
[0110] The implementation device of the present invention also includes a page element configuration module, which is used to:
[0111] In response to a click operation on the page element operation interface, the page element operation interface is displayed, and the page element and the page element name configured in the page element operation interface are received;
[0112] Receiving a step document for configuring the page element; wherein the step document includes one or more steps;
[0113] Receiving logical relationships configured between different steps in a step document, and constructing a step tree structure according to the step document and the logical relationships; and
[0114] Receive the storage location configured for each step and obtain the storage path of each step.
[0115] In the implementation device of the present invention, the page element configuration module is further used to: receive specific attributes configured for each step; wherein the specific attributes of different steps are different;
[0116] The process of determining the storage path of the target step is as follows: if the storage path of the target step is not obtained by the preset positioning method, the step tree structure is determined according to the page element name, so as to locate the position of the target step in the step tree structure and determine the parent of the position;
[0117] Obtain the storage path of the parent, and obtain the storage path of the target step based on the storage path of the parent and according to the specific attributes of the target step by locating downward from the parent;
[0118] In the case that the storage path of the target step is not obtained by locating downward from the parent, the parent of the parent is determined through the step tree structure, and the storage path of the parent of the parent is obtained. By locating downward from the parent of the parent, based on the storage path of the parent of the parent, the storage path of the target step is obtained according to the specific attributes of the target step.
[0119] In addition, the specific implementation content of the device described in the embodiment of the present invention has been described in detail in the method described above, so the repeated content will not be described again here.
[0120] Figure 7 An exemplary system architecture 700 to which embodiments of the present invention may be applied is shown, including terminal devices 701 , 702 , 703 , a network 704 and a server 705 (only an example).
[0121] Terminal devices 701, 702, 703 can be various electronic devices with display screens and supporting web browsing, and various communication client applications are installed. Users can use terminal devices 701, 702, 703 to interact with server 705 through network 704 to receive or send messages, etc.
[0122] The network 704 is used to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. The network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0123] The server 705 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using terminal devices 501, 502, and 503 (for example only). The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal device. It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 705, and accordingly, the device is generally set in the server 705.
[0124] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0125] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0126] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0127] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0128] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0129] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0131] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an interface module, a configuration module, a determination module, and a test module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the test module may also be described as a "test adjustment module".
[0132] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes any of the above-mentioned service test processing methods.
[0133] The computer program product of the present invention comprises a computer program, and when the computer program is executed by a processor, the service test processing method in the embodiment of the present invention is implemented.
[0134] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.< / audio> < / video> < / button>
Claims
1. A service test processing method, characterized in that: include: In response to a click operation on the business test operation interface, a page class list is displayed in the business test operation interface, and one or more page classes selected from the page class list are received; Receiving logical relationships configured between different page classes in the one or more page classes, and generating a business process class; Determine a pre-configured data table; wherein the data table includes test values and expected values configured for each step in each page element; the page class is generated by the component function, the component function is generated by the page element, and the page element is implemented by the steps; Get the storage path of each step based on the page class, read the test value of each step from the data table, write the read test value to the storage path of each step to test each step, compare the test results with the expected values, and perform corresponding operations on the business process class according to the comparison results.
2. The method according to claim 1, characterized in that Before displaying the page class list in the business test operation interface, the method further includes: In response to a click operation on the page class operation interface, a component function name list is displayed in the page class operation interface; receiving one or more component function names selected from the component function name list, and for each of the one or more component function names, determining a component function corresponding to each component function name; Get the page element name and step location element from each component function to generate the page class.
3. The method according to claim 2, characterized in that Before displaying the component function name list in the page class operation interface, the method further includes: In response to a click operation on the component operation interface, displaying a page element list in the component operation interface; Receiving one or more page elements selected from the page element list to generate a component, and receiving a name and a usage method configured for the component; Generate a component function according to the usage mode, the name of each page element in the one or more page elements, the positioning mode and storage path of each step; The component function is encapsulated, and the encapsulated component function is named using the component name to obtain a component function name.
4. The method according to claim 3, characterized in that The method further includes: receiving a type of configuration for the component; and The receiving of one or more component function names selected from the component function name list further includes: receiving an input component type, and querying a list of component function names that match the component type for display.
5. The method according to claim 3, characterized in that: Before displaying the page element list in the component operation interface, the method further includes: In response to a click operation on the page element operation interface, the page element operation interface is displayed, and the page element and the page element name configured in the page element operation interface are received; Receiving a step document for configuring the page element; wherein the step document includes one or more steps; Receiving logical relationships configured between different steps in a step document, and constructing a step tree structure according to the step document and the logical relationships; and Receive the storage location configured for each step and obtain the storage path of each step.
6. The method according to claim 5, characterized in that The method further comprises: receiving specific attributes configured for each step; wherein the specific attributes of different steps are different; The process of determining the storage path of the target step is as follows: if the storage path of the target step is not obtained by the preset positioning method, the step tree structure is determined according to the page element name, so as to locate the position of the target step in the step tree structure and determine the parent of the position; Obtain the storage path of the parent, and obtain the storage path of the target step based on the storage path of the parent and according to the specific attributes of the target step by locating downward from the parent; In the case that the storage path of the target step is not obtained by locating downward from the parent, the parent of the parent is determined through the step tree structure, and the storage path of the parent of the parent is obtained. By locating downward from the parent of the parent, based on the storage path of the parent of the parent, the storage path of the target step is obtained according to the specific attributes of the target step.
7. A service test processing device, characterized in that: include: An interface module, for displaying a page class list in the business test operation interface in response to a click operation on the business test operation interface, and receiving one or more page classes selected from the page class list; A configuration module, used for receiving the logical relationship configured between different page classes in the one or more page classes, and generating a business process class; A determination module is used to determine a pre-configured data table; wherein the data table includes test values and expected values configured for each step in each page element; the page class is generated by the component function, the component function is generated by the page element, and the page element is implemented by the steps; The test module is used to obtain the storage path of each step based on the page class, read the test value of each step from the data table, write the read test value to the storage path of each step to test each step, compare the test results with the expected values, and perform corresponding operations on the business process class according to the comparison results.
8. The device according to claim 7, characterized in that The device also includes a page element configuration module, which is used to: In response to a click operation on the page element operation interface, the page element operation interface is displayed, and the page element and the page element name configured in the page element operation interface are received; Receiving a step document for configuring the page element; wherein the step document includes one or more steps; Receiving logical relationships configured between different steps in a step document, and constructing a step tree structure according to the step document and the logical relationships; and Receive the storage location configured for each step and obtain the storage path of each step.
9. The device according to claim 8, characterized in that The page element configuration module is further used to: receive specific attributes configured for each step; wherein the specific attributes of different steps are different; The process of determining the storage path of the target step is as follows: if the storage path of the target step is not obtained by the preset positioning method, the step tree structure is determined according to the page element name, so as to locate the position of the target step in the step tree structure and determine the parent of the position; Obtain the storage path of the parent, and obtain the storage path of the target step based on the storage path of the parent and according to the specific attributes of the target step by locating downward from the parent; In the case that the storage path of the target step is not obtained by locating downward from the parent, the parent of the parent is determined through the step tree structure, and the storage path of the parent of the parent is obtained. By locating downward from the parent of the parent, based on the storage path of the parent of the parent, the storage path of the target step is obtained according to the specific attributes of the target step.
10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
