CN111581076A - System code testing method and device, computer equipment and storage medium - Google Patents
System code testing method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN111581076A CN111581076A CN202010238723.0A CN202010238723A CN111581076A CN 111581076 A CN111581076 A CN 111581076A CN 202010238723 A CN202010238723 A CN 202010238723A CN 111581076 A CN111581076 A CN 111581076A
- Authority
- CN
- China
- Prior art keywords
- code
- tested
- test node
- test
- execution
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3628—Software debugging of optimised code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a method, a device, computer equipment and a storage medium for testing system codes, wherein in the execution of the method, all execution codes of a system to be tested are firstly read to obtain data such as code addresses, interface information, designated parameters and the like corresponding to functions to be tested, so that test components for testing the functions to be tested are obtained, the topological relation of the test components is sorted according to the operation logic of the execution codes of the system to be tested, and then the execution codes of the system to be tested are tested according to the corresponding topological relation. The method and the device can complete the test of a plurality of functional items in the whole system to be tested at one time, and greatly improve the test efficiency of the execution code of the system to be tested.
Description
Technical Field
The present application relates to the field of code testing, and in particular, to a method and an apparatus for testing system code, a computer device, and a storage medium.
Background
In the software development life cycle, testing is a very necessary process, and because testing is an important ring for ensuring that functions of a system are available after the system is online, the system is easy to use and does not have production problems, how to ensure the accuracy and the efficiency of testing is very important.
At present, two methods are generally used for improving the testing efficiency and accuracy, wherein firstly, the method is completed by collecting and replaying operations, namely, the operations needed to be done when clicking on a webpage for testing are recorded by a recording operation method, and the next time, the automatic operation can be completed by replaying, so that the manual time is saved; and secondly, calling the interface by writing a test script or program, checking whether the return value is the same as the predefined value or not, and if so, determining that the test is passed. Both of these approaches may work well for simple page testing or interface testing, but are not satisfactory for complex systems. In the two modes, the test can only be performed on a single point basically, and the test of the whole functional item cannot be completed. Therefore, it is an urgent need to provide a testing method capable of completing the whole functional items.
Disclosure of Invention
The application mainly aims to provide a method and a device for testing system codes, computer equipment and a storage medium, and aims to solve the problem that the prior art cannot automatically test all functions in the whole system at one time.
In order to achieve the above object, the present application provides a method for testing a system code, including:
scanning an execution code of a system to be tested, and reading a code address, interface information and designated parameters corresponding to each function to be tested;
acquiring a test node component corresponding to each function to be tested according to a code address, interface information and designated parameters corresponding to each function to be tested, wherein the test node component is a script component for testing one function in the system to be tested;
acquiring the operation logic of the execution code, and establishing the topological relation of each test node assembly according to the operation logic of the execution code;
and executing each test node assembly according to the topological relation to finish the test of the system to be tested.
Further, the step of obtaining the test node assemblies corresponding to the functions to be tested according to the code addresses, the interface information and the designated parameters corresponding to the functions to be tested includes:
searching a preset first test node component corresponding to the code address, the interface information and the designated parameter corresponding to each function to be tested in a preset test node component library; the test node database is provided with an information table and a plurality of test node assemblies with different test functions, the information table is listed with mapping information of code addresses, interface information and designated parameters of the corresponding test node assemblies, and each mapping information is associated with one corresponding test node assembly;
calling each searched first test node assembly; and the number of the first and second groups,
inserting the rest other code addresses, interface information and designated parameters which are not found out from the first test node assembly into a plurality of codes which are written in advance and packaged into assemblies to obtain a plurality of second test node assemblies, wherein filling gaps which need to be filled are reserved in the codes which are written in advance and packaged into the assemblies, the filling gaps are used for filling the code addresses, the interface information and the designated parameters, and after the code addresses, the interface information and the designated parameters are inserted into the corresponding filling gaps, the test node assemblies for testing a certain function are formed; and the first test node assembly and the second test node assemblies are the test node assemblies.
Further, after the step of inserting the remaining other code addresses, interface information, and specified parameters that are not found in the first test node assembly into a plurality of codes written in advance and encapsulated into an assembly to obtain a plurality of second test node assemblies, the method includes:
storing the second test node component in the test node component library.
Further, after the step of executing each of the test node assemblies according to the topological relation and completing the test of the system to be tested, the method further includes:
generating a visual topological graph corresponding to the topological relation;
and displaying the test result of each node on each node of the visual topological graph.
Further, the step of scanning the execution code of the system to be tested and reading the code address, the interface information and the designated parameter corresponding to each function to be tested includes:
searching a preset marker in the execution code, wherein the marker is a marker written when a developer develops the execution code;
and extracting information corresponding to the marker, wherein the information is the code address, the interface information and the designated parameter.
Further, the step of extracting the information corresponding to the marker includes:
judging the type of the marker, wherein the type comprises an address marker corresponding to the code address, an interface marker corresponding to the interface information and a parameter marker corresponding to the specified parameter;
and calling a corresponding extraction rule according to the type of the marker, and reading to obtain information corresponding to the marker.
Further, the step of obtaining the operation logic of the execution code and establishing the topological relation of each test node component according to the operation logic of the execution code includes:
reading code serial numbers corresponding to all functions in the execution code and secondary code serial numbers pointed by the code serial numbers, wherein the code serial numbers and the secondary code serial numbers are serial numbers written by a developer when the execution code is developed, the secondary code serial numbers are code serial numbers of codes corresponding to the next one or more functions to be tested after the function test corresponding to the code serial numbers is finished, and the number of the secondary code serial numbers comprises one or more;
determining the running logic of the execution code according to the code sequence number and the secondary code sequence number;
and establishing the topological relation of each test node component according to the operation logic.
The present application further provides a system code testing apparatus, including:
the scanning and reading unit is used for scanning the execution codes of the system to be tested and reading the code address, the interface information and the designated parameters corresponding to each function to be tested;
the system comprises an acquisition component unit, a test node component unit and a test module unit, wherein the acquisition component unit is used for acquiring a test node component corresponding to each function to be tested according to a code address, interface information and designated parameters corresponding to each function to be tested, and the test node component is a script component used for testing one function in the system to be tested;
the topology establishing unit is used for acquiring the operation logic of the execution code and establishing the topology relation of each test node assembly according to the operation logic of the execution code;
and the execution testing unit is used for executing each testing node component according to the topological relation so as to finish the test of the system to be tested.
The present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method of any of the above.
According to the system code testing method, the system code testing device, the computer equipment and the storage medium, all execution codes of a system to be tested are firstly read, data such as code addresses, interface information and designated parameters corresponding to functions to be tested are obtained, further, testing components for testing the functions to be tested are obtained, topological relations of the testing components are sorted according to the operation logic of the execution codes of the system to be tested, and then the execution codes of the system to be tested are tested according to the corresponding topological relations. The method and the device can complete the test of a plurality of functional items in the whole system to be tested at one time, and greatly improve the test efficiency of the execution code of the system to be tested.
Drawings
FIG. 1 is a flowchart illustrating a method for testing system code according to an embodiment of the present application;
FIG. 2 is a block diagram illustrating a system code testing apparatus according to an embodiment of the present application;
FIG. 3 is a block diagram illustrating a computer device according to an embodiment of the present invention.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, an embodiment of the present application provides a method for testing a system code, including the steps of:
s1, scanning the execution code of the system to be tested, and reading the code address, the interface information and the designated parameter corresponding to each function to be tested;
s2, obtaining a test node component corresponding to each function to be tested according to the code address, the interface information and the designated parameters corresponding to each function to be tested, wherein the test node component is a script component used for testing one function in the system to be tested;
s3, acquiring the operation logic of the execution code, and establishing the topological relation of each test node assembly according to the operation logic of the execution code;
and S4, executing each test node assembly according to the topological relation, and completing the test of the system to be tested.
In this embodiment, the execution code is a code written by a developer when developing a test system, and can be written into codes with different formats according to different requirements or operating systems, for example, the android system and the apple system have the same function corresponding to the execution code, but have different languages for writing the execution code. One set of execution codes comprises different codes corresponding to a plurality of functions, and the different codes have corresponding code addresses and the like. The code address refers to the address of a code corresponding to a certain function, and the corresponding code can be found according to the address and then tested; the interface information refers to interface information required to be called for testing the code; the specified parameters refer to the type and value of the parameter required for testing the code.
After the code address, the interface information and the designated parameters are obtained, a script can be generated according to the pre-written node assembly, the test node assembly can be automatically generated, or the corresponding test node assembly can be called from a designated database. Each test node component is a script component for testing one function in the system to be tested. Script components refer to simple encapsulation of data and methods.
Specifically, a test node component is automatically generated according to a pre-written node component generation script, the pre-written node component is a code which is pre-written and encapsulated into a component by a developer, filling gaps which need to be filled are reserved in the code, the filling gaps are used for filling the code address, the interface information and the designated parameters, and after the code address, the interface information and the designated parameters are inserted into the corresponding filling gaps, the test node component capable of testing a certain function is formed. For example, the certain function to be tested is to click a button at a coordinate on the first interface to open the second interface, and obtain the execution code corresponding to the function, so as to obtain the code address, the interface information, the specified parameter, and the like of the execution code, specifically, the code address is address information in the execution code of the execution code to be tested of the execution code corresponding to the function, the interface information is interface information to be called corresponding to the function, and the specified parameter is coordinate information of the button on the first interface, and the like. And correspondingly inserting the information into a pre-written filling space of the node assembly to enable the node assembly to form a script assembly which can be operated, and when the script assembly is operated, testing that a button at a certain coordinate on the first interface is clicked to open the second interface. The pre-written node component is a general test framework, and when filling corresponding contents in the filling space in the framework, a script component which can be operated can be formed. It should be noted that the code addresses, the interface information and the designated parameters are grouped, that is, the code written in advance and packaged into the component includes at least three blanks for filling the code addresses, the interface information and the designated parameters in the same group, and the insertion of the code addresses, the interface information and the designated parameters in different groups into the same blank of the code written in advance and packaged into the component is prohibited. When filling the gap filler, the specific insertion into the gap filler is determined according to the code address, the interface information and the representation form (such as format and the like) of the specified parameters, or different carried marks.
And calling the corresponding test node assembly in a specified database, wherein the database is a storage space for storing data by a user, and a large number of test node assemblies written by developers in advance are stored in the storage space. Each pre-programmed test node component includes the code address, the interface information and the designated parameter, so that the corresponding test node component can be reversely found in the database in a keyword retrieval manner through the code address, the interface information and the designated parameter acquired in step S1.
And after all the test node assemblies are completely acquired, associating each test node assembly according to an operation sequence of each function in an actual use process or a preset dependency relationship, establishing a topological relationship of each test node assembly according to the association relationship, executing according to the topological relationship, and sequentially starting each test node assembly to finish the test of the system to be tested.
In an embodiment, the step S2 of obtaining the test node component corresponding to each function to be tested according to the code address, the interface information, and the specific parameter corresponding to each function to be tested includes:
s21, searching a preset first test node component corresponding to the code address, the interface information and the designated parameter corresponding to each function to be tested in a preset test node component library, wherein an information table and a plurality of test node components with different test functions are arranged in the test node database, the code address, the interface information and the mapping information of the designated parameter corresponding to the test node component are listed in the information table, and each mapping information is associated with one corresponding test node component;
s22, calling each searched first test node assembly, and inserting the other residual code addresses, interface information and designated parameters of the first test node assemblies which are not searched into a plurality of codes which are written in advance and packaged into assemblies to obtain a plurality of second test node assemblies, wherein filling gaps needing to be filled are reserved in the codes which are written in advance and packaged into the assemblies, the filling gaps are used for filling the code addresses, the interface information and the designated parameters, and when the code addresses, the interface information and the designated parameters are inserted into the corresponding filling gaps, the test node assemblies for testing a certain function are formed, wherein the first test node assemblies and the second test node assemblies are the test node assemblies.
In this embodiment, the test node component library is a database storing test node components with different test functions, and is a database that is organized in advance by developers and other research and development personnel, and generally has an information table and a plurality of test node components with different test functions, where the information table lists mapping information of code addresses, interface information, and specified parameters of corresponding test node components, and correspondingly, each mapping information is associated with one corresponding test node component. In this embodiment, a test node component library is searched for whether a first test node component corresponding to a read code address, interface information, and specified parameters exists, if so, the first test node component is directly called, and if not, a plurality of corresponding second test node components are generated according to mapping information of the code address, the interface information, and the specified parameters of the first test node that is not read. That is, a part of test node assemblies corresponding to execution codes are searched in the test node assembly library, and if code addresses, interface information and designated parameters of the test node assemblies which are not searched remain, the corresponding test node assemblies are automatically generated according to a pre-written node assembly generation script. Therefore, running resources during testing can be saved, and the acquisition speed of each testing node assembly is improved.
Further, after the step S22 of generating a plurality of corresponding second test node assemblies according to the remaining other code addresses, interface information, and specified parameters of the first test node assembly that are not found, the method includes:
s23, storing the second test node assembly into the test node assembly library.
In the embodiment, the test node assemblies in the test node assembly library can be enriched continuously, so that the test node assemblies can get a multiplexing opportunity, and convenience is provided for testing other systems later. Specifically, none of the test node components in the test node component library may be used at first, or some test node components written by a developer in advance may be preset. Different to-be-tested systems may need different testing functions, so that the required testing node components are different, and obviously, the number of the testing node components written by a developer in advance is difficult to cover all the testing functions. Therefore, in the continuous testing process, a plurality of corresponding second testing node assemblies are generated according to the remaining other code addresses, interface information and designated parameters of the first testing node assembly which are not found (as described above, the testing node assemblies are automatically generated according to the pre-written node assembly generation script), so that the automatically written second testing node assemblies are not deleted after being used, but are stored in the testing node assembly library, and thus the automatically generated testing node assemblies become the first testing node assemblies which can be directly called, and further can be reused. It should be noted that, when the second test node component is stored in the test node component library, the corresponding test function, the code address, the interface information, the mapping information of the specified parameter, and the like are written into the information table.
In an embodiment, after the step S5 of executing each of the test node assemblies according to the topological relation and completing the test on the system to be tested, the method further includes:
s6, generating a visual topological graph corresponding to the topological relation;
and S7, displaying the test result of each node on each node of the visual topological graph.
In this embodiment, a visual test report is generated, and before this, it is necessary to record the test result of each test node component during the test when each test node component is executed. After the test is finished, firstly, a visual topological graph corresponding to the topological relation is generated, and then the test result corresponding to each test node component is correspondingly added to each node of the visual topological graph. In a specific embodiment, the test result may be expressed by a color, such as green for test pass, red for test fail, etc. Furthermore, clicking the vivid red color of the visual topological graph can display the information such as the reason why the test node fails to test.
In an embodiment, the step S1 of scanning the execution code of the system to be tested and reading the code address, the interface information and the designated parameter corresponding to each function to be tested includes:
s11, searching a preset marker in the execution code, wherein the marker is a marker written when a developer develops the execution code;
and S12, extracting information corresponding to the marker, wherein the information is the code address, the interface information and the designated parameter.
In this embodiment, in order to achieve automatic acquisition of a test node component in a later stage, it is necessary to automatically read a code address, interface information, and specified parameters corresponding to each function to be tested, so that a developer adds a corresponding marker when writing a code, so as to read the corresponding code address, interface information, and specified parameters in an execution code. I.e. the identifier is identified, the information to be read can be obtained, i.e. the code address, the interface information, the specified parameters, etc.
Further, the step S12 of extracting the information corresponding to the marker includes:
s121, judging the type of the marker, wherein the type comprises an address marker corresponding to the code address, an interface marker corresponding to the interface information and a parameter marker corresponding to the specified parameter;
and S121, calling a corresponding extraction rule according to the type of the marker, and reading to obtain information corresponding to the marker.
In this embodiment, because the formats or expression forms of the code address, the interface information, and the specified parameter are different, the extracted rules are also different, and in order to facilitate correct extraction of the required information, the developer distinguishes the tags, which are respectively the address tag corresponding to the code address, the interface tag corresponding to the interface information, and the parameter tag corresponding to the specified parameter, and the extraction rules corresponding to different types of tags are different, and the specific extraction rule is determined according to the code address, the interface information, the expression form of the specified parameter, and the like, and the developer can easily implement through a script, such as how many bits of characters after reading the tag, how many bits of characters before reading the tag, and the like, which is not described herein.
In an embodiment, the step S3 of obtaining the execution logic of the execution code, and establishing the topological relation of each test node component according to the execution logic of the execution code includes:
s31, reading code serial numbers corresponding to the functions in the execution code and secondary code serial numbers pointed by the code serial numbers, wherein the code serial numbers and the secondary code serial numbers are serial numbers written by a developer when the execution code is developed, the secondary code serial numbers are code serial numbers of codes corresponding to the next one or more functions to be tested after the function test corresponding to the code serial numbers is finished, and the number of the secondary code serial numbers comprises one or more;
s32, determining the running logic of the execution code according to the code sequence number and the secondary code sequence number;
and S33, establishing the topological relation of each test node assembly according to the operation logic.
In this embodiment, the code number and the secondary code number are only a name, and in different map relations, the code number may become the secondary code number, and the secondary code number may become the secondary code number, for example, the system to be tested has three test nodes with numbers A, A1 and a2, respectively, and the execution sequence is a-a1-a2, then the relation between a and a1 is that a is the code number, a1 is the secondary code number, and the relation between a1 and a2 is that a1 is the code number, a2 is the secondary code number, etc. After the code sequence number and the secondary code sequence number are obtained, the running logic of the executed code can be determined, and then the topological relation of the test node assembly can be determined.
According to the system code testing method, firstly, all execution codes of the system to be tested are read, data such as code addresses, interface information and designated parameters corresponding to the functions to be tested are obtained, then, testing components for testing the functions to be tested are obtained, the topological relation of the testing components is sorted according to the operation logic of the execution codes of the system to be tested, and finally, the execution codes of the system to be tested are tested according to the corresponding topological relation. The method and the device can complete the test of a plurality of functional items in the whole system to be tested at one time, and greatly improve the test efficiency of the execution code of the system to be tested.
Referring to fig. 2, an embodiment of the present application further provides a device for testing a system code, including:
a scanning and reading unit 10, configured to scan an execution code of a system to be tested, and read a code address, interface information, and an assigned parameter corresponding to each function to be tested;
an obtaining component unit 20, configured to obtain a test node component corresponding to each function to be tested according to a code address, interface information, and an assigned parameter corresponding to each function to be tested, where the test node component is a script component for testing one function in the system to be tested;
a topology establishing unit 30, configured to acquire the operation logic of the execution code, and establish a topology relationship between the test node assemblies according to the operation logic of the execution code;
and the execution test unit 40 is configured to execute each test node component according to the topological relation, so as to complete the test on the system to be tested.
In one embodiment, the above-mentioned acquisition component unit 20 includes:
the system comprises a searching module, a testing node database and a judging module, wherein the searching module is used for searching a preset first testing node component corresponding to a code address, interface information and specified parameters corresponding to each function to be tested in a preset testing node component library, an information table and a plurality of testing node components with different testing functions are arranged in the testing node database, the code address, the interface information and the mapping information of the specified parameters corresponding to the testing node components are listed in the information table, and each mapping information is associated with one corresponding testing node component;
and the calling generation module is used for calling each searched first test node assembly and inserting the other residual code addresses, interface information and designated parameters of the first test node assemblies which are not searched into a plurality of codes which are written in advance and packaged into assemblies to obtain a plurality of second test node assemblies, wherein filling gaps needing to be filled are reserved in the codes which are written in advance and packaged into the assemblies, the filling gaps are used for filling the code addresses, the interface information and the designated parameters, and after the code addresses, the interface information and the designated parameters are inserted into the corresponding filling gaps, the test node assemblies for testing a certain function are formed, wherein the first test node assemblies and the second test node assemblies are the test node assemblies.
In an embodiment, the above-mentioned obtaining component unit 20 further includes:
and the storage module is used for storing the second test node assembly into the test node assembly library.
In an embodiment, the apparatus for testing system code further includes:
the generating unit is used for generating a visual topological graph corresponding to the topological relation;
and the display unit is used for displaying the test result of each node on each node of the visual topological graph.
In one embodiment, the scanning and reading unit 10 includes:
the mark searching module is used for searching a preset mark in the execution code, wherein the mark is a mark written when a developer develops the execution code;
and the information extracting module is used for extracting information corresponding to the marker, wherein the information is the code address, the interface information and the designated parameter.
In an embodiment, the information extracting module includes:
the judging submodule is used for judging the type of the marker, wherein the type comprises an address marker corresponding to the code address, an interface marker corresponding to the interface information and a parameter marker corresponding to the specified parameter;
and the extraction submodule is used for calling a corresponding extraction rule according to the type of the marker and reading to obtain the information corresponding to the marker.
In one embodiment, the above-mentioned building topology unit 30 includes:
the reading module is used for reading code serial numbers corresponding to all functions in the execution code and secondary code serial numbers pointed by the code serial numbers, wherein the code serial numbers and the secondary code serial numbers are serial numbers written by a developer when the execution code is developed, the secondary code serial numbers are code serial numbers of codes corresponding to the next one or more functions to be tested after the function test corresponding to the code serial numbers is finished, and the number of the secondary code serial numbers comprises one or more;
the determining module is used for determining the running logic of the execution code according to the code serial number and the secondary code serial number;
and the building module is used for building the topological relation of each test node assembly according to the operation logic.
The above units, modules, sub-modules, etc. are all devices for executing the test method of the system code, and therefore, a description thereof will not be provided.
Referring to fig. 3, a computer device, which may be a server and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for storing various script data, components and other data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of testing system code.
The method for the processor to execute the test of the system code comprises the following steps:
scanning an execution code of a system to be tested, and reading a code address, interface information and designated parameters corresponding to each function to be tested;
acquiring a test node component corresponding to each function to be tested according to a code address, interface information and designated parameters corresponding to each function to be tested, wherein the test node component is a script component for testing one function in the system to be tested;
acquiring the operation logic of the execution code, and establishing the topological relation of each test node assembly according to the operation logic of the execution code;
and executing each test node assembly according to the topological relation to finish the test of the system to be tested.
In one embodiment, the step of obtaining the test node component corresponding to each function to be tested according to the code address, the interface information and the designated parameter corresponding to each function to be tested includes:
searching a preset first test node component corresponding to the code address, the interface information and the designated parameter corresponding to each function to be tested in a preset test node component library, wherein an information table and a plurality of test node components with different test functions are arranged in the test node database, mapping information of the code address, the interface information and the designated parameter corresponding to the test node component is listed in the information table, and each mapping information is associated with one corresponding test node component;
calling each searched first test node assembly, inserting the rest other code addresses, interface information and designated parameters of the first test node assemblies which are not searched into a plurality of codes which are written in advance and packaged into assemblies to obtain a plurality of second test node assemblies, wherein filling gaps needing to be filled are reserved in the codes which are written in advance and packaged into the assemblies, the filling gaps are used for filling the code addresses, the interface information and the designated parameters, and after the code addresses, the interface information and the designated parameters are inserted into the corresponding filling gaps, the test node assemblies for testing a certain function are formed, wherein the first test node assemblies and the second test node assemblies are the test node assemblies.
In one embodiment, after the step of inserting the remaining other code addresses, interface information, and specified parameters that are not found to the first test node assembly into a plurality of codes written in advance and packaged into an assembly to obtain a plurality of second test node assemblies, the method includes:
storing the second test node component in the test node component library.
In an embodiment, after the step of executing each of the test node assemblies according to the topological relation and completing the test of the system to be tested, the method further includes:
generating a visual topological graph corresponding to the topological relation;
and displaying the test result of each node on each node of the visual topological graph.
In one embodiment, the step of scanning an execution code of a system to be tested, and reading a code address, interface information, and a designated parameter corresponding to each function to be tested includes:
searching a preset marker in the execution code, wherein the marker is a marker written when a developer develops the execution code;
and extracting information corresponding to the marker, wherein the information is the code address, the interface information and the designated parameter.
In one embodiment, the step of extracting the information corresponding to the marker includes:
judging the type of the marker, wherein the type comprises an address marker corresponding to the code address, an interface marker corresponding to the interface information and a parameter marker corresponding to the specified parameter;
and calling a corresponding extraction rule according to the type of the marker, and reading to obtain information corresponding to the marker.
In one embodiment, the step of obtaining the operation logic of the execution code and establishing the topological relation of each test node component according to the operation logic of the execution code includes:
reading code serial numbers corresponding to all functions in the execution code and secondary code serial numbers pointed by the code serial numbers, wherein the code serial numbers and the secondary code serial numbers are serial numbers written by a developer when the execution code is developed, the secondary code serial numbers are code serial numbers of codes corresponding to the next one or more functions to be tested after the function test corresponding to the code serial numbers is finished, and the number of the secondary code serial numbers comprises one or more;
determining the running logic of the execution code according to the code sequence number and the secondary code sequence number;
and establishing the topological relation of each test node component according to the operation logic.
Those skilled in the art will appreciate that the architecture shown in fig. 3 is only a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects may be applied.
In the computer device according to the embodiment of the application, when the processor executes the method for testing the system code, all the execution codes of the system to be tested are firstly read to obtain data such as code addresses, interface information and designated parameters corresponding to the functions to be tested, so as to obtain the test components for testing the functions to be tested, the topological relation of each test component is sorted according to the operation logic of the execution codes of the system to be tested, and then the execution codes of the system to be tested are tested according to the corresponding topological relation. The method and the device can complete the test of a plurality of functional items in the whole system to be tested at one time, and greatly improve the test efficiency of the execution code of the system to be tested.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements a method for testing system code, including:
scanning an execution code of a system to be tested, and reading a code address, interface information and designated parameters corresponding to each function to be tested;
acquiring a test node component corresponding to each function to be tested according to a code address, interface information and designated parameters corresponding to each function to be tested, wherein the test node component is a script component for testing one function in the system to be tested;
acquiring the operation logic of the execution code, and establishing the topological relation of each test node assembly according to the operation logic of the execution code;
and executing each test node assembly according to the topological relation to finish the test of the system to be tested.
When the processor executes the method for testing the system codes, firstly reading all the execution codes of the system to be tested to obtain data such as code addresses, interface information, designated parameters and the like corresponding to the functions to be tested, further obtaining test components for testing the functions to be tested, sorting the topological relation of the test components according to the operation logic of the execution codes of the system to be tested, and then testing the execution codes of the system to be tested according to the corresponding topological relation. The method and the device can complete the test of a plurality of functional items in the whole system to be tested at one time, and greatly improve the test efficiency of the execution code of the system to be tested.
In one embodiment, the step of obtaining the test node component corresponding to each function to be tested according to the code address, the interface information and the designated parameter corresponding to each function to be tested includes:
searching a preset first test node component corresponding to the code address, the interface information and the designated parameter corresponding to each function to be tested in a preset test node component library; the test node database is provided with an information table and a plurality of test node assemblies with different test functions, the information table is listed with mapping information of code addresses, interface information and designated parameters of the corresponding test node assemblies, and each mapping information is associated with one corresponding test node assembly;
calling each searched first test node assembly, inserting the rest other code addresses, interface information and designated parameters of the first test node assemblies which are not searched into a plurality of codes which are written in advance and packaged into assemblies to obtain a plurality of second test node assemblies, wherein filling gaps needing to be filled are reserved in the codes which are written in advance and packaged into the assemblies, the filling gaps are used for filling the code addresses, the interface information and the designated parameters, and after the code addresses, the interface information and the designated parameters are inserted into the corresponding filling gaps, the test node assemblies for testing a certain function are formed, wherein the first test node assemblies and the second test node assemblies are the test node assemblies.
In one embodiment, after the step of inserting the remaining other code addresses, interface information, and specified parameters that are not found to the first test node assembly into a plurality of codes written in advance and packaged into an assembly to obtain a plurality of second test node assemblies, the method includes:
storing the second test node component in the test node component library.
In an embodiment, after the step of executing each of the test node assemblies according to the topological relation and completing the test of the system to be tested, the method further includes:
generating a visual topological graph corresponding to the topological relation;
and displaying the test result of each node on each node of the visual topological graph.
In one embodiment, the step of scanning an execution code of a system to be tested, and reading a code address, interface information, and a designated parameter corresponding to each function to be tested includes:
searching a preset marker in the execution code, wherein the marker is a marker written when a developer develops the execution code;
and extracting information corresponding to the marker, wherein the information is the code address, the interface information and the designated parameter.
In one embodiment, the step of extracting the information corresponding to the marker includes:
judging the type of the marker, wherein the type comprises an address marker corresponding to the code address, an interface marker corresponding to the interface information and a parameter marker corresponding to the specified parameter;
and calling a corresponding extraction rule according to the type of the marker, and reading to obtain information corresponding to the marker.
In one embodiment, the step of obtaining the operation logic of the execution code and establishing the topological relation of each test node component according to the operation logic of the execution code includes:
reading code serial numbers corresponding to all functions in the execution code and secondary code serial numbers pointed by the code serial numbers, wherein the code serial numbers and the secondary code serial numbers are serial numbers written by a developer when the execution code is developed, the secondary code serial numbers are code serial numbers of codes corresponding to the next one or more functions to be tested after the function test corresponding to the code serial numbers is finished, and the number of the secondary code serial numbers comprises one or more;
determining the running logic of the execution code according to the code sequence number and the secondary code sequence number;
and establishing the topological relation of each test node component according to the operation logic.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.
Claims (10)
1. A method for testing system code, comprising:
scanning an execution code of a system to be tested, and reading a code address, interface information and designated parameters corresponding to each function to be tested;
acquiring a test node component corresponding to each function to be tested according to a code address, interface information and designated parameters corresponding to each function to be tested, wherein the test node component is a script component for testing one function in the system to be tested;
acquiring the operation logic of the execution code, and establishing the topological relation of each test node assembly according to the operation logic of the execution code;
and executing each test node assembly according to the topological relation to finish the test of the system to be tested.
2. The method for testing system code according to claim 1, wherein the step of obtaining the test node component corresponding to each function to be tested according to the code address, the interface information and the designated parameter corresponding to each function to be tested comprises:
searching a preset first test node component corresponding to the code address, the interface information and the designated parameter corresponding to each function to be tested in a preset test node component library; the test node database is provided with an information table and a plurality of test node assemblies with different test functions, the information table is listed with mapping information of code addresses, interface information and designated parameters of the corresponding test node assemblies, and each mapping information is associated with one corresponding test node assembly;
calling each searched first test node assembly; inserting the other residual code addresses, interface information and designated parameters which are not found out from the first test node assembly into a plurality of codes which are written in advance and packaged into assemblies to obtain a plurality of second test node assemblies, wherein filling gaps which need to be filled are reserved in the codes which are written in advance and packaged into the assemblies, the filling gaps are used for filling the code addresses, the interface information and the designated parameters, and when the code addresses, the interface information and the designated parameters are inserted into the corresponding filling gaps, the test node assemblies for testing a certain function are formed; and the first test node assembly and the second test node assemblies are the test node assemblies.
3. The method for testing system code according to claim 2, wherein the step of inserting the remaining other code addresses, interface information and specified parameters that are not found to the first test node assembly into the plurality of pre-written and packaged component codes to obtain the plurality of second test node assemblies comprises:
storing the second test node component in the test node component library.
4. The method for testing system code according to claim 1, wherein after the step of executing each of the test node assemblies according to the topological relation and completing the test of the system to be tested, the method further comprises:
generating a visual topological graph corresponding to the topological relation;
and displaying the test result of each node on each node of the visual topological graph.
5. The method for testing system code according to claim 1, wherein the step of scanning the execution code of the system to be tested and reading the code address, the interface information and the designated parameter corresponding to each function to be tested comprises:
searching a preset marker in the execution code, wherein the marker is a marker written when a developer develops the execution code;
and extracting information corresponding to the marker, wherein the information is the code address, the interface information and the designated parameter.
6. The method for testing system code according to claim 5, wherein the step of extracting information corresponding to the marker comprises:
judging the type of the marker, wherein the type comprises an address marker corresponding to the code address, an interface marker corresponding to the interface information and a parameter marker corresponding to the specified parameter;
and calling a corresponding extraction rule according to the type of the marker, and reading to obtain information corresponding to the marker.
7. The method for testing system code according to claim 1, wherein the step of obtaining the execution logic of the execution code and establishing the topological relation of each of the test node components according to the execution logic of the execution code comprises:
reading code serial numbers corresponding to all functions in the execution code and secondary code serial numbers pointed by the code serial numbers, wherein the code serial numbers and the secondary code serial numbers are serial numbers written by a developer when the execution code is developed, the secondary code serial numbers are code serial numbers of codes corresponding to the next one or more functions to be tested after the function test corresponding to the code serial numbers is finished, and the number of the secondary code serial numbers comprises one or more;
determining the running logic of the execution code according to the code sequence number and the secondary code sequence number;
and establishing the topological relation of each test node component according to the operation logic.
8. An apparatus for testing a system code, comprising:
the scanning and reading unit is used for scanning the execution codes of the system to be tested and reading the code address, the interface information and the designated parameters corresponding to each function to be tested;
the system comprises an acquisition component unit, a test node component unit and a test module unit, wherein the acquisition component unit is used for acquiring a test node component corresponding to each function to be tested according to a code address, interface information and designated parameters corresponding to each function to be tested, and the test node component is a script component used for testing one function in the system to be tested;
the topology establishing unit is used for acquiring the operation logic of the execution code and establishing the topology relation of each test node assembly according to the operation logic of the execution code;
and the execution testing unit is used for executing each testing node component according to the topological relation so as to finish the test of the system to be tested.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010238723.0A CN111581076A (en) | 2020-03-30 | 2020-03-30 | System code testing method and device, computer equipment and storage medium |
PCT/CN2020/132594 WO2021196674A1 (en) | 2020-03-30 | 2020-11-30 | System code testing method and apparatus, and computer device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010238723.0A CN111581076A (en) | 2020-03-30 | 2020-03-30 | System code testing method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111581076A true CN111581076A (en) | 2020-08-25 |
Family
ID=72126113
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010238723.0A Pending CN111581076A (en) | 2020-03-30 | 2020-03-30 | System code testing method and device, computer equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111581076A (en) |
WO (1) | WO2021196674A1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112131127A (en) * | 2020-09-28 | 2020-12-25 | 北京同邦卓益科技有限公司 | Interface testing method, device and system and electronic equipment |
WO2021196674A1 (en) * | 2020-03-30 | 2021-10-07 | 平安科技(深圳)有限公司 | System code testing method and apparatus, and computer device and storage medium |
CN113626326A (en) * | 2021-08-09 | 2021-11-09 | 三峡高科信息技术有限责任公司 | Dragging type zero code front end automatic test system based on image recognition |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116860630B (en) * | 2023-07-05 | 2024-09-20 | 珠海视熙科技有限公司 | Equipment testing method and device, storage medium and computer equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109582563A (en) * | 2018-10-26 | 2019-04-05 | 平安科技(深圳)有限公司 | Test method, device, computer equipment and the storage medium of test cases |
CN110232014A (en) * | 2019-02-25 | 2019-09-13 | 上海蔚来汽车有限公司 | Operation flow automated testing method, device, controller and medium |
CN110543301A (en) * | 2019-09-06 | 2019-12-06 | 中国工商银行股份有限公司 | Method and device for generating jenkins code file |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107908542B (en) * | 2017-07-26 | 2020-06-23 | 平安壹钱包电子商务有限公司 | Test case creating method and device, computer equipment and storage medium |
CN110389896A (en) * | 2019-06-18 | 2019-10-29 | 中国平安人寿保险股份有限公司 | Code automated analysis and test method, device and computer readable storage medium |
CN110442370B (en) * | 2019-07-30 | 2023-10-27 | 北京奇艺世纪科技有限公司 | Test case query method and device |
CN110704303B (en) * | 2019-09-05 | 2021-07-20 | 深圳开源互联网安全技术有限公司 | Method and device for acquiring test coverage information |
CN111581076A (en) * | 2020-03-30 | 2020-08-25 | 平安科技(深圳)有限公司 | System code testing method and device, computer equipment and storage medium |
-
2020
- 2020-03-30 CN CN202010238723.0A patent/CN111581076A/en active Pending
- 2020-11-30 WO PCT/CN2020/132594 patent/WO2021196674A1/en active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109582563A (en) * | 2018-10-26 | 2019-04-05 | 平安科技(深圳)有限公司 | Test method, device, computer equipment and the storage medium of test cases |
CN110232014A (en) * | 2019-02-25 | 2019-09-13 | 上海蔚来汽车有限公司 | Operation flow automated testing method, device, controller and medium |
CN110543301A (en) * | 2019-09-06 | 2019-12-06 | 中国工商银行股份有限公司 | Method and device for generating jenkins code file |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021196674A1 (en) * | 2020-03-30 | 2021-10-07 | 平安科技(深圳)有限公司 | System code testing method and apparatus, and computer device and storage medium |
CN112131127A (en) * | 2020-09-28 | 2020-12-25 | 北京同邦卓益科技有限公司 | Interface testing method, device and system and electronic equipment |
CN112131127B (en) * | 2020-09-28 | 2024-04-16 | 北京同邦卓益科技有限公司 | Interface testing method, device and system and electronic equipment |
CN113626326A (en) * | 2021-08-09 | 2021-11-09 | 三峡高科信息技术有限责任公司 | Dragging type zero code front end automatic test system based on image recognition |
Also Published As
Publication number | Publication date |
---|---|
WO2021196674A1 (en) | 2021-10-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111581076A (en) | System code testing method and device, computer equipment and storage medium | |
CN107908541B (en) | Interface testing method and device, computer equipment and storage medium | |
CN112597028B (en) | Method and device for displaying use case test results and readable storage medium | |
CN109710508A (en) | Test method, test device, test equipment and computer readable storage medium | |
CN110109897A (en) | Database script generation method, device, computer equipment and storage medium | |
CN110908895A (en) | Page automatic testing method and device, computer equipment and storage medium | |
CN102567565B (en) | Cable parameter processing method and system utilizing same | |
CN113282498B (en) | Method, device, equipment and storage medium for generating test cases | |
CN112363953B (en) | Interface test case generation method and system based on crawler technology and rule engine | |
CN113282513B (en) | Interface test case generation method and device, computer equipment and storage medium | |
CN111522741A (en) | Interface test code generation method and device, electronic equipment and readable storage medium | |
CN113886262A (en) | Software automation test method and device, computer equipment and storage medium | |
CN114138670B (en) | Method based on integration of interface automation test and function, performance and safety test | |
CN116820996A (en) | Automatic generation method and device for integrated test cases based on artificial intelligence | |
CN113515443B (en) | Multi-language automatic checking method, device, computer equipment and storage medium | |
CN117093497A (en) | Test report processing method and device, electronic equipment and storage medium | |
CN110147313A (en) | A kind of log-output method and device | |
CN112463164B (en) | SoC program execution display positioning method, device, computer equipment and storage medium | |
CN109815127A (en) | Automatized script conversion method, device, computer equipment and storage medium | |
CN112181809B (en) | Graphic user interface automatic test method based on multiple positioning methods | |
CN113094277A (en) | Chip test case management method and device | |
Nikiforova et al. | Towards a Business Process Model-based Testing of Information Systems Functionality. | |
CN113254343A (en) | User interface test assertion method and device, electronic equipment and storage medium | |
CN112579456A (en) | Web automatic testing method and device | |
CN108664383B (en) | Control testing method and software automatic testing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40033511 Country of ref document: HK |
|
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200825 |
|
RJ01 | Rejection of invention patent application after publication |