Framework testing method and system, electronic equipment and storage medium

By developing test sample programs in the test framework, deploying them to the container to run, obtaining and assigning test attributes, the problem of the framework exposing sensitive parameters in the container is solved, and the security of application operation is detected and adjusted.

CN119645828AActive Publication Date: 2025-03-18ALIPAY (HANGZHOU) INFORMATION TECH CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411479020.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-03-18
Estimated Expiration
2044-10-22

AI Technical Summary

Technical Problem

When the framework runs in a container, it may expose sensitive parameters, causing malicious users to modify these parameters, forming system vulnerabilities, and thus causing application operation security issues.

Method used

By developing test sample programs in the test framework, deploying them to a container to run, obtaining runtime test properties, and assigning these properties to obtain test results of the test framework, thereby identifying and adjusting potential security risks.

Benefits of technology

Effectively identify and solve the problem of sensitive parameters exposed by the framework when running in the container, avoid abnormal operation of applications due to parameter exposure, and improve the security and stability of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645828A_ABST
    Figure CN119645828A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of information, in particular to a frame testing method and system, electronic equipment and a storage medium. The framework test method comprises the steps that a test sample program obtained through development in a test framework is deployed into a container to be operated, test attributes in an operation environment during operation of the test sample program are obtained in the operation process, and the test attributes which can be obtained are attribute data allowed to be exposed by the test framework; and performing assignment operation on the test attributes, and finally obtaining a test result of the test framework according to whether assignment succeeds or not.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Multiple embodiments of this specification relate to the field of information technology, and specifically to a framework testing method and system, electronic equipment, and storage medium. Background Art

[0002] When developing applications, it is common and efficient to use pre-built frameworks. These frameworks provide many ready-made components and services that can help developers quickly build applications and improve development efficiency while ensuring application stability and maintainability.

[0003] However, the framework itself may be improperly constructed, which may cause the application developed using the framework to expose some sensitive parameters that should not be exposed when running in the container. Malicious users can modify these sensitive parameters to create system vulnerabilities, which in turn may cause operational security issues for subsequent applications. Summary of the invention

[0004] The embodiments of this specification provide a framework testing method and system, electronic equipment, and storage medium, which can implement testing of the framework.

[0005] The technical solution is as follows:

[0006] In a first aspect, an embodiment of the present specification provides a framework testing method, including:

[0007] Develop a test sample program in the test framework;

[0008] Deploy the test sample program to a container that provides an operating environment for the test sample program, and run the test sample program;

[0009] Acquire the test properties in the running environment when the test sample program is running;

[0010] An assignment operation is performed on the test attribute, and a test result of the test framework is obtained according to the assignment result of the test attribute.

[0011] In a second aspect, an embodiment of the present specification provides a framework testing system, including:

[0012] Development module, develops test sample program in the test framework;

[0013] A deployment module deploys the test sample program to a container that provides an operating environment for the test sample program and runs the test sample program;

[0014] A first acquisition module is used to acquire the test attributes of the running environment when the test sample program is running;

[0015] The test module performs an assignment operation on the test attribute and obtains a test result of the test framework according to the assignment result of the test attribute.

[0016] In a third aspect, an embodiment of this specification provides an electronic device, comprising a processor and a memory; the processor is connected to the memory; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps described in the first aspect of the above embodiment.

[0017] In a fourth aspect, an embodiment of this specification provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the steps described in the first aspect of the above embodiment.

[0018] The beneficial effects brought by the technical solutions provided by some embodiments of this specification include at least:

[0019] The test sample program developed in the test framework is deployed to the container for running, and the test attributes in the running environment when the test sample program is running are obtained during the running process. These test attributes that can be obtained are the attribute data allowed to be exposed by the test framework. These test attributes are assigned, and finally the test results of the test framework can be obtained according to the success or failure of the assignment. The framework is subsequently adjusted based on the test results to avoid the exposure of these attributes that may cause abnormal operation of the application, or to avoid the successful assignment of these attribute values ​​during the subsequent application operation, thereby avoiding the problem of abnormal operation of the application developed through the framework due to framework problems. The entire framework testing process is based on the test sample program developed in the test framework. Therefore, if you want to test a certain type of framework, you can develop a test sample program in that type of framework. The testing process can achieve adaptation to multiple frameworks. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 It is a schematic diagram of the environment architecture of an implementation process of a framework testing method provided in an embodiment of this specification.

