Software testing method and apparatus, device, medium, program product

By building a test case library and a test environment based on virtual ECUs, the automated operation of automotive software testing was achieved, solving the problems of complex, cumbersome, repetitive, and time-consuming testing processes, and improving the efficiency and effectiveness of software testing.

CN120803958BActive Publication Date: 2025-12-09CHONGQING CHANGAN AUTOMOBILE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511281738.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-09
Publication Date
2025-12-09
Estimated Expiration
2045-09-09

AI Technical Summary

Technical Problem

Existing automotive software testing platforms and methods suffer from problems such as complex and cumbersome testing processes, repetitive and time-consuming testing procedures, and test execution interruptions, resulting in low software testing efficiency and effectiveness.

Method used

By building a test case library, including a controlled model library, a common test keyword library, a basic functional test case library, and a functional test case extension library, automated testing is performed based on the virtual ECU testing environment, reducing testing complexity and improving efficiency.

Benefits of technology

It has enabled the automated execution of software testing, reduced testing complexity and time consumption, greatly improved testing efficiency and effectiveness, and solved the problems of cumbersome and repetitive testing processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803958B_ABST
    Figure CN120803958B_ABST
Patent Text Reader

Abstract

The application provides a software testing method and device, equipment, medium and program product; based on the software testing method, in the first aspect, a management mode of constructing a test case public library is adopted, a controlled model library, a public test keyword library, a function test case basic library and a function test case extension library are strictly added, modified and deleted through a test case label, and the maximum reuse degree of test cases between different projects is effectively improved. In the second aspect, in the automatic testing and interruption protection of a software interface, a backup and execution log management mode is adopted, test case automatic screening, identification, conversion, interruption processing and regression testing are realized, sudden situations occurring in the testing process can be efficiently prevented, and the complete, stable and automatic execution of test cases is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software testing, in particular to a software testing method and device, equipment, medium and program product. BACKGROUND

[0002] With the continuous success of automotive software in the field of new energy and intelligence, the automobile gradually changes from a highly mechanical and electrical integrated mechanical terminal to an intelligent, expandable and sustainable iterative upgrade mobile electronic terminal.

[0003] At present, the in-the-loop testing of automotive software mainly relies on virtual electronic control unit (ECU) technology. The common automotive software testing platform and method have problems such as complex and tedious testing process, repeated and time-consuming testing process, which greatly reduces the efficiency and effect of software testing. SUMMARY

[0004] The present application provides a software testing method and device, equipment, medium and program product, which reduces the testing complexity, reduces the testing time, and greatly improves the efficiency and effect of software testing.

[0005] In a first aspect, the present application provides a software testing method, which comprises: obtaining project source code, a software interface table, testing requirements and project function information; constructing a test case library based on the project source code, the software interface table and the project function information; wherein the test case library comprises at least one or more of the following: a controlled model library, a public test keyword library, a functional test case basic library and a functional test case extension library; constructing a virtual ECU-based test environment based on the project source code, the testing requirements, the project function information and the test case library; determining a first test case of a first project function based on the test case library and the testing requirements of the first project function in the virtual ECU-based test environment, and performing automatic testing on the first project function based on the first test case to obtain a test result; wherein the first project function is a project function to be tested.

[0006] It can be understood that the software testing method provided by the present application can construct a test case library, wherein the test case library can include a controlled model library, a public test keyword library, a functional test case basic library and a functional test case extension library constructed based on the project source code, the software interface table and the project function information, and then in the subsequent software testing process, the constructed test case library can be used to realize the running of the automatic testing of each project function in the built virtual ECU-based test environment in combination with the testing requirements, which reduces the testing complexity, reduces the testing time, and greatly improves the efficiency and effect of software testing.

[0007] In some embodiments, the test case library is constructed based on the project source code, the software interface table and the project function information, including: determining the newly added project function based on the project source code, the software interface table and the project function information, and determining the test mode of the newly added project function; in the case that the test mode of the newly added project function is a preset mode, designing the controlled model and the executable file of the controlled model; adding the controlled model and the executable file of the controlled model to the controlled model library.

[0008] It can be understood that the software testing method provided by the embodiments of the present application can identify the test mode for the newly added project function, and construct the controlled model library by using the identified test mode, and then in the subsequent software testing process, the automatic testing of each project function can be run by using the constructed controlled model library, which reduces the testing complexity, reduces the testing time consumption, and greatly improves the efficiency and effect of software testing.

[0009] In some embodiments, the test case library is constructed based on the project source code, the software interface table and the project function information, including: determining the newly added project function based on the project source code, the software interface table and the project function information; in the case that the second test case called by the newly added project function exists, generating the keyword information corresponding to the newly added project function based on the second test case; and adding the keyword information to the public test keyword library.

[0010] It can be understood that the software testing method provided by the embodiments of the present application can determine whether the second test case called by the newly added project function exists, and construct the public test keyword library in the case that the second test case called by the newly added project function exists, and then in the subsequent software testing process, the automatic testing of each project function can be run by using the constructed public test keyword library, which reduces the testing complexity, reduces the testing time consumption, and greatly improves the efficiency and effect of software testing.

[0011] In some embodiments, the method further includes: determining the newly added project function based on the project source code, the software interface table and the project function information; and performing project range identification on the newly added project function to determine the identification result of the newly added project function.

[0012] It can be understood that the software testing method provided by the embodiments of the present application can obtain the corresponding identification result through project scope identification for the newly added project function, and the identification result can be used to determine the project label of the test case in the construction process of the test case library, and then in the subsequent software testing process, the constructed test case library can be used to realize the running of the automation testing of each project function in the built test environment based on the virtual ECU in combination with the test requirements, thereby reducing the testing complexity, reducing the testing time consumption, and greatly improving the efficiency and effect of the software testing.

[0013] In some embodiments, the test case library is constructed based on the project source code, the software interface table and the project function information, including: performing basic design of the test case for the newly added project function based on the function definition file included in the project function information, to obtain the basic test case of the newly added project function; determining the project label of the basic test case of the newly added project function based on the identification result of the newly added project function; and adding the basic test case of the newly added project function and the project label to the function test case basic library.

[0014] It can be understood that the software testing method provided by the embodiments of the present application can perform basic design of the test case for the newly added project function, and construct the function test case basic library by using the obtained basic test case, and then in the subsequent software testing process, the constructed function test case basic library can be used to realize the running of the automation testing of each project function, thereby reducing the testing complexity, reducing the testing time consumption, and greatly improving the efficiency and effect of the software testing.

[0015] In some embodiments, the test case library is constructed based on the project source code, the software interface table and the project function information, including: performing extension design of the test case for the newly added project function based on the function definition file included in the project function information and the basic test case of the newly added project function, to obtain the extension test case of the newly added project function; and adding the extension test case of the newly added project function and the project label to the function test case extension library.

[0016] It can be understood that the software testing method provided by the embodiments of the present application can perform extension design of the test case for the newly added project function, and construct the function test case extension library by using the obtained extension test case, and then in the subsequent software testing process, the constructed function test case extension library can be used to realize the running of the automation testing of each project function, thereby reducing the testing complexity, reducing the testing time consumption, and greatly improving the efficiency and effect of the software testing.

[0017] In some embodiments, based on the project source code, the test requirement, the project function information and the test case library, a virtual ECU-based test environment is constructed, including: generating an executable file of a master model based on the project source code; obtaining a controlled model of a second project function and an executable file of the controlled model of the second project function in a controlled model library; wherein the second project function is a project function to be tested indicated by the test requirement; and constructing the virtual ECU-based test environment based on the executable file of the master model and the executable file of the controlled model of the second project function.

[0018] It can be understood that the software testing method provided by the embodiments of the present application can reduce the complexity of the test case, solve the problem of low test efficiency caused by repeated updating operation in the process of updating the test case, and ultimately solve the technical problems of complex and tedious test process and repeated time-consuming test process, thereby greatly improving the efficiency and effect of software testing.

[0019] In some embodiments, based on the test case library and the test requirement of the first project function, a first test case of the first project function is determined, including: determining a project number of the first project function to be tested; and determining the first test case in the test case library based on the project number and the test requirement of the first project function.

[0020] It can be understood that the software testing method provided by the embodiments of the present application can select the corresponding test case from the constructed test case library for testing by the project number and the test requirement of the project function to be tested in the running process of the automatic test of the virtual ECU-based test environment, thereby reducing the test complexity and test time consumption, and greatly improving the efficiency and effect of software testing.

[0021] In some embodiments, based on the first test case, an automatic test of the first project function is performed to obtain a test result, including: generating a first test case execution file based on the first test case in the virtual ECU-based test environment; and automatically running the first test case execution file to obtain the test result.

[0022] It can be understood that the software testing method provided by the embodiments of the present application can test by automatically running the first test case execution file corresponding to the first test case in the running process of the automatic test of the virtual ECU-based test environment, thereby reducing the test complexity and test time consumption, and greatly improving the efficiency and effect of software testing.

[0023] In some embodiments, the method further comprises: recording and storing a running log corresponding to the first test case during automatic running of the first test case execution file; accordingly, the method further comprises: in the case of interruption of the automatic testing of the first project function, performing interruption protection processing based on the running log corresponding to the first test case.

[0024] It can be understood that the software testing method provided by the embodiments of the present application can record and store a running log corresponding to the first test case during the running of the automatic testing of the virtual ECU-based test environment, and perform interruption protection processing based on the running log corresponding to the first test case in the case of subsequent interruption, thereby reducing the testing complexity, reducing the testing time consumption, and greatly improving the efficiency and effect of software testing.

[0025] In a second aspect, the embodiments of the present application provide a software testing device, which comprises:

[0026] An acquisition unit is configured to acquire project source code, a software interface table, test requirements, and project function information.

[0027] A construction unit is configured to construct a test case library based on the project source code, the software interface table, and the project function information; wherein the test case library comprises at least one or more of the following: a controlled model library, a public test keyword library, a functional test case basic library, and a functional test case extension library.

