Test program generation method and device, electronic device and storage medium
By updating the encoded array of the test program and generating a new CSV file, the problem of poor flexibility and adaptability of the existing FCT software program is solved, and flexible adjustment of the test steps and efficiency improvement are achieved.
Patent Information
- Application Number
- CN202411437580.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The test programs of existing FCT software programs have poor flexibility and adaptability, and cannot effectively replace or delete test steps, resulting in long-term modification time and low efficiency of the test program.
By obtaining the index information of the current test program, detecting and updating the encoded array, and generating a new CSV file, the execution order of the test steps and the addition and deletion of the steps are realized, and the flexibility of the test program is improved.
It realizes the flexibility and adaptability of the test program, saves the time to modify the test program and improves the testing efficiency.
Smart Images

Figure CN119512850A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a method, device, electronic device and storage medium for generating a test program. Background Art
[0002] Functional Circuit Test (FCT) generally refers to the functional test of the printed circuit board assembly (PCBA) after power-on, including: voltage, current, power, power factor, frequency, duty cycle, position determination, LED brightness and color recognition, LCD character and color recognition, sound recognition, temperature measurement and control, pressure measurement and control, precision micro-motion control, FLASH and electrically erasable programmable read only memory (EEPROM) online burning and other functional parameter measurements. At the same time, FCT refers to the test method that provides a simulated operating environment (stimulus and load) for the test target board (Unit Under Test, UUT) to make it work in various design states, so as to obtain the parameters of each state to verify the function of UUT.
[0003] The current FCT software program usually has fixed test steps, and the order of test steps cannot be changed. For example, if a certain test step needs to be tested first, the order cannot be changed. At the same time, the test steps cannot be deleted. For example, when a certain test step is not needed, it cannot be simply deleted from the test steps of the test program. In other words, the current FCT software program needs to change the order of steps (test subroutines) in the test program or add or delete steps. If the order of test steps needs to be changed or added or deleted, it needs to be modified by changing the code, which makes the flexibility and adaptability of the test program corresponding to the FCT software program poor.
[0004] Currently, no effective solution has been proposed for the problem of poor flexibility and adaptability of the test program corresponding to the FCT software program of the related art. Summary of the invention
[0005] The embodiments of the present application provide a method, device, electronic device and storage medium for generating a test program, so as to at least solve the problem of poor flexibility and adaptability of the test program corresponding to the FCT software program in the related art.
[0006] In a first aspect, an embodiment of the present application provides a method for generating a test program, comprising: obtaining a plurality of second index information selected from a plurality of first index information corresponding to a currently executed test program, wherein the first index information is generated after a first CSV file corresponding to the test program is loaded into a preset table control, one first index information corresponds to a first test subroutine, and the second index information is the first index information corresponding to the selected second test subroutine; among all first codes of a first coding array corresponding to the first CSV file, detecting the first code currently corresponding to each second index information, and obtaining a plurality of second codes, wherein the order of the first codes is used to characterize the correspondence between each first index information and the first code. The execution order of the first test subprogram in the currently executed test program; based on the second code and the correction information corresponding to all the second test subprograms, generate a third code associated with each of the second test subprograms, and update the first code array according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subprograms in the target test program after the execution order of all the second test subprograms is corrected according to the correction information; based on the second code array, correct and update the first CSV file to generate a second CSV file corresponding to the target test program, and initialize and generate the target test program according to the second CSV file.
[0007] In a second aspect, an embodiment of the present application provides a test program generation device, including: An acquisition module, used for acquiring a plurality of second index information selected from a plurality of first index information corresponding to a currently executed test program, wherein the first index information is generated after a first CSV file corresponding to the test program is loaded into a preset table control, one first index information corresponds to a first test subprogram, and the second index information is the first index information corresponding to a selected second test subprogram; A detection module, configured to detect the first code currently corresponding to each second index information among all the first codes of the first code array corresponding to the first CSV file, and obtain a plurality of second codes, wherein the order of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the test program currently being executed; A processing module, used for generating a third code associated with each of the second test subroutines based on the second code and the correction information corresponding to all the second test subroutines, and updating the first code array according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subroutines in the target test program after the execution order of all the second test subroutines is corrected according to the correction information; A generation module is used to modify and update the first CSV file based on the second encoding array to generate a second CSV file corresponding to the target test program, and initialize the generation of the target test program according to the second CSV file.
[0008] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for generating a test program as described in the first aspect are implemented.
[0009] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for generating a test program as described in the first aspect above.
[0010] Compared with the related art, the test program generation method, device, electronic device and storage medium provided in the embodiments of the present application adopt the method of obtaining multiple second index information selected from multiple first index information corresponding to the currently executed test program, wherein the first index information is generated after loading the first CSV file corresponding to the test program into a preset table control, one first index information corresponds to a first test subroutine, and the second index information is the first index information corresponding to the selected second test subroutine; among all the first codes of the first code array corresponding to the first CSV file, the first code currently corresponding to each second index information is detected to obtain multiple second codes, and the order of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the currently executed test program; based on the second code and the correction information corresponding to all the second test subroutines, a correction information corresponding to the second test subroutine is generated. A third code is associated with each second test subroutine, and the first code array is updated according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subroutines in the target test program after the execution order of all the second test subroutines is corrected according to the correction information; based on the second code array, the first CSV file is corrected and updated to generate a second CSV file corresponding to the target test program, and the target test program is generated according to the second CSV file initialization, and the CSV file corresponding to the test program is loaded into a table control to generate a code array including multiple index information, and the code corresponding to the selected index information is corrected according to the preset correction information, and after the sorting position of the index information in the code array is changed, the execution order of the test steps of the test program is replaced or the test steps are deleted, and the test steps of the test program are controllable, which solves the problem of poor flexibility and adaptability of the test program corresponding to the FCT software program in the related art, realizes improving the flexibility of test program changes, saving test program modification time, and improving test efficiency.
[0011] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 It is a hardware structure block diagram of a terminal for running the method for generating a test program according to an embodiment of the present application; Figure 2is a flow chart of a method for generating a test program according to an embodiment of the present application; Figure 3 It is a structural block diagram of a test program generation device according to an embodiment of the present application. DETAILED DESCRIPTION
[0013] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.
[0014] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0015] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation and may represent the singular or plural. The terms "including", "comprising", "having" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include unlisted steps or units, or may also include other steps or units inherent to these processes, methods, products or devices. The "multiple links" involved in this application refer to links greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in this application are only used to distinguish similar objects and do not represent a specific ordering of objects.
[0016] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1 1 is a hardware structure diagram of a terminal for running the method for generating a test program according to an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0017] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for generating the test program in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0018] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0019] This embodiment provides a method for generating a test program running on the above terminal. Figure 2 is a flow chart of a method for generating a test program according to an embodiment of the present application, such as Figure 2As shown, the process includes the following steps: Step S201, obtain multiple second index information selected from multiple first index information corresponding to the currently executed test program, wherein the first index information is generated after loading the first CSV file corresponding to the test program into a preset table control, one first index information corresponds to a first test subroutine, and the second index information is the first index information corresponding to the selected second test subroutine.
[0020] In this embodiment, the test program generation method is implemented when the currently executed test program cannot meet the corresponding test requirements. For example, the voltage test step and the temperature measurement step in the currently executed test program need to be replaced in sequence. At this time, the current test program needs to be modified to generate a target test program that meets the corresponding test requirements. It can be understood that when it is determined that the current test program needs to be modified, it is necessary to first determine the test subprograms corresponding to the current test program and the execution order of each test subprogram. The execution order of each test subprogram is that at which test step the test subprogram is executed during the execution of the entire test program. In this embodiment, the current test program is determined. The corresponding test subroutine is obtained by loading the first CSV file corresponding to the test program into the table control of the editing program, that is, after clicking on the test program to be modified in the editing program, the corresponding table control will load all the contents of the corresponding first CSV file, and convert the index information obtained after loading and the encoding corresponding to the index information into a two-dimensional array and store it. At the same time, the editing interface of the editing program will display all the obtained index information, that is, determine the test subroutine corresponding to the current test program. After the index information is displayed on the editing interface, the target object can select the index information of the test subroutine that needs to be modified from the editing interface, that is, obtain the second index information.
[0021] Step S202, among all the first codes in the first code array corresponding to the first CSV file, detect the first code currently corresponding to each second index information to obtain multiple second codes, wherein the order of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the currently executed test program.
[0022] In this embodiment, in the process of implementing the correction of the first test subroutine of the test program, the arrangement order of the first index information of the first test subroutine (the sequence number of the first test subroutine in the execution of the test program) is corrected, and the program itself and program parameters corresponding to the first test subroutine are stored in a preset database. After generating the CSV file corresponding to the corresponding test program, by initializing the corresponding CSV file, the execution body of the test program will retrieve the first test subroutine itself from the database according to the corresponding index information, and then when the test program is executed, it will traverse each first test subroutine and implement the steps of the corresponding first test subroutine in sequence. Therefore, it can be understood that one first index information will map a first test subroutine, and one first index information will map a first test subroutine. An index information also represents target information corresponding to a first test subroutine, such as the test name and related parameters (such as upper limit, lower limit and unit) of the test subroutine. In the present embodiment, when modifying or deleting the execution order of the first test subroutine, the coding position of the corresponding first index information, that is, the test number, is changed in the corresponding coding array. For example, the execution order of the two first test subroutines with test numbers 001 and 003 is swapped. As long as the first index information of the two first test subroutines is swapped or the coding position is replaced, for example, the first index information of the first test subroutine with test number 003 is written at the original coding position of the first test subroutine with test number 001, it indicates that the execution order of the two first test subroutines is swapped.
[0023] In this embodiment, before modifying or deleting the execution order of the first test subroutine, it is necessary to determine the current coding position of the first index information corresponding to the first test subroutine in the first coding array, that is, to determine the first coding currently corresponding to the selected second index information, so as to provide initial parameters for the subsequent correction of the corresponding test subroutine based on the target object in the process of selecting the second index information (for example: what kind of execution order of the second test subroutine corresponding to the second index information should be changed).
[0024] Step S203, based on the second code and the correction information corresponding to all the second test subroutines, generate a third code associated with each second test subroutine, and update the first code array according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subroutines in the target test program after the execution order of all the second test subroutines is corrected according to the correction information.
[0025] In this embodiment, after determining the first code (that is, the second code) currently corresponding to the selected second index information, the second code corresponding to the selected second index information is corrected based on the correction target made by the target object in the process of selecting the second index information (for example: selecting the first index information corresponding to the two first test subroutines with test numbers 001 and 003, and at the same time, making a choice to replace the execution order of the two first test subroutines with test numbers 001 and 003, and for another example: selecting the first index information corresponding to the first test subroutine with test number 002, and at the same time, making a choice to delete the first test subroutine with test number 002), thereby updating the code position of the second test subroutine corresponding to the selected second index information in the code array corresponding to the first CSV file, generating a new code, that is, generating a third code associated with each second test subroutine, and then, in the first code array, changing the code corresponding to each second test subroutine from the previous second code to the third code, thereby generating a second code array.
[0026] Step S204: based on the second coding array, the first CSV file is modified and updated to generate a second CSV file corresponding to the target test program, and the target test program is generated according to the second CSV file.
[0027] In this embodiment, after determining the second coding array, the execution steps of each corresponding test subroutine in the corresponding test program in the future after completing the corresponding correction are determined. Then, according to the order of the corresponding execution steps, the selected second index information and all unselected first index information are sorted, and the data of the two-dimensional array is encoded to generate a second CSV file based on the first CSV file.
[0028] In this embodiment, after generating the second CSV file, by loading the second CSV file and initializing it, the target test subroutine can be traversed and called, so that the execution body of the test program can execute the corresponding target test subroutine in sequence according to the corresponding test steps, thereby performing the corresponding FCT test.
[0029] Through the above steps S201 to S204, a plurality of second index information selected from a plurality of first index information corresponding to the currently executed test program is obtained, the first index information is generated after the first CSV file corresponding to the test program is loaded into a preset table control, one first index information corresponds to a first test subroutine, and the second index information is the first index information corresponding to the selected second test subroutine; among all the first codes of the first code array corresponding to the first CSV file, the first code currently corresponding to each second index information is detected to obtain a plurality of second codes, and the sorting of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the currently executed test program; based on the second code and the correction information corresponding to all the second test subroutines, the first code associated with each second test subroutine is generated. Three codes are provided, and the first code array is updated according to the third code to generate a second code array, the third code is used to represent the execution order of the second test subprograms in the target test program after the execution order of all second test subprograms is corrected according to the correction information; based on the second code array, the first CSV file is corrected and updated to generate a second CSV file corresponding to the target test program, and the target test program is generated according to the second CSV file initialization, and the CSV file corresponding to the test program is loaded into a table control to generate a code array including multiple index information, and the code corresponding to the selected index information is corrected according to the preset correction information, and after the sorting position of the index information in the code array is changed, the execution order of the test steps of the test program is replaced or the test steps are deleted, and the test steps of the test program are controllable, which solves the problem of poor flexibility and adaptability of the test program corresponding to the FCT software program in the related art, realizes improving the flexibility of test program changes, saving test program modification time, and improving test efficiency.
[0030] In some embodiments, the step S203 of generating the third code associated with each second test subprogram based on the second code and the correction information corresponding to all the second test subprograms is implemented by the following steps: Step 21, determining a current correction mode for the second test subprogram according to the correction information, wherein the correction mode includes execution order modification and test subprogram deletion.
[0031] In this embodiment, when the target object (for example, the tester) selects the corresponding second index information, he or she also makes a choice of what kind of correction to make to the second test subroutine (one of the first test subroutines) corresponding to the second index information, that is, he or she will make a choice of the correction mode for what kind of correction to make to the selected second test subroutine.
[0032] Step 22, when the correction mode is execution order modification, detect the preset execution order number corresponding to each second test subroutine from the correction parameters corresponding to the correction mode, wherein the preset execution order number is used to characterize the expected execution order of the second test subroutine in the target test program.
[0033] In this embodiment, the correction parameters are also generated correspondingly when the target object makes a correction selection. For example: select three first test subroutines whose coding positions are 003, 005 and 008 respectively, then select the correction mode as execution order modification, and select to set the execution steps of the three first test subroutines to: first execute the first test subroutine with coding position 005, then execute the first test subroutine with coding position 008, and finally execute the first test subroutine with coding position 003. The corresponding correction parameters include: first execute the first test subroutine with coding position 005, then execute the first test subroutine with coding position 008, and finally execute the first test subroutine with coding position 003. At this time, the preset execution order numbers corresponding to the three first test subroutines are: 005, 008, and 003 respectively.
[0034] Step 23, using the second code corresponding to the preset execution sequence number as the third code associated with the second test subroutine corresponding to the preset execution sequence number.
[0035] In this embodiment, after determining the correction parameters, the expected adjusted code position of the selected first test subroutine (corresponding to the second test subroutine) has been determined, for example: the code position of the first test subroutine with a code position of 003 is adjusted from 003 to 008, the code position of the first test subroutine with a code position of 005 is adjusted from 005 to 003, and the code position of the first test subroutine with a code position of 008 is adjusted from 008 to 005. It can be understood that before the correction, the second codes associated with the selected first test subroutine (corresponding to the second test subroutine) are: 003, 005, 008, respectively. After the expected correction, the corresponding preset execution sequence numbers will become: 005, 008, 003. At this time, the expected third codes associated with the second test subroutine are: 005, 008, 003, respectively.
[0036] Through the above steps 21 to 23, according to the correction information, the correction mode of the current correction of the second test subroutine is determined, and the correction mode includes execution order modification and test subroutine deletion; when the correction mode is execution order modification, the preset execution order number corresponding to each second test subroutine is detected from the correction parameters corresponding to the correction mode, and the preset execution order number is used to characterize the expected execution order of the second test subroutine in the target test program; the second code corresponding to the preset execution order number is used as the third code associated with the second test subroutine corresponding to the preset execution order number, thereby realizing the correction of the second code corresponding to the selected second index information based on the correction target made by the target object in the process of selecting the second index information, thereby updating the code position of the second test subroutine corresponding to the selected second index information in the code array corresponding to the first CSV file, generating a new code, and providing update correction parameters for the subsequent generation of the corresponding second CSV file.
[0037] In some embodiments, the first encoding array is updated according to the third encoding to generate the second encoding array, which is implemented by the following steps: Step 31, among all the first codes in the first code array, all the first codes except all the third codes are detected to obtain candidate codes.
[0038] Step 32, arranging all candidate codes and all third codes in the order of sorting from front to back to generate a second code array.
[0039] Through the above steps 31 to 32, all first codes except all third codes are detected among all first codes in the first code array to obtain candidate codes; all candidate codes and all third codes are arranged in the sorting order from front to back to generate a second code array, thereby updating the first code data and generating new second code data.
[0040] In some of the embodiments, when the correction mode is test subroutine deletion, the following steps are further implemented: Step 41, in the first code array, delete multiple second codes in order from front to back in sorting order, and detect all first codes after the first deleted second code in all first codes in the first code array to obtain a fourth code.
[0041] In this embodiment, the target object (for example, the tester) can choose to delete the second test subroutine (one of the first test subroutines) corresponding to the second index information while selecting the corresponding second index information. At this time, the corresponding correction parameters are eliminated due to the selection of the correction mode, which can also be understood as the operation of the correction parameters contained in the correction mode.
[0042] Step 42, arrange all fourth codes in ascending order, and arrange the first fourth code at the position of the first deleted second code to generate a second code array.
[0043] In this embodiment, because the selected first test subroutine is deleted, the test step corresponding to the first test subroutine is vacant, and the first test subroutine after the first test subroutine naturally becomes the first test subroutine executed in the next test step. Therefore, the generation of the second coding array is completed by moving the codes and index information corresponding to all the first test subroutines after each deleted second test subroutine forward one step.
[0044] Through the above steps 41 to 42, multiple second codes are deleted in the first code array in order from front to back in the sorting order, and among all the first codes in the first code array, all first codes located after the first deleted second code are detected to obtain the fourth code; all fourth codes are arranged in order from small to large, and the first fourth code is arranged at the position of the first deleted second code to generate the second code array, so as to update the test program in the deletion mode.
[0045] In some embodiments, based on the second encoding array, the first CSV file is modified and updated to generate a second CSV file corresponding to the target test program, which is achieved by the following steps: Step 51, obtaining all fifth codes corresponding to the second code array, and determining third index information associated with each fifth code, wherein the third index information includes one of the first index information and the second index information.
[0046] Step 52, among all the first test subroutines corresponding to the first CSV file, based on each third index information associated with each fifth code, determine the first test subroutines corresponding to each fifth code, and obtain the target test subroutines.
[0047] In this embodiment, after the new second coding array is determined, associations are established between all fifth codes in the second coding array and the corresponding first test subroutines, and then all target test subroutines corresponding to the target test program are determined.
[0048] Step 53, convert the target information corresponding to all target test subroutines and the corresponding fifth codes into two-dimensional arrays to generate a second CSV file.
[0049] In this embodiment, the target information of the target test subroutine and the corresponding fifth code are converted into two-dimensional data to form a loadable CSV file. By loading and initializing the CSV file, an executable target test program can be obtained, and the FCT test can be performed according to the expected test steps.
[0050] Through the above steps 51 to 53, all fifth codes corresponding to the second code array are obtained, and the third index information associated with each fifth code is determined, wherein the third index information includes one of the first index information and the second index information; in all first test subprograms corresponding to the first CSV file, based on each third index information associated with each fifth code, the first test subprogram corresponding to each fifth code is determined to obtain the target test subprogram; the target information corresponding to all target test subprograms and the corresponding fifth codes are converted into two-dimensional arrays to generate a second CSV file, thereby generating a CSV file corresponding to the updated target test program.
[0051] In some embodiments, initializing and generating a target test program according to the second CSV file includes the following steps: Step 61, after loading the second CSV file into the table control, obtain the target test subroutine corresponding to each fifth code.
[0052] Step 62, according to the order of each fifth code, all target test subroutines are initialized and loaded to obtain the target test program.
[0053] In some of the embodiments, before obtaining multiple second index information selected from multiple first index information corresponding to the currently executed test program, the following steps are also implemented: From the editing interface corresponding to the table control that loads the second CSV file, obtain the editing control selected by the user to generate correction information, wherein one editing control corresponds to one correction mode.
[0054] This embodiment also provides a device for generating a test program, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "module", "unit", "subunit" and the like can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0055] Figure 3 is a structural block diagram of a test program generation device according to an embodiment of the present application, such as Figure 3 As shown, the device includes an acquisition module 31, a detection module 32, a processing module 33 and a generation module 34, wherein: An acquisition module 31 is used to acquire a plurality of second index information selected from a plurality of first index information corresponding to a currently executed test program, wherein the first index information is generated after a first CSV file corresponding to the test program is loaded into a preset table control, one first index information corresponds to one first test subprogram, and the second index information is the first index information corresponding to the selected second test subprogram; The detection module 32 is coupled to the acquisition module 31 and is used to detect the first code currently corresponding to each second index information among all the first codes in the first code array corresponding to the first CSV file, and obtain a plurality of second codes, wherein the order of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the currently executed test program; The processing module 33 is coupled to the detection module 32 and is used to generate a third code associated with each second test subprogram based on the second code and the correction information corresponding to all the second test subprograms, and to update the first code array according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subprograms in the target test program after the execution order of all the second test subprograms is corrected according to the correction information; The generating module 34 is coupled to the processing module 33, and is used to modify and update the first CSV file based on the second coding array to generate a second CSV file corresponding to the target test program, and initialize the generation of the target test program according to the second CSV file.
[0056] Through the above-mentioned generating device, a plurality of second index information selected from a plurality of first index information corresponding to the currently executed test program is obtained, the first index information is generated after the first CSV file corresponding to the test program is loaded into a preset table control, one first index information corresponds to a first test subroutine, and the second index information is the first index information corresponding to the selected second test subroutine; among all the first codes of the first coding array corresponding to the first CSV file, the first code currently corresponding to each second index information is detected to obtain a plurality of second codes, and the order of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the currently executed test program; based on the second code and the correction information corresponding to all the second test subroutines, a third code associated with each second test subroutine is generated, and The first coding array is updated according to the third coding to generate a second coding array, wherein the third coding is used to represent the execution order of the second test subroutines in the target test program after the execution order of all second test subroutines is corrected according to the correction information; based on the second coding array, the first CSV file is corrected and updated to generate a second CSV file corresponding to the target test program, and the target test program is generated according to the second CSV file initialization, and the CSV file corresponding to the test program is loaded into a table control to generate a coding array including multiple index information, and the coding corresponding to the selected index information is corrected according to the preset correction information, and after the sorting position of the index information in the coding array is changed, the execution order of the test steps of the test program is replaced or the test steps are deleted, and the test steps of the test program are controllable, which solves the problem of poor flexibility and adaptability of the test program corresponding to the FCT software program in the related art, and realizes improving the flexibility of test program changes, saving test program modification time, and improving test efficiency.
[0057] In some embodiments, the processing module 33 further includes: The first determination unit is used to determine a correction mode for the second test subroutine according to the correction information, wherein the correction mode includes execution order modification and test subroutine deletion.
[0058] The first detection unit is coupled to the first determination unit, and is used to detect the preset execution order number corresponding to each second test subroutine from the correction parameters corresponding to the correction mode when the correction mode is execution order modification, wherein the preset execution order number is used to characterize the expected execution order of the second test subroutine in the target test program.
[0059] The first processing unit is coupled to the first detection unit and is used to use the second code corresponding to the preset execution sequence number as the third code associated with the second test subroutine corresponding to the preset execution sequence number.
[0060] In some of the embodiments, the processing module 33 is also used to detect all first codes except all third codes among all first codes in the first code array to obtain candidate codes; arrange all candidate codes and all third codes in a sorted order from front to back to generate a second code array.
[0061] In some of the embodiments, when the correction mode is test subroutine deletion, the generating device is also used to delete multiple second codes in the first code array in order from front to back in the sorting order, and detect all the first codes located after the first deleted second code in all the first codes in the first code array to obtain the fourth code; arrange all the fourth codes in order from small to large, and arrange the first fourth code in the position of the first deleted second code to generate the second code array.
[0062] In some embodiments, the generating module 34 further comprises: The first acquisition unit is used to acquire all fifth codes corresponding to the second code array, and determine third index information associated with each fifth code, wherein the third index information includes one of the first index information and the second index information.
[0063] The second determination unit is coupled to the first acquisition unit, and is used to determine the first test subprogram corresponding to each fifth code in all the first test subprograms corresponding to the first CSV file based on each third index information associated with each fifth code, so as to obtain the target test subprogram.
[0064] The first generating unit is coupled to the second determining unit and is used for performing two-dimensional array conversion on the target information corresponding to all target test subroutines and the corresponding fifth codes to generate a second CSV file.
[0065] In some of the embodiments, the generation module 34 is also used to obtain the target test subroutine corresponding to each fifth code after loading the second CSV file into the table control; initialize and load all the target test subroutines according to the order of each fifth code to obtain the target test program.
[0066] In some of the embodiments, before obtaining multiple second index information selected from multiple first index information corresponding to the currently executed test program, the generating device is also used to obtain the editing control selected by the user from the editing interface corresponding to the table control for loading the second CSV file to generate the correction information, wherein one editing control corresponds to one correction mode.
[0067] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0068] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0069] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program: S1, obtain multiple second index information selected from multiple first index information corresponding to the currently executed test program, wherein the first index information is generated after loading the first CSV file corresponding to the test program into a preset table control, one first index information corresponds to a first test subroutine, and the second index information is the first index information corresponding to the selected second test subroutine.
[0070] S2. Among all the first codes in the first code array corresponding to the first CSV file, detect the first code currently corresponding to each second index information to obtain multiple second codes, wherein the order of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the currently executed test program.
[0071] S3, based on the second code and the correction information corresponding to all the second test subroutines, generate a third code associated with each second test subroutine, and update the first code array according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subroutines in the target test program after the execution order of all the second test subroutines is corrected according to the correction information.
[0072] S4, based on the second coding array, modify and update the first CSV file to generate a second CSV file corresponding to the target test program, and initialize and generate the target test program according to the second CSV file.
[0073] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0074] In addition, in combination with the test program generation method in the above embodiment, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any test program generation method in the above embodiment is implemented.
[0075] Those skilled in the art should understand that the technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0076] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for generating a test program, characterized in that: include: Obtain multiple second index information selected from multiple first index information corresponding to the currently executed test program, wherein the first index information is generated after loading the first CSV file corresponding to the test program into a preset table control, one first index information corresponds to a first test subroutine, and the second index information is the first index information corresponding to the selected second test subroutine; Among all the first codes of the first code array corresponding to the first CSV file, the first code currently corresponding to each second index information is detected to obtain a plurality of second codes, wherein the order of the first codes is used to represent the execution order of the first test subroutine corresponding to each first index information in the currently executed test program; Based on the second code and the correction information corresponding to all the second test subroutines, a third code associated with each of the second test subroutines is generated, and the first code array is updated according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subroutines in the target test program after the execution order of all the second test subroutines is corrected according to the correction information; Based on the second encoding array, the first CSV file is modified and updated to generate a second CSV file corresponding to the target test program, and the target test program is initialized and generated according to the second CSV file.
2. The generation method according to claim 1, characterized in that: Based on the second code and the correction information corresponding to all the second test subroutines, generating a third code associated with each of the second test subroutines, including: Determine, according to the correction information, a correction mode for correcting the second test subroutine, wherein the correction mode includes execution order modification and test subroutine deletion; In the case where the correction mode is execution order modification, detecting a preset execution order number corresponding to each second test subroutine from the correction parameters corresponding to the correction mode, wherein the preset execution order number is used to characterize the expected execution order of the second test subroutine in the target test program; The second code corresponding to the preset execution sequence number is used as the third code associated with the second test subroutine corresponding to the preset execution sequence number.
3. The generation method according to claim 2, characterized in that: The first encoding array is updated according to the third encoding to generate a second encoding array, including: Among all the first codes in the first code array, all the first codes except all the third codes are detected to obtain candidate codes; All the candidate codes and all the third codes are arranged in a sorting order from front to back to generate the second code array.
4. The generation method according to claim 2, characterized in that: In the case where the correction mode is test subroutine deletion, the method further includes: In the first coding array, a plurality of the second codings are deleted in order from front to back in sorting order, and among all the first codings in the first coding array, all the first codings after the first deleted second coding are detected to obtain a fourth coding; All the fourth codes are arranged in ascending order, and the first fourth code is arranged at the position of the first deleted second code, so as to generate the second code array.
5. The generation method according to claim 1, characterized in that: Based on the second encoding array, the first CSV file is modified and updated to generate a second CSV file corresponding to the target test program, including: Obtain all fifth codes corresponding to the second code array, and determine third index information associated with each of the fifth codes, wherein the third index information includes one of the first index information and the second index information; In all the first test subprograms corresponding to the first CSV file, based on each of the third index information associated with each of the fifth codes, determine the first test subprogram corresponding to each of the fifth codes to obtain a target test subprogram; The target information corresponding to all the target test subroutines and the corresponding fifth codes are converted into two-dimensional arrays to generate the second CSV file.
6. The generation method according to claim 5, characterized in that: Initializing and generating the target test program according to the second CSV file includes: After loading the second CSV file into the table control, obtaining the target test subroutine corresponding to each of the fifth codes; According to the order of each of the fifth codes, all the target test subroutines are initialized and loaded to obtain the target test program.
7. The generation method according to claim 2, characterized in that: Before obtaining multiple second index information selected from multiple first index information corresponding to the currently executed test program, the method also includes: obtaining the editing control selected by the user from the editing interface corresponding to the table control that loads the second CSV file to generate the correction information, wherein one editing control corresponds to one correction mode.
8. A test program generating device, characterized in that: include: An acquisition module, used for acquiring a plurality of second index information selected from a plurality of first index information corresponding to a currently executed test program, wherein the first index information is generated after a first CSV file corresponding to the test program is loaded into a preset table control, one first index information corresponds to a first test subprogram, and the second index information is the first index information corresponding to a selected second test subprogram; A detection module, configured to detect the first code currently corresponding to each second index information among all the first codes of the first code array corresponding to the first CSV file, and obtain a plurality of second codes, wherein the order of the first codes is used to characterize the execution order of the first test subroutine corresponding to each first index information in the test program currently being executed; A processing module, used for generating a third code associated with each of the second test subroutines based on the second code and the correction information corresponding to all the second test subroutines, and updating the first code array according to the third code to generate a second code array, wherein the third code is used to represent the execution order of the second test subroutines in the target test program after the execution order of all the second test subroutines is corrected according to the correction information; A generation module is used to modify and update the first CSV file based on the second encoding array to generate a second CSV file corresponding to the target test program, and initialize the generation of the target test program according to the second CSV file.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps of the test program generation method according to any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the test program generation method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Ordered batch test method and system, terminal and storage medium
CN111338964A
Method, device and system for generating test sample
CN116560969A
Testing method and testing apparatus for testing function of electronic apparatus
US20130145217A1