[0023] Figure 2 It is a flowchart of a framework testing method provided in an embodiment of this specification.

[0024] Figure 3 It is a flowchart of another framework testing method provided in an embodiment of this specification.

[0025] Figure 4 It is a flowchart of another framework testing method provided in an embodiment of this specification.

[0026] Figure 5 It is a flowchart of another framework testing method provided in an embodiment of this specification.

[0027] Figure 6 It is a structural diagram of a framework testing system provided in an embodiment of this specification.

[0028] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0029] The technical solutions in the embodiments of this specification will be described clearly and completely below in conjunction with the drawings in the embodiments of this specification.

[0030] The terms "first", "second", "third", etc. in the description and claims of this specification and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0031] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present specification. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described with respect to some examples may be combined in other examples.

[0032] Reference Figure 1 The figure is a schematic diagram of the environment architecture for implementing the framework testing method provided in one or more embodiments of the present specification.

[0033] The implementation environment architecture of the framework testing method provided in one or more embodiments of this specification includes at least a client, a container, and a framework. Figure 1 The web container and web framework are used as examples for demonstration.

[0034] The client can be a mobile phone, a personal computer, a tablet computer, an e-book reader, a device for information interaction based on VR (Virtual Reality), a vehicle terminal, an IoT (Internet of Things) device, a wearable smart device, a laptop computer, a desktop computer, etc. The client is used to respond to the user's HTTP request and initiate a response HTTP request to the web container.

[0035] Among them, the application developed by the Web framework needs to be deployed in the Web container, which provides a running environment for the application. The Web container receives the HTTP request and then passes the request to the Web framework. The Web framework processes the request and generates a response, which is then returned to the Web container, which sends it to the client.

[0036] Based on the above implementation environment architecture, it can be seen that the attribute data that may be exposed when the application runs in the web container is directly related to the construction of the web framework.

[0037] The framework testing method provided in one or more embodiments of this specification obtains attributes during the operation of the application in the web container based on the above-mentioned environment architecture, and reassigns the obtained attributes. It can be understood that if the attribute can be obtained, it means that when the application developed under the current web framework is running in the web container, the attribute is in an exposed state. Furthermore, if the exposed attribute can be reassigned, the reassigned value may affect the normal operation of the application in the web container. Therefore, the web framework needs to be improved in the future to avoid the exposure of these attributes that may cause abnormal operation of the application, or to avoid the successful assignment of these attribute values ​​during the subsequent operation of the application.

[0038] Reference Figure 2 As shown, Figure 2 A flowchart of a framework testing method provided in an embodiment of this specification may include at least the following steps:

[0039] Step 202: Develop a test sample program in the test framework. The test sample program can be a program that only implements a single function, such as a user login function, a user registration function, etc.; it can also be a complete application program, such as a blog program, a chat program, an e-commerce platform program, etc. The specific settings can be made according to the test requirements, because different programs will involve different attribute data.

[0040] Step 204: deploy the test sample program to a container that provides an operating environment for the test sample program, and run it.

[0041] Step 206: Acquire the test attributes in the running environment when the test sample program is running.

[0042] Step 208: perform an assignment operation on the test attribute, and obtain a test result of the test framework according to the assignment result of the test attribute.

[0043] In one or more embodiments of the present specification, a test sample program developed in a test framework is deployed into a container for running, and test attributes in the running environment when the test sample program is running are obtained during the running process. These test attributes that can be obtained are attribute data that the test framework allows to be exposed. These test attributes are assigned values, and finally the test results of the test framework can be obtained based on the success or failure of the assignment.