[0028] The construction unit is further configured to construct a virtual ECU-based test environment based on the project source code, the test requirements, the project function information, and the test case library.

[0029] A determination unit is configured to determine a first test case of a first project function based on the test case library and test requirements of the first project function under the virtual ECU-based test environment; wherein the first project function is a project function to be tested.

[0030] A testing unit is configured to perform automatic testing of the first project function based on the first test case, and obtain a test result.

[0031] In a third aspect, the embodiments of the present application provide an electronic device, which comprises a memory and a processor, the memory stores a computer program capable of running on the processor, and the processor implements the software testing method of the first aspect when executing the program.

[0032] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the software testing method of the first aspect.

[0033] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program or instructions, which, when executed by a processor, implements the software testing method of the first aspect. BRIEF DESCRIPTION OF DRAWINGS

[0034] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application. It is apparent that the accompanying drawings are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.

[0035] The flowcharts shown in the drawings are only exemplary and do not necessarily include all contents and operations / steps, nor are they necessarily executed in the order described. For example, some operations / steps can be further divided, and some operations / steps can be combined or partially combined, so the actual execution order can be changed according to actual conditions.

[0036] Figure 1 Implementation flowchart of the software testing method provided by an embodiment of the present application Figure 1

[0037] Figure 2 Schematic diagram of the test case library provided by an embodiment of the present application

[0038] Figure 3 Schematic diagram of the functional test case basic library provided by an embodiment of the present application

[0039] Figure 4 Schematic diagram of the functional test case extension library provided by an embodiment of the present application

[0040] Figure 5 Implementation schematic diagram of the test case design provided by an embodiment of the present application

[0041] Figure 6 Implementation schematic diagram of the test case design provided by an embodiment of the present application

[0042] Figure 7 Implementation flowchart of the software testing method provided by an embodiment of the present application Figure 2

[0043] Figure 8 Implementation schematic diagram of the interruption protection of the test case provided by an embodiment of the present application

[0044] Figure 9 Implementation flowchart of the software testing method provided by an embodiment of the present application Figure 3 ​​​

[0045] Figure 10 A schematic diagram of a test system architecture is provided for embodiments of the present application.

[0046] Figure 11 A schematic diagram of a software testing device is provided for embodiments of the present application.

[0047] Figure 12 A schematic diagram of an electronic device is provided for embodiments of the present application. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.

[0049] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described below with reference to the drawings, and the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Therefore, the described embodiments should not be regarded as limitations on the present application, and all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.

[0050] In the following description, "some embodiments / other embodiments" are described, which describe a subset of all possible embodiments, but it can be understood that "some embodiments / other embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0051] In the following description, the terms "first / second" are only to distinguish similar objects, and do not represent a specific order of the objects. It can be understood that "first / second" can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

[0053] In the era of mobile travel, cars have gradually changed from purely mechanically driven hardware to software-driven electronic products. Today, the hardware configurations of different car manufacturers' products have gradually converged, and in the case of limited cost and functional improvement space, the reconstruction of the traditional automobile value chain is imperative. The core elements of differentiation created by car manufacturers have shifted to automotive software, which was previously deeply integrated with hardware. With the success of automotive software in the new energy and intelligent fields, it has become an industry consensus to enter the era of "Software Defined Vehicles (SDV)". "Software Defined Vehicles" reflects the transformation of cars from highly mechanical and electrical integrated mechanical terminals to intelligent, expandable, and sustainable iterative and upgraded mobile electronic terminals.

[0054] To achieve this goal, the vehicle pre-embeds hardware with superior performance before the standard operating procedure, and gradually unlocks and releases functions and values through Over-the-Air Technology (OTA) during the life cycle. The impact is first that the development cost of software and automotive electronics gradually increases, and the value of in-vehicle software and electronic hardware will gradually exceed that of hardware, becoming the core of the vehicle's value. Second, the performance and functionality changes brought about by software and software updates will determine the future differentiation of cars. Therefore, software updates and maintenance are the most economical, convenient, and fastest way for OEMs to provide differentiated experiences and improve customer satisfaction. Automotive software development uses a software and hardware decoupling approach to develop software and hardware independently, thereby reducing development costs, improving efficiency, and avoiding repeated vehicle verification. Therefore, how to transition the pure software development and verification process from a prototype vehicle or hardware-in-the-loop test to a software-in-the-loop test and verification is a key issue in achieving flexible updates during the vehicle's life cycle.

[0055] Currently, automotive software-in-the-loop testing mainly relies on virtual electronic control unit (ECU) technology, which converts real controllers into virtual controllers and deploys them to computer integration environments and joint simulation platforms to move automotive software testing forward to the early development stage to form a closed loop, thereby reducing automotive software development costs and time. During the conversion process, the automotive software source code needs to be processed multiple times, different interfaces need to be punched according to project requirements, and the testing process requires manual testing of test cases. The process is relatively cumbersome. Moreover, the basic functions of automotive software for different vehicle models have many similarities, and designing test cases for each project separately prolongs the software development cycle and wastes a lot of testing human resources. In addition, manual testing often cannot effectively prevent interruptions caused by computers, testing tools, or human error, and the testing process needs to be manually reset, which greatly affects the testing completion time.

[0056] At present, the common automobile software test platform and method can solve the problems of complicated test process and low test efficiency to a certain extent, but still has certain limitations, and cannot solve the problems of complicated test process, repeated test process, test execution interruption and the like, which greatly reduces the efficiency and effect of software test.

[0057] To solve the above problems, an embodiment of the present application provides a software test method, which acquires project source code, a software interface table, test requirements and project function information; constructs a test case library based on the project source code, the software interface table and the project function information; wherein the test case library comprises at least one or more of the following: a controlled model library, a public test keyword library, a function test case basic library and a function test case extension library; constructs a virtual ECU-based test environment based on the project source code, the test requirements, the project function information and the test case library; determines a first test case of a first project function based on the test case library and the test requirements of the first project function in the virtual ECU-based test environment, and performs automatic test on the first project function based on the first test case to obtain a test result; wherein the first project function is a project function to be tested. As can be seen, in the embodiment of the present application, the test case library can be constructed, wherein the test case library can comprise the controlled model library, the public test keyword library, the function test case basic library and the function test case extension library constructed based on the project source code, the software interface table and the project function information, wherein the controlled model library and the public test keyword library can be used for building the virtual ECU-based test environment, and the function test case basic library and the function test case extension library can be used for screening test cases, so that in the subsequent software test process, the complexity of the screened test cases can be reduced by building the virtual ECU-based test environment, and the test case library can be used to realize the operation of automatic test of each project function in combination with the test requirements. That is, the scheme provided in the embodiment of the present application can reduce the test complexity, reduce the test time consumption, and greatly improve the efficiency and effect of software test.

[0058] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.

[0059] An embodiment of the present application provides a software test method, which can be applied to a software test device or an electronic device, and can also be applied to any terminal or any vehicle device comprising the software test device or the electronic device.

[0060] It can be understood that the software testing method provided in the embodiments of the present application can include an automatic software interface testing method based on a virtual ECU, and is an automatic software interface testing mechanism which is efficient and reliable, easy to operate and stable in operation. All steps in the testing process are concentrated together, agile development, rapid iteration and reuse of test cases between different projects can be realized under rapid change of functional requirements, test interruption caused by external reasons can be avoided, automatic testing of software interfaces is realized, and the overall process of software-in-the-loop testing is greatly optimized.

[0061] In the following, the software testing method provided in the embodiments of the present application is exemplarily described by taking a software testing device as an example.

[0062] Further, in the embodiments of the present application, Figure 1 The implementation process of the software testing method provided in the embodiments of the present application is shown in Figure 1 As shown in Figure 1 The software testing method includes the following steps:

[0063] Step 101, obtaining project source code, a software interface table, test requirements and project function information.

[0064] In the embodiments of the present application, the software testing device can first obtain the project source code, the software interface table, the test requirements and the project function information.

[0065] In some embodiments, the project source code, the software interface table, the test requirements and the project function information can be obtained after the software development is completed. For example, after the automobile software is developed, the software testing device can obtain the project source code, the software interface table, the test requirements and the project function information through the submission of data and information performed by the developer.

[0066] In some embodiments, the project source code can be understood as a project source project.

[0067] In some embodiments, the software interface table is a list of all software interfaces designed for implementing the project function in the project source code; wherein the software interface table can include software interfaces used for implementing the function, mapping connection, etc.

[0068] In some embodiments, the test requirements are the functional range (test functional range) contained in the software testing, that is, the functional range of the corresponding test can be determined through the test requirements.

[0069] In some embodiments, the item function information can include one or more of the following: an item function list, a function definition file, a configuration word, and the like. The item function list can include item functions to be tested and corresponding item function names. The function definition file can include a file for specifically describing item functions. The configuration word can be used to implement item functions, for example, different configuration words correspond to different item functions.

[0070] In some embodiments, if an item function does not have a corresponding configuration word, the item function can be tested by default.

[0071] For example, in some embodiments, the configuration word corresponding to item function A can be 1, the configuration word corresponding to item function B can be 2, and the configuration word corresponding to item function C can be null.

[0072] For example, in some embodiments, after software development is completed, a developer can perform data and information submission, and accordingly, the software testing device can obtain one or more of the following: item source code, an item function list, a function definition file, a configuration word, and the like.

[0073] For example, in some embodiments, the software testing device can also obtain item source code, a software interface table, test requirements, and item function information in the form of a test admission specification. The test admission specification can include one or more of the following: item source code, an item function list, a function definition file, a software interface table, a configuration word, and the like.

[0074] At step 102, a test case library is constructed based on the item source code, the software interface table, and the item function information. The test case library includes one or more of the following: a controlled model library, a public test keyword library, a function test case base library, and a function test case extension library.

[0075] In the embodiments of the present application, after obtaining the item source code, the software interface table, the test requirements, and the item function information, the construction of the test case library can be further performed, that is, the test case library is constructed based on the item source code, the software interface table, and the item function information.

