Test method and device of code engineering, electronic equipment and storage medium
By obtaining test configuration files from the server and linking test cases, unified testing of the underlying code of the Android and iOS players is performed, solving the problem of repetitive testing of the underlying SDK and realizing a cost-effective testing method.
Patent Information
- Application Number
- CN202210877885.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-25
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-07-25
AI Technical Summary
In existing technologies, testing the player on Android and iOS separately leads to repeated testing of the underlying SDK, increasing testing costs and wasting resources.
By obtaining the test configuration file from the server, and using the storage location and test type information in the file, the code to be tested is pulled from the server, and the corresponding test cases are linked to perform unified testing on the underlying code.
It enables simultaneous testing of the underlying SDK of the player on both Android and iOS platforms, avoiding redundant testing, reducing testing costs, and saving testing resources.
Smart Images

Figure CN115237778B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to testing methods, apparatus, electronic devices, and storage media for code engineering. Background Technology
[0002] Android and iOS are two different operating systems, using different programming languages and having different system features. However, regardless of the platform, the underlying code of a media player is a common set of codes. For example, the underlying code for media players on both Android and iOS is mostly developed using C and C++ languages.
[0003] In related technologies, testers need to test the Android player and the iOS player separately. However, the underlying software development kit (SDK) of the Android player and the underlying SDK of the iOS player are the same. Therefore, if the Android player and the iOS player are tested separately, it is equivalent to testing the underlying SDK of the player twice, which increases the testing cost and wastes testing resources. Summary of the Invention
[0004] This disclosure provides testing methods, apparatus, electronic devices, and storage media for code engineering, in order to at least solve the problem in the aforementioned related technologies that if testing is performed separately for Android players and iOS players, it is equivalent to testing the underlying SDK of the player twice, which increases testing costs and wastes testing resources.
[0005] According to a first aspect of the present disclosure, a method for testing a code project is provided, applied to a test terminal. The method includes: obtaining a server address from a business terminal; obtaining a test configuration file from a server indicated by the server address, wherein the test configuration file is uploaded to the server by the business terminal, and the test configuration file contains storage location information and test type information of each of a plurality of code contents to be tested contained in the code project to be tested on the server, the code project to be tested is uploaded to the server by the business terminal, and the code project to be tested is low-level code common to different operating systems; for each code content to be tested, based on the storage location information of the code content to be tested on the server, obtaining the code content to be tested from the server, and linking test cases corresponding to the test type information according to the test type information of the code content to be tested; and testing the code content to be tested using the test cases corresponding to the test type information.
[0006] Optionally, the test configuration file further includes the storage location information of the compiled file on the server; the test method further includes: obtaining the compiled file from the server based on the storage location information of the compiled file on the server, wherein the compiled file is uploaded to the server by the business terminal; the step of testing the code content to be tested using the test cases corresponding to the test type information includes: compiling the code content to be tested using the compiled file to obtain executable content; and testing the executable content corresponding to the code content to be tested using the test cases corresponding to the test type information.
[0007] Optionally, the test configuration file further includes the storage location information of each code content to be formatted in the code project to be tested on the server; the test method further includes: obtaining the code content to be formatted from the server according to the storage location information of each code content to be formatted on the server; and formatting each code content to be formatted.
[0008] Optionally, the server includes multiple servers, and each piece of code to be tested is stored in one of the multiple servers. The storage location information of each piece of code to be tested also indicates the server in which it is stored. The step of obtaining the piece of code to be tested from the server based on the storage location information of the piece of code to be tested on the server includes: obtaining the piece of code to be tested based on the server indicated by the storage location information of the piece of code to be tested and the storage location on the server.
[0009] Optionally, the test configuration file may also include a test result address, which indicates the address for sending the test results of the code project under test.
[0010] Optionally, the test configuration file may also include the storage location information of false positive information on the server; the test method may further include: obtaining the false positive information from the server based on the storage location information of the false positive information on the server, wherein the false positive information is information about falsely reported vulnerabilities obtained by the business terminal performing vulnerability analysis on the code project to be tested.
[0011] Optionally, the code to be tested is the code files in the folder contained in the code project to be tested.
[0012] Optionally, the code project to be tested is developed using the C / C++ language.
[0013] According to a second aspect of the present disclosure, a testing apparatus for a code project is provided, comprising: a server address acquisition module configured to acquire a server address from a business terminal; a test configuration file acquisition module configured to acquire a test configuration file from a server indicated by the server address, wherein the test configuration file is uploaded to the server by the business terminal, the test configuration file includes storage location information and test type information of each of a plurality of test code contents contained in the code project to be tested on the server, the code project to be tested is uploaded to the server by the business terminal, and the code project to be tested is low-level code common to different operating systems; a linking module configured to, for each test code content, acquire the test code content to be tested from the server based on the storage location information of the test code content to be tested on the server, and link test cases corresponding to the test type information according to the test type information of the test code content to be tested; and a testing module configured to test the test code content to be tested using the test cases corresponding to the test type information.
[0014] Optionally, the test configuration file further includes the storage location information of the compiled file on the server; the test device further includes: a compiled file acquisition module, configured to acquire the compiled file from the server based on the storage location information of the compiled file on the server, wherein the compiled file is uploaded to the server by the business terminal; the test module is configured to: compile the code content to be tested using the compiled file to obtain executable content; and test the executable content corresponding to the code content to be tested using the test cases corresponding to the test type information.
[0015] Optionally, the test configuration file further includes the storage location information of each code content to be formatted in the code project to be tested on the server; the test device further includes: a code content to be formatted acquisition module, configured to acquire the code content to be formatted from the server according to the storage location information of each code content to be formatted on the server; and a formatting module, configured to format each code content to be formatted.
[0016] Optionally, the server includes multiple servers, and each piece of code to be tested is stored on one of the multiple servers. The storage location information of each piece of code to be tested also indicates the server on which it is stored. The linking module is configured to: obtain the piece of code to be tested based on the server indicated by the storage location information of the piece of code to be tested and its storage location on the server.
[0017] Optionally, the test configuration file may also include a test result address, which indicates the address for sending the test results of the code project under test.
[0018] Optionally, the test configuration file further includes the storage location information of false positive information on the server; the test device further includes: a false positive information acquisition module, configured to acquire the false positive information from the server based on the storage location information of the false positive information on the server, wherein the false positive information is information on falsely reported vulnerabilities obtained by the business terminal performing vulnerability analysis on the code project to be tested.
[0019] Optionally, the code to be tested is the code files in the folder contained in the code project to be tested.
[0020] Optionally, the code project to be tested is developed using the C / C++ language.
[0021] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement a test method for code engineering according to the present disclosure.
[0022] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform a test method based on code engineering according to the present disclosure.
[0023] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a test method based on code engineering according to the present disclosure.
[0024] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0025] The testing method of the code project disclosed herein can test the code content to be tested pulled from the server based on the storage location information and test type information of each code content to be tested in the code project to be tested contained in the test configuration file. That is, only the underlying code needs to be tested. Since the underlying SDK of the Android player and the underlying SDK of the iOS player are the same, it is equivalent to simultaneously testing the Android player and the iOS player. Compared with the method of testing the player separately for different system terminals, the testing method of the code project disclosed herein avoids repeated testing of the player's underlying SDK, reduces testing costs, and saves testing resources.
[0026] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0027] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0028] Figure 1 This is a flowchart illustrating a testing method for a code project according to an exemplary embodiment of the present disclosure;
[0029] Figure 2 This is a flowchart illustrating a specific implementation of a testing method for a code project according to an exemplary embodiment of the present disclosure;
[0030] Figure 3 This is a schematic diagram illustrating the test results of code content according to an exemplary embodiment of the present disclosure;
[0031] Figure 4 This is a block diagram illustrating a testing apparatus for code engineering according to an exemplary embodiment of the present disclosure;
[0032] Figure 5 This is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0033] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0034] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0035] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. As another example, "performing at least one of step one and step two" indicates the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.
[0036] Figure 1 This is a flowchart illustrating a testing method for a code project according to an exemplary embodiment of the present disclosure, applied to a test terminal.
[0037] Reference Figure 1 In step 101, the server address can be obtained from the business terminal. It should be noted that since some code projects to be tested are quite large, storing them locally would consume a significant amount of storage space. Therefore, the business terminal can upload the code projects to be tested to a repository on the server for storage. Furthermore, the business terminal can also send the server address used to store the code projects to be tested, i.e., the repository address, to the testing terminal, so that the testing terminal can retrieve the code projects to be tested from the corresponding repository based on the repository address.
[0038] In step 102, a test configuration file can be obtained from the server indicated by the server address. This test configuration file is uploaded to the server by the business terminal. It may contain information about the storage location of each piece of code to be tested within the code project under test, as well as test type information. The code project under test, uploaded by the business terminal, can be low-level code common to different operating systems.
[0039] For example, a test configuration file can contain information about the storage location on the server for folders that need to be tested for line coverage, function coverage, or memory leaks. This allows business users to specify the code content to be tested and the corresponding test types in the test configuration file, meaning they only need to configure the relevant parameters to perform specified types of tests on the specified code content. The process is simple, convenient, and quick.
[0040] In step 103, for each piece of code to be tested, the code to be tested can be retrieved from the server based on its storage location information on the server, that is, the code to be tested can be pulled from the server to the local test terminal. Furthermore, the test cases corresponding to the test type information can be linked according to the test type information of the code to be tested.
[0041] Furthermore, the header files for the test cases can be obtained from the server, and then these header files can be used to link the test cases. Next, the test cases can be used to test the code to be tested.
[0042] In step 104, the test cases corresponding to the test type information can be used to test the code content to be tested.
[0043] For example, if the test configuration file specifies that code line coverage is tested for folder A in the code project under test, then only code line coverage can be tested for folder A; if the test configuration file specifies that memory leaks are tested for folder B in the code project under test, then only memory leaks can be tested for folder B, and so on.
[0044] According to an exemplary embodiment of this disclosure, the test configuration file may also include information about the storage location of the compiled file on the server. The compiled file can be retrieved from the server based on this storage location information. This compiled file is uploaded to the server by the business terminal. Then, the compiled file can be used to compile the code to be tested, obtaining executable content. Next, the test cases corresponding to the test type information can be used to test the executable content corresponding to the code to be tested.
[0045] According to an exemplary embodiment of this disclosure, the test configuration file may further include the storage location information of each piece of code to be formatted in the code project under test on the server. The code content to be formatted can be retrieved from the server based on its storage location information. Then, each piece of code content to be formatted can be formatted. It should be noted that some code content written by the business side may not be standardized; therefore, the code content that needs to be formatted can be specified in the test configuration file. The test terminal can then format the specified code content based on the test configuration file, making the corresponding code content more standardized.
[0046] According to exemplary embodiments of this disclosure, it should be noted that some code projects to be tested may be quite large, and the code content to be tested contained therein may be stored on different servers. Therefore, this disclosure may include multiple servers, and each piece of code to be tested may be stored on one of the multiple servers. The storage location information of each piece of code to be tested also indicates the server on which it is stored. The code content to be tested can be obtained based on the server indicated by the storage location information of the code content to be tested and its storage location on that server.
[0047] According to an exemplary embodiment of this disclosure, the test configuration file may further include a test result address, which indicates the address where the test results of the code project under test can be sent. Thus, after the code project under test is tested and test results are obtained, the test results can be sent to the location indicated by the test result address contained in the test configuration file. Testers can then view the test results and evaluate whether the code project needs further improvement based on the test results.
[0048] According to an exemplary embodiment of this disclosure, the test configuration file may also include information on the storage location of false positive information on the server. False positive information can be retrieved from the server based on this storage location information. This false positive information refers to vulnerability information falsely reported by the business terminal during vulnerability analysis of the code project under test. "False positive" means that the business terminal determines that certain code content in the code project under test has a vulnerability, but the developers, after analysis, believe that the code content is not problematic. In this case, the developers' analysis results should be taken as the standard.
[0049] According to an exemplary embodiment of this disclosure, the code to be tested can be code files in a folder contained in the code project to be tested.
[0050] According to an exemplary embodiment of this disclosure, the code project to be tested can be developed based on the C / C++ language.
[0051] Figure 2 A flowchart illustrating a specific implementation of a testing method for a code project according to an exemplary embodiment of the present disclosure is shown.
[0052] Reference Figure 2 In step 201, the business terminal integrates the open-source unit testing framework Catch2 into the code project to be tested. That is, the business terminal can include a header file in the code project to be tested, allowing the testing terminal to link to test cases using that header file and then use those test cases to test the code project.
[0053] In step 202, the business terminal configures the relevant parameters in the test configuration file according to its own needs.
[0054] For example, the contents of the test configuration file can be as follows:
[0055]
[0056]
[0057] In the aforementioned test configuration file, the "relative path to the entry point CMakeLists.txt" indicates the storage path of the compiled files on the server, where CMakeLists is a compilation method; the "project" field in "the content of project in CMakeLists.txt [required]" is the name of the code project to be tested; the "relative path to some scripts for cloning libraries and other operations before CMake" indicates the storage path of the code content to be tested stored on other servers besides the current server; the "false alarm stack information" in "due to possible false alarms, the stack information of false alarms will be put into separate files, and the file paths are given here" refers to the "false alarm vulnerability information obtained by the business terminal from vulnerability analysis of the code project to be tested" as described in the previous embodiment; "astyle" in "folders that need to be formatted with astyle" and "clang-format" in "folders that need to be formatted with clang-format" are two different formatting tools. In the aforementioned test configuration file, "required" indicates parameters that the business party must configure, while "optional" indicates parameters that the business party can selectively configure according to its own needs.
[0058] In this way, business users can specify the code content to be tested and the corresponding test type in the test configuration file according to their own needs. That is, business users only need to configure the relevant parameters in the test configuration file to perform specified types of tests on the specified code content to be tested. The implementation process is simple, convenient and quick.
[0059] In step 203, the business terminal uploads the code project to be tested and the configured test configuration file to the remote server, and sends the repository address of the server used to store the code project to be tested and the test configuration file to the test terminal.
[0060] In step 204, the test terminal configures the repository address sent by the business terminal on Jenkins. Jenkins then downloads the code project to be tested and the corresponding test configuration file from the remote server indicated by that repository address. Finally, Jenkins compiles and tests the code project based on the relevant parameters in the test configuration file. Jenkins is an open-source software project, a continuous integration tool developed based on Java, used to monitor repetitive tasks. It aims to provide an open and easy-to-use software platform that enables continuous software integration.
[0061] Reference Figure 3 , Figure 3 A schematic diagram illustrating the test results of code content according to an exemplary embodiment of this disclosure. Figure 3 The results show the test start time, compilation branch, name of the test submitter, execution artifacts of the code project under test, code line coverage test results, code function coverage test results, and memory leak detection test results. The execution artifacts of the code project under test (Jenkins address) can be a link that takes the user to a detailed test results page. This page can include the code project's test logs, the compilation process, and detailed test results for each code segment within the code project. Figure 3 The document also shows the pass / fail status of test cases and assertions. Test cases can be used to test the correctness of functions in the code project. Specifically, there are a total of 6 test cases, with 5 passing and 1 failing; and a total of 23 assertions, with 22 passing and 1 failing.
[0062] The testing method presented in this code project integrates and encapsulates open-source tools. It can use Catch2 as a unit testing framework, AddressSanitizer for memory leak detection, gcov / lcov for code coverage statistics, and Jenkins for code project testing and result notification. Since testing only the underlying code, and the Android and iOS player SDKs are the same, this effectively tests both the Android and iOS player simultaneously. Compared to testing players separately for different system terminals, this method avoids redundant testing of the player's underlying SDK, reduces testing costs, and saves testing resources.
[0063] Furthermore, the testing methods of the code project disclosed herein can encapsulate external interfaces, so that business users do not need to pay attention to internal details and intermediate processes. They only need to configure relevant parameters in the test configuration file to automatically complete the specified type of testing on the specified code content in the code project with one click. The implementation process is simple, convenient and fast.
[0064] Figure 4 This is a block diagram illustrating a test apparatus for a code project according to an exemplary embodiment of the present disclosure.
[0065] Reference Figure 4 The device 400 may include a server address acquisition module 401, a test configuration file acquisition module 402, a connection module 403, and a test module 404.
[0066] The server address acquisition module 401 can obtain the server address from the business terminal. It should be noted that some code projects to be tested are quite large, and storing them locally would consume a significant amount of storage space. Therefore, the business terminal can upload the code projects to be tested to a repository on the server for storage. Furthermore, the business terminal can also send the server address used to store the code projects to be tested, i.e., the repository address, to the testing terminal, so that the testing terminal can retrieve the code projects to be tested from the corresponding repository based on the server address.
[0067] The test configuration file acquisition module 402 can obtain the test configuration file from the server indicated by the server address. This test configuration file is uploaded to the server by the business terminal. It may contain information about the storage location of each piece of code to be tested within the code project under test, as well as test type information. The code project under test is uploaded to the server by the business terminal and can be low-level code common to different operating systems.
[0068] For example, a test configuration file can contain information about the storage location on the server for folders that need to be tested for line coverage, function coverage, or memory leaks. This allows business users to specify the code content to be tested and the corresponding test types in the test configuration file, meaning they only need to configure the relevant parameters to perform specified types of tests on the specified code content. The process is simple, convenient, and quick.
[0069] For each piece of code to be tested, the linking module 403 can retrieve the code to be tested from the server based on its storage location information on the server, that is, pull the code to be tested from the server to the local test terminal. Furthermore, the linking module 403 can link the corresponding test cases based on the test type information of the code to be tested.
[0070] Furthermore, the header files for the test cases can be obtained from the server, and then these header files can be used to link the test cases. Next, the test cases can be used to test the code to be tested.
[0071] The 404 test module can use the test cases corresponding to the test type information to test the code content to be tested.
[0072] For example, if the test configuration file specifies that code line coverage is tested for folder A in the code project under test, then only code line coverage can be tested for folder A; if the test configuration file specifies that memory leaks are tested for folder B in the code project under test, then only memory leaks can be tested for folder B, and so on.
[0073] According to an exemplary embodiment of this disclosure, the testing apparatus 400 for the code project may further include a compiled file acquisition module. The test configuration file may also include information about the storage location of the compiled file on the server. The compiled file acquisition module can acquire the compiled file from the server based on the storage location information. This compiled file is uploaded to the server by the business terminal. Then, the testing module 404 can use the compiled file to compile the code to be tested, obtaining executable content. Next, the testing module 404 can use the test cases corresponding to the test type information to test the executable content corresponding to the code to be tested.
[0074] According to an exemplary embodiment of this disclosure, the testing apparatus 400 for a code project may further include a code content acquisition module and a formatting module. The test configuration file may also include storage location information on the server for each piece of code content to be formatted in the code project under test. The code content acquisition module can acquire the code content to be formatted from the server based on the storage location information on the server. Then, the formatting module can format each piece of code content to be formatted. It should be noted that some code content written by the business side may not be standardized; therefore, the code content that needs to be formatted can be specified in the test configuration file. The test terminal can then format the specified code content based on the test configuration file, making the corresponding code content more standardized.
[0075] According to exemplary embodiments of this disclosure, it should be noted that some code projects to be tested may be quite large, and the code content to be tested contained therein may be stored on different servers. Therefore, this disclosure may include multiple servers, and each piece of code to be tested may be stored on one of the multiple servers. The storage location information of each piece of code to be tested also indicates the server on which it is stored. The linking module 403 can obtain the code content to be tested based on the server indicated by the storage location information of the code content to be tested and its storage location on that server.
[0076] According to an exemplary embodiment of this disclosure, the test configuration file may further include a test result address, which indicates the address where the test results of the code project under test can be sent. Thus, after the code project under test is tested and test results are obtained, the test results can be sent to the location indicated by the test result address contained in the test configuration file. Testers can then view the test results and evaluate whether the code project needs further improvement based on the test results.
[0077] According to an exemplary embodiment of this disclosure, the testing apparatus 400 for the code project may further include a false positive information acquisition module. The test configuration file may also include information on the storage location of false positive information on the server. The false positive information acquisition module can acquire false positive information from the server based on the storage location information of the false positive information on the server. Here, the false positive information refers to information about falsely reported vulnerabilities obtained by the business terminal during vulnerability analysis of the code project under test. "False positive" means that the business terminal determines that certain code content in the code project under test has a vulnerability, but the developers, after analysis, believe that the code content is not problematic. In this case, the developers' analysis result shall prevail.
[0078] According to an exemplary embodiment of this disclosure, the code to be tested can be code files in a folder contained in the code project to be tested.
[0079] According to an exemplary embodiment of this disclosure, the code project to be tested can be developed based on the C / C++ language.
[0080] Figure 5 This is a block diagram illustrating an electronic device 500 according to an exemplary embodiment of the present disclosure.
[0081] Reference Figure 5 The electronic device 500 includes at least one memory 501 and at least one processor 502. The at least one memory 501 stores instructions that, when executed by the at least one processor 502, execute a test method of code engineering according to an exemplary embodiment of the present disclosure.
[0082] As an example, electronic device 500 may be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned instructions. Here, electronic device 500 is not necessarily a single electronic device, but may be a collection of any devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Electronic device 500 may also be part of an integrated control system or system manager, or may be configured to interconnect with a portable electronic device locally or remotely (e.g., via wireless transmission) through an interface.
[0083] In electronic device 500, processor 502 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, processor may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc.
[0084] The processor 502 can execute instructions or code stored in the memory 501, which can also store data. Instructions and data can also be sent and received over a network via a network interface device, which can employ any known transmission protocol.
[0085] The memory 501 may be integrated with the processor 502, for example, by arranging RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 501 may include a separate device, such as an external disk drive, a storage array, or other storage device usable by any database system. The memory 501 and the processor 502 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 502 to read files stored in the memory.
[0086] In addition, electronic device 500 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of electronic device 500 can be interconnected via a bus and / or network.
[0087] According to exemplary embodiments of the present disclosure, a computer-readable storage medium may also be provided, which, when executed by a processor of an electronic device, enables the electronic device to perform a test method engineered according to the present disclosure. Examples of computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.
[0088] According to exemplary embodiments of the present disclosure, a computer program product may also be provided, including a computer program that, when executed by a processor, implements a test method based on code engineering according to the present disclosure.
[0089] According to the testing method, apparatus, electronic device, and storage medium of the code project disclosed herein, the code content to be tested pulled from the server can be tested based on the storage location information and test type information of each piece of code to be tested in the code project to be tested contained in the test configuration file. That is, only the underlying code needs to be tested. Since the underlying SDK of the Android player and the underlying SDK of the iOS player are the same, it is equivalent to simultaneously testing the Android player and the iOS player. Compared with the method of testing the player separately for different system terminals, the testing method of the code project disclosed herein avoids repeated testing of the underlying SDK of the player, reduces testing costs, and saves testing resources.
[0090] Furthermore, business users can specify the code content to be tested and the corresponding test types in the test configuration file according to their own needs. That is, business users only need to configure the relevant parameters in the test configuration file to perform specified types of tests on the specified code content to be tested. The implementation process is simple, convenient and quick.
[0091] Furthermore, some code written by business users may not be standardized. Therefore, the code content that needs to be formatted can be specified in the test configuration file. Then, the test terminal can format the specified code content based on the test configuration file, making the corresponding code content more standardized.
[0092] Furthermore, after testing the code project to be tested and obtaining the test results, the test results can be sent to the location indicated by the test result address contained in the test configuration file. In this way, testers can view the test results and evaluate whether the code project needs further improvement based on the test results.
[0093] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0094] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A testing method for code engineering, applied to a test terminal, characterized in that, The testing method includes: Obtain the server address from the business terminal; The test configuration file is obtained from the server indicated by the server address. The test configuration file is uploaded to the server by the business terminal. The test configuration file is used to configure the test content and test type of the code project to be tested. It includes the storage location information and test type information of each code content to be tested in the code project to be tested on the server. The code project to be tested is a low-level code that is common to different operating systems. The test type information includes at least one of the following: test code line coverage, test code function coverage, and test memory leak. The test configuration file also includes the storage location information of the compiled files on the server. For each piece of code to be tested, based on the storage location information of the code to be tested on the server, the code to be tested is retrieved from the server, and the test cases corresponding to the test type information are linked according to the test type information of the code to be tested. The compiled file is retrieved from the server based on the storage location information of the compiled file on the server, wherein the compiled file is uploaded to the server by the business terminal; The code to be tested is compiled using the compiled file to obtain executable content; The executable content corresponding to the code to be tested is tested using the test cases corresponding to the test type information.
2. The test method as described in claim 1, characterized in that, The test configuration file also contains the storage location information of each piece of code to be formatted in the code project to be tested on the server; The testing method also includes: Based on the storage location information of each code content to be formatted on the server, the code content to be formatted is retrieved from the server; Format each piece of code to be formatted.
3. The test method as described in claim 1, characterized in that, The server includes multiple servers, and each piece of code to be tested is stored in one of the multiple servers. The storage location information of each piece of code to be tested also indicates the server where it is stored. The step of retrieving the code content to be tested from the server based on the storage location information of the code content to be tested on the server includes: The code content to be tested is obtained based on the server indicated by the storage location information of the code content to be tested and the storage location on the server.
4. The test method as described in claim 1, characterized in that, The test configuration file also includes a test result address, which indicates the address where the test results of the code project to be tested are sent.
5. The test method as described in claim 1, characterized in that, The test configuration file also includes information on the storage location of false alarm information on the server; The testing method also includes: The false alarm information is obtained from the server based on the storage location information of the false alarm information on the server, wherein the false alarm information is information about the falsely reported vulnerabilities obtained by the business terminal in performing vulnerability analysis on the code project to be tested.
6. The test method as described in claim 1, characterized in that, The code to be tested refers to the code files in the folder contained in the code project to be tested.
7. The test method according to any one of claims 1 to 6, characterized in that, The code project to be tested was developed using the C / C++ language.
8. A testing device for code engineering, characterized in that, include: The server address acquisition module is configured to obtain the server address from the business terminal. The test configuration file acquisition module is configured to acquire a test configuration file from the server indicated by the server address. The test configuration file is uploaded to the server by the business terminal. The test configuration file is used to configure the test content and test type of the code project to be tested. It includes the storage location information and test type information of each code content to be tested in the code project to be tested on the server. The code project to be tested is a low-level code that is common to different operating systems. The test type information includes at least one of the following: test code line coverage, test code function coverage, and test memory leak. The test configuration file also includes the storage location information of the compiled files on the server. The linking module is configured to, for each piece of code to be tested, retrieve the code to be tested from the server based on the storage location information of the code to be tested on the server, and link the test cases corresponding to the test type information according to the test type information of the code to be tested; The compilation file acquisition module is configured to acquire the compilation file from the server based on the storage location information of the compilation file on the server, wherein the compilation file is uploaded to the server by the business terminal; The testing module is configured to compile the code to be tested using the compiled file to obtain executable content; and to test the executable content corresponding to the code to be tested using the test cases corresponding to the test type information.
9. The testing apparatus as described in claim 8, characterized in that, The test configuration file also contains the storage location information of each piece of code to be formatted in the code project to be tested on the server; The testing apparatus also includes: The code content to be formatted module is configured to retrieve the code content to be formatted from the server based on the storage location information of each code content to be formatted on the server; The formatting module is configured to format each piece of code to be formatted.
10. The testing apparatus as described in claim 8, characterized in that, The server includes multiple servers, and each piece of code to be tested is stored in one of the multiple servers. The storage location information of each piece of code to be tested also indicates the server where it is stored. The link module is configured as follows: The code content to be tested is obtained based on the server indicated by the storage location information of the code content to be tested and the storage location on the server.
11. The testing apparatus as described in claim 8, characterized in that, The test configuration file also includes a test result address, which indicates the address where the test results of the code project to be tested are sent.
12. The testing apparatus as described in claim 8, characterized in that, The test configuration file also includes information on the storage location of false alarm information on the server; The testing apparatus also includes: The false alarm information acquisition module is configured to acquire the false alarm information from the server based on the storage location information of the false alarm information on the server, wherein the false alarm information is information about falsely reported vulnerabilities obtained by the business terminal in performing vulnerability analysis on the code project to be tested.
13. The testing apparatus as described in claim 8, characterized in that, The code to be tested refers to the code files in the folder contained in the code project to be tested.
14. The testing apparatus as described in any one of claims 8 to 13, characterized in that, The code project to be tested was developed using the C / C++ language.
15. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the testing method of the code project as described in any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the test method of the code engineering as described in any one of claims 1 to 7.
17. A computer program product comprising a computer program that, when executed by a processor, implements a test method for a code engineering as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Unit test method and apparatus for user state network file system
CN107807883A
Test method and device, equipment and storage medium
CN113641575A