[0044] For example, if the test attribute obtained is the city attribute under the user object, the value assigned to the city attribute can be, but is not limited to, "Hangzhou", "Hunan", "Beijing", "Shanghai", etc., or other values ​​without specific meanings, such as "Hangzhou", "Tiantian", etc. Furthermore, the attribute values ​​that can be successfully assigned to the city attribute need to be paid special attention to in the future, because after these values ​​are successfully assigned, they may affect the operation of the application.

[0045] For another example, if the test attribute obtained is the suffix attribute under the log object, the value assigned to the suffix attribute can be, but is not limited to, ".jsp", ".log", ".txt", ".xml", ".jspx", etc. Furthermore, for the attribute values ​​that can be successfully assigned to the suffix attribute, it is necessary to pay special attention to them later, because after these values ​​are successfully assigned, they may also affect the normal operation of the application.

[0046] It should be noted that the above-mentioned values ​​that can be successfully assigned do not necessarily affect the normal operation of the application. For example, if the city attribute of the user object is tampered with from "Hangzhou" to "Hunan", although the information is tampered with, the application may still be able to run normally. And if the suffix attribute of the log object is tampered with from ".log" to ".jsp", it is likely to affect the normal operation of the application. The framework testing method described in one or more embodiments of this specification can find these attribute values ​​that can be assigned, and then obtain the test results of the test framework. The framework is subsequently adjusted based on the test results to avoid the exposure of these attributes that may cause abnormal operation of the application, or to avoid the successful assignment of these attribute values ​​during the subsequent operation of the application, thereby avoiding abnormal problems in the operation of the application developed through the framework due to framework problems.

[0047] It should be noted that when the assignable attribute is allowed to be hidden during the application running, it can be directly hidden. When the assignable attribute is not allowed to be hidden, it is necessary to prevent the attribute value obtained by the test during the subsequent application running process from being successfully assigned to the attribute.

[0048] The entire framework testing process is carried out based on the test sample program developed in the test framework. Therefore, if you want to test a certain type of framework, you can develop a test sample program in that type of framework. The testing process can adapt to multiple frameworks.

[0049] In one embodiment of the present specification, the obtaining of the test attributes in the running environment when the test sample program is running includes:

[0050] Step 2062: Acquire the test object in the running environment when the test sample program is running.

[0051] It should be noted that the test object described here may be, but is not limited to, the user object or log object in the above examples.

[0052] Step 2064: Recursively call the attribute interface to obtain the subordinate relationship between the attributes in the test object.

[0053] Take the user object as an example, assuming that the attribute nesting relationship of the user object is as follows: user-address-city-region-street and zip code.

[0054] That is, by recursively calling the attribute interface, the subordinate attribute of the user attribute can be obtained as the address attribute, the subordinate attribute of the address attribute is the city attribute, the subordinate attribute of the city attribute is the region attribute, and the subordinate attributes of the region attribute are the street attribute and the zip code attribute.

[0055] Step 2066: Based on the subordinate relationship between the attributes in the test object, all the attributes in the test object are formed into an attribute tree.

[0056] Still based on the above user object example, the root node in the formed attribute tree is the user attribute, the child node of the root node is the address attribute node, the child node of the address attribute node is the city attribute node, the child node of the city attribute node is the region attribute node, and the two child nodes of the region attribute node are the street attribute node and the postal code attribute node.

[0057] Step 2068: Use a depth-first search algorithm to traverse the attribute tree to obtain the attributes corresponding to each terminal node in the attribute tree, and then obtain the test attribute.

[0058] It should be noted that the Depth-First Search algorithm (DFS for short) is an algorithm for traversing or searching a tree, which searches the branches of the tree as deeply as possible.

[0059] Therefore, still based on the above user object example, the attribute tree is traversed using a depth-first search algorithm, and the attributes corresponding to each terminal node in the obtained attribute tree are the street attribute and the zip code attribute.