[0076] For example, in some embodiments, the software testing device can determine one or more of the following based on the obtained test admission specification: item source code, an added function list (including an added item function in the item function list), a function definition file, a software interface table, a configuration word, and the like, and then further construct the test case library based on one or more of the above information.

[0077] In some embodiments, the test case library can include one or more of the following: a controlled model library, a public test keyword library, a functional test case base library, and a functional test case extension library.

[0078] In some embodiments, the controlled model library and the public test keyword library in the test case library can be used to build a subsequent virtual ECU-based test environment. The virtual ECU-based test environment built based on the controlled model library and the public test keyword library can reduce the complexity of test cases, solve the problem of low test efficiency caused by repeated updating operations during test case updating, and ultimately solve technical problems such as complex and tedious test processes and time-consuming test procedures.

[0079] In some embodiments, the functional test case base library and the functional test case extension library in the test case library can be used to select and determine test cases in a subsequent software testing process.

[0080] For example, in some embodiments, the macro architecture of the test case library is as shown in Figure 2 The test case library can include a controlled model library, a public test keyword library, a functional test case base library, and a functional test case extension library. The controlled model library and the public test keyword library can be distinguished by function tags, for example, the controlled model library uses function 1, function 2, etc. as function tags, and the public test keyword library uses function a, function b, etc. as function tags. The functional test case base library and the functional test case extension library can be distinguished by project tags, for example, the functional test case base library uses platformization, project A, project B, project C, project D, etc. as project tags, and the functional test case extension library uses platformization, project A, project B, project C, project D, etc. as project tags.

[0081] In some embodiments, the controlled model library can be used to store controlled models used in the software testing process, wherein the controlled models can be stored in the controlled model library in the form of executable files in Functional Mock-up Unit (FMU) format.

[0082] In some embodiments, the public test keyword library can be used to store other functional test cases called in the software testing process, wherein the called other functional test cases can be stored in the public test keyword library in the form of encapsulated public test keywords.

[0083] In some embodiments, the functional test case base library can be used to store basic test cases used in the software testing process, wherein the basic test cases can be stored in the functional test case base library together with corresponding project tags.

[0084] In some embodiments, the function test case extension library can be used to store the extension test cases used in the software testing process, wherein the extension test cases can be stored in the function test case extension library together with the corresponding project tags.

[0085] In the embodiments of the present application, when constructing the test case library based on the project source code, the software interface table and the project function information, the newly added project functions can be determined based on the project source code, the software interface table and the project function information, and the test mode of the newly added project functions can be determined. In the case where the test mode of the newly added project functions is a preset mode, the controlled model and the executable file of the controlled model are designed. The controlled model and the executable file of the controlled model are added to the controlled model library.

[0086] In some embodiments, the software testing device can determine the newly added project functions based on the project source code, the software interface table and the project function information. Among them, for all the project functions indicated by the project function information (i.e. all the project functions included in the project function list), it can include project functions that have generated test cases and / or project functions that have not generated test cases. Among them, these project functions that have not generated test cases are the newly added project functions.

[0087] Exemplarily, in some embodiments, the software testing device can detect and identify all the project functions included in the project function list based on the project source code at one time, so as to determine the newly added project functions (new function list).

[0088] In some embodiments, the test mode can be understood as the test implementation mode of the software testing of the project function. Among them, the test mode can include a preset mode, which can be understood as a test implementation mode using a controlled model.

[0089] In some embodiments, the software testing device can further identify the test implementation mode of each newly added project function according to the new function list and the source code project (project source code), confirm whether the newly added project function can be directly tested through the software interface, or whether it is necessary to design a controlled model to simulate the read-write interaction between the bottom hardware and the application layer software, and finally determine the test mode corresponding to the newly added project function.

[0090] In some embodiments, if it is determined that the test mode of the newly added project function is a preset mode, i.e. it is determined that the test implementation mode of the newly added project function is a test implementation mode using a controlled model, then the controlled model needs to be further designed, and the executable file of the controlled model is generated. The executable file of the controlled model can be an executable file in FMU format.

[0091] Exemplarily, in some embodiments, for the newly added project function that cannot be directly tested through the software interface, the software testing device can further design a corresponding controlled model, and then generate an FMU format executable file, and add the controlled model to the controlled model library. The FMU executable file of the controlled model is a functional model unit of a single model generated based on the Functional Mock-up Interface (FMI) standard.

[0092] In some embodiments, the test mode of the newly added project function can be understood as a specific test implementation mode determined by the functional definition analysis of the newly added project function. For example, the test mode can include but is not limited to a mode requiring real-time interface change input provided by the underlying module, or a mode requiring output after implementation of other functions to be fed back to the input, or a mode capable of being directly tested through the software interface, etc.

[0093] In some embodiments, the preset mode can be used to determine whether the design condition of the controlled model is met. For example, if the preset mode is a mode requiring the controlled model to simulate the read-write interaction of the underlying hardware and the application layer software, it can be determined that it is the preset mode, and then the controlled model can be designed.

[0094] Exemplarily, in some embodiments, during the construction of the controlled model library, the corresponding test function range can be determined based on the test requirements, and then the controlled model library can be built based on the test function range.

[0095] Exemplarily, in some embodiments, when the controlled model library is built based on the test function range, for the function items in the test function range, the function definition is analyzed. If the function requires real-time interface change input provided by the underlying module, a controlled model for simulating the underlying real-time input can be further constructed, and then the controlled model is added to the controlled model library and a function tag (such as Figure 2 indicated) is added. The preset mode includes a test mode requiring real-time interface change input provided by the underlying module.

[0096] Exemplarily, in some embodiments, when the controlled model library is built based on the test function range, for the function items in the test function range, the function definition is analyzed. If the function requires output after implementation of other functions to be fed back to the input, a controlled model for simulating the underlying signal transmission is constructed, and then the controlled model is added to the controlled model library and a function tag (such as Figure 2 indicated) is added. The preset mode includes a test mode requiring output after implementation of other functions to be fed back to the input.

[0097] Exemplarily, in some embodiments, when building the controlled model library based on the test function range, for the function items in the test function range, the function definition is analyzed, if the expected result of the function dynamically changes, the controlled model is constructed, which is used for automatically identifying and feeding back the dynamic change of the expected result, then the controlled model is added to the controlled model library, and the function label (such as Figure 2 indicated) is added. Among them, the preset mode includes the test mode which needs to automatically identify and feed back the dynamic change of the expected result.

[0098] Exemplarily, in some embodiments, when building the controlled model library based on the test function range, for the function items in the test function range, the function definition is analyzed, if the function needs to assign values to the input interface at irregular times during the function implementation process, the controlled model is constructed, which is used for automatically assigning values to the input interface during the function implementation process, then the controlled model is added to the controlled model library, and the function label (such as Figure 2 indicated) is added. Among them, the preset mode includes the test mode which automatically assigns values to the input interface during the function implementation process.

[0099] That is, in the embodiments of the present application, the construction of the controlled model library includes building the controlled model based on the test function range determined according to the test requirements, which can include but is not limited to the following time limit mode:

[0100] (1) For the function items in the test function range, the function definition is analyzed, if the function needs to provide real-time interface change input for the underlying module, the controlled model is constructed to simulate the real-time input of the underlying module, and is added to the controlled model library, and the function label (such as Figure 2 indicated) is added.

[0101] (2) For the function items in the test function range, the function definition is analyzed, if the function needs to feed back the output after the implementation of other functions to the input, the controlled model is constructed to simulate the signal transmission of the underlying module, and is added to the controlled model library, and the function label (such as Figure 2 indicated) is added.

[0102] (3) For the function items in the test function range, the function definition is analyzed, if the expected result of the function dynamically changes, the controlled model library is constructed to automatically identify and feed back the dynamic change of the expected result, and is added to the controlled model library, and the function label (such as Figure 2 indicated) is added.

[0103] (4) For the function items in the test function range, the function definition is analyzed, if the function needs to assign values to the input interface at irregular times during the function implementation process, the controlled model library is constructed to automatically assign values to the input interface during the function implementation process, and is added to the controlled model library, and the function label (such asFigure 3 As shown).

[0104] In the embodiments of the present application, when the test case library is constructed based on the project source code, the software interface table and the project function information, the newly added project function can be determined based on the project source code, the software interface table and the project function information. In the case that the newly added project function exists a second test case for calling, the keyword information corresponding to the newly added project function is generated based on the second test case. The keyword information is added to the public test keyword library.

[0105] In some embodiments, before the test case for each newly added function (newly added project function) is designed, whether the test case of each newly added project function exists a case of calling other function test cases as a precondition based on the newly added project function and the project source code. If it exists, it (the called test case) can be encapsulated into a public test keyword and added to the public test keyword library. The public test keyword is used for direct calling of other test cases, which is convenient for management and simplifies subsequent modification operations.

[0106] In the embodiments of the present application, the software testing device can determine the newly added project function based on the project source code, the software interface table and the project function information. The project scope recognition of the newly added project function is performed to determine the recognition result of the newly added project function.

[0107] In some embodiments, the project scope recognition can be used to determine the scope to which the project function belongs.

[0108] Exemplarily, in some embodiments, for the newly added function list (including the list of newly added project functions) in the obtained project function list, the scope to which each newly added function (newly added project function) belongs can be recognized according to the newly added function list, and it is confirmed whether the newly added project function belongs to a platform function, i.e., a function common to all projects, or a function unique to a single project.

[0109] Exemplarily, in some embodiments, after the project scope recognition of the newly added project function is performed, the corresponding recognition result determined can include but is not limited to a platform function, a project unique function, etc.

[0110] In the embodiments of the present application, when the test case library is constructed based on the project source code, the software interface table and the project function information, the basic test cases of the newly added project function can be obtained by performing basic design of the test cases on the newly added project function based on the function definition file included in the project function information; the project tags of the basic test cases of the newly added project function are determined based on the identification result of the newly added project function; and the basic test cases of the newly added project function and the project tags are added to the basic library of function test cases.

