A framework testing method and system, electronic device, and storage medium.
By developing test sample programs within the testing framework and obtaining and assigning test properties to containers, the problem of sensitive parameter exposure caused by the framework is solved, thereby improving the security and stability of the application.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2026-03-10
AI Technical Summary
Existing frameworks may expose sensitive parameters during application development, leading to system vulnerabilities and operational security issues. Current technologies struggle to effectively detect and prevent such problems.
By developing test sample programs within the testing framework, deploying them to a container for execution, acquiring and assigning test attributes, and obtaining the test results of the testing framework based on the assignment results, the framework can be adjusted to prevent the exposure of sensitive parameters.
Effectively detect and adjust the framework to prevent abnormal application operation, and achieve adaptation to multiple frameworks and improved security.
Smart Images

Figure CN119645828B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the field of information technology, and in particular to a framework testing method and system, an electronic device, and a storage medium. BACKGROUND
[0002] When developing an application, it is a common and efficient practice to use a pre-built framework. These frameworks provide many ready-made components and services that can help developers quickly build applications, improve development efficiency, and ensure the stability and maintainability of the application.
[0003] However, the framework itself may be improperly constructed, which can cause the application developed by the framework to expose some sensitive parameters that should not be exposed when running in a container, allowing malicious users to modify these sensitive parameters to form system vulnerabilities, thereby causing subsequent application security problems. SUMMARY
[0004] The embodiments of the present specification provide a framework testing method and system, an electronic device, and a storage medium, which can test the framework.
[0005] The technical solutions are as follows:
[0006] In a first aspect, the embodiments of the present specification provide a framework testing method, comprising:
[0007] developing a test sample program in a test framework;
[0008] deploying the test sample program to a container that provides a running environment for running the test sample program, and running the test sample program;
[0009] obtaining test attributes in the running environment when the test sample program is running;
[0010] performing a value assignment operation on the test attributes, and obtaining a test result of the test framework according to the value assignment result of the test attributes.
[0011] In a second aspect, the embodiments of the present specification provide a framework testing system, comprising:
[0012] a development module that develops a test sample program in a test framework;
[0013] a deployment module that deploys the test sample program to a container that provides a running environment for running the test sample program, and runs the test sample program;
[0014] a first obtaining module that obtains test attributes in the running environment when the test sample program is running;
[0015] The test module performs assignment operation on the test attributes, and obtains the test result of the test framework according to the assignment result of the test attributes.
[0016] In a third aspect, an electronic device is provided, including a processor and a memory; the processor is connected with the memory; the memory is used for storing 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 of the first aspect.
[0017] In a fourth aspect, a computer storage medium is provided, which stores a plurality of instructions, the instructions are suitable for being loaded by a processor and executing the steps of the first aspect.
[0018] The technical solutions provided by some embodiments of the present specification have at least the following beneficial effects:
[0019] The test sample program developed in the test framework is deployed in the container for running, and the test attributes in the running environment during the running of the test sample program are obtained. These obtainable test attributes are the attribute data allowed to be exposed by the test framework. Assignment operation is performed on these test attributes, and finally the test result of the test framework can be obtained according to the success or failure of the assignment. Subsequently, the framework is adjusted based on the test result to avoid the exposure of these attributes that may cause abnormal running of the application program, or to avoid the assignment success of these attribute values during the subsequent running of the application program, thereby avoiding the problem that the application program developed through the framework appears abnormal during the running due to the problem of the framework. The entire framework test process is carried out based on the test sample program developed in the test framework. Therefore, to test what type of framework, the test sample program developed in what type of framework can be used. The test process can realize the adaptation to multiple frameworks. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor based on these drawings.
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
[0022] Figure 1 is a schematic diagram of an environment architecture of a framework test method implementation process provided by an embodiment of the present specification.
[0023] Figure 2 is a schematic diagram of a framework test method provided by an embodiment of the present specification.
[0024] Figure 3 is a schematic diagram of another framework test method provided by an embodiment of the present specification.
[0025] Figure 4 is a schematic diagram of another framework test method provided by an embodiment of the present specification.
[0026] Figure 5 is a schematic diagram of another framework test method provided by an embodiment of the present specification.
[0027] Figure 6 is a schematic diagram of a framework test system provided by an embodiment of the present specification.
[0028] Figure 7 is a schematic diagram of an electronic device provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present specification will be described clearly and completely below in combination with the drawings in the embodiments of the present specification.
[0030] The terms "first", "second", "third", etc. in the specification and claims of the present specification and the above drawings are used to distinguish different objects, and are not used to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed or can optionally include other steps or units inherent to the process, method, product or device.
[0031] The following description provides examples, and is not intended to limit the scope, applicability or example set forth in the claims. Alterations and further modifications of the described elements are possible without departing from the scope of the description. Various examples can omit, substitute, or add various procedures or components as appropriate. For instance, the methods described can be performed in an order different than described, and various steps can be added, omitted, or combined. Also, features described with respect to some examples can be combined in other examples.
[0032] Referring to Figure 1 As shown in the figure, the environment architecture diagram of the framework test method implementation process provided by one or more embodiments of the present specification.
[0033] The implementation environment architecture of the framework test method provided by one or more embodiments of the present specification at least includes a client, a container, and a framework. Figure 1 In the embodiment, a web container and a web framework are taken as examples for illustration.
[0034] The client can be a mobile phone, a personal computer, a tablet computer, an electronic 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, and a desktop computer, etc. The client is used to respond to HTTP requests of a user and initiate HTTP requests of responses to the web container.
[0035] The application program developed by the web framework needs to be deployed in the web container, and the web container provides a running environment for the application program. The web container receives an HTTP request, and then passes the request to the web framework. The web framework processes the request and generates a response, and then returns the response to the web container, which sends the response to the client.
[0036] Based on the above implementation environment architecture, it can be known that the attribute data exposed by the application program during the running process in the web container is directly related to the construction of the web framework.
[0037] The framework testing method provided by one or more embodiments of the present specification can acquire attributes during the running of the application in the web container on the basis of the above-mentioned environment architecture, and reassign the acquired attributes. It can be understood that if the attributes can be acquired, it indicates that the attributes are in an exposed state when the application developed under the current web framework runs in the web container. Furthermore, if the exposed attributes can be reassigned, the reassignment value can affect the normal running of the application in the web container. Therefore, subsequent improvements need to be made to the web framework to avoid the exposure of these attributes that can cause abnormal running of the application, or to avoid the successful assignment of the attribute values during the subsequent running of the application.
[0038] Referring to Figure 2 Figure 2 FIG. 1 is a flowchart of a framework testing method provided by an embodiment of the present specification, which can at least include the following steps:
[0039] Step 202, a test sample program is developed in a 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. The test sample program can also be a complete application program, such as a blog program, a chat program, an e-commerce platform program, etc. The specific test sample program can be set according to the test requirements, because different programs will involve different attribute data.
[0040] Step 204, the test sample program is deployed into a container that provides a running environment for the running of the test sample program, and is run.
[0041] Step 206, test attributes in the running environment during the running of the test sample program are acquired.
[0042] Step 208, the test attributes are assigned, and a test result of the test framework is obtained according to the assignment result of the test attributes.
[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 during the running of the test sample program are acquired. These acquirable test attributes are attribute data that the test framework allows to be exposed. The test attributes are assigned, and finally a test result of the test framework is obtained according to the success or failure of the assignment.
[0044] For example, the obtained test attribute is the city attribute under the user object, at this time, the assignment to the city attribute can be, but is not limited to, "Hangzhou", "Hunan", "Beijing", "Shanghai", etc., or other values without specific meaning, such as "Hanghai", "Tian Tian", etc. Further, for the attribute values that can be successfully assigned to the city attribute, subsequent attention is needed because these values may affect the running of the application program after being successfully assigned.
[0045] For example, the obtained test attribute is the suffix attribute under the log object, at this time, the assignment to the suffix attribute can be, but is not limited to, ".jsp", ".log", ".txt", ".xml", ".jspx", etc. Further, for the attribute values that can be successfully assigned to the suffix attribute, subsequent attention is needed because these values may also affect the normal running of the application program after being successfully assigned.
[0046] It should be noted that the above values that can be successfully assigned may not necessarily affect the normal running of the application program. For example, the city attribute of the user object is tampered from "Hangzhou" to "Hunan", although the information is tampered, but the application program can still run normally. However, the suffix attribute of the log object is tampered from ".log" to ".jsp", which will probably affect the normal running of the application program. The framework test method described in one or more embodiments of the present specification can find these assignable attribute values, and then obtain the test results of the test framework. Subsequently, the framework is adjusted based on the test results to avoid the exposure of these attributes that may cause abnormal running of the application program, or to avoid the subsequent application program running process that these attribute values can be successfully assigned, thereby avoiding the problem that the application program developed through the framework due to the problem of the framework causes the abnormal problem in the running process.
[0047] It should be noted that when the assignable attribute is allowed to be hidden during the running of the application program, it can be directly hidden. When the assignable attribute is not allowed to be hidden, the attribute values obtained by the test in the subsequent application program running process need to be avoided to be successfully assigned to the attribute.
[0048] The entire framework test process is based on the test sample program developed in the test framework, so as to test what type of framework, the test sample program is developed in what type of framework, and the test process can realize the adaptation to multiple frameworks.
[0049] In an embodiment of the present specification, the test attribute in the running environment during the running of the test sample program is obtained, comprising:
[0050] Step 2062, obtaining a test object in the running environment during the running of the test sample program.
[0051] It should be noted that the test object described herein can be, but is not limited to, the user object or the log object in the above examples.
[0052] In step 2064, the dependency relationship between the attributes in the test object is obtained by recursively calling the attribute interface.
[0053] Taking the user object as an example, it is assumed that the attribute nesting relationship of the user object is as follows: user-address-city-region-street and postcode.
[0054] That is, the sub-attribute of the user attribute is the address attribute, the sub-attribute of the address attribute is the city attribute, the sub-attribute of the city attribute is the region attribute, and the sub-attribute of the region attribute is the street attribute and the postcode attribute.
[0055] In step 2066, all attributes in the test object are formed into an attribute tree based on the dependency relationship between the attributes in the test object.
[0056] Still based on the above example of the user object, the root node of 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 postcode attribute node.
[0057] In step 2068, the attribute tree is traversed by using a depth-first search algorithm to obtain the attributes corresponding to each end node in the attribute tree, and then the test attributes are obtained.
[0058] It should be noted that the depth-first search algorithm (Depth-First Search, DFS for short) is an algorithm for traversing or searching a tree. This algorithm searches the branches of the tree as deeply as possible.
[0059] Therefore, still based on the above example of the user object, the attributes corresponding to each end node in the attribute tree obtained by traversing the attribute tree by using the depth-first search algorithm are the street attribute and the postcode attribute.
[0060] The method of first forming an attribute tree and then searching for test attributes by using a depth-first search algorithm in this embodiment can avoid the omission problem in the process of obtaining test attributes.
[0061] In an embodiment of the present specification, before the attribute tree is traversed by using a depth-first search algorithm to obtain the attributes corresponding to each end node in the attribute tree, and then the test attributes are obtained, the method further comprises: obtaining an attribute set comprising a plurality of preset attributes.
[0062] The process involves using a depth-first search algorithm to traverse the attribute tree to obtain the attributes corresponding to each terminal node in the attribute tree, thereby obtaining the test attributes, including:
[0063] Step 20682: Use a depth-first search algorithm to traverse the attribute tree to obtain the attributes corresponding to each end node in the attribute tree.
[0064] Step 20684: Based on the attribute set and the attributes corresponding to each end node in the attribute tree, obtain the test attributes.
[0065] Understandably, not all attribute data exposed by an application while it's running in a container is prohibited from being exposed. For example, the user attributes mentioned above are generally allowed to be exposed because exposing such attribute data will not cause any operational problems for the application.
[0066] Therefore, in this embodiment, multiple attributes that may cause operational problems in the application after exposure are first obtained and combined to form an attribute set. Subsequently, based on this attribute set and the attributes corresponding to each end node in the attribute tree, the test attributes are obtained, thereby reducing the amount of data processing during the testing process.
[0067] In one embodiment of this specification, the step of assigning values to the test attributes and obtaining the test results of the test framework based on the assignment results of the test attributes includes:
[0068] Step 2082: Obtain at least two attribute test values that are different from the current attribute value of the test attribute.
[0069] For example, when the test property is a suffix property of a log object, and the current property value of the suffix property is ".log", the property test value can be, but is not limited to, at least two of ".jsp", ".txt", ".xml", ".jspx", etc.
[0070] Step 2084: Assign values to the test attributes based on each attribute test value to obtain the assignment results of the test attributes.
[0071] Step 2086: Obtain the test results of the test framework based on the assignment results of the test attributes.
[0072] It is understandable that, in order to avoid false positives and improve the comprehensiveness of testing, when assigning values to test attributes in this embodiment, 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 this specification, before obtaining the assignment result of the test attribute, the method further includes:
[0074] Perform a mutation operation on the attribute test value that was successfully assigned to obtain the first mutated value.
[0075] The test attribute is assigned a value based on the first mutation value.
[0076] It is understandable that for attribute test values that can be successfully assigned, the probability of successfully assigning mutated values obtained by mutating them is also relatively high. Therefore, in this embodiment, a mutation operation is performed on the attribute test values that have been successfully assigned to obtain a first mutated value, and the test attribute is assigned a value again based on the first mutated value.
[0077] In one embodiment of this specification, performing a mutation operation on the attribute test value after a successful assignment operation to obtain a first mutated value includes:
[0078] Convert the attribute test value that was successfully assigned into the first byte of data.
[0079] Perform a first inversion operation on the values at certain byte positions in the first byte of data to obtain the second byte of data.
[0080] The second byte of data is converted into data of the same data type as the attribute test value that was successfully assigned, to obtain the first mutated value.
[0081] It is understandable that 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 (i.e., 0 becomes 1 and 1 becomes 0). Finally, the inverted byte data is converted back to the original data structure to obtain the mutated value.
[0082] It should be noted that by employing the above mutation method, the purpose of data mutation is achieved while ensuring that the mutation value is relatively small compared to the original attribute test value. The byte positions mentioned here may include, but are not limited to, the header byte position, middle byte position, tail byte position, or a combination of these byte positions.
[0083] In one embodiment of this specification, after assigning a value to the test attribute based on the first mutation value, the method further includes:
[0084] Get the position of the first inverted operation corresponding to the first byte of data of the first mutated value of the first successful assignment operation.
[0085] The second inversion position is determined based on the first inversion operation position, which determines the first byte of data corresponding to the first mutated value of the successfully assigned value.
[0086] Based on the second inversion operation position, the first byte of data corresponding to the first mutated value of the successful assignment operation is subjected to a second inversion operation to obtain the third byte of data.
[0087] The third byte of data is converted into data of the same data type as the attribute test value that was successfully assigned, in order to obtain the second mutated value.
[0088] The test attribute is assigned a value based on the second mutation value.
[0089] Understandably, for a mutated value that has already been successfully assigned, a value obtained by mutating near the mutated byte position corresponding to that mutated value should be more likely to be successfully assigned. For example, regarding the ".log" obtained in the example above, if the value at the byte position corresponding to "." is inverted, the mutated value corresponding to that inversion operation is almost impossible to be assigned successfully. However, if the value at the byte position corresponding to "log" is inverted, the mutated value corresponding to that inversion operation is highly 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 first byte data is subjected to a second inversion operation 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 mutation value; finally, the test attribute is assigned a value based on the second mutation value.
[0091] It should be explained that the second inversion operation position can be obtained by shifting the first inversion operation position in the byte data by a preset number of bytes.
[0092] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0093] Please refer to the following. Figure 6 , Figure 6 A schematic diagram of the structure of a frame testing system 600 provided in an embodiment of this specification is shown.
[0094] The framework test system 600 can include at least:
[0095] Module 601 was developed to create a test sample program within the test framework.
[0096] Deployment module 602 deploys the test sample program to a container that provides a runtime environment for the test sample program, and then runs it.
[0097] The first acquisition module 603 acquires the test attributes in the runtime environment during the runtime of the test sample program;
[0098] Test module 604 assigns values to the test attributes and obtains the test results of the test framework based on the assignment results of the test attributes.
[0099] The test sample program developed in the test framework is deployed to a container for execution. During the execution, the test attributes in the runtime environment of the test sample program are obtained. These obtainable test attributes are the attribute data that the test framework allows to expose. Values are assigned to these test attributes, and finally, the test results of the test framework can be obtained based on whether the assignment is successful or not.
[0100] In one embodiment of this specification, the first acquisition module 603 includes:
[0101] The first acquisition unit 6031 acquires the test object in the runtime environment when the test sample program is running;
[0102] The second acquisition unit 6032 uses a recursive call to the attribute interface to obtain the dependency relationship between the attributes in the test object;
[0103] The first processing unit 6033 forms an attribute tree for all attributes in the test object based on the subordinate relationships 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 end node in the attribute tree, and then obtains the test attributes.
[0105] The method described in this embodiment, which involves first forming an attribute tree and then searching for test attributes using a depth-first search algorithm, can avoid omissions during the process of obtaining test attributes.
[0106] In one embodiment of this specification, the framework testing system further includes:
[0107] The second acquisition module 605 acquires an attribute set including multiple 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 attribute corresponding to each end node in the attribute tree.
[0110] The second acquisition subunit 60342 acquires the test attributes based on the attribute set and the attributes corresponding to each end node in the attribute tree.
[0111] In this embodiment, multiple attributes that may cause operational problems in the application after exposure are first obtained and combined to form an attribute set. Subsequently, based on this attribute set and the attributes corresponding to each end node in the attribute tree, the test attributes are obtained, thereby reducing the amount of data processing during the testing process.
[0112] In one embodiment of this specification, the test module 604 includes:
[0113] The fourth acquisition unit 6041 acquires at least two attribute test values that are different from the current attribute value of the test attribute;
[0114] Assignment unit 6042 performs assignment operations on the test attribute based on each attribute test value to obtain the assignment result of the test attribute;
[0115] The fifth acquisition unit 6043 obtains the test results of the test framework based on the assignment results of the test attributes.
[0116] To avoid false positives and improve the comprehensiveness of testing, in this embodiment, when assigning values to test attributes, 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 this specification, the test module 604 further includes:
[0118] The second processing unit 6044 performs a mutation operation on the attribute test value that was successfully assigned, in order to obtain the first mutated value;
[0119] The assignment unit 6042 also performs an assignment operation on the test attribute based on the first mutation value.
[0120] In one embodiment of this specification, the second processing unit 6044 includes:
[0121] The first processing subunit 60441 converts the attribute test value that was successfully assigned into the first byte of data.
[0122] The second processing subunit 60442 performs a first inversion operation on the values of some byte positions in the first byte data to obtain the second byte data;
[0123] The third processing subunit 60443 converts the second byte data into data of the same data type as the attribute test value that was successfully assigned, in order to obtain the first mutated value.
[0124] It is understandable that for attribute test values that can be successfully assigned, the probability of successfully assigning mutated values obtained by mutating them is also relatively high. Therefore, in this embodiment, a mutation operation is performed on the attribute test values that have been successfully assigned to obtain a first mutated value, and the test attribute is assigned a value again based on the first mutated value.
[0125] In one embodiment of this specification, the test module 604 further includes:
[0126] The sixth acquisition unit 6045 acquires the position of the first inversion operation corresponding to the first byte of data of the first mutated value corresponding to the first successful assignment operation;
[0127] The third processing unit 6046 determines the second inversion operation position of the first byte data corresponding to the first mutated value of the successfully assigned operation based on the first inversion operation position.
[0128] The second processing subunit 60442 further performs a second inversion operation on the first byte data corresponding to the first mutated value of the successful assignment operation based on the second inversion operation position, so as to obtain the third byte data;
[0129] The third processing subunit 60443 also converts the third byte data into data of the same data type as the attribute test value that was successfully assigned, in order to obtain the second mutated value;
[0130] The assignment unit 6042 also performs an assignment operation on the test attribute based on the second mutation value.
[0131] It is understandable that for a mutated value that has already been successfully assigned, the value obtained by mutating near the mutated byte position corresponding to that mutated value should be easier to assign successfully. 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 first byte data is subjected to a second inversion operation 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 mutated value; finally, the test attribute is assigned a value based on the second mutated value.
[0132] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the framework testing system embodiment is basically similar to the framework testing method embodiment, so the description is relatively simple; relevant parts can be referred to the description of the framework testing method embodiment.
[0133] Please see Figure 7 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this specification.
[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 can be used to realize the connection and communication of the above 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, Bluetooth modules, NFC modules, Wi-Fi modules, etc.
[0138] The processor 701 may include one or more processing cores. The processor 701 connects to various parts within the electronic device 700 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 705, and by calling data stored in the memory 705. Optionally, the processor 701 may be implemented using at least one hardware form of DSP, FPGA, or PLA. The processor 701 may integrate one or more of the following: CPU, GPU, and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 701 and may be implemented as a separate chip.
[0139] The memory 705 may include RAM or ROM. Optionally, the memory 705 may include a non-transitory computer-readable medium. The memory 705 may be used to store instructions, programs, code, 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 touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 705 may also be at least one storage device located remotely from the aforementioned processor 701. As a computer storage medium, the memory 705 may include an operating system, a network communication module, a user interface module, and a framework testing application. The processor 701 may be used to call the framework testing application stored in the memory 705 and execute the steps of the framework testing method mentioned in the foregoing embodiments.
[0140] This specification also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps in the above-described framework testing method embodiments. If the constituent modules of the above-described electronic device are implemented as 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, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as 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, all or part of the processes or functions described in the embodiments of this specification are generated. 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 or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0142] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation 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. Any modifications and improvements made by those skilled in the art to the technical solutions of this specification without departing from the spirit of this specification should fall within the protection scope defined by the claims of this specification.
Claims
1. A framework testing method, comprising: developing a test sample program in a test framework; deploying the test sample program into a container providing a running environment for running the test sample program, and running the test sample program; obtaining test attributes in the running environment during running of the test sample program; performing assignment operations on the test attributes, and obtaining a test result of the test framework according to assignment results of the test attributes; the obtaining of the test attributes in the running environment during running of the test sample program comprises: obtaining test objects in the running environment during running of the test sample program; obtaining dependency relationships between attributes in the test objects; forming all attributes in the test objects into an attribute tree based on the dependency relationships between the attributes in the test objects; traversing the attribute tree using a depth-first search algorithm to obtain attributes corresponding to each end node in the attribute tree, and then obtaining the test attributes. 2.The framework testing method of claim 1, wherein the obtaining of the dependency relationships between the attributes in the test objects comprises: obtaining the dependency relationships between the attributes in the test objects by recursively calling an attribute interface.
3. The method of claim 1, wherein traversing the attribute tree using the depth-first search algorithm to obtain the respective attributes corresponding to each of the end nodes of the attribute tree to obtain the test attributes further comprises: obtaining an attribute set comprising a plurality of preset attributes; the traversing of the attribute tree using the depth-first search algorithm to obtain the attributes corresponding to each end node in the attribute tree, and then obtaining the test attributes comprises: traversing the attribute tree using the depth-first search algorithm to obtain the attributes corresponding to each end node in the attribute tree; obtaining the test attributes based on the attribute set and the attributes corresponding to each end node in the attribute tree. 4.The framework testing method of claim 1, wherein the performing of the assignment operations on the test attributes, and the obtaining of the test result of the test framework according to the assignment results of the test attributes comprises: obtaining at least two attribute test values different from a current attribute value of the test attribute corresponding to the test attributes; performing assignment operations on the test attributes based on each attribute test value respectively to obtain assignment results of the test attributes; obtaining the test result of the test framework according to the assignment results of the test attributes. 5.The framework testing method of claim 4, further comprising, before the obtaining of the assignment results of the test attributes: performing mutation operations on the attribute test values on which the assignment operations are successful to obtain first mutation values; performing assignment operations on the test attributes based on the first mutation values. 6.The framework testing method of claim 5, wherein the performing of the mutation operations on the attribute test values on which the assignment operations are successful to obtain the first mutation values comprises: converting the attribute test values on which the assignment operations are successful into first byte data; performing a first NOT operation on values in part of byte positions in the first byte data to obtain second byte data; converting the second byte data into data of a same data type as the attribute test values on which the assignment operations are successful to obtain the first mutation values. 7.The framework testing method of claim 6, further comprising, after the performing of the assignment operations on the test attributes based on the first mutation values: obtaining a first NOT operation position corresponding to the first byte data corresponding to the first mutation values on which the assignment operations are successful. determine a second bitwise NOT operation position of the first byte data corresponding to the first mutated value of the assignment operation success based on the first bitwise NOT operation position; perform a second bitwise NOT operation on the first byte data corresponding to the first mutated value of the assignment operation success based on the second bitwise NOT operation position to obtain third byte data; convert the third byte data into data of the same data type as the attribute test value of the assignment operation success to obtain a second mutated value; perform an assignment operation on the test attribute based on the second mutated value.
8. A framework test system, comprising: a development module that develops a test sample program in a test framework; a deployment module that deploys the test sample program into a container that provides a running environment for running the test sample program and performs running; a first acquisition module that acquires a test attribute in the running environment when the test sample program is running; a test module that performs an assignment operation on the test attribute and obtains a test result of the test framework according to an assignment result of the test attribute; the first acquisition module comprises: a first acquisition unit that acquires a test object in the running environment when the test sample program is running; a second acquisition unit that acquires a dependency relationship between attributes in the test object; a first processing unit that forms all attributes in the test object into an attribute tree based on the dependency relationship between the attributes in the test object; a third acquisition unit that traverses the attribute tree by using a depth-first search algorithm to acquire attributes corresponding to each end node in the attribute tree and further acquires the test attribute.
9. The framework test system of claim 8, wherein the second acquisition unit acquires the dependency relationship between the attributes in the test object by using a recursive call attribute interface.
10. The framework test system of claim 8, further comprising: a second acquisition module that acquires an attribute set comprising a plurality of preset attributes; the third acquisition unit comprises: a first acquisition subunit that traverses the attribute tree by using a depth-first search algorithm to acquire attributes corresponding to each end node in the attribute tree; a second acquisition subunit that acquires the test attribute based on the attribute set and the attributes corresponding to each end node in the attribute tree.
11. The framework test system of claim 8, wherein the test module comprises: a fourth acquisition unit that acquires at least two attribute test values corresponding to the test attribute and different from a current attribute value of the test attribute; an assignment unit that performs an assignment operation on the test attribute based on each attribute test value to obtain an assignment result of the test attribute; a fifth acquisition unit that obtains a test result of the test framework according to the assignment result of the test attribute.
12. The framework test system of claim 11, wherein the test module further comprises: a second processing unit that performs a mutation operation on the attribute test value of the assignment operation success to obtain a first mutated value; the assignment unit further performs an assignment operation on the test attribute based on the first mutated value.
13. The framework test system of claim 12, wherein the second processing unit comprises: a first processing subunit that converts the attribute test value of the assignment operation success into first byte data; The second processing subunit performs a first NOT operation on the value of the partial byte position 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 property test value of the assignment operation success to obtain a first mutation value.
14. The framework test system of claim 13, wherein the test module further comprises: A sixth obtaining unit that obtains a first NOT operation position corresponding to the first byte data corresponding to the first mutation value of the assignment operation success; A third processing unit that determines a second NOT operation position of the first byte data corresponding to the first mutation value of the assignment operation success based on the first NOT operation position; The second processing subunit further performs a second NOT operation on the first byte data corresponding to the first mutation value of the assignment operation success based on the second NOT operation position to obtain third byte data; The third processing subunit further converts the third byte data into data of the same data type as the property test value of the assignment operation success to obtain a second mutation value; The assignment unit further performs an assignment operation on the test property based on the second mutation value.
15. An electronic device, comprising a processor and a memory; The processor is connected with the memory; The memory is configured 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 of any one of claims 1-7.
16. A computer readable storage medium having stored thereon a computer program, wherein the computer program is executed by a processor to implement the method of any one of claims 1-7.
Citation Information
Patent Citations
Program test method and system, computer system and computer readable storage medium
CN110413502A
Java Web framework-oriented data binding vulnerability automatic detection method
CN118332555A