[0060] The method described in this embodiment of first forming an attribute tree and then searching for test attributes through a depth-first search algorithm can avoid omission problems in the process of obtaining test attributes.

[0061] In one embodiment of the present specification, before traversing the attribute tree using a depth-first search algorithm to obtain the attributes corresponding to each terminal node in the attribute tree and then obtaining the test attribute, the method further includes: obtaining an attribute set including a plurality of preset attributes;

[0062] The method of traversing the attribute tree using a depth-first search algorithm to obtain the attributes corresponding to each terminal node in the attribute tree, and then obtaining the test attribute, includes:

[0063] Step 20682: Use a depth-first search algorithm to traverse the attribute tree to obtain the attributes corresponding to each terminal node in the attribute tree.

[0064] Step 20684: Based on the attribute set and the attributes corresponding to each terminal node in the attribute tree, obtain the test attribute.

[0065] It is understandable that not all attribute data exposed during the operation of the application in the container is not allowed to be exposed. For example, the user attributes involved in the above example are allowed to be exposed in most cases. This is because even if such attribute data is exposed, it will not cause problems in the operation of the application.

[0066] Therefore, in this embodiment, multiple attributes that may cause running problems in the application program after exposure are first obtained and combined to form an attribute set. Subsequently, based on the attribute set and the attributes corresponding to each terminal node in the attribute tree, the test attribute is obtained, thereby reducing the amount of data processing during the test process.

[0067] In one embodiment of the present specification, the assigning operation to the test attribute and obtaining the test result of the test framework according to the assignment result of the test attribute includes:

[0068] Step 2082: Obtain at least two attribute test values ​​corresponding to the test attribute that are different from the current attribute value of the test attribute.

[0069] For example, when the test attribute is the suffix attribute of the log object, and the current attribute value of the suffix attribute is ".log", the attribute test value can be but is not limited to at least two of ".jsp", ".txt", ".xml", ".jspx", etc.

[0070] Step 2084: perform assignment operations on the test attributes based on each attribute test value to obtain the assignment results of the test attributes.

[0071] Step 2086: Obtain the test result of the test framework according to the assignment result of the test attribute.

[0072] It is understandable that in order to avoid false positives in the test and improve the comprehensiveness of the test, in this embodiment, when the test attribute is assigned, the assignment operation is performed based on at least two attribute test values ​​that are different from the current attribute value of the test attribute.

[0073] In one embodiment of the present specification, before obtaining the assignment result of the test attribute, the method further includes:

[0074] A mutation operation is performed on the attribute test value for which the assignment operation is successful to obtain a first mutation value.

[0075] An assignment operation is performed on the test attribute based on the first mutation value.

[0076] It can be understood that for an attribute test value that can be assigned successfully, the probability that a mutated value obtained by mutating the attribute test value based on the attribute test value can be assigned successfully is also relatively large. Therefore, in this embodiment, a mutation operation is performed on the attribute test value that has been successfully assigned to obtain a first mutated value, and the test attribute is assigned again based on the first mutated value.

[0077] In one embodiment of the present specification, performing a mutation operation on the attribute test value for which the assignment operation is successful to obtain a first mutation value includes:

[0078] Convert the attribute test value of a successful assignment operation into the first byte data.

[0079] A first inversion operation is performed on values ​​of some byte positions in the first byte data to obtain second byte data.

[0080] The second byte data is converted into data of the same data type as the attribute test value of the successful assignment operation to obtain the first variation value.

[0081] It can be understood that the data of all data structures can be converted into byte form. Therefore, in this embodiment, the attribute test value is first converted into byte data, and the values ​​of some byte positions in the byte data are inverted (that is, 0 is converted to 1, and 1 is converted to 0). Finally, the byte data after the inversion operation is converted back to the original data structure to obtain the variant value.

[0082] It should be noted that the above mutation method can achieve the purpose of data mutation and ensure that the mutation value has a smaller mutation range than the original attribute test value. The partial byte position can be, but is not limited to, the head byte position, middle byte position, tail byte position of the byte data, or a combination of the above byte positions.