[0111] In some embodiments, when the basic test cases are designed, the test cases can be designed based on excel by referring to the function definition file, and the project tags are added to each basic test case, and then the basic library of function test cases is added.

[0112] In some embodiments, the design of the test cases based on excel is mainly to facilitate the management and identification of the test cases, and necessary description words can be added to the excel file to facilitate the identification and understanding of the test cases.

[0113] In some embodiments, the tags (project tags) added to each test case in the excel source file are derived from the identification result determined after the project scope identification, wherein the identification result includes but is not limited to platformization function, project unique function, etc.

[0114] Exemplarily, in some embodiments, if the identification result is platformization function, the project tag of the test case can be determined as “PLATFORMIZATION”; if the identification result is project unique function, the project tag of the test case can be determined as “project X”, wherein “project X” is the project code, if the function is shared by multiple projects, the project tag of the test case can be determined as “project X1, project X2”, wherein “project X1” and “project X2” are both project codes.

[0115] Exemplarily, in some embodiments, as shown in Figure 4 , the forward 1, forward 2 and other test cases are basic test cases, of course, the basic library of function test cases can also include other basic test cases in addition to the forward 1, forward 2.

[0116] In the embodiments of the present application, when the test case library is constructed based on the project source code, the software interface table and the project function information, the extended test cases of the newly added project function can be obtained by performing extension design of the test cases on the newly added project function based on the function definition file included in the project function information and the basic test cases of the newly added project function; and the extended test cases of the newly added project function and the project tags are added to the extended library of function test cases.

[0117] In some embodiments, when designing the basic test cases, the extended test cases can be designed based on the excel and the project tags are added to each extended test case, and the extended test cases are added to the function test case extension library.

[0118] Exemplarily, in some embodiments, the extended test cases can mainly include one or more of the following: reverse test cases, boundary condition test cases, state switching test cases, etc.

[0119] Exemplarily, in some embodiments, for the same project function, the project tags of the generated extended test cases are consistent with the project tags of the basic test cases, that is, the test cases corresponding to the same project function (including the basic test cases and / or the extended test cases) have the same project tags.

[0120] Exemplarily, in some embodiments, as shown in Figure 5 , the reverse 1, reverse 2, reverse 3, reverse 4, switching, etc. test cases are extended test cases, of course, the function test case extension library can also include other extended test cases in addition to the reverse 1, reverse 2, reverse 3, reverse 4, switching.

[0121] Exemplarily, in some embodiments, the design principles of the basic test cases and the extended test cases are as shown in Figure 6 and Table 1, the basic test cases are forward test cases of functions, and the extended test cases include reverse test cases, state switching, etc., wherein the reverse test cases need to set a premise condition not to be met for output detection, and the state switching needs to set a trigger condition to change after the normal execution of the forward test case for output detection.

[0122] Table 1

[0123]

[0124] Step 103, based on the project source code, the test requirements, the project function information and the test case library, a virtual ECU-based test environment is constructed.

[0125] In the embodiments of the present application, after the test case library is constructed based on the project source code, the software interface table and the project function information, the virtual ECU-based test environment can be further constructed based on the project source code, the test requirements, the project function information and the test case library.

[0126] In some embodiments, after the construction of the test case library is completed, the software testing device can further perform the construction of the virtual ECU-based test environment based on the constructed test case library, that is, the test environment is constructed based on the virtual ECU.

[0127] In the embodiments of the present application, after obtaining the test requirements, the functional scope of the test can be further determined based on the test requirements, that is, the test requirements can be used to determine the functional scope of the corresponding test, and then the virtual ECU-based test environment can be built through the functional scope of the test in the subsequent processing flow.

[0128] In some embodiments, the test requirements can include, but are not limited to, full-amount testing, incremental testing, etc. Among them, the full-amount testing is all functions of the test project, and the incremental testing is the newly added function, the basic function and the associated function of the test project.

[0129] In some embodiments, if the test requirements are full-amount testing, the functional scope of the test includes, but is not limited to, all test cases in the test case basic library and the test case extension library with the platformization label and conforming to the project number.

[0130] In some embodiments, if the test requirements are incremental testing, the functional scope of the test includes, but is not limited to, newly added test cases, all test cases in the test case basic library with the platformization label and conforming to the project number, and all test cases in the test case extension library related to the newly added function with the platformization label and conforming to the project number.

[0131] In some embodiments, when the virtual ECU-based test environment is constructed based on the project source code, the test requirements, the project function information and the test case library, the executable file of the master model can be generated based on the project source code first; the controlled model of the second project function and the executable file of the controlled model of the second project function are obtained from the controlled model library; wherein the second project function is the project function to be tested indicated by the test requirements; the virtual ECU-based test environment is constructed based on the executable file of the master model and the executable file of the controlled model of the second project function.

[0132] In some embodiments, for the second project function, the controlled model library can be screened for the controlled model first to obtain the controlled model corresponding to the second project function. Among them, in the determination process of the controlled model corresponding to the second project function, the test function scope corresponding to the second project function can be determined based on the test requirements of the second project function, and then the function label corresponding to the second project function is determined based on the determined test function scope of the second project function, and then the controlled model of the second project function can be screened from the controlled model library based on the function label corresponding to the second project function.

[0133] Exemplarily, in some embodiments, for the second project function to be tested indicated by the test requirement, the corresponding test function range can be determined first. For example, if the test requirement corresponding to the second project function is full-amount testing, the test function range can be determined as all the functions specified in the project function list corresponding to the second project function. If the test requirement corresponding to the second project function is incremental testing, the test function range can be determined as the function changed in this test and all the functions associated with the function in the project function list corresponding to the second project function.

[0134] Exemplarily, in some embodiments, after determining the test function range corresponding to the second project function, i.e., determining the functions to be tested, the function tags of the functions to be tested can be further determined, i.e., the function tags corresponding to the second project function are determined.

[0135] As can be seen, in the embodiments of the present application, the implementation of constructing the test environment based on the virtual ECU relies on the screening processing of the controlled models in the controlled model library. When screening the required controlled models, the test function range can be determined based on the test requirement first, and then the controlled models can be screened from the controlled model library according to the function tags corresponding to all the functions to be tested based on the determined function range (test function range), i.e., based on all the functions to be tested. If the test requirement is full-amount testing, the test function range is all the functions specified in the project function list. If the test requirement is incremental testing, the test function range is the function changed in this test and all the functions associated with the function.

[0136] In some embodiments, based on one or more of the acquired project source code, test requirement, project function information, and test case library constructed, the software testing device can determine the executable file corresponding to the master model and the executable file corresponding to the controlled model, respectively. Finally, the test environment based on the virtual ECU can be built by using the executable file corresponding to the master model and the executable file corresponding to the controlled model.

[0137] Exemplarily, in some embodiments, the executable file corresponding to the master model and the executable file corresponding to the controlled model can include an executable file in FMU format. The virtual ECU can use the file in FMU format.

[0138] Exemplarily, in some embodiments, the executable file of the master model can be generated based on the project source code. Wherein, the software testing device can obtain the source code required for building the virtual ECU through the project source project (project source code), wherein the required source code includes: C code source file, C code header file, ARXML file, task scheduling timing, etc.; then use a script to preprocess the project source code (source code required for building the virtual ECU), and assign initial values to the part of the interface corresponding to the configuration word to simulate the initial value writing of the underlying layer; finally, the executable file in FMU format can be generated based on the preprocessed source code, that is, the executable file of the master model is generated.

[0139] In some embodiments, the second project function can be a project function to be tested indicated by the test requirement, and / or the second project function can be any one of the project functions in the project function list.

[0140] In some embodiments, during the process of building the test case library, the controlled model corresponding to the second project function can be stored in the controlled model library in the test case library. Wherein, the controlled model of the second project function can be stored in the form of an executable file of the controlled model.

[0141] Exemplarily, in some embodiments, for the second project function indicated by the test requirement and required to be implemented by the controlled model, the software testing device can filter and obtain the FMU file corresponding to the required controlled model (the controlled model of the second project function) in the controlled model library in the test case library; finally, based on the FMU file of the project source project (the executable file of the master model) and the FMU file of the controlled model (the executable file of the controlled model), the virtual ECU-based test environment can be built.

[0142] In some embodiments, after determining the executable file of the master model and the executable file of the controlled model of the second project function, the virtual ECU-based test environment can be further built in combination with the public test keyword library. Wherein, during the building of the test environment, the master model and the controlled model are both run in the form of executable files, and other functional test cases called in the public test keyword library are run in the form of public test keywords.

[0143] Exemplarily, in some embodiments, for other functional test cases called in the software testing process, that is, existing test cases as preconditions, based on the public test keyword library, the virtual ECU-based test environment can be further built in the form of public test keywords, so that the direct calling and updating of other functional test cases as preconditions in the subsequent software testing process can be realized in the virtual ECU-based test environment.

[0144] It can be seen that the virtual ECU-based test environment is built by the controlled model library and the public test keyword library in the test case library. Therefore, the controlled model to be invoked and other functional test cases to be invoked already exist in the built virtual ECU-based test environment, and a more simple test case can be obtained in the subsequent test case screening process in the virtual ECU-based test environment, thereby reducing the complexity of the test case (the first test case) in the test process.

[0145] In step 104, based on the test case library and the test requirement of the first project function, a first test case of the first project function is determined in the virtual ECU-based test environment, and automatic testing of the first project function is performed based on the first test case to obtain a test result. The first project function is a project function to be tested.

[0146] In the embodiments of the present application, after the virtual ECU-based test environment is constructed based on the project source code, the test requirement, the project function information and the test case library, the first test case of the first project function can be further determined based on the test case library and the test requirement of the first project function in the virtual ECU-based test environment, and the automatic testing of the first project function is performed based on the first test case to obtain a test result.

[0147] In some embodiments, when the first test case of the first project function is determined based on the test case library and the test requirement of the first project function, the project number of the first project function to be tested is determined, and then the first test case is determined in the test case library based on the project number and the test requirement of the first project function.

