CN116662189A - Program testing method, device, equipment and storage medium - Google Patents

Program testing method, device, equipment and storage medium Download PDF

Info

Publication number
CN116662189A
CN116662189A CN202310658434.XA CN202310658434A CN116662189A CN 116662189 A CN116662189 A CN 116662189A CN 202310658434 A CN202310658434 A CN 202310658434A CN 116662189 A CN116662189 A CN 116662189A
Authority
CN
China
Prior art keywords
brushing
program
test
code
tested
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
Application number
CN202310658434.XA
Other languages
Chinese (zh)
Inventor
葛坚
谢朱庆
刘泽凌
林斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Zhiyu Automobile Technology Co ltd
Original Assignee
Jiangsu Zhiyu Automobile Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Jiangsu Zhiyu Automobile Technology Co ltd filed Critical Jiangsu Zhiyu Automobile Technology Co ltd
Priority to CN202310658434.XA priority Critical patent/CN116662189A/en
Publication of CN116662189A publication Critical patent/CN116662189A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a program testing method, which comprises the following steps: determining a functional unit to be tested from a target brushing program, and acquiring a test code corresponding to the functional unit to be tested; writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, and executing the first flashing program by a flashing upper computer to perform a flashing operation to obtain a first flashing result corresponding to the test code; executing the target refreshing program by the refreshing upper computer to carry out refreshing operation under the condition that the first refreshing result is matched with the expected error corresponding to the test code, so as to obtain a second refreshing result corresponding to the test code; and under the condition that the second brushing result is successful brushing, judging that the functional unit to be tested passes the test. By the method, various possible brushing scenes of the brushing program can be tested, the testing content is relatively comprehensive, and the accuracy of the testing result is improved.

Description