[0083] In one embodiment of the present specification, after the test attribute is assigned a value based on the first variation value, the method further includes:

[0084] The first inversion operation position corresponding to the first byte data corresponding to the first variation value whose assignment operation is successful is obtained.

[0085] Based on the first inversion operation position, a second inversion operation position of the first byte data corresponding to the first variation value for which the assignment operation is successful is determined.

[0086] Based on the second inversion operation position, a second inversion operation is performed on the first byte data corresponding to the first variation value for which the assignment operation is successful, so as to obtain the third byte data.

[0087] The third byte data is converted into data of the same data type as the attribute test value of the successful assignment operation to obtain a second variation value.

[0088] An assignment operation is performed on the test attribute based on the second mutated value.

[0089] It is understandable that for a variant value that has been successfully assigned, the value obtained by performing a mutation near the variant byte position corresponding to the variant value should be more likely to be successfully assigned. For example, for the ".log" obtained in the above example, if the value at the byte position corresponding to "." is negated, the variant value corresponding to the negation operation is basically unlikely to be successfully assigned. However, if the value at the byte position corresponding to "log" is negated, the variant value corresponding to the negation operation is likely to be successfully assigned.

[0090] Therefore, in this embodiment, the first inversion operation position corresponding to the first byte data is first obtained; then the second inversion operation position of the first byte data is determined based on the first inversion operation position; then based on the second inversion operation position, the second inversion operation is performed on the first byte data to obtain the third byte data; then the third byte data is converted into data of the original data structure type to obtain the second variation value; finally, the test attribute is assigned based on the second variation value.

[0091] It should be explained that the second inversion operation position can be obtained by moving the first inversion operation position by a preset number of byte positions in the byte data.

[0092] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0093] See next Figure 6 , Figure 6 A schematic structural diagram of a framework testing system 600 provided in an embodiment of this specification is shown.

[0094] The framework testing system 600 may include at least:

[0095] A development module 601 is used to develop a test sample program in a test framework;

[0096] A deployment module 602 deploys the test sample program to a container that provides an operating environment for the test sample program and runs the test sample program;

[0097] A first acquisition module 603 is used to acquire the test attributes of the running environment when the test sample program is running;

[0098] The testing module 604 performs a value assignment operation on the test attribute and obtains a test result of the testing framework according to the value assignment result of the test attribute.

[0099] The test sample program developed in the test framework is deployed into the container for running. During the running process, the test attributes in the running environment when the test sample program is running are obtained. These test attributes that can be obtained are the attribute data allowed to be exposed by the test framework. These test attributes are assigned values, and finally the test results of the test framework can be obtained according to the success or failure of the assignment.

[0100] In one embodiment of the present specification, the first acquisition module 603 includes:

[0101] A first acquisition unit 6031 acquires a test object in the running environment when the test sample program is running;

[0102] The second acquisition unit 6032 acquires the subordinate relationship between the attributes in the test object by recursively calling the attribute interface;

[0103] The first processing unit 6033 forms an attribute tree for all attributes in the test object based on the subordinate relationship between the attributes in the test object;

[0104] The third acquisition unit 6034 uses a depth-first search algorithm to traverse the attribute tree to obtain the attributes corresponding to each terminal node in the attribute tree, and then obtain the test attribute.

[0105] The method described in this embodiment of first forming an attribute tree and then searching for test attributes through a depth-first search algorithm can avoid omission problems in the process of obtaining test attributes.

[0106] In one embodiment of the present specification, the framework testing system further includes:

[0107] The second acquisition module 605 acquires an attribute set including a plurality of preset attributes;

[0108] The third acquisition unit 6034 includes:

[0109] The first acquisition subunit 60341 uses a depth-first search algorithm to traverse the attribute tree to obtain the attributes corresponding to each terminal node in the attribute tree;

[0110] The second acquisition subunit 60342 acquires the test attribute based on the attribute set and the attributes corresponding to each terminal node in the attribute tree.