[0148] In the embodiments of the present application, for the first project function to be tested, the corresponding test function range of the first project function can be determined according to the test requirement of the first project function, that is, the test requirement of the first project function can be used to determine the test function range corresponding to the first project function, and then the selection process of the corresponding test case can be performed through the test function range of the first project function in the subsequent processing process.

[0149] In some embodiments, the test requirement of the first project function can include but is not limited to full-amount testing, incremental testing, etc. The full-amount testing is to test all functions of a project, and the incremental testing is to test the newly added functions, the basic functions and the associated functions of the project.

[0150] In some embodiments, if the test requirement of the first project function is full-amount testing, the test function range of the first project function includes but is not limited to all test cases with a platformization tag and a project number in the test case basic library and the test case extension library.

[0151] In some embodiments, if the test requirement of the first project function is incremental testing, the function scope of the test of the first project function includes, but is not limited to, newly added test cases, all test cases with the platformization label and the project number in the test case base, and all test cases with the platformization label and the project number related to the newly added function in the test case extension library.

[0152] Exemplarily, in some embodiments, the software testing device can screen and obtain the corresponding test cases (first test cases) in the test case library according to the project number of the first project function and the test requirement of the first project function. For example, if the test requirement is full amount testing, all test cases with the project label of “PLATFORMIZATION” and the corresponding project number label (project number) in the function test case base library and the function test case extension library need to be screened out as the corresponding first test cases.

[0153] Exemplarily, in some embodiments, the software testing device can screen and obtain the corresponding test cases (first test cases) in the test case library according to the project number of the first project function and the test requirement of the first project function. For example, if the test requirement is incremental testing, the test cases to be screened include all newly added test cases, all test cases with the “PLATFORMIZATION” label and the project number label (project number) in the function test case base library, and all test cases related to the newly added test cases in the function test case extension library, and finally the corresponding first test cases are obtained.

[0154] Exemplarily, in some embodiments, the process of screening test cases based on the test requirement is as follows Figure 7As shown, the functional scope of the test corresponding to the first project function can be determined based on the test requirements of the first project function, i.e., it is determined whether the corresponding test type is full-amount test or incremental test (step 601). If the functional scope of the test corresponding to the first project function (test type) is full-amount test, then the "PLATFORMIZATION" and the project number tag can be filtered in the test case base library according to the project number (step 602), and the "PLATFORMIZATION" and the project number tag can be filtered in the test case extension library according to the project number (step 603) to obtain the corresponding test case. If the functional scope of the test corresponding to the first project function (test type) is incremental test, then the test case base library can be filtered according to the project number to obtain the test case with the "PLATFORMIZATION", the project number tag and the newly added test case (step 604), and the test case extension library can be filtered according to the newly added function to obtain the newly added test case and the associated test case by using the keyword matching principle (step 605) to obtain the corresponding test case.

[0155] Exemplarily, in some embodiments, when the relevant test case in the functional test case extension library is filtered, the Chinese keyword filtering can be performed by using a script.

[0156] In some embodiments, since the virtual ECU-based test environment is built by using the controlled model library and the public test keyword library in the test case library, for the test requirements of the first project function, the controlled model to be called and the other functional test cases to be called already exist in the built virtual ECU-based test environment. Therefore, when the first test case is filtered, the controlled model to be called and the other functional test cases to be called do not need to be considered, which can greatly simplify the complexity of the first test case.

[0157] In some embodiments, when the automatic test of the first project function based on the first test case is performed, and the test result is obtained, under the virtual ECU-based test environment, the first test case execution file can be generated based on the first test case; then the first test case execution file is automatically run to obtain the test result.

[0158] Exemplarily, in some embodiments, the software testing device can process the excel-based test case (first test case) by using a script to generate a test case execution file (first test case execution file) based on the Robot Framework framework; then the generated first test case execution file can be automatically run by using a script, and finally the test result of the run test case execution file is output.

[0159] In some embodiments, the test result can be understood as an automatic running result of the first test case execution file, and can include, but is not limited to, one or more of the following: a running conclusion, a failure item record, and the like. The running conclusion can be used to determine whether there is a failure item.

[0160] Exemplarily, in some embodiments, during the automated testing process, after the running of each test case is completed, the software testing apparatus can back up the test result of each test case and record the test result of the test case of the previous running.

[0161] In the embodiments of the present application, Figure 2 An implementation flowchart of a software testing method provided in the embodiments of the present application is shown in Figure 7 As shown in Figure 8 The software testing method can further include the following steps:

[0162] Step 105, during the automatic running of the first test case execution file, a running log corresponding to the first test case is recorded and stored.

[0163] In some embodiments, during the automatic running of the first test case execution file, the software testing apparatus can record and store the running log corresponding to the first test case. The running log corresponding to the first test case can be used for subsequent interruption protection processing.

[0164] Exemplarily, in some embodiments, during the automated testing process, the software testing apparatus can record the test result of the running test case execution file, and at the same time, can record and store the running log (execution log) corresponding to the first test case. In the execution log (running log), the label of the test case execution file that has not been run can be "Fail"; the label of the test case execution file that has been successfully run can be "Success"; the label of the test case execution file that has failed to run can be "Error", and at the same time, the title of the test case that has failed to run can be recorded; the label of the test case execution file that has been interrupted can remain "Fail".

[0165] Step 106, in the case where the automated testing of the first project function is interrupted, interruption protection processing is performed based on the running log corresponding to the first test case.

[0166] In the embodiments of the present application, if the automated testing of the first project function is interrupted, the software testing apparatus can perform interruption protection processing based on the running log corresponding to the first test case.

[0167] In some embodiments, the interruption can be understood as a situation where the automated testing in step S5 is interrupted before all test case execution files are run for any reason.

[0168] In some embodiments, based on the recorded and stored running log, the software testing device can resume the interruption in the automated execution of the test cases.

[0169] Illustratively, in some embodiments, after the interruption of the automated software interface testing system, based on the running log, the test case name of the last running and the test case execution file name can be obtained from the saved test case results of the previous running; then, all corresponding test cases can be re-screened in the test case library according to the project number and the testing requirements; all test cases based on excel can be preprocessed by using a script, and the test case execution file based on the Robot Framework framework can be regenerated; then, all newly generated test case execution files are compared with the test case execution files recorded in the running log (execution log), the test case execution files not recorded are added to the execution log, and the initial label “Fail” is added; then, the “Fail” item in the execution log is re-tested by using a script: whether the test case execution file of the last running is the current file, if yes, the test case of the last running is re-tested, otherwise, all test cases need to be tested.

[0170] Illustratively, in some embodiments, in the interruption protection process of the test case execution, the software testing device can backup the results after each test case is run, and record the test case results of the previous running.

[0171] In some embodiments, based on the recorded and stored running log, the software testing device can also perform regression testing after the test cases are modified.

[0172] Illustratively, in some embodiments, the software testing device can perform regression testing on the “Error” item in the running log (execution log) by using a script: all test cases recorded in the execution log that fail the test are automatically tested.

[0173] Illustratively, in some embodiments, as Figure 9As shown, in the process of interruption protection of the test case, it can be determined whether the interruption protection type is an execution interruption or a regression test (step 801), if the interruption protection type is an execution interruption, the test record of the last execution interruption can be parsed to obtain the test case where the interruption occurs (step 802), then the Fail item in the test log which is not tested is read (step 803), then it is judged whether the test interruption test case is located in the current Fail item file (step 804), if yes, the test is continued from the test interruption test case (step 805), otherwise, the test is continued from the first test case based on the current Fail item file (step 806). If the interruption protection type is a regression test, the test log can be parsed to obtain the test case execution file of the test ERROR item and the corresponding failed test case (step 807), then the modified test case is processed to regenerate the test case execution file based on the Robot Framework framework (step 808), then the test case which fails in the test is filtered out from the newly generated test case execution file for retesting (step 809).

[0174] In the embodiments of the present application, after the software test based on the project source code and the project function information is completed, the software test device can generate a complete test report based on the corresponding test results of the first project function, and then output the complete test report.

[0175] Exemplarily, in some embodiments, the software test device can merge the test results obtained in the execution process of the automation test and the test results obtained after the interruption protection processing, and output the complete test results.

[0176] In the embodiments of the present application, after the software test based on the project source code and the project function information is completed, the software test device can also perform fault localization on the test case which fails to execute, and output the fault localization.

[0177] Exemplarily, in some embodiments, the software test device can output all the test cases which fail to test, including the steps which fail to test, the interface state, etc.

[0178] In the embodiments of the present application, after the software test based on the project source code and the project function information is completed, the software test device can also determine the release of the software code according to the complete test results.

[0179] Exemplarily, in some embodiments, if all the test cases execute successfully, the software code and the complete test results are released; if the test cases fail to test, the release of the software code is blocked and the complete test results are fed back.

[0180] In some embodiments, the complete test result can at least include one or more of the following: test result statistics of the test case, test pass rate, execution log of each test case, failure step and fault interface state of the test case that fails to run, execution time of the test case, and the like.

[0181] In the embodiments of the present application, Figure 3 An implementation flowchart of a software testing method provided in the embodiments of the present application Figure 9 As shown in Figure 10 The software testing method can further include the following steps:

[0182] Step 107, triggering test automation execution in the case of changes in the project source code.

[0183] Step 108, triggering test case automation execution in the case of changes in the test case library.

[0184] In the embodiments of the present application, the software testing device further has the function of test engineering change identification, that is, the software testing device can identify the changes of the test engineering, and perform subsequent automation processing based on the identified changes.

[0185] In some embodiments, for the first time of submitting code (project source code) with new functions, the step of test engineering change identification does not need to be performed; after the software testing is performed, based on the execution result of each time, partial adjustment of the submitted code or changes in the test case can be performed, and the step of test engineering change identification can be performed.

[0186] In some embodiments, if the project source engineering (project source code) has new changes, test automation execution is triggered; if the test case library has new changes, test case automation execution is triggered.

[0187] Exemplarily, in some embodiments, the new changes of the project source engineering (project source code) can be understood as software repair, at this time, the function has not changed, and therefore the test automation execution can be directly triggered; if the function has changed or the interface of the function has changed, the design of the test case needs to be performed first, the test case library is updated, and then the test case automation execution is triggered.

