Product testing method and device, computer equipment, readable storage medium and program product
By building a product functional tree diagram and generating corresponding test cases, the problems of omission and duplication of test cases in the prior art are solved, and the accuracy and efficiency of product testing are improved.
Patent Information
- Application Number
- CN202411694130.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-02-18
AI Technical Summary
Existing product testing methods rely on the developer's experience and intuition, which can easily lead to omissions or repetition of test cases and affect the accuracy of product testing.
By building the functional tree diagram of the target product, obtain the functional information and test requirements information of each product function, perform test cases conversion, generate test cases with the same hierarchy structure as the functional tree diagram, and execute these use cases to obtain test results.
Ensure that the test covers all key functional points of the product, reduces omissions and duplication of test cases, improves the accuracy of test cases and product testing accuracy, and reduces testing costs.
Smart Images

Figure CN119473905A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing, and in particular to a product testing method, apparatus, computer equipment, readable storage medium and program product. Background Art
[0002] Product testing is the operation of verifying whether a product meets the pre-defined requirements. Through product testing, defects in the product can be discovered and solved in time. Therefore, product testing is very necessary to ensure product quality.
[0003] Currently, developers usually write and run test cases to test products. However, this method often relies on the experience and intuition of developers, which can easily lead to omissions or duplications of test cases, thus affecting the accuracy of product testing. Summary of the invention
[0004] Based on this, it is necessary to provide a product testing method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of product testing in response to the above technical problems.
[0005] In a first aspect, the present application provides a product testing method, comprising: in response to a test instruction for a target product, respectively obtaining functional information and test requirement information of each product function in the target product; constructing a functional tree diagram of the target product based on each functional information and each test requirement information; the nodes in the functional tree diagram correspond one-to-one to the product functions; according to the functional tree diagram, performing test case conversion to obtain test cases having the same hierarchical structure as the functional tree diagram; executing the test cases to obtain test results of the target product.
[0006] In one of the embodiments, a functional tree diagram of a target product is constructed based on each functional information and each test requirement information, including: for each product function, based on the functional information of the product function, node label matching is performed to obtain a node type label that matches the product function; the node type label and the test requirement information of the product function are added to the blank node of the product function to obtain a functional node of the product function; and each functional node together constitutes a functional tree diagram of the target product.
[0007] In one of the embodiments, test case conversion is performed according to a function tree diagram to obtain test cases having the same hierarchical structure as the function tree diagram, including: converting each product function in the function tree diagram into a test case to obtain a sub-test case for each product function; creating a test case directory according to the hierarchical structure of the function tree diagram; and adding each sub-test case to the test case directory to obtain a test case for the target product.
[0008] In one of the embodiments, the method also includes: when receiving an update instruction for a function tree diagram, obtaining a target function and update content indicated by the update instruction; the target function is any one or more functions among the product functions; filtering out a target test case of the target function from each sub-test case; and synchronously updating the target test case based on the update content.
[0009] In one of the embodiments, when an update instruction for a function tree diagram is received, the target function and update content indicated by the update instruction are obtained, including: when an update instruction for a function tree diagram is received, a permission check is performed on the target object that triggers the update instruction to obtain a permission check result for the target object; when the permission check result indicates that the target object has permission to update the function tree diagram, the target function and update content indicated by the update instruction are obtained.
[0010] In one of the embodiments, the method also includes: before the test case is executed, performing test coverage detection on the test case to obtain the static coverage of the test case; during the execution of the test case, performing test coverage detection on the test case to obtain the dynamic coverage of the test case; when the static coverage and / or dynamic coverage does not reach the coverage threshold, optimizing the test case.
[0011] On the second aspect, the present application also provides a product testing device, including: an information acquisition module, used to respond to the test instructions for the target product, and respectively obtain the functional information and test requirement information of each product function in the target product; a product function tree construction module, used to construct a function tree diagram of the target product based on each function information and each test requirement information; the nodes in the function tree diagram correspond one-to-one to the product functions; a test case generation module, used to convert the test case according to the function tree diagram, and obtain the test case with the same hierarchical structure as the function tree diagram; a product testing module, used to execute the test case to obtain the test result of the target product.
[0012] On the third aspect, the present application also provides a computer device, including a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program: in response to a test instruction for a target product, obtaining functional information and test requirement information of each product function in the target product respectively; constructing a functional tree diagram of the target product based on each functional information and each test requirement information; the nodes in the functional tree diagram correspond one-to-one to the product functions; performing test case conversion according to the functional tree diagram to obtain test cases having the same hierarchical structure as the functional tree diagram; executing the test cases to obtain test results of the target product.
[0013] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which implements the following steps when the computer program is executed by a processor: in response to a test instruction for a target product, respectively obtain functional information and test requirement information of each product function in the target product; based on each functional information and each test requirement information, construct a functional tree diagram of the target product; the nodes in the functional tree diagram correspond one-to-one to the product functions; according to the functional tree diagram, perform test case conversion to obtain test cases having the same hierarchical structure as the functional tree diagram; execute the test cases to obtain test results of the target product.
[0014] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the following steps when executed by a processor: in response to a test instruction for a target product, respectively obtain functional information and test requirement information of each product function in the target product; based on each functional information and each test requirement information, construct a functional tree diagram of the target product; the nodes in the functional tree diagram correspond one-to-one to the product functions; according to the functional tree diagram, perform test case conversion to obtain test cases with the same hierarchical structure as the functional tree diagram; execute the test cases to obtain test results of the target product.
[0015] The above-mentioned product testing method, device, computer equipment, computer-readable storage medium and computer program product, in response to the test instruction for the target product, first obtain the functional information and test requirement information of each product function in the target product respectively. Thus, according to these functional information and test requirement information, a functional tree diagram of the target product is constructed, and the nodes in the functional tree diagram correspond to the product functions one by one. Then, according to the functional tree diagram, the test case conversion is performed to obtain a test case with the same hierarchical structure as the functional tree diagram. Finally, the test case is executed to obtain the test result of the target product. It can be seen that the present application can ensure that the test covers all key functional points of the product by writing test cases based on the product function tree diagram, reduce the omission and duplication of test cases, thereby improving the accuracy of test cases, and then improving the accuracy of product testing. And the test case and the product function tree diagram have the same hierarchical structure, which can ensure that the organizational structure of the test case is clear and orderly, avoid the confusion of the test process caused by the confusion of the test case storage, and further improve the quality of product testing. In addition, since the test case design is more comprehensive, the product testing tasks in the present application can be efficiently executed, thereby reducing unnecessary testing work and reducing product testing costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0017] FIG1 is an application environment diagram of a product testing method in one embodiment;
[0018] FIG2 is a schematic flow chart of a product testing method in one embodiment;
[0019] FIG3 is a schematic diagram of a process for constructing a function tree diagram in one embodiment;
[0020] FIG4 is a schematic diagram of a process for generating a test case in one embodiment;
[0021] FIG5 is a schematic diagram of a process of synchronously updating a test case in one embodiment;
[0022] FIG6 is a schematic diagram of a process flow of permission detection in one embodiment;
[0023] FIG7 is a schematic diagram of a flow chart of test case coverage detection in one embodiment;
[0024] FIG8 is a schematic diagram of a process flow of a product test in a specific embodiment;
[0025] FIG9 is a schematic diagram of a functional tree diagram in a specific embodiment;
[0026] FIG10 is a diagram showing coverage detection results in a specific embodiment;
[0027] FIG11 is a block diagram of a product testing device in one embodiment;
[0028] FIG. 12 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0030] The product testing method provided in the embodiment of the present application can be applied in the application environment as shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and Internet of Things devices. The server 104 can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides cloud computing services.
[0031] Specifically, in response to the test instruction for the target product initiated by the terminal 102, the server 104 first obtains the function information and test requirement information of each product function in the target product. Based on each function information and each test requirement information, a function tree diagram of the target product is constructed. The nodes in the function tree diagram correspond to the product functions one by one. Finally, according to the function tree diagram, the test case conversion is performed to obtain a test case with the same hierarchical structure as the function tree diagram. By executing the test case, the test of the target product can be realized, thereby obtaining the test result of the target product.
[0032] In an exemplary embodiment, as shown in FIG. 2 , a product testing method is provided, which is described by taking the method applied to the server 104 in FIG. 1 as an example, and includes:
[0033] Step S202 , in response to a test instruction for a target product, respectively obtain function information and test requirement information of each product function in the target product.
[0034] The target product may refer to the software or application that needs to be tested. The test instruction refers to the instruction to test the target product. The product function refers to each function in the target product. Function information refers to the attribute information corresponding to each product function, such as function description, function type, and compatible terminal system. Test requirement information refers to the test requirements corresponding to each product function, including but not limited to test objectives, test scope, test environment, etc.
[0035] For example, when the server receives a test instruction for a target product initiated by a terminal, it can display a front-end construction interface of a function tree diagram to the user. Through the front-end construction interface, the server can obtain the function information of each product function of the target product input by the user, as well as the requirement information of each product function during the test. In one example, the front-end construction interface can include a toolbar, a navigation panel, and a display area of the function tree diagram.
[0036] Step S204, constructing a function tree diagram of the target product based on each function information and each test requirement information; the nodes in the function tree diagram correspond one-to-one to the product functions.
[0037] Among them, the function tree diagram is a way to display the functions and hierarchical structure of the target product in a tree structure. The node is the basic unit of the function tree diagram, and each node in the function tree diagram corresponds to a product function.
[0038] Exemplarily, after obtaining each functional information and each test requirement information, the server can call a pre-configured construction tool, i.e., a software tool for creating, editing and managing a functional tree diagram of a target product, and generate a functional tree diagram of the target product based on each functional information and each test requirement information.
[0039] In one example, the construction tool is a construction tool based on jsMind, which is a JavaScript library for generating mind maps, which can be used to generate a functional tree diagram of the target product. It should be noted that in traditional technology, a spreadsheet such as Excel is usually used to make a product function tree, but it is difficult to intuitively express the hierarchical relationship and interdependence between product functions, and the visual presentation is relatively simple. When it is necessary to frequently expand, fold or reorganize the hierarchical product function tree, the operation of the spreadsheet is not intuitive and flexible enough. As for existing professional software such as Xmind, although it has rich visual expression and supports complex hierarchical and branching structures, there is a certain cost threshold. Advanced editing and collaboration functions usually require paid subscriptions, which will constitute an economic burden on enterprises or individual users. Based on this, a construction tool based on jsMind is introduced in this example to build a functional tree diagram of the target product, which is more intuitive and less expensive than traditional spreadsheets. It can achieve a more intuitive and clear display of the functional tree diagram of the target product on the basis of ensuring cost, and provide accurate data support for subsequent test cases.
[0040] In one example, in addition to inputting functional information and test requirement information in the front-end construction interface, users can also directly import files including the functional information and test requirement information of the target product in the front-end construction interface. After the server receives the file, it is converted into a file with a specific form structure of jsMind. jsMind can recognize the file, automatically convert it into a corresponding tree diagram, and display the tree diagram in the front-end construction interface. During the entire product testing process, users can edit or delete each node at any time, and each node can be configured with a corresponding editing page. The front-end construction interface can also provide shortcut keys and toolbar buttons so that users can quickly add nodes. Users can also trigger a pop-up window by clicking the right mouse button after selecting a node, and then create an association with other nodes. Of course, users can also adjust the display ratio of the tree diagram by using the mouse wheel or toolbar zoom button, or move nodes by dragging and dropping to change the position of nodes in the tree diagram.
[0041] Step S206: Perform test case conversion according to the function tree diagram to obtain test cases having the same hierarchical structure as the function tree diagram.
[0042] Among them, test case conversion can be understood as the process of converting the function tree diagram into a test case. At present, it is generally written and run by developers to test the product. However, this method often relies on the experience and intuition of developers, which easily leads to omission or duplication of test cases, thereby affecting the accuracy of product testing. Therefore, in this embodiment, by effectively combining the function tree diagram of the target product with the test case, the test case has the same hierarchical structure as the function tree diagram, making the test case clearer and more accurate, thereby improving the accuracy of product testing.
[0043] Exemplarily, the server converts the test cases according to the function tree diagram constructed by the jsMind construction tool, that is, converts the function tree diagram into corresponding test cases, ensuring that the test cases and the function tree diagram have the same functional hierarchy structure, thereby ensuring the consistency between the test cases and the function tree diagram. Of course, when the function tree diagram is updated, the test cases will also be updated synchronously.
[0044] Step S208, executing the test case to obtain the test result of the target product.
[0045] The test results may be results used to characterize the test effect of the target product, such as test duration, reliability, stability, security, response speed, etc. of the target product.
[0046] Exemplarily, after the server generates the test case, it can run the test case to test the target product, and record the test result of the target product to facilitate subsequent test optimization.
[0047] In this embodiment, the server responds to the test instruction for the target product, and first obtains the function information and test requirement information of each product function in the target product. Thus, according to these function information and test requirement information, a function tree diagram of the target product is constructed, and the nodes in the function tree diagram correspond to the product functions one by one. Then, according to the function tree diagram, the test case conversion is performed to obtain a test case with the same hierarchical structure as the function tree diagram. Finally, the test case is executed to obtain the test result of the target product. It can be seen that this embodiment can ensure that the test covers all key functional points of the product by writing test cases based on the product function tree diagram, reduce omissions and duplications of test cases, thereby improving the accuracy of test cases, and then improving the accuracy of product testing. And the test case and the product function tree diagram have the same hierarchical structure, which can ensure that the organizational structure of the test case is clear and orderly, avoid the confusion of the test process caused by the confusion of the test case storage, and further improve the quality of product testing. In addition, since the test case design is more comprehensive, the product testing tasks in this embodiment can be efficiently executed, thereby reducing unnecessary testing work and reducing product testing costs.
[0048] In an exemplary embodiment, as shown in FIG3 , a function tree diagram of a target product is constructed based on each function information and each test requirement information, including:
[0049] Step S302 : for each product function, node label matching is performed based on the function information of the product function to obtain a node type label that matches the product function.
[0050] Among them, the node type label may refer to a label used to characterize the node type. In this embodiment, the node type label may include but is not limited to an attribute label, a cross label and a scenario label. The node type label can be determined based on the functional information of the product function. For example, when the functional information of a product function only includes basic attribute information, the node type label corresponding to the product function is determined as an attribute label. If the functional information also includes cross information or association information with other products, the node type label corresponding to the product function is determined as a cross label, which means that this product function has a product function associated with it. If the functional information also includes application scenario information, the node type label corresponding to the product function is determined as a scenario label, which means that this product function can be used in a specific scenario, which is convenient for designing functional tests for feature scenarios when generating test cases. For each product function, there can be multiple node type labels.
[0051] Exemplarily, for each product function, the server may perform node label matching according to the function information of the product function, that is, query the node type label that matches the product function.
[0052] Step S304: adding the node type label and the test requirement information of the product function to the blank node of the product function to obtain the function node of the product function.
[0053] Among them, the blank node refers to the initial state of the node. Generally speaking, each node is blank in the initial stage. The functional node is the node obtained by adding the node type label and the test requirement information of the product function to the blank node.
[0054] For example, each product function may correspond to a blank node that does not contain any content. After matching the node type label of the product function, the server may add the node type label and the test requirement information of the product function to the blank node to form a function node.
[0055] Step S306: the functional nodes together form a functional tree diagram of the target product.
[0056] Exemplarily, after the corresponding node type labels and test requirement information are added to the blank nodes of all product functions, a function tree diagram of the target product composed of all function nodes can be obtained.
[0057] In this embodiment, by matching each product function with a corresponding node type label, the content of the nodes of the product functions is supplemented based on the node type label and test requirement information, thereby improving the accuracy of the nodes, thereby improving the accuracy of the function tree diagram, and further improving the accuracy of the test cases.
[0058] In an exemplary embodiment, as shown in FIG4 , test case conversion is performed according to the function tree diagram to obtain test cases having the same hierarchical structure as the function tree diagram, including:
[0059] Step S402, convert each product function in the function tree diagram into a test case to obtain a sub-test case for each product function.
[0060] Among them, sub-test cases refer to the test cases corresponding to each product function.
[0061] Exemplarily, when generating a test case, the server may first convert the test case based on the node type label and test requirement information contained in each function node in the function tree diagram, thereby obtaining a test case corresponding to each product function.
[0062] Step S404: Create a test case directory according to the hierarchical structure of the function tree diagram.
[0063] Among them, the test case directory refers to a directory organized according to certain structures and rules to better manage and execute test cases.
[0064] Exemplarily, the server creates a test case directory accordingly according to the hierarchical structure of the function tree diagram, ensuring that the test case target is consistent with the hierarchical structure of the function tree diagram.
[0065] Step S406, adding each sub-test case to the test case directory to obtain the test case of the target product.
[0066] Exemplarily, the server finally adds the converted sub-test cases of each product function to the test case directory, and the test case of the target product can be obtained.
[0067] In this embodiment, by converting the test cases for each functional node in a targeted manner, the sub-test cases for each product function are obtained, and these sub-test cases are added to the test case directory with the same hierarchical structure as the function tree map, thereby obtaining the test cases for the target product. On the basis of ensuring that the test cases cover each product function, the organizational structure of the test cases is also ensured to be clear and orderly, thereby improving the accuracy and efficiency of product testing.
[0068] In an exemplary embodiment, as shown in FIG5 , the product testing method further includes:
[0069] Step S502: upon receiving an update instruction for the function tree diagram, obtaining the target function and update content indicated by the update instruction.
[0070] The update instruction refers to an instruction to update the function tree diagram. The target function may refer to the product function to be updated, and the target function may be any one or more functions among the product functions. The update content may refer to the content that needs to be updated for the target product.
[0071] Exemplarily, when receiving an update instruction for the function tree diagram, the server parses the update instruction to obtain the to-be-updated function and update content carried by the update instruction.
[0072] Step S504: Filter out target test cases of target functions from each sub-test case.
[0073] Among them, the target test case refers to the sub-test case corresponding to the target function.
[0074] Exemplarily, after determining the target function to be updated, the server can query the sub-test cases corresponding to the target function, that is, the target test cases, in each sub-test case. The query may be based on the function identifier of the target function, such as the function name or function number.
[0075] Step S506: Synchronously update the target test case based on the updated content.
[0076] Exemplarily, after querying the target test case corresponding to the target function, the server can synchronously update the target test case based on the updated content, thereby achieving synchronous update between the test case and the function tree diagram and ensuring the consistency of the test case and the function tree diagram.
[0077] In this embodiment, when the function tree diagram of the target product is updated, the test cases also need to be updated synchronously. A high degree of synchronization between the test cases and the function tree diagram is achieved, which is not only conducive to the standardized storage and maintenance of the test cases, ensuring that the organizational structure of the test cases is clear and orderly, and avoiding management chaos caused by storage chaos, but also ensures that as the function tree diagram is updated, the associated test cases can be automatically updated and maintained, without the need to regenerate new test cases, thereby improving the efficiency of product testing.
[0078] In an exemplary embodiment, as shown in FIG6 , when an update instruction for a function tree diagram is received, obtaining a target function and update content indicated by the update instruction includes:
[0079] Step S602: when receiving an update instruction for the function tree diagram, performing a permission check on the target object that triggers the update instruction to obtain a permission check result of the target object.
[0080] The permission detection refers to the process of detecting whether the target object has the permission to update the function tree diagram. The target object may refer to the user object that updates the function tree diagram. The permission detection result may be used to indicate whether the target object has the permission to update the function tree diagram.
[0081] Exemplarily, when the server receives an update instruction for the function tree diagram, in order to ensure product data security and regular product testing process, in this embodiment, the user object that initiated the update instruction will be checked for permissions. That is, it is checked whether the user object has the permission to update the function tree diagram of the target product. In one example, the server will introduce a collaboration mechanism for the function tree diagram, that is, user objects with update permissions are allowed to modify the function tree diagram, while user objects without update permissions can view and discuss in real time, ensuring the smoothness of product collaboration while ensuring product data security.
[0082] Step S604: when the authority detection result indicates that the target object has the authority to update the function tree diagram, the target function and update content indicated by the update instruction are obtained.
[0083] For example, when the permission detection result indicates that the target object has the permission to update the function tree diagram, the server can obtain the target function and update content indicated by the update instruction, and perform synchronous update of the function tree diagram and the test case. When the permission detection result indicates that the target object does not have the permission to update the function tree diagram, the server can refuse to update.
[0084] In this embodiment, when the function tree diagram of the target product is updated, the product data security is guaranteed by performing permission detection on the target object that initiates the update instruction.
[0085] In an exemplary embodiment, as shown in FIG7 , the product testing method further includes:
[0086] Step S702: Before the test case is executed, test coverage detection is performed on the test case to obtain the static coverage rate of the test case.
[0087] Among them, test coverage detection is used to evaluate the coverage of test cases for the function tree diagram, that is, to evaluate whether the test cases fully cover all product functions of the target product to ensure that there are no omissions. Static coverage refers to the coverage of test cases for the function tree diagram before the test case is executed, that is, in the early stage of the test.
[0088] Exemplarily, before the test case is executed, the server may perform a round of coverage detection on the test case to detect the coverage of the function tree diagram of the target product by the test case. The ratio between the number of product function tests before the test case is executed and the total number of function nodes in the function tree diagram is the static coverage of the test case.
[0089] Step S704: During the execution of the test case, test coverage detection is performed on the test case to obtain the dynamic coverage rate of the test case.
[0090] The dynamic coverage rate refers to the coverage of the function tree diagram by the test case during the execution of the test case, that is, during the test of the target product. In practical applications, the dynamic coverage rate can also be detected after the test case execution is completed.
[0091] For example, during the execution of the test case, the server can perform another round of coverage detection on the test case to detect the coverage of the function tree diagram of the target product by the test case. The ratio between the number of product function tests during the execution of the test case and the total number of function nodes in the function tree diagram is the dynamic coverage of the test case.
[0092] Step S706: When the static coverage and / or the dynamic coverage does not reach the coverage threshold, the test case is optimized.
[0093] The coverage threshold refers to a threshold set in advance for static coverage and / or dynamic coverage. If the threshold is not reached, it means that the coverage of the test case does not meet the standard, that is, the test case does not fully cover the function tree diagram and needs to be optimized. When the static coverage and / or dynamic coverage reaches the threshold, it means that the test case has fully covered the function tree diagram.
[0094] Exemplarily, after calculating the static coverage and / or dynamic coverage of the test case, the server can compare the static coverage and / or dynamic coverage with a preset coverage threshold, and determine whether the test case needs to be optimized based on the comparison result.
[0095] In one example, the server may also generate a corresponding coverage detection report, which may record the total number of tested product functions, static coverage, dynamic coverage, uncovered product functions, etc.
[0096] In this embodiment, by performing static and dynamic coverage detection on the test cases, it is convenient to timely discover uncovered product functions, thereby supplementing and optimizing the test cases in a targeted manner, and further improving the reliability of the product.
[0097] In a specific embodiment, as shown in FIG8 , the process of the product testing method includes:
[0098] S1: Build jsMind build tool. The server builds jsMind build tool with the function of creating function tree diagram.
[0099] S2: Generate a functional tree diagram of the target product. The user enters the functional information of each product function of the target product, including product function 1, product function 2, product function 3...product function N, and the requirement information of each product function during testing in the front-end interface of the jsMind construction tool, as shown in Figure 9. For each product function, the jsMind construction tool matches the node labels based on the functional information of the product function to obtain a node type label that matches the product function. Add the node type label and the test requirement information of the product function to the blank node of the product function to obtain the functional node of the product function. Each functional node together constitutes the functional tree diagram of the target product.
[0100] S3: Create a test directory for the test case. The server creates a test case directory according to the hierarchical structure of the function tree diagram.
[0101] S3: Generate test cases. The server converts each product function in the function tree diagram into a test case to obtain a sub-test case for each product function. Each sub-test case is added to the test case directory to obtain a test case for the target product.
[0102] S4: Target product testing. The server executes the test case and obtains the test result of the target product.
[0103] S5: Test case coverage detection. Test case coverage detection is performed before and during execution to obtain static coverage and dynamic coverage of the test case. When the static coverage and / or dynamic coverage does not reach the coverage threshold, the test case is optimized. The server can visualize the coverage detection results, as shown in Figure 10.
[0104] In this embodiment, the server responds to the test instruction for the target product, and first obtains the function information and test requirement information of each product function in the target product. Thus, according to these function information and test requirement information, a function tree diagram of the target product is constructed, and the nodes in the function tree diagram correspond to the product functions one by one. Then, according to the function tree diagram, the test case conversion is performed to obtain a test case with the same hierarchical structure as the function tree diagram. Finally, the test case is executed to obtain the test result of the target product. It can be seen that this embodiment can ensure that the test covers all key functional points of the product by writing test cases based on the product function tree diagram, reduce omissions and duplications of test cases, thereby improving the accuracy of test cases, and then improving the accuracy of product testing. And the test case and the product function tree diagram have the same hierarchical structure, which can ensure that the organizational structure of the test case is clear and orderly, avoid the confusion of the test process caused by the confusion of the test case storage, and further improve the quality of product testing. In addition, since the test case design is more comprehensive, the product testing tasks in this embodiment can be efficiently executed, thereby reducing unnecessary testing work and reducing product testing costs.
[0105] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0106] Based on the same inventive concept, the embodiment of the present application also provides a product testing device for implementing the product testing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more product testing device embodiments provided below can refer to the limitations on the product testing method above, and will not be repeated here.
[0107] In an exemplary embodiment, as shown in FIG11 , a product testing device is provided, including: an information acquisition module 1102, for respectively acquiring functional information and test requirement information of each product function in the target product in response to a test instruction for the target product; a product function tree construction module 1104, for constructing a functional tree diagram of the target product based on each functional information and each test requirement information; the nodes in the functional tree diagram correspond one-to-one to the product functions; a test case generation module 1106, for performing test case conversion according to the functional tree diagram to obtain test cases having the same hierarchical structure as the functional tree diagram; a product testing module 1108, for executing the test case to obtain the test result of the target product.
[0108] In one of the embodiments, the product function tree construction module 1104 is also used to: for each product function, based on the functional information of the product function, perform node label matching to obtain a node type label that matches the product function; add the node type label and the test requirement information of the product function to the blank node of the product function to obtain a functional node of the product function; and each functional node together constitutes a functional tree diagram of the target product.
[0109] In one embodiment, the test case generation module 1106 is also used to: convert each product function in the function tree diagram into a test case to obtain a sub-test case for each product function; create a test case directory according to the hierarchical structure of the function tree diagram; add each sub-test case to the test case directory to obtain a test case for the target product.
[0110] In one of the embodiments, the device is also used to: when receiving an update instruction for a function tree diagram, obtain the target function and update content indicated by the update instruction; the target function is any one or more functions among the product functions; filter out the target test case of the target function in each sub-test case; based on the update content, synchronously update the target test case.
[0111] In one of the embodiments, the device is also used to: when receiving an update instruction for a function tree diagram, perform a permission check on the target object that triggers the update instruction to obtain a permission check result of the target object; when the permission check result indicates that the target object has the permission to update the function tree diagram, obtain the target function and update content indicated by the update instruction.
[0112] In one of the embodiments, the device is also used to: perform test coverage detection on the test case before the test case is executed to obtain the static coverage of the test case; perform test coverage detection on the test case during the execution of the test case to obtain the dynamic coverage of the test case; when the static coverage and / or dynamic coverage does not reach the coverage threshold, optimize the test case.
[0113] Each module in the above-mentioned product testing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0114] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG12. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store product test data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a product testing method is implemented.
[0115] Those skilled in the art will understand that the structure shown in FIG. 12 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0116] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: in response to a test instruction for a target product, respectively obtaining function information and test requirement information of each product function in the target product; constructing a function tree diagram of the target product based on each function information and each test requirement information; the nodes in the function tree diagram correspond one-to-one to the product functions; performing test case conversion according to the function tree diagram to obtain test cases having the same hierarchical structure as the function tree diagram; and executing the test cases to obtain test results of the target product.
[0117] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each product function, based on the functional information of the product function, node label matching is performed to obtain a node type label that matches the product function; the node type label and the test requirement information of the product function are added to the blank node of the product function to obtain a functional node of the product function; and each functional node together constitutes a functional tree diagram of the target product.
[0118] In one embodiment, when the processor executes the computer program, the following steps are also implemented: each product function in the function tree diagram is converted into a test case to obtain a sub-test case for each product function; a test case directory is created according to the hierarchical structure of the function tree diagram; and each sub-test case is added to the test case directory to obtain a test case for the target product.
[0119] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when receiving an update instruction for the function tree diagram, the target function and update content indicated by the update instruction are obtained; the target function is any one or more functions among the product functions; the target test case of the target function is filtered out in each sub-test case; based on the update content, the target test case is synchronously updated.
[0120] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when an update instruction for the function tree diagram is received, a permission check is performed on the target object that triggers the update instruction to obtain a permission check result of the target object; when the permission check result indicates that the target object has the permission to update the function tree diagram, the target function and update content indicated by the update instruction are obtained.
[0121] In one embodiment, when the processor executes the computer program, the following steps are also implemented: before the test case is executed, test coverage detection is performed on the test case to obtain the static coverage rate of the test case; during the execution of the test case, test coverage detection is performed on the test case to obtain the dynamic coverage rate of the test case; when the static coverage rate and / or the dynamic coverage rate does not reach the coverage rate threshold, the test case is optimized.
[0122] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: in response to a test instruction for a target product, functional information and test requirement information of each product function in the target product are respectively obtained; based on each functional information and each test requirement information, a functional tree diagram of the target product is constructed; the nodes in the functional tree diagram correspond one-to-one to the product functions; according to the functional tree diagram, test case conversion is performed to obtain test cases with the same hierarchical structure as the functional tree diagram; and the test cases are executed to obtain test results of the target product.
[0123] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each product function, based on the functional information of the product function, node label matching is performed to obtain a node type label that matches the product function; the node type label and the test requirement information of the product function are added to the blank node of the product function to obtain a functional node of the product function; and each functional node together constitutes a functional tree diagram of the target product.
[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: each product function in the function tree diagram is converted into a test case to obtain a sub-test case for each product function; a test case directory is created according to the hierarchical structure of the function tree diagram; and each sub-test case is added to the test case directory to obtain a test case for the target product.
[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when an update instruction for the function tree diagram is received, the target function and update content indicated by the update instruction are obtained; the target function is any one or more functions among the product functions; the target test case of the target function is filtered out in each sub-test case; based on the update content, the target test case is synchronously updated.
[0126] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: when an update instruction for a functional tree diagram is received, a permission check is performed on the target object that triggers the update instruction to obtain a permission check result of the target object; when the permission check result indicates that the target object has permission to update the functional tree diagram, the target function and update content indicated by the update instruction are obtained.
[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: before the test case is executed, test coverage detection is performed on the test case to obtain the static coverage rate of the test case; during the execution of the test case, test coverage detection is performed on the test case to obtain the dynamic coverage rate of the test case; when the static coverage rate and / or the dynamic coverage rate does not reach the coverage rate threshold, the test case is optimized.
[0128] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: in response to a test instruction for a target product, respectively obtaining function information and test requirement information of each product function in the target product; constructing a function tree diagram of the target product based on each function information and each test requirement information; the nodes in the function tree diagram correspond one-to-one to the product functions; according to the function tree diagram, performing test case conversion to obtain test cases with the same hierarchical structure as the function tree diagram; executing the test cases to obtain test results of the target product.
[0129] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each product function, based on the functional information of the product function, node label matching is performed to obtain a node type label that matches the product function; the node type label and the test requirement information of the product function are added to the blank node of the product function to obtain a functional node of the product function; and each functional node together constitutes a functional tree diagram of the target product.
[0130] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: each product function in the function tree diagram is converted into a test case to obtain a sub-test case for each product function; a test case directory is created according to the hierarchical structure of the function tree diagram; and each sub-test case is added to the test case directory to obtain a test case for the target product.
[0131] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when an update instruction for the function tree diagram is received, the target function and update content indicated by the update instruction are obtained; the target function is any one or more functions among the product functions; the target test case of the target function is filtered out in each sub-test case; based on the update content, the target test case is synchronously updated.
[0132] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: when an update instruction for a functional tree diagram is received, a permission check is performed on the target object that triggers the update instruction to obtain a permission check result of the target object; when the permission check result indicates that the target object has permission to update the functional tree diagram, the target function and update content indicated by the update instruction are obtained.
[0133] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: before the test case is executed, test coverage detection is performed on the test case to obtain the static coverage rate of the test case; during the execution of the test case, test coverage detection is performed on the test case to obtain the dynamic coverage rate of the test case; when the static coverage rate and / or the dynamic coverage rate does not reach the coverage rate threshold, the test case is optimized.
[0134] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0135] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0136] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0137] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A product testing method, characterized in that: The method comprises: In response to a test instruction for a target product, respectively acquiring function information and test requirement information of each product function in the target product; Based on each of the functional information and each of the test requirement information, construct a functional tree diagram of the target product; the nodes in the functional tree diagram correspond one-to-one to the product functions; According to the function tree diagram, test case conversion is performed to obtain test cases having the same hierarchical structure as the function tree diagram; Execute the test case to obtain the test result of the target product.
2. The method according to claim 1, characterized in that The constructing a function tree diagram of the target product based on each of the function information and each of the test requirement information includes: For each of the product functions, node label matching is performed based on the function information of the product function to obtain a node type label that matches the product function; Adding the node type label and the test requirement information of the product function to the blank node of the product function to obtain a function node of the product function; The functional nodes together constitute a functional tree diagram of the target product.
3. The method according to claim 1, characterized in that The converting of test cases according to the function tree diagram to obtain test cases having the same hierarchical structure as the function tree diagram includes: Convert each product function of the function tree diagram into a test case to obtain a sub-test case for each product function; Create a test case directory according to the hierarchical structure of the function tree diagram; Add each of the sub-test cases under the test case directory to obtain the test case of the target product.
4. The method according to claim 3, characterized in that The method further comprises: When receiving an update instruction for the function tree diagram, obtaining a target function and update content indicated by the update instruction; the target function is any one or more functions among the product functions; Filtering out a target test case of the target function from each of the sub-test cases; Based on the updated content, the target test case is synchronously updated.
5. The method according to claim 4, characterized in that When receiving an update instruction for the function tree diagram, obtaining the target function and update content indicated by the update instruction includes: When receiving an update instruction for the function tree diagram, performing a permission check on a target object that triggers the update instruction to obtain a permission check result of the target object; When the permission detection result indicates that the target object has the permission to update the function tree diagram, the target function and update content indicated by the update instruction are obtained.
6. The method according to claim 1, characterized in that The method further comprises: Before the test case is executed, test coverage detection is performed on the test case to obtain static coverage of the test case; During the execution of the test case, the test coverage detection is performed on the test case to obtain the dynamic coverage rate of the test case; When the static coverage and / or the dynamic coverage does not reach a coverage threshold, the test case is optimized.
7. A product testing device, characterized in that: The device comprises: An information acquisition module, configured to respectively acquire function information and test requirement information of each product function in the target product in response to a test instruction for the target product; A product function tree construction module, used to construct a function tree diagram of the target product based on each of the function information and each of the test requirement information; the nodes in the function tree diagram correspond one-to-one to the product functions; A test case generation module is used to convert the test cases according to the function tree diagram to obtain test cases having the same hierarchical structure as the function tree diagram; The product testing module is used to execute the test cases and obtain the test results of the target product.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.