[0111] In this embodiment, multiple attributes that may cause running problems in the application program after exposure are first obtained and combined to form an attribute set. Subsequently, based on the attribute set and the attributes corresponding to each terminal node in the attribute tree, the test attribute is obtained, thereby reducing the amount of data processing during the test process.

[0112] In one embodiment of the present specification, the testing module 604 includes:

[0113] A fourth acquiring unit 6041 acquires at least two attribute test values ​​corresponding to the test attribute and different from the current attribute value of the test attribute;

[0114] The assignment unit 6042 performs an assignment operation on the test attribute based on each attribute test value to obtain an assignment result of the test attribute;

[0115] The fifth acquisition unit 6043 obtains the test result of the test framework according to the assignment result of the test attribute.

[0116] To avoid false positives in the test and improve the comprehensiveness of the test, in this embodiment, when the test attribute is assigned, the assignment operation is performed based on at least two attribute test values ​​that are different from the current attribute value of the test attribute.

[0117] In one embodiment of the present specification, the testing module 604 further includes:

[0118] The second processing unit 6044 performs a mutation operation on the attribute test value for which the assignment operation is successful, to obtain a first mutation value;

[0119] The assignment unit 6042 also performs an assignment operation on the test attribute based on the first variation value.

[0120] In one embodiment of the present specification, the second processing unit 6044 includes:

[0121] The first processing subunit 60441 converts the attribute test value of the successful assignment operation into the first byte data;

[0122] The second processing sub-unit 60442 performs a first inversion operation on the values ​​of some byte positions in the first byte data to obtain second byte data;

[0123] The third processing sub-unit 60443 converts the second byte data into data of the same data type as the attribute test value of the successful assignment operation to obtain a first variation value.

[0124] It can be understood that for an attribute test value that can be assigned successfully, the probability that a mutated value obtained by mutating the attribute test value based on the attribute test value can be assigned successfully is also relatively large. Therefore, in this embodiment, a mutation operation is performed on the attribute test value that has been successfully assigned to obtain a first mutated value, and the test attribute is assigned again based on the first mutated value.

[0125] In one embodiment of the present specification, the testing module 604 further includes:

[0126] A sixth obtaining unit 6045 obtains a first inversion operation position corresponding to a first byte data corresponding to a first variation value for which the assignment operation is successful;

[0127] The third processing unit 6046 determines, based on the first inversion operation position, a second inversion operation position of the first byte data corresponding to the first variation value for which the assignment operation is successful;

[0128] The second processing sub-unit 60442 further performs a second inversion operation on the first byte data corresponding to the first variation value for which the assignment operation is successful based on the second inversion operation position, so as to obtain third byte data;

[0129] The third processing sub-unit 60443 further converts the third byte data into data of the same data type as the attribute test value of the successful assignment operation, so as to obtain a second variation value;

[0130] The assignment unit 6042 also performs an assignment operation on the test attribute based on the second variation value.

[0131] It can be understood that for a variant value that has been successfully assigned, the value obtained by performing a mutation near the variant byte position corresponding to the variant value should be more likely to be successfully assigned. Therefore, in this embodiment, the first inversion operation position corresponding to the first byte data is first obtained; then the second inversion operation position of the first byte data is determined based on the first inversion operation position; then the second inversion operation is performed on the first byte data based on the second inversion operation position to obtain the third byte data; then the third byte data is converted into data of the original data structure type to obtain the second variant value; finally, the test attribute is assigned based on the second variant value.

[0132] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the framework test system embodiment, since it is basically similar to the framework test method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the framework test method embodiment.

[0133] See also Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification is shown.

[0134] like Figure 7 As shown, the electronic device 700 may include: at least one processor 701 , at least one network interface 704 , a user interface 703 , a memory 705 , and at least one communication bus 702 .

[0135] The communication bus 702 may be used to realize the connection and communication among the above-mentioned components.

[0136] The user interface 703 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.