[0188] In some embodiments, in the process of performing software testing in the virtual ECU-based test environment, if a new change occurs and the test case needs to be updated, for the controlled model and other functional test cases that need to be called in the virtual ECU-based test environment, only one update needs to be performed, and the controlled model and other functional test cases called in the subsequent retesting process are already updated, which can solve the problem of repeated time consumption caused by repeated update processing when the controlled model and other functional test cases are called.

[0189] As can be seen, in the embodiments of the present application, the virtual ECU-based test environment built based on the controlled model library and the public test keyword library is used as the test environment for subsequent software testing, which can reduce the complexity of the test case, solve the problem of low test efficiency caused by repeated update operations in the process of updating the test case, and ultimately solve the technical problems of complex and tedious test flow and repeated time consumption in the test process.

[0190] The software testing method proposed in the embodiments of the present application, first, adopts the management mode of constructing a test case public library, strictly adds, modifies and deletes the controlled model library, the public test keyword library, the functional test case basic library and the functional test case extension library through the use case tag, effectively improves the maximum reuse degree of test cases between different projects. Among them, according to the new function list, the test implementation mode is to design the controlled model to simulate the read-write interaction of the new function between the bottom hardware and the application layer software, design the controlled model, and generate an executable file in FMU format, and add it to the controlled model library; before designing each test case of the new function, based on the new function and the source code, identify whether each new function test case calls other functional test cases as a precondition, if so, encapsulate the called other functional test cases into public test keywords, and add them to the public test keyword library; based on the function definition file, design the forward basic function of the test case of the new function, and add a project tag to each basic test case, and add it to the functional test case basic library; based on the function definition file and the corresponding basic functional test case, design the extension test case of the new function, and add a project tag to each extension test case, and add it to the functional test case extension library.

[0191] The software testing method provided in the embodiments of the present application, in the second aspect, in the automatic testing and interruption protection of the software interface, a backup and execution log management method is adopted to realize automatic filtering, identification, conversion, interruption processing and regression testing of test cases, efficiently prevent sudden situations from occurring in the testing process, and ensure complete, stable and automatic execution of test cases. Among them, the test case execution file is automatically run to obtain the execution result of each test case execution file; the test case execution file with an execution result of not running or execution failure is interrupted and recovered, that is, the test case name of the last running and the test case execution file name are obtained from the test case result of the last running saved; all corresponding test cases are re-filtered and obtained in the test case library according to the project number and test requirements; all test cases are preprocessed to regenerate the test case execution file based on the Robot Framework framework; all newly generated test case execution files are compared with the test case execution files recorded in the execution log, the test case execution files not recorded are added to the execution log, and the initial label "Fail" is added; the "Fail" item in the execution log is automatically tested by using a script: it is judged whether the test case execution file of the last running is the current file, if yes, the test case of the last running recorded is tested again, otherwise, all test cases need to be tested; the test case execution file with an execution error is subjected to regression testing.

[0192] In summary, the automatic software interface testing system and method based on virtual ECU provided in the embodiments of the present application utilize virtual ECU technology to complete the automatic in-the-loop testing of automobile software, quickly intervene in the function and interface testing after the software program module development is completed, identify system vulnerabilities and errors as early as possible, reduce the development time and cost, and solve the problem of how to realize agile development and rapid iteration under the rapid change of function requirements; in the test case management aspect, the management method of the test case public library is adopted, the controlled model library, the public test keyword library, the function test case basic library and the function test case extension library are strictly added, modified and deleted through the test case label, and the maximum reuse degree of test cases between different projects is effectively improved; in the automatic testing and interruption protection of the software interface, a backup and execution log management method is adopted to realize automatic filtering, identification, conversion, interruption processing and regression testing of test cases, efficiently prevent sudden situations from occurring in the testing process, and ensure complete, stable and automatic execution of test cases. The system and method are more intelligent than the prior art, can effectively reduce the development time and testing cost of automobile software, avoid frequent repeated design and writing of test cases, meet the demand for stable and automatic testing, and greatly optimize the overall process of software in-the-loop testing.

[0193] The embodiment of the application provides a software testing method, acquires project source code, a software interface table, testing requirements and project function information; based on the project source code, the software interface table and the project function information, a test case library is constructed; wherein the test case library comprises at least one or more of the following: a controlled model library, a public test keyword library, a function test case basic library and a function test case extension library; based on the project source code, the testing requirements, the project function information and the test case library, a virtual ECU-based test environment is constructed; in the virtual ECU-based test environment, based on the test case library and the testing requirements of a first project function, a first test case of the first project function is determined, and based on the first test case, automatic testing of the first project function is performed to obtain a test result; wherein the first project function is a project function to be tested. It can be seen that in the embodiment of the application, the construction of the test case library can be performed, wherein the test case library can comprise the controlled model library, the public test keyword library, the function test case basic library and the function test case extension library constructed based on the project source code, the software interface table and the project function information, wherein the controlled model library and the public test keyword library can be used for the establishment of the virtual ECU-based test environment, and the function test case basic library and the function test case extension library can be used for the screening of test cases, so that in the subsequent software testing process, the complexity of the screened test cases is reduced by the established virtual ECU-based test environment, and the automatic testing of various project functions can be performed by using the constructed test case library in combination with the testing requirements. That is, the scheme provided in the embodiment of the application can reduce the testing complexity, reduce the testing time consumption and greatly improve the efficiency and effect of software testing.

[0194] Based on the above embodiment, another embodiment of the application provides a software testing method, comprising an automatic software interface testing system and method based on a virtual ECU, which is an automatic software interface testing mechanism that is efficient and reliable, easy to operate and stable in operation. All steps in the testing process are concentrated together, agile development and rapid iteration can be realized under rapid change of function requirements, the reuse of test cases between different projects is solved, testing interruption caused by external reasons is avoided, automatic testing of software interfaces is realized, and the overall process of software-in-the-loop testing is greatly optimized.

[0195] In order to realize efficient and reliable software testing functions, the following problems need to be considered: 1. How to realize agile development and rapid iteration under rapid change of function requirements, so as to perform software verification as early as possible and discover and correct important errors in the code; 2. How to efficiently manage test cases to realize maximum reuse of test cases between different projects; 3. How to stably perform automatic testing of software interfaces and interruption protection.

[0196] To solve the problems of how to realize agile development and rapid iteration under rapid change of functional requirements, how to efficiently manage test cases to realize maximum reuse of test cases among different projects, and how to stably perform automatic testing and interruption protection of software interfaces, embodiments of the present application provide a virtual ECU-based automatic software interface testing system and method, as shown in Figure 3 The macro architecture of the test system 1000 proposed in the embodiments of the present application mainly includes a project source engineering submission module 1001, a test case library construction module 1002, a test engineering change identification module 1003, a virtual ECU-based test environment building module 1004, a test case automatic execution module 1005, a test case execution interruption protection module 1006, a test result output and fault positioning module 1007, a software code and test result release module 1008, and the like.

[0197] In some embodiments, the project source engineering submission module can be used for a developer to submit a project source engineering after completing development of automotive software. The submission of the project source engineering can include the following steps:

[0198] S11, project source code (master model), project function list, function definition file, software interface table, and configuration word are obtained. The project function list includes function names. The function definition file is a file that specifically describes functions. The software interface table is a software interface that needs to be used to implement functions and is mapped and connected. The configuration word is different, and the implemented function is different.

[0199] S12, a test admission specification is obtained.

[0200] Further, in S12, the test admission specification mainly includes test scope and test requirements, and then the tester needs to audit the test admission specification, feed back the part that is not clear or missing in the admission requirements, and require the developer to supplement.

[0201] For example, in some embodiments, the test admission specification can include a function A required to be tested by the developer.

[0202] In some embodiments, the test case library construction module can be used to design test cases according to the submission file of the project source engineering submission module. The design of the test cases can include the following steps:

[0203] S21, the project source code, the newly added function list, the function definition file, the software interface table, and the configuration word are obtained according to the test admission specification.

[0204] S22, according to the newly added function list, the scope of each newly added function is identified, and it is confirmed whether the function belongs to the platform function (all projects) or the single project unique function;

[0205] S23, according to the newly added function list and the source code project, the test implementation mode of each newly added function is identified, and it is confirmed whether the function can be directly tested through the software interface, or the controlled model needs to be designed to simulate the read-write interaction between the bottom hardware and the application layer software.

[0206] S24, the controlled model is designed and the executable file in the function model unit (FMU) format is generated, and the controlled model library is added; wherein the FMU executable file of the controlled model is a single model function model unit generated based on the function model interface (FMI) standard.

[0207] S25, before designing the test case for each newly added function, based on the newly added function and the source code, it is identified whether the test case of each newly added function has a calling other function test case as a precondition, if so, it is encapsulated into a public test keyword and added to the public test keyword library; wherein the public test keyword is used for direct calling of other test cases, which facilitates management and simplifies subsequent modification operation.

[0208] S26, according to the function definition file, the test case is designed based on excel, and the project tag is added to each basic test case, which is added to the basic library of function test case, for example Figure 4 The first two test cases in table 1, and the first two test cases in table 1.

[0209] S27, according to the function definition file and the corresponding basic function test case, the extended test case is designed based on excel, and the project tag is added to each extended test case, which is added to the extended library of function test case, for example Figure 2 The first five test cases in table 1, and the last five test cases in table 1.

[0210] In S26, the test cases are designed based on excel, which mainly provides convenience for the management and identification of test cases. Necessary description can be added in the excel file to facilitate the identification and understanding of test cases. In addition, the label of each test case in the excel source file is derived from the identification result in S22. If the function is a platformization function, the test case label is "PLATFORMIZATION". If the function is a project-specific function, the test case label is "Project X", where "Project X" is the project code. If the function is shared by multiple projects, the test case label is "Project X1, Project X2", where "Project X1" and "Project X2" are both project codes.