Program testing method, device, equipment and storage medium
Technical Field
The application belongs to the technical field of program testing, and particularly relates to a program testing method, a program testing device, program testing equipment and a storage medium.
Background
With the rapid development of the computer industry and the electronic industry, the degree of intellectualization of various electronic devices is also increasing. Various control units have been developed that can store a running computer program for controlling some of the hardware circuitry and performing some of the functions. The computer programs stored by these control units are typically written into the control units by writing to the host computer and writing to the writing software in the host computer.
In the prior art, the refreshing software can be deployed first, then test cases are generated, then the test cases are refreshed by the refreshing software, and if the test cases can be successfully refreshed, the refreshing software passes the test.
However, the test is performed by the scheme in the prior art, the test content is not comprehensive enough, and the accuracy of the test result is poor.
Disclosure of Invention
The application aims to provide a program testing method, a program testing device, electronic equipment and a storage medium, so as to solve the problem of poor accuracy of a program testing result in the prior art.
In order to solve the technical problems, the application is realized as follows:
a program testing method, the method comprising:
determining a functional unit to be tested from a target brushing program, and acquiring a test code corresponding to the functional unit to be tested;
writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, and executing the first flashing program by a flashing upper computer to perform a flashing operation to obtain a first flashing result corresponding to the test code;
executing the target refreshing program by the refreshing upper computer to carry out refreshing operation under the condition that the first refreshing result is matched with the expected error corresponding to the test code, so as to obtain a second refreshing result corresponding to the test code;
and under the condition that the second brushing result is successful brushing, judging that the functional unit to be tested passes the test.
Optionally, the number of functional units to be tested is greater than 1, and the method further includes:
and under the condition that each functional unit to be tested passes the test, judging that the test of the target brushing program passes.
Optionally, the determining the functional unit to be tested from the target brushing program includes:
executing the target brushing program by the brushing upper computer to perform brushing operation to obtain a target brushing result;
and under the condition that the target brushing result is that the brushing is successful, determining the functional unit to be tested from the target brushing program.
Optionally, the functional unit to be tested includes at least one of a refresh session unit, a data reading unit, a secure access unit, a download request unit, a data transmission unit, an exit transmission request unit, and a reset unit.
Optionally, the test code includes at least one of a request service miss code, an address exception code, an unlock exception code, a data exception code, a check code exception code, a module miss code, and an interrupt code; the request service missing code is used for intercepting request service, the addressing exception code is used for changing a target address of the addressing service, the unlocking exception code is used for executing data unlocking, the data exception code is used for modifying data length, data type or data system, the check code exception code is used for modifying check code, the module missing code is used for simulating module missing, and the interrupt code is used for simulating transmission interrupt.
Optionally, the method further comprises:
and under the condition that the first brushing result is not matched with the expected error or the second brushing result is the brushing failure, judging that the functional unit to be tested fails to test.
Optionally, the method further comprises:
and displaying the test code under the condition that the first brushing result is not matched with the expected error or the second brushing result is the brushing failure.
A program testing apparatus, the apparatus comprising:
the first acquisition module is used for determining a functional unit to be tested from a target brushing program and acquiring a test code corresponding to the functional unit to be tested;
the first execution module is used for writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, and executing the first flashing program to perform a flashing operation through a flashing upper computer to obtain a first flashing result corresponding to the test code;
the second execution module executes the target refreshing program to carry out refreshing operation through the refreshing upper computer under the condition that the first refreshing result is matched with the expected error, and a second refreshing result corresponding to the test code is obtained;
and the first judging module is used for judging that the functional unit to be tested passes the test under the condition that the second writing result is writing success.
Optionally, the number of functional units to be tested is greater than 1, and the apparatus further comprises:
and the second judging module is used for judging that the target brushing program passes the test under the condition that each functional unit to be tested passes the test.
Optionally, the first acquisition module includes:
the execution sub-module is used for executing the target refreshing program through the refreshing upper computer to carry out refreshing operation so as to obtain a target refreshing result;
and the determining submodule is used for determining the functional unit to be tested from the target brushing program under the condition that the target brushing result is that the brushing is successful.
Optionally, the apparatus further comprises:
and the judging module is used for judging that the functional unit to be tested fails to test under the condition that the first brushing result is not matched with the expected error or the second brushing result is the brushing failure.
Optionally, the apparatus further comprises:
and the display module is used for displaying the test code under the condition that the first writing result is not matched with the expected error or the second writing result is writing failure.
An electronic device comprising a processor and a memory having stored therein at least one instruction, at least one program, code set or instruction set that is loaded and executed by the processor to implement a program test method as described above.
A computer readable storage medium having stored therein at least one instruction or at least one program loaded and executed by a processor to implement a program testing method as described above.
Compared with the prior art, the method and the device have the advantages that the functional unit to be tested is determined from the target brushing program, the test code corresponding to the functional unit to be tested is obtained, and the brushing program can be split, so that the test object is thinned; writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, executing the first flashing program by a flashing upper computer to perform flashing operation to obtain a first flashing result corresponding to the test code, and simulating a corresponding test scene by using the test code to test the flashing program; executing the target refreshing program by the refreshing upper computer to carry out refreshing operation under the condition that the first refreshing result is matched with the expected error corresponding to the test code, so as to obtain a second refreshing result corresponding to the test code, and verifying the applicability of a test scene corresponding to the test code after the test corresponding to the test code is completed; and under the condition that the second refreshing result is that the refreshing is successful, judging that the functional unit to be tested passes the test, and judging that the whole test process is effective after the applicability of the test scene passes the verification. By the method, various possible brushing scenes of the brushing program can be tested, the testing content is relatively comprehensive, and the accuracy of the testing result is improved.
The foregoing description is only an overview of the present application, and is intended to be implemented in accordance with the teachings of the present application in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present application more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow chart of a program testing method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating another testing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a program test according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a specific implementation of a program testing method according to an embodiment of the present application;
FIG. 5 is a logic block diagram of a program testing apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.
Referring to fig. 1, fig. 1 is a flowchart of a program testing method according to an embodiment of the present application, where the method may include:
step 101, determining a functional unit to be tested from a target flashing program, and obtaining a test code corresponding to the functional unit to be tested.
In an embodiment of the present application, a program for flushing may be acquired in program flushing software, which is called a target flushing program. Some program segments may be determined in the target brushprogram as functional units to be tested. These program segments may be an execution statement within a program, may be a sub-function, or may be a loop or other block of code that performs a complete function.
In particular, the flashing software for performing the flashing function may generally consist of a front-end panel and back-end function code. The front panel may include some user interfaces, and in particular may include a display interface and an operator interface; the back-end function code may be stored in some buffer registers. To facilitate software debugging, each buffer may typically store a corresponding code for a function. The function may be a specific overwriting step in the overwriting process, such as reading the overwritten file, encoding the overwritten file, erasing a memory area of the overwritten device, data transfer, etc. In addition, each buffer register has a fixed virtual address through which writing and/or modifying operations can be performed if debugging is desired for the function code stored in a certain buffer register. After the functional unit to be tested is determined, a test code corresponding to the functional unit to be tested can be obtained in the upper computer for testing the functional unit to be tested. It should be noted that, the refreshing related to the embodiment of the present application may refer to a process of refreshing a refreshed file into a receiving terminal device through a refreshing software. The written files may be some assembly language programs, some application software, or some operating system, which the present application is not limited to.
Step 102, writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, and executing the first flashing program by a flashing upper computer to perform a flashing operation to obtain a first flashing result corresponding to the test code.
In the embodiment of the present application, the upper computer may be a computer capable of directly sending a control command, for directly controlling some devices or hardware connected to the upper computer, and the upper computer for brushing may be an upper computer carrying brushing software, where the brushing software may write some of the brushed files into the devices and hardware connected to the upper computer for brushing, that is, the receiving terminal device.
In an embodiment of the present application, the brushing may be one of: firstly, the upper computer for writing is connected with the receiving terminal equipment, then the writing software carried on the upper computer for writing is started, the writing software is operated to load the written file, then the writing software is started to write the written file into the receiving terminal equipment, after writing is completed, the receiving terminal equipment can send a feedback signal, and after receiving the feedback signal, the upper computer for writing can confirm that writing is successful.
In the embodiment of the application, after the corresponding test code is obtained, the test code can be written into the corresponding position of the functional unit to be tested through a background debugging tool of the software to be refreshed. The written result may then be marked and saved, thus forming a first brushwrite program. Then, the upper computer for brushing can start brushing software to perform brushing operation, and then a brushing result corresponding to the brushing operation can be obtained, which is called a first brushing result.
And step 103, executing the target refreshing program by the refreshing upper computer to perform refreshing operation under the condition that the first refreshing result is matched with the expected error corresponding to the test code, so as to obtain a second refreshing result corresponding to the test code.
In an embodiment of the application, the test code may correspond to an expected error, e.g. the test code performs a second assignment of a parameter in the functional unit to be tested, so that after performing a flushing operation, a flushing error should occur due to this second assignment, in which case the first flushing result may be considered to match the expected error corresponding to the test code.
Therefore, when the first refreshing result is matched with the expected error corresponding to the test code, it can be determined that the refreshing test of the first refreshing program is passed, and then the target refreshing program can be executed by the refreshing upper computer to perform a second refreshing operation, so that a second refreshing result of the second refreshing operation can be obtained.
It should be noted that the second writing result still corresponds to the test code, and is used to provide a reference for the whole test process of the test code.
And 104, judging that the functional unit to be tested passes the test under the condition that the second brushing result is that the brushing is successful.
In embodiments of the present application, since the second brushing result is based on the target brushing program, the expected result of the second brushing operation may be that the brushing was successful. And further, under the condition that the second brushing result is that the brushing is successful, the functional unit to be tested can be judged to pass the test.
In the embodiment of the application, the upper refreshing computer and the vehicle-mounted controller can be connected, and further the upper refreshing computer can be used for refreshing the refreshed file into the vehicle-mounted controller. In the process of refreshing, the refreshing process can be interrupted by the test code to simulate the disconnection scene in the refreshing process, the test code can be deleted under the condition that the refreshing process is confirmed to fail, the refreshing operation can be carried out again, and the test can be judged to pass under the condition that the second refreshing process is confirmed to be successful.
In the embodiment of the application, the functional unit to be tested is determined from the target brushing program, and the test code corresponding to the functional unit to be tested is obtained, so that the brushing program can be split, and the test object is refined; writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, executing the first flashing program by a flashing upper computer to perform flashing operation to obtain a first flashing result corresponding to the test code, and simulating a corresponding test scene by using the test code to test the flashing program; executing the target refreshing program by the refreshing upper computer to carry out refreshing operation under the condition that the first refreshing result is matched with the expected error corresponding to the test code, so as to obtain a second refreshing result corresponding to the test code, and verifying the applicability of a test scene corresponding to the test code after the test corresponding to the test code is completed; and under the condition that the second refreshing result is that the refreshing is successful, judging that the functional unit to be tested passes the test, and judging that the whole test process is effective after the applicability of the test scene passes the verification. By the method, various possible brushing scenes of the brushing program can be tested, the testing content is relatively comprehensive, and the accuracy of the testing result is improved.
Referring to fig. 2, fig. 2 is a flow chart of another program testing method according to an embodiment of the present application, where the method may include:
and step 201, executing the target brushing program by the brushing upper computer to perform brushing operation, and obtaining a target brushing result.
In the embodiment of the application, the first brushing operation can be executed by brushing the brushing software in the upper computer, so that the result of the current brushing operation can be obtained, which is called a target brushing result and is used for verifying the brushing program corresponding to the current brushing software, namely the target brushing program. The target swipe result may include a successful swipe and a failed swipe.
Step 202, determining a functional unit to be tested from a target brushing program and obtaining a test code corresponding to the functional unit to be tested when the target brushing result is that the brushing is successful.
In an embodiment of the present application, the functional unit to be tested may include at least one of a refresh session unit, a data reading unit, a secure access unit, a download request unit, a data transmission unit, an exit transmission request unit, and a reset unit. The test code may include a request service miss code, an address exception code, an unlock exception code, a data exception code, a check code exception code, a module miss code, an interrupt code, and the like. The system comprises a request service missing code, an address exception code, an unlocking exception code, a data exception code, a check code exception code and a module missing code, wherein the request service missing code is used for intercepting a request service, the address exception code is used for changing a target address of the address service, the unlocking exception code is used for executing data unlocking, the data exception code is used for modifying a data length, a data type or a data system, the check code exception code is used for modifying the check code, the module missing code is used for simulating module missing, the interrupt code is used for simulating transmission interrupt, and the transmission interrupt comprises physical interrupt and interrupt caused by some other conditions.
In the embodiment of the application, under the condition that the target writing result is writing success, the functional unit to be tested can be determined from the target writing program, and then the test code corresponding to the functional unit to be tested can be obtained based on the information of the functional unit to be tested. In the embodiment of the present application, the other implementation contents of the step may refer to the implementation contents of step 101, and will not be described herein.
In the embodiment of the application, the target brushing program is executed by the brushing upper computer to perform brushing operation to obtain a target brushing result, then the functional unit to be tested is determined from the target brushing program under the condition that the target brushing result is successful in brushing, the test code corresponding to the functional unit to be tested is obtained, and the brushing program can be verified before testing, so that the effectiveness of the subsequent testing can be ensured.
And 203, writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, and executing the first flashing program by a flashing upper computer to perform a flashing operation to obtain a first flashing result corresponding to the test code.
In the embodiment of the present application, the implementation content of the step 102 is referred to, and will not be described herein.
And 204, executing the target refreshing program by the refreshing upper computer to perform refreshing operation under the condition that the first refreshing result is matched with the expected error corresponding to the test code, so as to obtain a second refreshing result corresponding to the test code.
In the embodiment of the present application, the implementation content of the step may refer to the implementation content of step 103, and will not be described herein.
And step 205, determining that the functional unit to be tested passes the test under the condition that the second brushing result is that the brushing is successful.
In the embodiment of the present application, the implementation content of the step may refer to the implementation content of step 104, which is not described herein.
And step 206, determining that the target brushware program test passes under the condition that each functional unit to be tested passes the test.
In an embodiment of the present application, the target brushprogram may include a plurality of functional units to be tested, where the functional units to be tested have respective corresponding test codes, and the test codes may be used to simulate a certain test scenario to test the brushwriting process under various conditions.
In the embodiment of the application, the upper computer for brushing can perform traversal test on each functional unit to be tested in the target brushing program to obtain brushing test results corresponding to each functional unit to be tested, wherein the traversal test can be serial test, namely, each functional unit to be tested is tested one by one, or parallel test, namely, each functional unit to be tested is tested simultaneously. In the case of serial testing, the order in which the functional units to be tested are tested can be determined freely, i.e. not in the top-to-bottom order shown by the brushing flow. In addition, it may be determined that the target brushwrite program passes the test in the case where all of the respective functional units to be tested pass the test. At this time, the test scenes corresponding to the functional units to be tested of the target brushing program are all tested.
In the embodiment of the application, the whole brushing flow can be tested by judging the step of passing the test of the target brushing program under the condition that each functional unit to be tested passes the test, so that the accuracy of the brushing test can be fully improved.
And step 207, sending a brushing failure prompt when the target brushing result is that the brushing fails.
In the embodiment of the application, when the target brushing result is the brushing failure, a brushing failure prompt can be sent for a tester to check and timely process the testing problem. In this case, it can be stated that the target brushstroke program has a problem, and the tester can transfer the problem to the developer for processing.
In the embodiment of the application, by sending the prompt of the brushing failure when the target brushing result is the brushing failure, unnecessary tests performed under the condition that the brushing program has errors can be effectively avoided, the test reliability can be ensured, the test time cost can be saved, and the accuracy of the brushing test can be further improved.
And step 208, determining that the functional unit to be tested fails the test if the first writing result does not match the expected error or the second writing result is writing failure.
In embodiments of the present application, the first brushing results may include a number of situations, for example, matching with an expected error, not matching with an expected error. In the event of a mismatch with the expected error, an unexpected error and a successful brush are also included. Mismatch of the first brushing result with the expected error may generally be caused by misselection of the test code and/or mislocation of writing of the test code. Therefore, in this case, the current test may be interrupted, and it may be determined that the current test does not pass, and the test code may be displayed so that a tester solves the problem encountered in the current test based on the test code.
In the embodiment of the application, by judging that the test of the functional unit to be tested fails when the first brushing result is not matched with the expected error or the second brushing result is failed, the test process can be interrupted in time and the brushing test can be judged to fail when the first brushing result is not matched with the expected error, so that the time cost of the test can be effectively saved.
Step 209, displaying the test code if the first brushing result does not match the expected error or if the second brushing result is a brushing failure.
In the embodiment of the present application, since the brushing operation of the target brushing program has been performed once and the result of successful brushing is obtained, the second brushing result may be successful brushing in most cases. However, there is still a possibility that the second brushing result is a brushing failure. Since the flush procedure may typically be performed by the flush host computer on the receiving terminal device to flush the flushed file into the receiving terminal device, the case where the second flush result is a flush failure may typically be caused by the test code changing the default value of the port in some hardware of the receiving terminal device. Therefore, in this case, it can be considered that the test scenario corresponding to the test code exceeds the test range of the target writing program, and when the tester obtains that the second writing result is the writing failure, the tester can delete the corresponding test code, so as to avoid performing unnecessary writing test.
In the embodiment of the application, the test codes are displayed when the first brushing result is not matched with the expected error or the second brushing result is the brushing failure, so that the corresponding test codes can be displayed when the brushing test is not passed, the test fault is removed by a tester, and the reliability of the test is ensured.
In the embodiment of the application, the brushing operation can be executed through the brushing upper computer to obtain a target brushing result, then a functional unit to be tested can be determined from the target brushing program under the condition that the target brushing result is successful in brushing, a test code corresponding to the functional unit to be tested can be obtained, then the test code can be written into the functional unit to be tested of the target brushing program to obtain a first brushing program, the first brushing program is executed through the brushing upper computer to perform brushing operation to obtain a first brushing result corresponding to the test code, then the target brushing program can be executed through the brushing upper computer to obtain a second brushing result corresponding to the test code under the condition that the first brushing result is matched with an expected error corresponding to the test code, then the functional unit to be tested can be tested under the condition that the second brushing result is successful, finally the functional unit to be tested can be tested, and finally the functional unit to be tested can be tested under the condition that the test fails or the test fails under the condition that the test code is not tested, and the test can be tested under the condition that the test is failed, and the test result is not failed. By the method, a priori test can be performed once before reverse test is performed, so that unnecessary reverse test and forward test can be avoided, the time cost of test can be effectively saved, the brushing test process can be timely interrupted when the first brushing result and the second brushing result are abnormal, the time cost can be effectively saved, corresponding test codes can be displayed in the brushing upper computer after the brushing test process is interrupted, the test personnel can check and reference the test codes, faults can be timely processed, and the accuracy of the test result can be further improved.
Referring to fig. 3, fig. 3 is a schematic diagram of a program test according to an embodiment of the present application. In the forward refreshing flow, the refreshing session control corresponds to a refreshing session unit, the data reading unit corresponds to the data reading unit, the secure access corresponds to the secure access unit, the download request corresponds to the download request unit, the transmission data corresponds to the data transmission unit, the request for exiting the transmission corresponds to the exiting the transmission request unit, and the electric control unit resets the corresponding reset unit. The reverse test scene comprises a request service missing, a service addressing abnormality, a scene which does not meet the entering service condition, a scene which is abnormally unlocked, a scene which is lost by a module, a scene which is abnormal in data length, a scene which is abnormal in check code, a scene which is abnormally powered off in the process of refreshing, a scene which is interrupted in the process of refreshing, a scene which is high in network load rate of refreshing, and the like. In the reverse test scenario, test codes may be used to simulate those scenarios, where scenarios that do not meet the incoming service conditions, scenarios that are abnormally powered off during a flush, scenarios that are network disrupted during a flush, and scenarios that flush the high load rate of the network may all be simulated with interrupt codes. Each reverse test scene can be independently injected into the brushing flow to form a reverse test scheme.
Referring to fig. 4, fig. 4 is a flowchart of a specific implementation of a program testing method according to an embodiment of the present application. Wherein, starting the refresh session 0x10 indicates that the storage address of the refresh session unit is 0x10,0x10 is a 16-bit address indicating method, wherein 0x indicates that the address is in a 16-bit format, and 10 indicates the specific location of the address; other similar expressions in fig. 4 may be interpreted with reference to 0x 10. It should be noted that, for a certain functional unit to be tested, not all reverse test scenarios are necessarily applicable, and thus the reverse test scenarios may be categorized. The refreshing session unit corresponding to the refreshing session starting can be suitable for requesting service missing, service addressing abnormality, service sub-function unsupported, and network interruption in the process of refreshing; the data reading unit corresponding to the data read according to the identifier can be suitable for requesting service missing, failing to meet the scene of entering service, abnormal identifier, inhibiting response request and abnormal power failure in the process of refreshing; the secure access unit corresponding to the secure access may be adapted to request service absence, abnormal unlocking, access level error, request sequence error, and Key (Key) transmission error; the download request unit corresponding to the download request can be suitable for request service missing, service addressing abnormality, sub-function inconsistency, head address error and data length abnormality; the data transmission unit corresponding to the transmission data can be suitable for requesting service missing, service addressing abnormality, byte number exceeding the maximum of the module, module missing and high load rate of the network refreshing; the request unit for exiting transmission corresponding to the request for exiting transmission can be suitable for request service missing, service addressing abnormality, sub-function inconsistency, check code error and request exiting time error; the reset unit corresponding to the reset of the electric control unit can be suitable for requesting service missing, service addressing abnormality, sub-function inconsistency and inhibiting positive response. It should be noted that each reverse test scenario in fig. 4 is a specific description of the reverse test scenario in fig. 3, and is not a new reverse test scenario, for example, the suppression affirmative response and the suppression response request belong to one of interrupts.
Referring to fig. 5, fig. 5 is a logic block diagram of a program testing apparatus according to an embodiment of the present application, the program testing apparatus 300 may include:
the first obtaining module 301 is configured to determine a functional unit to be tested from a target brushing program, and obtain a test code corresponding to the functional unit to be tested;
the first execution module 302 is configured to write the test code into the functional unit to be tested of the target flush program to obtain a first flush program, execute the first flush program by using a flush host computer to perform a flush operation, and obtain a first flush result corresponding to the test code;
the second execution module 303 executes the target brushing program to perform brushing operation through the brushing upper computer to obtain a second brushing result corresponding to the test code when the first brushing result is matched with the expected error;
and the first determining module 304 is configured to determine that the functional unit to be tested passes the test if the second writing result is that writing is successful.
Optionally, the number of functional units to be tested is greater than 1, and the apparatus 300 further includes:
and the second judging module is used for judging that the target brushing program passes the test under the condition that each functional unit to be tested passes the test.
Optionally, the first obtaining module 301 includes:
the execution sub-module is used for executing the target refreshing program through the refreshing upper computer to carry out refreshing operation so as to obtain a target refreshing result;
and the determining submodule is used for determining the functional unit to be tested from the target brushing program under the condition that the target brushing result is that the brushing is successful.
Optionally, the apparatus 300 further includes:
and the judging module is used for judging that the functional unit to be tested fails to test under the condition that the first brushing result is not matched with the expected error or the second brushing result is the brushing failure.
Optionally, the apparatus 300 further includes:
and the display module is used for displaying the test code when the first brushing result is not matched with the expected error or the second brushing result is the brushing failure.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
The program testing device has the same advantages as those of the program testing method described in the foregoing embodiment compared with the prior art, and will not be described herein.
An embodiment of the present application provides an electronic device, referring to fig. 6, the electronic device 60 includes: a processor 601, a memory 602, and a computer program 6021 stored on the memory 602 and executable on the processor 601, the processor 601 implementing the program test method of the foregoing embodiment when executing the program.
An embodiment of the present application provides a readable storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform the program test method described above.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A program testing method, the method comprising:
determining a functional unit to be tested from a target brushing program, and acquiring a test code corresponding to the functional unit to be tested;
writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, and executing the first flashing program by a flashing upper computer to perform a flashing operation to obtain a first flashing result corresponding to the test code;
executing the target refreshing program by the refreshing upper computer to carry out refreshing operation under the condition that the first refreshing result is matched with the expected error corresponding to the test code, so as to obtain a second refreshing result corresponding to the test code;
and under the condition that the second brushing result is successful brushing, judging that the functional unit to be tested passes the test.
2. The method according to claim 1, wherein the number of functional units to be tested is greater than 1, the method further comprising:
and under the condition that each functional unit to be tested passes the test, judging that the test of the target brushing program passes.
3. The method of claim 1, wherein the determining the functional unit to be tested from the target brushprogram comprises:
executing the target brushing program by the brushing upper computer to perform brushing operation to obtain a target brushing result;
and under the condition that the target brushing result is that the brushing is successful, determining the functional unit to be tested from the target brushing program.
4. The method of claim 1, wherein the functional unit to be tested comprises at least one of a refresh session unit, a data read unit, a secure access unit, a download request unit, a data transfer unit, an exit transfer request unit, a reset unit.
5. The method of claim 1, wherein the test code comprises at least one of a request service miss code, an address exception code, an unlock exception code, a data exception code, a check code exception code, a module miss code, an interrupt code; the request service missing code is used for intercepting request service, the addressing exception code is used for changing a target address of the addressing service, the unlocking exception code is used for executing data unlocking, the data exception code is used for modifying data length, data type or data system, the check code exception code is used for modifying check code, the module missing code is used for simulating module missing, and the interrupt code is used for simulating transmission interrupt.
6. The method according to any one of claims 1 to 5, further comprising:
and judging that the functional unit to be tested fails to test under the condition that the first brushing result is not matched with the expected error or the second brushing result is the brushing failure.
7. The method according to any one of claims 1 to 5, further comprising:
and displaying the test code under the condition that the first brushing result is not matched with the expected error or the second brushing result is the brushing failure.
8. A program testing apparatus, the apparatus comprising:
the first acquisition module is used for determining a functional unit to be tested from a target brushing program and acquiring a test code corresponding to the functional unit to be tested;
the first execution module is used for writing the test code into the functional unit to be tested of the target flashing program to obtain a first flashing program, and executing the first flashing program to perform a flashing operation through a flashing upper computer to obtain a first flashing result corresponding to the test code;
the second execution module executes the target refreshing program to carry out refreshing operation through the refreshing upper computer under the condition that the first refreshing result is matched with the expected error, and a second refreshing result corresponding to the test code is obtained;
and the first judging module is used for judging that the functional unit to be tested passes the test under the condition that the second writing result is writing success.
9. An electronic device comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the program testing method of any one of claims 1-7.
10. A computer readable storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by a processor to implement the program testing method of any one of claims 1 to 7.
CN202310658434.XA 2023-06-05 2023-06-05 Program testing method, device, equipment and storage medium Pending CN116662189A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310658434.XA CN116662189A (en) 2023-06-05 2023-06-05 Program testing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310658434.XA CN116662189A (en) 2023-06-05 2023-06-05 Program testing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116662189A true CN116662189A (en) 2023-08-29