[0137] The network interface 704 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, etc.

[0138] Among them, the processor 701 may include one or more processing cores. The processor 701 uses various interfaces and lines to connect the various parts of the entire electronic device 700, and executes various functions and processes data of the electronic device 700 by running or executing instructions, programs, code sets or instruction sets stored in the memory 705, and calling data stored in the memory 705. Optionally, the processor 701 can be implemented in at least one hardware form of DSP, FPGA, and PLA. The processor 701 can integrate one or a combination of CPU, GPU, modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to handle wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 701, and it can be implemented separately through a chip.

[0139] Among them, the memory 705 may include RAM or ROM. Optionally, the memory 705 includes a non-transient computer-readable medium. The memory 705 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 705 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above various method embodiments, etc. The memory 705 may also be at least one storage device located away from the aforementioned processor 701. The memory 705 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a framework test application. The processor 701 can be used to call the framework test application stored in the memory 705 and execute the steps of the framework test method mentioned in the aforementioned embodiment.

[0140] The embodiments of this specification also provide a computer-readable storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes one or more steps in the above framework test method embodiment. If the component modules of the above electronic device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.

[0141] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of this specification is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0142] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.

[0143] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims of this specification.

Claims

1. A framework testing method, comprising: Develop a test sample program in the test framework; Deploy the test sample program to a container that provides an operating environment for the test sample program, and run the test sample program; Acquire the test properties in the running environment when the test sample program is running; An assignment operation is performed on the test attribute, and a test result of the test framework is obtained according to the assignment result of the test attribute.

2. According to the framework testing method of claim 1, the step of obtaining the test attributes in the running environment when the test sample program is running comprises: Acquire the test object in the running environment when the test sample program is running; The attribute interface is called recursively to obtain the subordinate relationship between the attributes in the test object; Based on the subordinate relationship between the attributes in the test object, all the attributes in the test object are formed into an attribute tree; The attribute tree is traversed by using a depth-first search algorithm to obtain the attributes corresponding to each terminal node in the attribute tree, and then obtain the test attribute.

3. According to a framework testing method of claim 2, before traversing the attribute tree using a depth-first search algorithm to obtain the attributes corresponding to each terminal node in the attribute tree and then obtaining the test attribute, the method further comprises: Obtaining a property set including a plurality of preset properties; The method of traversing the attribute tree using a depth-first search algorithm to obtain the attributes corresponding to each terminal node in the attribute tree, and then obtaining the test attribute, includes: Using a depth-first search algorithm to traverse the attribute tree to obtain the attributes corresponding to each terminal node in the attribute tree; Based on the attribute set and the attributes corresponding to each terminal node in the attribute tree, the test attributes are obtained.

4. According to a framework testing method according to claim 1, the step of assigning a value to the test attribute and obtaining a test result of the test framework according to the assignment result of the test attribute comprises: Obtain at least two attribute test values ​​corresponding to the test attribute that are different from the current attribute value of the test attribute; Performing assignment operations on the test attributes based on each attribute test value to obtain assignment results of the test attributes; The test results of the test framework are obtained according to the assignment results of the test attributes.

5. According to the framework testing method of claim 4, before obtaining the assignment result of the test attribute, it also includes: Performing a mutation operation on the attribute test value for which the assignment operation is successful, to obtain a first mutation value; An assignment operation is performed on the test attribute based on the first mutation value.

6. According to the framework testing method of claim 5, the step of performing a mutation operation on the successfully assigned attribute test value to obtain a first mutation value comprises: Convert the attribute test value of the successful assignment operation into the first byte data; Performing a first inversion operation on values ​​of some byte positions in the first byte data to obtain second byte data; The second byte data is converted into data of the same data type as the attribute test value of the successful assignment operation to obtain the first variation value.