[0211] In S27, the extended test cases mainly include reverse cases, boundary condition cases, state switching cases, etc. The label of the extended test case should be consistent with the basic test case label.

[0212] The macro-architecture diagram of the test case library is shown in Figure 5 , which mainly includes the controlled model library, the public test keyword library, the functional test case basic library, and the functional test case extension library. The controlled model library and the public test keyword library are distinguished by function labels, and the functional test case basic library and the functional test case extension library are distinguished by project labels.

[0213] The design and implementation of the basic test case and the extended test case are shown in Figure 11 and Table 1. The basic test case is a positive test case of the function, and the extended test case includes reverse test cases, state switching, etc. The reverse test case needs to set a certain prerequisite condition (such as inputting a pre-set different condition, including but not limited to one or more of condition 1, condition 2, condition 3, condition 4, etc.) to perform output detection. The state switching needs to set a certain trigger condition to change after the normal execution of the positive test case, and then perform output detection. Finally, based on the output result (such as output result 1, output result 2, etc.), the test result is further determined.

[0214] In some embodiments, the test engineering change identification module can be used to identify changes in the test engineering. For the first submission of code with new functions, no change identification step is needed. Then, based on the execution result of each time, the submitted code is adjusted or the test case is changed, and the change identification step needs to be executed.

[0215] The identification of the change in the test engineering can include the following steps:

[0216] S31, if the project source engineering has new changes, triggering the test automation execution;

[0217] S32, if the test case library is newly changed, triggering the automatic execution of the test case.

[0218] Further, in S31 / S32, if the new change of the project source engineering is a software repair, the function does not change, then directly trigger the test automation execution; if the function changes or the (function) interface changes, the test case design needs to be performed first, the test case library is updated, and then the test case automation execution is triggered.

[0219] In some embodiments, the virtual ECU-based test environment building module can be used to build a test environment based on a virtual ECU. Wherein, building a test environment based on a virtual ECU can include the following steps:

[0220] S41, obtaining the project source code required for building a virtual ECU in the project source engineering, wherein the project source code to be obtained includes: C code source file, C code header file, ARXML file, task scheduling timing, etc.

[0221] S42, using a script to preprocess the project source code, and assigning initial values to at least part of the interface corresponding to the configuration word to simulate the initial value writing of the underlying layer;

[0222] S43, generating an FMU format executable file based on the project source code; the virtual ECU must use this format file.

[0223] S44, according to the first function to be implemented through the controlled model in the project function list, screening and obtaining the FMU file corresponding to the required controlled model (the controlled model corresponding to the first function) in the controlled model library in the test case library;

[0224] S45, building a virtual ECU-based test environment based on the FMU file of the project source engineering and the FMU file of the controlled model.

[0225] In some embodiments, the automatic execution module of the test case can be used to automatically execute the test case. Wherein, automatically executing the test case can include the following steps:

[0226] S51, according to the project number of the project function to be tested and the test requirement of the project function to be tested, the corresponding test case is screened and obtained in the test case library, for example, if the test requirement is full-amount test, all test cases with the "PLATFORMIZATION" label and the project number label need to be screened out in the function test case basic library and the function test case extension library; if the test requirement is incremental test, the test cases to be screened include: all newly added test cases, all test cases with the "PLATFORMIZATION" label and the project number label in the function test case basic library, and all test cases related to the newly added test cases in the function test case extension library; wherein, the related test cases in the function test case extension library are screened by using a script to perform Chinese keyword screening;

[0227] S52, the test case based on excel is processed by using a script to generate a test case execution file based on the Robot Framework framework;

[0228] S53, the generated test case execution file is automatically run by using a script;

[0229] S54, in the automatic test process, the test result of the test case execution file after running is recorded, and the execution log is output, wherein the record of the running result includes the running conclusion (whether there is a failed item) and the record of the failed item; in the execution log, the label of the test case execution file not run is "Fail"; the label of the test case execution file running successfully is "Success"; the label of the test case execution file running failed is "Error" and the title of the test case running failed is recorded at the same time; the label of the test case execution file interrupted remains "Fail";

[0230] S55, in the automatic test process, the result after each test case is run is backed up, and the test case result of the previous running is recorded. The

[0231] In some embodiments, the test case execution interruption protection module can be used for recovering the test case automatic execution interruption and performing regression test after the test case is modified. Wherein, the test case automatic execution interruption recovery and the regression test after the test case is modified can include the following steps:

[0232] S61, after the interruption of the automatic software interface test system, the test case name and the test case execution file name of the last running are obtained from the saved test case result of the previous running;

[0233] S62, re-screening all corresponding test cases in the test case library according to the project number and test requirements;

[0234] S63, preprocessing all test cases based on excel by using scripts, and regenerating test case execution files based on RobotFramework framework;

[0235] S64, comparing all newly generated test case execution files with the test case execution files recorded in the execution log, adding the test case execution files not recorded in the execution log to the execution log, and adding the initial label "Fail";

[0236] S65, re-testing the "Fail" items in the execution log by using scripts: judging whether the test case execution file of the last run is the current file, if yes, starting to re-test from the recorded test case of the last run, otherwise, all need to be tested;

[0237] S66, regression testing of "Error" items in the execution log by using scripts: automatically testing all test cases that failed in the execution log;

[0238] S67, in the test case execution interruption protection process, the results after each test case is run are backed up, and the results of the previous test case are recorded.

[0239] Further, in S61, the interruptions that can be handled by the test case execution interruption protection module include the interruption of the automatic test in S5 caused by any reason before all test case execution files are run, and the processing method corresponds to S62-S65; regression testing after test case execution failure, and the processing method corresponds to S66.

[0240] In some embodiments, the test result output and fault positioning module can be used to output a complete test report and to locate the fault of the test case that fails to execute. Wherein, outputting a complete test report and locating the fault of the test case that fails to execute can include the following steps:

[0241] S71, merging the test results backed up in the automatic test case execution module and the test case execution interruption protection module, and outputting a complete test result;

[0242] S72, outputting all test cases that fail to test, including: test failure steps, interface state, etc.

[0243] In some embodiments, the software code and test result release module can be used to determine the release of the software code according to the test result. The determination of the release of the software code according to the test result can include the following steps:

[0244] S81, if all the test cases are successfully executed, the software code and the test result are released;

[0245] S82, if the test cases fail, the release of the software code is blocked and the test result is fed back.

[0246] Further, in S81 and S82, the test result includes the test result statistics of the test cases, the test pass rate, the execution log of each test case, the failure steps of the failed test cases, the fault interface state, the execution time of the test cases, etc.

[0247] In summary, the embodiment of the present application provides an automatic software interface test system and method based on virtual ECU, which uses virtual ECU technology to complete the automatic in-loop test of automobile software. After the development of the software program module is completed, the function and interface test is quickly intervened, the system vulnerabilities and errors are identified as early as possible, the development time and cost are reduced, and the problem of how to realize agile development and rapid iteration under the rapid change of functional requirements is solved. In the aspect of test case management, the management mode of test case public library is adopted, the controlled model library, the public test keyword library, the functional test case basic library and the functional test case extension library are strictly added, modified and deleted through the use of case labels, and the maximum reuse degree of test cases between different projects is effectively improved. In the automatic test and interruption protection of software interface, the backup and execution log management mode is adopted, the test case automatic screening, identification, conversion, interruption processing and regression test are realized, the sudden situation in the test process can be efficiently prevented, and the complete, stable and automatic execution of the test case is ensured. Compared with the previous technology, the system and method are more intelligent, can effectively reduce the development time and test cost of automobile software, avoid the frequent repeated design and writing of test cases, meet the demand of stable automatic test, and greatly optimize the overall process of software in-loop test.

[0248] The embodiment of the application provides a software testing method, which can construct a test case library, wherein the test case library can include a controlled model library, a public test keyword library, a function test case basic library and a function test case extension library which are constructed based on project source code, a software interface table and project function information, wherein the controlled model library and the public test keyword library can be used for building a test environment based on a virtual ECU, and the function test case basic library and the function test case extension library can be used for screening test cases, so that in the subsequent software testing process, the complexity of the screened test cases is reduced through the built test environment based on the virtual ECU, and the constructed test case library can be used to realize the operation of automatic testing of various project functions in combination with test requirements. That is, the scheme provided in the embodiment of the application can reduce the test complexity, reduce the test time consumption, and greatly improve the efficiency and effect of software testing.

[0249] Finally, it should be pointed out that the above embodiments are only used to illustrate the technical solutions of the application and are not limiting. Although the application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the application can be modified or replaced equivalently without departing from the purpose and scope of the technical solutions of the application, and they should all be included in the protection scope of the application.

[0250] It should be noted that although the steps of the method in the application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order or that all the steps shown must be performed to achieve the desired result. In addition or alternatively, some steps can be omitted, a plurality of steps can be combined into one step, and / or one step can be divided into a plurality of steps, etc.; or the steps in different embodiments can be combined into a new technical solution. Based on the foregoing embodiments, the embodiments of the application provide a device including the modules included therein and the units included in the modules, which can be realized by a processor; of course, it can also be realized by a specific logic circuit; in the implementation process, the processor can be an AI acceleration engine (such as NPU), a graphics processing unit (GPU), a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.

[0251] Figure 11 A schematic diagram of a software testing device provided by the embodiment of the application is shown in FIG. 11, which includes an acquisition unit 1101, a construction unit 1102, a determination unit 1103 and a testing unit 1104. Figure 12

[0252] The acquisition unit 1101 is configured to acquire project source code, a software interface table, test requirements and project function information.​

[0253] The construction unit 1102 is configured to construct a test case library based on the project source code, the software interface table and the project function information, wherein the test case library comprises at least one or more of the following: a controlled model library, a public test keyword library, a function test case basic library and a function test case extension library.

[0254] The construction unit 1102 is further configured to construct a virtual ECU-based test environment based on the project source code, the test requirement, the project function information and the test case library.

[0255] The determination unit 1103 is configured to determine a first test case of a first project function based on the test case library and a test requirement of the first project function in the virtual ECU-based test environment, wherein the first project function is a project function to be tested.