Family

ID=87718675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310658434.XA Pending CN116662189A (en) 2023-06-05 2023-06-05 Program testing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116662189A (en)

Similar Documents

Publication Publication Date Title
US20050268195A1 (en) Apparatus and method for improving emulation speed of high-level languages in on-chip emulation systems
US6247146B1 (en) Method for verifying branch trace history buffer information
CN110688313B (en) Fault injection method for software testing under VxWorks operating system
EP0111952A2 (en) Verification of a processor architecture having a partial instruction set
CN110704314A (en) Fault injection method for embedded software test
JP3173855B2 (en) How to edit digital test vectors
CN114664369A (en) Memory chip testing method and device
US6539338B1 (en) Self-diagnostic testing of a network interface adapter
CN110704315B (en) Fault injection device for embedded software test
US20070226471A1 (en) Data processing apparatus
CN116662050A (en) Error injection support function verification method, device, terminal and medium
CN116662189A (en) Program testing method, device, equipment and storage medium
CN110737985A (en) Running data verification method and device, computer equipment and readable storage medium
CN115373929A (en) Test method, device, equipment, readable storage medium and program product
US5903719A (en) Emulator apparatus and emulation method for efficiently analyzing program faults
CN110096888B (en) Method and system for accelerating verification and analyzing SMM potential safety hazard
US7546589B2 (en) Semi-automated desk checking system and method
WO2021247074A1 (en) Resumable instruction generation
CN114048131B (en) Method, device and equipment for testing flow needing to be checked based on fuzzing
CN116909800B (en) Method and device for locating crash information and storage medium
US20230305938A1 (en) Method and device for determining coverage in hil testing, and storage medium
CN114138588B (en) Method, system, equipment and medium for deriving debug information of controller
CN113434386B (en) Method, system and storage medium for fuzz testing
CN117236277B (en) Method and device for checking register and electronic equipment
CN112527657B (en) Method and equipment for automatic pile insertion in unit test

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