7. A framework testing method according to claim 6, after assigning a value to the test attribute based on the first variation value, further comprising: Obtain a first inversion operation position corresponding to a first byte data corresponding to a first variation value for which the assignment operation is successful; Determine, based on the first inversion operation position, a second inversion operation position of the first byte data corresponding to the first variation value for which the assignment operation is successful; Based on the second inversion operation position, a second inversion operation is performed on the first byte data corresponding to the first variation value for which the assignment operation is successful, so as to obtain a third byte data; Convert the third byte data into data of the same data type as the attribute test value of the successful assignment operation to obtain a second variation value; An assignment operation is performed on the test attribute based on the second mutated value.

8. A framework testing system, comprising: Development module, develops test sample program in the test framework; A deployment module deploys the test sample program to a container that provides an operating environment for the test sample program and runs the test sample program; A first acquisition module is used to acquire the test attributes of the running environment when the test sample program is running; The test module performs an assignment operation on the test attribute and obtains a test result of the test framework according to the assignment result of the test attribute.

9. A framework testing system according to claim 8, wherein the first acquisition module comprises: A first acquisition unit, which acquires a test object in the running environment when the test sample program is running; The second acquisition unit acquires the subordinate relationship between the attributes in the test object by recursively calling the attribute interface; A first processing unit, based on the subordinate relationship between the attributes in the test object, forms an attribute tree for all the attributes in the test object; The third acquisition unit uses a depth-first search algorithm to traverse the attribute tree to acquire the attributes corresponding to each terminal node in the attribute tree, and then acquires the test attribute.

10. A frame testing system according to claim 9, further comprising: A second acquisition module acquires an attribute set including a plurality of preset attributes; The third acquisition unit includes: A first acquisition subunit uses a depth-first search algorithm to traverse the attribute tree to acquire the attributes corresponding to each terminal node in the attribute tree; The second acquisition subunit acquires the test attribute based on the attribute set and the attributes corresponding to each terminal node in the attribute tree.

11. A framework testing system according to claim 8, wherein the testing module comprises: A fourth acquiring unit, acquiring at least two attribute test values ​​corresponding to the test attribute and different from the current attribute value of the test attribute; An assignment unit, performing an assignment operation on the test attribute based on each attribute test value to obtain an assignment result of the test attribute; The fifth acquisition unit obtains the test result of the test framework according to the assignment result of the test attribute.

12. A framework testing system according to claim 11, wherein the testing module further comprises: The second processing unit performs a mutation operation on the attribute test value for which the assignment operation is successful, so as to obtain a first mutation value; The assignment unit further performs an assignment operation on the test attribute based on the first variation value.

13. A framework testing system according to claim 12, wherein the second processing unit comprises: A first processing subunit converts the attribute test value of a successful assignment operation into first byte data; The second processing subunit performs a first inversion operation on values ​​of some byte positions in the first byte data to obtain second byte data; The third processing subunit converts the second byte data into data of the same data type as the attribute test value of the successful assignment operation to obtain a first variation value.

14. A framework testing system according to claim 13, wherein the testing module further comprises: A sixth acquisition unit is configured to acquire a first inversion operation position corresponding to a first byte data corresponding to a first variation value for which the assignment operation is successful; A third processing unit determines, based on the first inversion operation position, a second inversion operation position of the first byte data corresponding to the first variation value for which the assignment operation is successful; The second processing sub-unit further performs a second inversion operation on the first byte data corresponding to the first variation value for which the assignment operation is successful based on the second inversion operation position, so as to obtain third byte data; The third processing sub-unit further converts the third byte data into data of the same data type as the attribute test value of the successful assignment operation, so as to obtain a second variation value; The assignment unit further performs an assignment operation on the test attribute based on the second variation value.

15. An electronic device comprising a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 7.

16. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Program test method and system, computer system and computer readable storage medium

    CN110413502A

  • Test environment generation method and device, electronic equipment and storage medium

    CN114385497A

  • Software testing method, device and equipment and readable storage medium

    CN115145817A

  • Java Web framework-oriented data binding vulnerability automatic detection method

    CN118332555A

  • Centralized system for analyzing software performance metrics

    US20090199160A1