[0256] The test unit 1104 is configured to perform an automated test on the first project function based on the first test case, and obtain a test result.

[0257] The above description of the device embodiments is similar to the description of the method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments.

[0258] It should be noted that the division of modules in the embodiments of the present application is illustrative, and is only a logical function division. In actual implementation, another division mode can be used. In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or can be physically separated, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a software functional unit. It can also be realized in the form of a combination of software and hardware.

[0259] It should be noted that if the above method is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a vehicle to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read only memory (ROM), a magnetic disk or an optical disk, and various storage media that can store program codes. Thus, the embodiments of the present application are not limited to any specific hardware and software combination.

[0260] The embodiment of the present application provides an electronic device, Figure 12 The structural schematic diagram of the electronic device provided by the embodiment of the present application is shown in the figure, ​ As shown in the figure, the electronic device 1200 comprises a memory 1201 and a processor 1202, the memory 1201 stores a computer program which can be run on the processor 1202, and the processor 1202 implements the steps in the method provided by the above embodiment when executing the program.

[0261] It should be noted that the memory 1201 is configured to store instructions and applications executable by the processor 1202, and can also buffer data (for example, image data, audio data, voice communication data and video communication data) to be processed or having been processed in the processor 1202 and each module of the electronic device 1200, which can be realized by a flash memory (FLASH) or a random access memory (RAM).

[0262] In some embodiments, the electronic device comprises a cloud server or a vehicle.

[0263] The embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps in the method provided by the above embodiment.

[0264] The embodiment of the present application provides a computer program product comprising instructions which, when executed on a computer, cause the computer to carry out the steps of the method provided by the above method embodiment.

[0265] It should be noted here that the description of the above storage medium and vehicle embodiment is similar to the description of the above method embodiment, and has similar beneficial effects to the method embodiment. For technical details not disclosed in the storage medium and vehicle embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0266] It should be understood that the term "one embodiment" or "an embodiment" or "some embodiments" as used herein means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Thus, the appearances of the phrase "in one embodiment" or "in an embodiment" or "in some embodiments" in various places throughout the specification are not necessarily referring to the same embodiment. Further, the particular features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that the sequence of steps in the above-described processes does not necessarily mean that the steps are executed in the order described, and the execution order of the steps should be determined according to their functions and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the application. The sequence numbers of the above-described embodiments of the application are only for description, and do not represent the advantages or disadvantages of the embodiments. The above description of each embodiment tends to emphasize the differences between the embodiments, and the same or similar parts can be mutually referred to, and are not described herein for the sake of brevity.

[0267] The term "and / or", merely describes an associated relationship, which means that there can be three relationships, for example, object A and / or object B, which can mean that object A exists alone, object A and object B exist together, and object B exists alone.

[0268] It should be noted that the terms "comprising", "including", or any other variant thereof, are intended to cover a non-exclusive inclusion, so that a process, method, article, or apparatus that comprises a list of elements does not include only those elements, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, the element defined by the sentence "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or device including the element.

[0269] In several embodiments provided by the present application, it should be understood that the disclosed vehicle and method can be implemented in other ways. The above-described embodiments are only illustrative, for example, the division of the modules is only a logical functional division, and actual implementation can have another division manner, for example, multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components can be through some interface, and the indirect coupling or communication connection between the vehicle or modules can be electrical, mechanical or other forms.

[0270] The modules described above as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; they can be located in one place or distributed on multiple network units; and some or all of the modules can be selected as needed to achieve the purposes of the embodiments.

[0271] In addition, the functional modules in the embodiments of the present application can be integrated in one processing unit, or each module can be a separate unit, or two or more modules can be integrated in one unit; the integrated modules can be realized in the form of hardware or in the form of hardware plus software function units.

[0272] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the aforementioned program can be stored in a computer readable storage medium, and the program executes the steps including the above-mentioned method embodiments when executed; and the aforementioned storage medium includes mobile storage devices, read only memory (ROM), magnetic discs or optical discs and various storage program codes.

[0273] Alternatively, the integrated units of the present application, if implemented in the form of software function modules and sold or used as independent products, can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products, which are stored in a storage medium and include several instructions for enabling the vehicle to execute all or part of the methods described in the embodiments of the present application. The aforementioned storage medium includes mobile storage devices, ROM, magnetic discs or optical discs and various storage program codes.

[0274] The methods disclosed in the several method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.

[0275] The features disclosed in the several product embodiments provided by the present application can be combined arbitrarily without conflict to obtain new product embodiments.

[0276] The features disclosed in the several method or vehicle embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments or vehicle embodiments.

[0277] The above merely provides the implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the change or replacement within the technical range disclosed by the present application, which should be covered in the protection scope of the present application.

Claims

1. A software testing method characterized by, The method comprises: acquiring project source code, a software interface table, test requirements and project function information; based on the project source code, the software interface table and the project function information, a test case library is constructed; wherein the test case library comprises one or more of the following: a controlled model library, a public test keyword library, a functional test case basic library and a functional test case extension library; the controlled model library is used to store controlled models used in the software testing process; the public test keyword library is used to store existing other functional test cases as preconditions called in the software testing process; based on the project source code, the test requirements, the project function information and the test case library, a virtual electronic control unit (ECU) based test environment is constructed; in the virtual ECU based test environment, based on the test case library and test requirements of a first project function, a first test case of the first project function is determined, and based on the first test case, an automatic test of the first project function is performed to obtain a test result; wherein the first project function is a project function to be tested; wherein, based on the project source code, the test requirements, the project function information and the test case library, the virtual ECU based test environment is constructed, comprising: generating an executable file of a master control model based on the project source code; acquiring a controlled model of a second project function and an executable file of the controlled model of the second project function in the controlled model library; wherein the second project function is a project function to be tested indicated by the test requirements; the second project function is used to determine the test function range; based on the executable file of the master control model and the executable file of the controlled model of the second project function, the virtual ECU based test environment is constructed.

2. The method of claim 1, wherein, The method comprises: based on the project source code, the software interface table and the project function information, determining an added project function and a test method of the added project function; in the case where the test method of the added project function is a preset method, designing a controlled model and an executable file of the controlled model; adding the controlled model and the executable file of the controlled model to the controlled model library.

3. The method of claim 1, wherein, The method comprises: based on the project source code, the software interface table and the project function information, determining an added project function; in the case where the added project function exists a second test case called, generating keyword information corresponding to the added project function based on the second test case; adding the keyword information to the public test keyword library.

4. The method according to any one of claims 1-3, characterized by, The method further comprises: based on the project source code, the software interface table and the project function information, determining an added project function; performing project range identification on the added project function to determine an identification result of the added project function.

5. The method of claim 4, wherein, The test case library is constructed based on the project source code, the software interface table and the project function information, and the test case library includes: Based on the function definition file included in the project function information, the basic design of the test case for the added project function is performed, and the basic test case of the added project function is obtained; Based on the identification result of the added project function, the project tag of the basic test case of the added project function is determined; The basic test case of the added project function and the project tag are added to the function test case basic library.

6. The method of claim 5, wherein, The test case library is constructed based on the project source code, the software interface table and the project function information, and the test case library includes: Based on the function definition file included in the project function information and the basic test case of the added project function, the extension design of the test case for the added project function is performed, and the extension test case of the added project function is obtained; The extension test case of the added project function and the project tag are added to the function test case extension library.

7. The method according to any one of claims 1-3, 5, 6, characterized in that, The first test case of the first project function is determined based on the test case library and the test requirement of the first project function, and the first test case of the first project function includes: For the first project function to be tested, the project number of the first project function is determined; Based on the project number and the test requirement of the first project function, the first test case is determined in the test case library.

8. The method of claim 7, wherein, The automatic test of the first project function is performed based on the first test case, and the test result is obtained, and the automatic test of the first project function includes: In the virtual ECU-based test environment, the first test case execution file is generated based on the first test case; The first test case execution file is automatically run to obtain the test result.

9. The method of claim 8, wherein, The method further includes: During the automatic running of the first test case execution file, the running log corresponding to the first test case is recorded and stored; Correspondingly, the method further includes: In the case of interruption of the automatic test of the first project function, the interruption protection processing is performed based on the running log corresponding to the first test case.

10. A software testing apparatus, characterized by, The software testing device includes: An acquisition unit is configured to acquire project source code, a software interface table, test requirements and project function information; A construction unit is configured to construct a test case library based on the project source code, the software interface table and the project function information; wherein the test case library includes one or more of the following: a controlled model library, a public test keyword library, a function test case basic library and a function test case extension library; the controlled model library is used to store controlled models used in the software testing process; the public test keyword library is used to store existing other function test cases as preconditions called in the software testing process; The construction unit is further configured to construct a virtual ECU-based test environment based on the project source code, the test requirements, the project function information and the test case library. A determining unit is configured to determine a first test case of a first project function based on the test case library and a test requirement of the first project function in the virtual ECU-based test environment, wherein the first project function is a project function to be tested. A testing unit is configured to perform automatic testing on the first project function based on the first test case to obtain a test result. In the virtual ECU-based test environment, The constructing unit is further configured to generate an executable file of the master model based on the project source code, acquire a controlled model of a second project function and an executable file of the controlled model of the second project function in the controlled model library, wherein the second project function is a project function to be tested indicated by the test requirement, the second project function is used for determining a test function range, and the virtual ECU-based test environment is constructed based on the executable file of the master model and the executable file of the controlled model of the second project function.

11. An electronic device comprising a memory and a processor, the memory storing a computer program operable to run on the processor, characterized in that, The processor executes the program to implement the method in any one of claims 1-9.

12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method in any one of claims 1-9.

13. A computer program product comprising computer programs or instructions, characterized in that, The computer program or the instruction is executed by the processor to implement the method in any one of claims 1-9.

Citation Information

Patent Citations

  • Automatic testing method for power supply partition software

    CN112699030A

  • Vehicle testing method and device

    CN114062806A