Information Processing Method and Apparatus, Electronic Device, and Computer-Readable Storage Medium
By determining the constant information and data source information of the called program, the target test information is automatically generated, which solves the problem of high cost of manual analysis of code by testers and improves the efficiency and accuracy of automated testing.
Patent Information
- Application Number
- CN202210370987.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-08
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2042-04-08
AI Technical Summary
In the prior art, the cost of manually analyzing code by testers is too high to ensure the efficiency of writing automated test cases.
By responding to the test request, the called program and its starting position information associated with the test request are determined, the constant information and data source information of the called program are further determined, and the target test information is automatically generated.
It reduces the cost and time of manual code analysis, improves the efficiency of writing automated test cases and the accuracy of information processing.
Smart Images

Figure CN114817007B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of computer technology and finance, and more particularly, to an information processing method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the development of computer technology, the iteration speed of software products is also getting faster and faster. In order to better reduce the testing cost of software products, more and more system testers will write automated test cases for long-term functions.
[0003] In the process of implementing the concept of the present disclosure, the inventors found that there are at least the following problems in the related art: The cost of manually analyzing code by testers is too high, and the writing efficiency of automated test cases cannot be guaranteed. Summary of the Invention
[0004] In view of this, the present disclosure provides an information processing method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of the present disclosure, there is provided an information processing method, including:
[0006] In response to receiving a test request, determining, according to the test request, a called program associated with the test request and start position information of the called program corresponding to the called program, where the test request includes start position information and source code information of a program to be tested;
[0007] Determining constant information and data source information of the called program according to the called program and the start position information of the called program corresponding to the called program; and
[0008] Generating target test information according to the start position information of the program to be tested, the source code information, the start position information of the called program, the constant information, and the data source information.
[0009] According to an embodiment of the present disclosure, where determining the constant information and data source information of the called program according to the called program and the start position information of the called program corresponding to the called program includes:
[0010] Determining constant name information and data source name information according to the called program and the start position information of the called program; and
[0011] Determining the constant information and data source information according to the constant name information and the data source name information.
[0012] According to an embodiment of the present disclosure, wherein determining the constant name information and the data source name information according to the called program and the starting position information of the called program includes:
[0013] When it is detected that the called program includes a constant, determining the constant name information; and
[0014] When it is detected that the called program includes a preset keyword, processing the called program to obtain the data source name information.
[0015] According to an embodiment of the present disclosure, wherein determining the constant information and the data source information according to the constant name information and the data source name information includes:
[0016] Determining the constant information according to the constant name information, wherein the constant information includes a constant value corresponding to the constant name information; and
[0017] Determining the data source information according to the data source name information, wherein the data source information includes at least one of address information, port number information, identifier information, user name information, and password information corresponding to the data source name information.
[0018] According to an embodiment of the present disclosure, wherein generating target test information according to the starting position information of the program to be tested, the source code information, the starting position information of the called program, the constant information, and the data source information includes:
[0019] Processing the constant information and the data source information to obtain processed constant information and data source information; and
[0020] Determining the target test information according to the starting position information of the program to be tested, the source code information, the starting position information of the called program, the processed constant information, and the data source information.
[0021] According to an embodiment of the present disclosure, wherein in response to receiving a test request, determining the called program associated with the test request and the starting position information of the called program corresponding to the called program includes:
[0022] Performing disassembly processing on the source code information to obtain processed source code information; and
[0023] Determining the called program associated with the source code information and the starting position information of the called program according to the starting position information of the program to be tested and the processed source code information.
[0024] According to another aspect of the present disclosure, there is provided an information processing apparatus, including:
[0025] A first determination module, configured to, in response to receiving a test request, determine a called program associated with the test request and start position information of the called program corresponding to the called program according to the test request, where the test request includes start position information and source code information of a program to be tested;
[0026] A second determination module, configured to determine constant information and data source information of the called program according to the called program and the start position information of the called program corresponding to the called program; and
[0027] A generation module, configured to generate target test information according to the start position information of the program to be tested, the source code information, the start position information of the called program, the constant information, and the data source information.
[0028] According to another aspect of the present disclosure, there is provided an electronic device, including:
[0029] One or more processors;
[0030] A memory, configured to store one or more instructions,
[0031] wherein, when the one or more instructions are executed by the one or more processors, the one or more processors are caused to implement the method as described above.
[0032] According to another aspect of the present disclosure, there is provided a computer-readable storage medium, on which executable instructions are stored, and when the executable instructions are executed by a processor, the processor is caused to implement the method as described above.
[0033] According to another aspect of the present disclosure, there is provided a computer program product, where the computer program product includes computer-executable instructions, and the computer-executable instructions are used to implement the method as described above when executed.
[0034] According to an embodiment of the present disclosure, in the case of receiving a test request, constant information and data source information of a called program are determined according to the called program associated with the test request and the start position information of the called program, and target test information is generated. By the above technical means, since the target test information can be automatically generated according to the start position information and source code information of the program to be tested provided by a tester, at least partially, the technical problem in the related art that the cost of manual code analysis by the tester is too high and the writing efficiency of automated test cases cannot be guaranteed is overcome, the participation of manual labor is reduced, the time for generating the target test information is saved, and thus the efficiency and accuracy of information processing are improved. Description of the Drawings
[0035] Through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, the above and other objects, features, and advantages of the present disclosure will become clearer. In the drawings:
[0036] Figure 1 Schematically shows a system architecture to which an information processing method according to an embodiment of the present disclosure can be applied;
[0037] Figure 2 Schematically shows a flowchart of an information processing method according to an embodiment of the present disclosure;
[0038] Figure 3 Schematically shows a flowchart of a method for determining a called program and start position information of the called program according to an embodiment of the present disclosure;
[0039] Figure 4 Schematically shows a flowchart of a method for determining constant name information and data source name information according to an embodiment of the present disclosure;
[0040] Figure 5 Schematically shows a flowchart of a method for determining constant information and data source information according to an embodiment of the present disclosure;
[0041] Figure 6 Schematically shows an example diagram of an information processing method according to an embodiment of the present disclosure;
[0042] Figure 7 Schematically shows a block diagram of an information processing apparatus according to an embodiment of the present disclosure; and
[0043] Figure 8 Schematically shows a block diagram of an electronic device suitable for implementing an information processing method according to an embodiment of the present disclosure. Detailed Description of the Embodiments
[0044] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, obviously, one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present disclosure.
[0045] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0046] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0047] In cases where expressions similar to "at least one of A, B, and C, etc." are used, generally, it should be interpreted according to the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include, but not be limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.). In cases where expressions similar to "at least one of A, B, or C, etc." are used, generally, it should be interpreted according to the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include, but not be limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0048] In the technical solutions of the present disclosure, the acquisition, storage, and application of the user's personal information involved, etc., all comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good customs.
[0049] In the technical solutions of the present disclosure, before obtaining or collecting the user's personal information, the authorization or consent of the user has been obtained.
[0050] With the development of computer technology, the iteration speed of software products is also getting faster and faster. In order to better reduce the testing cost of software products, more and more system testers will write automated test cases for long-term functions and execute these cases regularly to ensure that the new functions will not affect the existing functions that have not been modified in the current software version.
[0051] For the old code of the existing functions, in the premise of lacking software requirement documents, such functions pose a great obstacle to testers in writing automation. Taking the acquisition of database information as an example, currently, testers first have to directly obtain the developed source code, analyze the program code for the existing functions, find the corresponding database configuration, and then can perform operations such as writing automated cases, preparing and restoring test data, and writing assertions.
[0052] In the process of implementing the concept of the present disclosure, the inventors found that there are at least the following problems in the related technologies: The cost of manually analyzing the code by testers is too high, and the writing efficiency of automated test cases cannot be guaranteed.
[0053] To at least partially solve the technical problems existing in the related art, the present disclosure provides an information processing method and apparatus, an electronic device, and a computer-readable storage medium, which can be applied to the fields of computer technology and finance. The information processing method includes: in response to receiving a test request, determining, according to the test request, a called program associated with the test request and start position information of the called program corresponding to the called program, where the test request includes start position information and source code information of a program to be tested; determining constant information and data source information of the called program according to the called program and the start position information of the called program corresponding to the called program; and generating target test information according to the start position information, source code information, start position information of the called program, constant information, and data source information of the program to be tested.
[0054] It should be noted that the information processing method and apparatus provided in the embodiments of the present disclosure can be used in the fields of computer technology and finance, such as network maintenance in each bank branch. The information processing method and apparatus provided in the embodiments of the present disclosure can also be used in any field other than the fields of computer technology and finance, such as software testing. The application fields of the information processing method and apparatus provided in the embodiments of the present disclosure are not limited.
[0055] Figure 1 Schematically shows a system architecture to which the information processing method according to an embodiment of the present disclosure can be applied. It should be noted that Figure 1 The shown is only an example of a system architecture to which the embodiments of the present disclosure can be applied, to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0056] As Figure 1 shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0057] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only as examples).
[0058] The terminal devices 101, 102, and 103 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, laptop portable computers, desktop computers, and so on.
[0059] The server 105 can be a server that provides various services. For example, it can be a background management server (only for example) that supports the websites browsed by users using the terminal devices 101, 102, and 103. The background management server can analyze and process data such as user requests received, and feedback the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0060] It should be noted that the information processing method provided by the embodiments of the present disclosure can generally be executed by the server 105. Correspondingly, the information processing device provided by the embodiments of the present disclosure can generally be set in the server 105. The information processing method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Correspondingly, the information processing device provided by the embodiments of the present disclosure can also be set in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Or, the information processing method provided by the embodiments of the present disclosure can also be executed by the terminal devices 101, 102, or 103, or can also be executed by other terminal devices different from the terminal devices 101, 102, or 103. Correspondingly, the information processing device provided by the embodiments of the present disclosure can also be set in the terminal devices 101, 102, or 103, or set in other terminal devices different from the terminal devices 101, 102, or 103.
[0061] For example, the constant information and data source information can originally be stored in any one of the terminal devices 101, 102, or 103 (for example, the terminal device 101, but not limited to this), or stored on an external storage device and can be imported into the terminal device 101. Then, the terminal device 101 can execute the information processing method provided by the embodiments of the present disclosure locally, or send the constant information and data source information to other terminal devices, servers, or server clusters, and the other terminal devices, servers, or server clusters that receive the constant information and data source information execute the information processing method provided by the embodiments of the present disclosure.
[0062] It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in
[0063] Figure 2 Schematically shows a flowchart of an information processing method according to an embodiment of the present disclosure.
[0064] As Figure 2 shown, the information processing method includes operations S210 to S230.
[0065] In operation S210, in response to receiving a test request, according to the test request, determine a called program associated with the test request and start position information of the called program corresponding to the called program, wherein the test request includes start position information and source code information of a program to be tested.
[0066] In operation S220, according to the called program and the start position information of the called program corresponding to the called program, determine constant information and data source information of the called program.
[0067] In operation S230, generate target test information according to the start position information, source code information, start position information of the called program, constant information, and data source information of the program to be tested.
[0068] According to an embodiment of the present disclosure, the test request may include a request message sent by a tester to a server through a client. The test request may include a request method, a URL (Uniform Resource Locator), a protocol version, a request header, request data, and the like.
[0069] According to an embodiment of the present disclosure, for example, a tester may input the start position information and source code information of a program to be tested on a client and initiate a test request for the program to be tested to the server.
[0070] According to an embodiment of the present disclosure, the source code information may be used to characterize the program code of the program to be tested. The start position information of the program to be tested may be used to characterize the program entry position of the program to be tested, that is, the position where the program to be tested starts to execute. The start position information of the called program may be used to characterize the program entry position of the called program, that is, the position where the called program starts to execute.
[0071] According to an embodiment of the present disclosure, the constant information may include information that will not be modified by the program during program operation. The data source information may provide the position of data required by the program and ensure the specifications and protocols for the interaction between the program and the data.
[0072] According to an embodiment of the present disclosure, the target test information may be used to test the program to be tested to check whether the program to be tested meets the specified requirements or determine the difference between the expected result and the actual result.
[0073] According to an embodiment of the present disclosure, in the case of receiving a test request, according to the called program associated with the test request and the starting position information of the called program, the constant information and data source information of the called program are determined, and target test information is generated. By the above technical means, since the target test information can be automatically generated according to the starting position information and source code information of the program to be tested provided by the tester, it at least partially overcomes the technical problem in the related art that the cost of manually analyzing the code by the tester is too high and the writing efficiency of automated test cases cannot be guaranteed, reduces the manual participation, saves the time for generating the target test information, and thus improves the efficiency and accuracy of information processing.
[0074] The following refers to Figures 3 to 6 , and further illustrates the Figure 2 method shown in combination with specific embodiments.
[0075] Figure 3 FIG. schematically shows a flowchart of a method for determining a called program and the starting position information of the called program according to an embodiment of the present disclosure.
[0076] According to an embodiment of the present disclosure, in one example, operation S210 may include the following operations.
[0077] Perform disassembly processing on the source code information to obtain the processed source code information. According to the starting position information of the program to be tested and the processed source code information, determine the called program associated with the source code information and the starting position information of the called program.
[0078] According to an embodiment of the present disclosure, in one example, as Figure 3 shown, in operation S311, the starting position information and source code information of the program to be tested can be obtained.
[0079] In operation S312, disassembly processing can be performed on the source code information to obtain the processed source code information.
[0080] In operation S313, according to the processed source code information, the starting position information of the called program can be determined.
[0081] In operation S314, it can be determined whether there is a jump in the called program.
[0082] In the case where it is determined that the called program has a jump, operation S315 can be executed to determine the called program.
[0083] In the case where it is determined that the called program does not have a jump, or after operation S315 is executed, operation S316 can be executed to determine whether the call of the program to be tested ends.
[0084] When it is determined that the call of the program to be tested has not ended, the operations S313 to S316 can be iteratively executed continuously.
[0085] When it is determined that the call of the program to be tested has ended, the called program and the starting position information of the called program can be determined.
[0086] According to an embodiment of the present disclosure, disassembly processing can also be referred to as computer software reverse engineering, and can include reverse analysis and research work on the target program of the software to deduce design elements such as the ideas, principles, structures, algorithms, processing processes, and running methods used in the software product. Disassembly processing can be performed by a method combining static and dynamic debugging.
[0087] According to an embodiment of the present disclosure, the processed source code information can be stored in a specified register of the machine in a preset format. For example, the preset format can include fixedly reserving the first four bytes, specifying the middle eight bytes as the version number of the current programming language, and using the last eight bytes to store program constants, etc. The specific content of the preset format can be set by those skilled in the art according to actual needs, and different programming languages can adapt to the corresponding preset format. The present disclosure embodiment does not limit the specific content of the preset format.
[0088] According to an embodiment of the present disclosure, fixed fields can be used in the processed source code information to represent operations such as program jumps, judgments, and the end of the current program function. For example, the field "jump" can be used to represent the starting position information of the called program called in the program to be tested.
[0089] According to an embodiment of the present disclosure, the starting position information of at least one called program can be determined in the processed source code information according to the position of the field "jump", and each starting position information of the called program can be used as a starting point to analyze the called program.
[0090] According to an embodiment of the present disclosure, the program call relationship can be determined according to the starting position information of the program to be tested, the source code information, the called program, and the starting position information of the called program.
[0091] According to an embodiment of the present disclosure, by performing disassembly processing on the source code information, the called program and the starting position information of the called program associated with the source code information can be determined, and then the target test information can be further automatically generated according to the program call relationship, improving the efficiency and accuracy of generating the target test information.
[0092] According to an embodiment of the present disclosure, the operation S220 can include the following operations.
[0093] Determine the constant name information and data source name information according to the called program and the starting position information of the called program. Determine the constant information and data source information according to the constant name information and data source name information.
[0094] According to an embodiment of the present disclosure, constants may include character constants, date constants, logical constants, currency constants, and symbolic constants. The constant name information can be custom-set by relevant personnel when writing the program.
[0095] According to an embodiment of the present disclosure, the data source name information can be custom-set by relevant personnel when writing the program according to information such as the database driver information, database storage location, and database name.
[0096] According to an embodiment of the present disclosure, the constant information may include the specific content corresponding to the constant name information. The data source information may include the specific content corresponding to the data source name information.
[0097] Figure 4 Schematically shows a flowchart of a method for determining constant name information and data source name information according to an embodiment of the present disclosure.
[0098] According to an embodiment of the present disclosure, in one example, determining the constant name information and data source name information according to the called program and the starting position information of the called program may include the following operations.
[0099] When it is detected that the called program includes a constant, determine the constant name information. When it is detected that the called program includes a preset keyword, process the called program to obtain the data source name information.
[0100] According to an embodiment of the present disclosure, in one example, as Figure 4 shown, in operation S421, the called program and the starting position information of the called program can be determined.
[0101] In operation S422, it can be determined whether there is a constant in the called program.
[0102] When it is determined that there is a constant in the called program, operation S423 can be executed to determine the constant name information.
[0103] When it is determined that there is no constant in the called program or when operation S423 is completed, operation S424 can be executed to determine whether there is a preset keyword in the called program.
[0104] When it is determined that there is a preset keyword in the called program, operation S425 can be executed to process the called program to obtain the data source name information.
[0105] When it is determined that the called program does not have a preset keyword or when the operation S425 is completed, the operation S426 can be executed to determine whether there are other called programs.
[0106] When it is determined that there are other called programs, the operations S421 to S426 can be iteratively executed continuously.
[0107] When it is determined that there are no other called programs, the constant name information and the data source name information can be determined.
[0108] According to an embodiment of the present disclosure, at least one called program can be analyzed according to the program call relationship so as to obtain the actually called constant name information and data source name information.
[0109] According to an embodiment of the present disclosure, it can be determined whether it is a call for database operation. For example, it can be determined according to a preset keyword for characterizing database operation. If it is determined that the called program involves database operation, the annotation of the called program can be parsed to record the referenced data source name information. The preset keyword can be set by those skilled in the art according to actual needs. For example, it can include select, insert, etc. The present disclosure embodiment does not limit the specific content of the preset keyword.
[0110] According to an embodiment of the present disclosure, when it is detected that the called program includes a constant, the constant name information can be determined. When it is detected that the called program includes a preset keyword, the called program can be processed to obtain the data source name information. Through the above technical means, the call chain including the starting position information of the program to be tested, the source code information, the called program, and the starting position information of the called program can be further analyzed, so as to subsequently determine the actually used constant information and data source information according to the constant name information and data source name information used by each called program, improving the efficiency of information processing.
[0111] Figure 5 Schematically shows a flowchart of a method for determining constant information and data source information according to an embodiment of the present disclosure.
[0112] According to an embodiment of the present disclosure, in one example, determining the constant information and the data source information according to the constant name information and the data source name information may include the following operations.
[0113] Determine the constant information according to the constant name information, where the constant information includes the constant value corresponding to the constant name information. Determine the data source information according to the data source name information, where the data source information includes at least one of address information, port number information, identifier information, user name information, and password information corresponding to the data source name information.
[0114] According to an embodiment of the present disclosure, in one example, as Figure 5 shown, in operation S521, a configuration file can be determined.
[0115] In operation S522, the configuration file can be parsed to obtain data source configuration information and constant configuration information.
[0116] In operation S523, according to the starting position information of the called program, the constant information of the called program can be determined.
[0117] In operation S524, according to the starting position information of the called program, the data source information of the called program can be determined.
[0118] In operation S525, it can be waited for whether the call of the program to be tested ends.
[0119] According to an embodiment of the present disclosure, by analyzing the configuration file of the called program, the actually configured constant information and data source information can be matched one by one with the constant name information and data source name information. The corresponding constant name information and constant information, data source name information and data source information can be recorded in the form of a list.
[0120] According to an embodiment of the present disclosure, by calculating the similarity between the constant name information of the called program and the constant name information in the configuration file, the constant information that matches the constant name information of the called program can be determined.
[0121] According to an embodiment of the present disclosure, by using a similarity calculation method and a similarity detection algorithm, the similarity between the data source name information of the called program and the data source name information in the configuration file can be calculated to determine the data source information that matches the data source name information of the called program.
[0122] According to an embodiment of the present disclosure, the similarity calculation method can include cosine similarity, minimum edit distance, Euclidean distance, Jaccard correlation coefficient, Pearson correlation coefficient, Hamming distance, etc. The similarity detection algorithm can include TF-IDF (Term Frequency-Inverse Document Frequency) algorithm, BM25 algorithm, Simhash algorithm, LSI (Latent Semantic Indexing) model, DSSM (Deep Structured Semantic Models), ConvNet based on convolutional neural network, and LSTM (Long Short-Term Memory) artificial neural network, etc.
[0123] According to an embodiment of the present disclosure, the identifier information may include the names used by a user during programming, which are used to name variables, constants, functions, statement blocks, etc., so as to establish a relationship between the names and their uses. The identifier information may include letters, numbers, and other characters.
[0124] According to an embodiment of the present disclosure, by determining the constant information and data source information based on the constant name information and data source name information, the actual called program and the system data source information and constant values associated with the called program can be obtained based on the configuration file, reducing manual participation, thereby improving the accuracy of generating the target test information.
[0125] According to an embodiment of the present disclosure, operation S230 may include the following operations.
[0126] Process the constant information and data source information to obtain the processed constant information and data source information. Determine the target test information based on the starting position information of the program to be tested, the source code information, the starting position information of the called program, the processed constant information, and the data source information.
[0127] According to an embodiment of the present disclosure, the constant information and data source information can be integrated and formatted, and the determined target test information can be provided to the tester to facilitate the tester's configuration and writing operations for automated testing of the existing program code.
[0128] According to an embodiment of the present disclosure, by based on the starting position information of the program to be tested, the source code information, the starting position information of the called program, the processed constant information, and the data source information, the target test information can be automatically determined, so that the tester can test the program to be tested according to the target test information, thereby improving the efficiency and accuracy of program testing.
[0129] Figure 6 An example schematic diagram of an information processing method according to an embodiment of the present disclosure is schematically shown.
[0130] As Figure 6 shown, the tester can input the program 601 to be tested, and the program 601 to be tested may include the starting position information and source code information of the program 601 to be tested.
[0131] The source code information of the program 601 to be tested can be disassembled, and the call relationship including the called program associated with the program 601 to be tested and the starting position information of the called program can be recorded in the call chain. For example, the called programs in the call chain may include called program 602_1, called program 602_2, called program 602_3, …, called program 602_n, …, and called program 602_N.
[0132] Each called program in the call chain can be analyzed cyclically to determine the constant name information of each called program, and the constant name information can include at least one constant name. The injection code of the corresponding data source can be found according to the database keyword to determine the data source name information, and the data source name information can include at least one data source name information. For example, the constant name information 603_21 and the data source name information 603_22 of the called program 602_2 can be determined, and the constant name information 603_31 and the data source name information 603_32 of the called program 602_3 can be determined. The constant name information 603_21 can include constant names 603_211, 603_212, …, 603_21p, …, and 603_21P. The data source name information 603_22 can include data source names 603_221, 603_222, …, 603_21q, …, and 603_21Q.
[0133] The system configuration file can be analyzed to determine the constant information corresponding to the constant name information and the data source information corresponding to the data source name information. For example, the constant value 604_211 corresponding to the constant name 603_211, the constant value 604_212 corresponding to the constant name 603_212, …, the constant value 604_21p corresponding to the constant name 603_21p, …, and the constant value 604_21P corresponding to the constant name 603_21P can be determined. The address information 603_2211, the port number information 603_2212, the identifier information 603_2213, the user name information 603_2214, and the password information 603_2215 corresponding to the data source name 603_221 can be determined.
[0134] The constant value, address information, port number information, identifier information, user name information, and password information referred to by each called program can be integrated and formatted for testers to perform automated code testing.
[0135] Figure 7 A block diagram of an information processing apparatus according to an embodiment of the present disclosure is schematically shown.
[0136] As Figure 7 shown, the information processing apparatus 700 includes a first determination module 701, a second determination module 702, and a generation module 703.
[0137] The first determination module 701 is configured to, in response to receiving a test request, determine a called program associated with the test request and starting position information of the called program corresponding to the called program according to the test request, where the test request includes starting position information and source code information of a program to be tested.
[0138] The second determination module 702 is configured to determine constant information and data source information of the called program according to the called program and the starting position information of the called program corresponding to the called program.
[0139] The generation module 703 is configured to generate target test information according to the starting position information of the program to be tested, the source code information, the starting position information of the called program, the constant information, and the data source information.
[0140] According to an embodiment of the present disclosure, the second determination module 702 includes a first determination unit and a second determination unit.
[0141] The first determination unit is configured to determine constant name information and data source name information according to the called program and the starting position information of the called program.
[0142] The second determination unit is configured to determine constant information and data source information according to the constant name information and the data source name information.
[0143] According to an embodiment of the present disclosure, the first determination unit includes a first determination subunit and a first processing subunit.
[0144] The first determination subunit is configured to determine constant name information when it is detected that the called program includes a constant.
[0145] The first processing subunit is configured to process the called program to obtain data source name information when it is detected that the called program includes a preset keyword.
[0146] According to an embodiment of the present disclosure, the second determination unit includes a second determination subunit and a third determination subunit.
[0147] The second determination subunit is configured to determine constant information according to the constant name information, where the constant information includes a constant value corresponding to the constant name information.
[0148] The third determination subunit is configured to determine data source information according to the data source name information, where the data source information includes at least one of address information, port number information, identifier information, user name information, and password information corresponding to the data source name information.
[0149] According to an embodiment of the present disclosure, the generation module 703 includes a processing unit and a third determination unit.
[0150] A processing unit for processing constant information and data source information to obtain processed constant information and data source information.
[0151] A third determination unit for determining target test information according to the start position information of the program to be tested, source code information, start position information of the called program, processed constant information, and data source information.
[0152] According to an embodiment of the present disclosure, the first determination module 701 includes a second processing subunit and a fourth determination subunit.
[0153] The second processing subunit is configured to perform disassembly processing on the source code information to obtain processed source code information.
[0154] The fourth determination subunit is configured to determine the called program associated with the source code information and the start position information of the called program according to the start position information of the program to be tested and the processed source code information.
[0155] According to an embodiment of the present disclosure, any multiple of the modules, sub-modules, units, and sub-units, or at least part of the functions of any of them can be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure can be split into multiple modules for implementation. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on a substrate, a system in a package, an application specific integrated circuit (ASIC), or can be implemented by any other reasonable way of integrating or packaging circuits in hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure can be at least partially implemented as a computer program module, and when the computer program module runs, it can execute the corresponding functions.
[0156] For example, any combination of the first determination module 701, the second determination module 702, and the generation module 703 may be combined and implemented in one module / unit / sub-unit, or any one of the modules / units / sub-units may be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units may be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the first determination module 701, the second determination module 702, and the generation module 703 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable manner of integrating or packaging circuits, etc., implemented by hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in any appropriate combination of several of them. Alternatively, at least one of the first determination module 701, the second determination module 702, and the generation module 703 may be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding functions may be executed.
[0157] It should be noted that the information processing device part in the embodiments of the present disclosure corresponds to the information processing method part in the embodiments of the present disclosure. For the description of the information processing device part, please refer to the information processing method part for details, and will not be elaborated here.
[0158] Figure 8 A block diagram of an electronic device suitable for implementing the information processing method according to an embodiment of the present disclosure is schematically shown. Figure 8 The shown electronic device is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.
[0159] As Figure 8 shown, the computer electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to the program stored in the read only memory (ROM) 802 or the program loaded from the storage section 808 into the random access memory (RAM) 803. The processor 801 may include, for example, a general microprocessor (such as a CPU), an instruction set processor and / or a related chipset, and / or a dedicated microprocessor (such as an application specific integrated circuit (ASIC)), etc. The processor 801 may also include on-board memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0160] In the RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. The processor 801 performs various operations of the method flow according to the embodiments of the present disclosure by executing the programs in the ROM 802 and / or the RAM 803. It should be noted that the programs may also be stored in one or more memories other than the ROM 802 and the RAM 803. The processor 801 may also perform various operations of the method flow according to the embodiments of the present disclosure by executing the programs stored in the one or more memories.
[0161] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, and the input / output (I / O) interface 805 is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the I / O interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read from it can be installed into the storage portion 808 as needed.
[0162] According to an embodiment of the present disclosure, the method flow according to the embodiments of the present disclosure may be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a computer-readable storage medium, and the computer program includes program codes for performing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above-described functions defined in the system according to the embodiments of the present disclosure are performed. According to an embodiment of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. may be implemented by computer program modules.
[0163] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.
[0164] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0165] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include one or more memories other than the above-described ROM 802 and / or RAM 803 and / or ROM 802 and RAM 803.
[0166] An embodiment of the present disclosure also includes a computer program product, which includes a computer program that contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to cause the electronic device to implement the information processing method provided by the embodiment of the present disclosure.
[0167] When the computer program is executed by the processor 801, the above functions defined in the system / apparatus of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the above-described systems, apparatuses, modules, units, etc. may be implemented by computer program modules.
[0168] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 809, and / or installed from the removable medium 811. The program code included in the computer program may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0169] According to embodiments of the present disclosure, program code for executing the computer programs provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, such as Java, C++, Python, the "C" language, or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., by using an Internet service provider to connect through the Internet).
[0170] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions. Those skilled in the art can understand that the features recited in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly recited in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features recited in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.
[0171] The above describes the embodiments of the present disclosure. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications should fall within the scope of the present disclosure.
Claims
1. An information processing method, comprising: In response to receiving a test request, according to the test request, determine a called program associated with the test request and start position information of the called program corresponding to the called program, wherein the test request includes start position information and source code information of a program to be tested; Determine constant name information and data source name information according to the called program and the start position information of the called program; Determine constant information and data source information according to the constant name information and the data source name information; and Generate target test information according to the start position information of the program to be tested, the source code information, the start position information of the called program, the constant information and the data source information; The determining the constant name information and the data source name information according to the called program and the start position information of the called program includes: When it is detected that the called program includes a constant, determine the constant name information; and When it is detected that the called program includes a preset keyword, process the called program to obtain the data source name information.
2. The method according to claim 1, wherein, The determining the constant information and the data source information according to the constant name information and the data source name information includes: Determine the constant information according to the constant name information, wherein the constant information includes a constant value corresponding to the constant name information; and Determine the data source information according to the data source name information, wherein the data source information includes at least one of address information, port number information, identifier information, user name information and password information corresponding to the data source name information.
3. The method according to claim 2, wherein, The generating the target test information according to the start position information of the program to be tested, the source code information, the start position information of the called program, the constant information and the data source information includes: Process the constant information and the data source information to obtain processed constant information and data source information; and Determine the target test information according to the start position information of the program to be tested, the source code information, the start position information of the called program, the processed constant information and the data source information.
4. The method according to any one of claims 1 to 3, wherein, The responding to receiving a test request and determining a called program associated with the test request and start position information of the called program corresponding to the called program according to the test request includes: Perform disassembly processing on the source code information to obtain processed source code information; and Determine the called program associated with the source code information and the start position information of the called program according to the start position information of the program to be tested and the processed source code information.
5. An information processing apparatus, comprising: A first determination module, configured to, in response to receiving a test request, determine a called program associated with the test request and start position information of the called program corresponding to the called program according to the test request, wherein the test request includes start position information and source code information of a program to be tested; A first determination unit, configured to determine constant name information and data source name information according to the called program and the starting position information of the called program; A second determination unit, configured to determine constant information and data source information according to the constant name information and the data source name information; and A generation module, configured to generate target test information according to the starting position information of the program to be tested, the source code information, the starting position information of the called program, the constant information, and the data source information; The first determination unit includes: a first determination subunit, configured to determine the constant name information when it is detected that the called program includes a constant; a first processing subunit, configured to process the called program to obtain the data source name information when it is detected that the called program includes a preset keyword.
6. An electronic device, comprising: One or more processors; A memory, configured to store one or more instructions, wherein, when the one or more instructions are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, on which executable instructions are stored, and when the executable instructions are executed by a processor, the processor is caused to implement the method according to any one of claims 1 to 4.
8. A computer program product, the computer program product comprising computer-executable instructions, and the computer-executable instructions are used to implement the method according to any one of claims 1 to 4 when being executed.
Citation Information
Patent Citations
Data processing method and device
CN111381879A
Interface testing method and device, storage medium and electronic equipment
CN113326184A