CN111858367A - Code coverage rate testing method, system, device, electronic equipment and storage medium - Google Patents
Code coverage rate testing method, system, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111858367A CN111858367A CN202010725448.5A CN202010725448A CN111858367A CN 111858367 A CN111858367 A CN 111858367A CN 202010725448 A CN202010725448 A CN 202010725448A CN 111858367 A CN111858367 A CN 111858367A
- Authority
- CN
- China
- Prior art keywords
- file
- electronic device
- software
- coverage
- code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present disclosure provides a code coverage rate testing method, system, device, electronic device and storage medium, which relates to the technical field of software development, and the method comprises: receiving a first code coverage rate file sent by first electronic equipment, wherein the first code coverage rate file is generated by the first electronic equipment through a coverage rate test based on an installation package of software to be tested and is automatically uploaded; acquiring a test item of software to be tested; generating a result catalog corresponding to the test item according to the test item; and generating a first coverage report of the software to be tested according to the first code coverage file and the result directory. Therefore, the operation flow is simplified, and the efficiency of code coverage rate testing is improved.
Description
Technical Field
The present disclosure relates to the field of software development technologies, and in particular, to a method, a system, an apparatus, an electronic device, and a storage medium for testing code coverage.
Background
In the process of software development, software testing becomes an important link in the process of software development. In the process of software testing, it is necessary to know whether all code files of the software have been tested, and the test coverage degree of the code files of the software to be tested is often reflected by the code coverage rate. In the process of determining whether the code file is tested, multiple tests are often required for multiple test cases in order to obtain a more complete code coverage report. In the process of testing each test case, a tester needs to manually create a result directory for generating a coverage rate report, so that the operation is complex and the working efficiency is low.
Disclosure of Invention
The embodiment of the disclosure provides a code coverage rate testing method, a code coverage rate testing system, a code coverage rate testing device, electronic equipment and a storage medium, and can improve the efficiency of code coverage rate testing. The technical scheme is as follows:
according to an aspect of the embodiments of the present disclosure, there is provided a code coverage testing method, the method including:
receiving a first code coverage rate file sent by first electronic equipment, wherein the first code coverage rate file is generated by the first electronic equipment through a coverage rate test based on an installation package of software to be tested and is automatically uploaded;
acquiring a test item of the software to be tested;
generating a result catalog corresponding to the test item according to the test item;
and generating a first coverage rate report of the software to be tested according to the first code coverage rate file and the result directory.
In some embodiments, the obtaining the test item of the software to be tested includes:
determining a software identifier of the software to be tested corresponding to the first code coverage rate file;
and acquiring the test items of the software to be tested from an item file library according to the software identification.
In some embodiments, after receiving the first code coverage file sent by the first electronic device, the method further includes:
determining a second code coverage rate file, wherein the second code coverage rate file is a coverage rate file of a historical version of the software to be tested;
replacing the second code coverage file with the first code coverage file.
In some embodiments, after generating the first coverage report of the software to be tested according to the first code coverage file and the result directory, the method further comprises:
sending a refresh instruction to a second electronic device, where the refresh instruction carries the first coverage report, and is used for replacing the second coverage report displayed on the current interface with the first coverage report by the second electronic device, and the second coverage report is generated according to the second code coverage file.
In some embodiments, the method further comprises:
responding to a display request sent by the second electronic device, wherein the display request is used for requesting to display a target interface, sending interface data of the target interface to the second electronic device, and using the second electronic device to render the target interface according to the interface data, wherein the target interface comprises device identifications of a plurality of first electronic devices under test;
and receiving the device identification of the selected first electronic device sent by the second electronic device, and sending the second coverage rate report to the second electronic device according to the device identification of the first electronic device.
In some embodiments, the method further comprises:
receiving a test item of the software to be tested, which is sent by a third terminal, wherein the test item is automatically generated and uploaded by the third terminal;
and storing the test items into the item file library.
According to another aspect of the embodiments of the present disclosure, there is provided a code coverage testing system, the system including: the system comprises an installation package processing module and a coverage rate report generating module;
the installation package processing module is configured to execute an installation package for generating software to be tested, and the installation package comprises a coverage rate testing unit and an automatic uploading unit;
the coverage rate testing unit is configured to execute a coverage rate test based on the installation package of the software to be tested to obtain a first code coverage rate file;
the automatic uploading unit is configured to automatically upload the first code coverage rate file to the coverage rate report generation module;
the coverage report generating module is configured to execute receiving the first code coverage file, obtain an item to be tested, generate a result directory corresponding to the test item, and generate a first coverage report of the software to be tested according to the first code coverage file and the result directory.
In some embodiments, the coverage report generation module is configured to perform determining a software identifier of the software to be tested corresponding to the first code coverage file; and acquiring the test items of the software to be tested from an item file library according to the software identification.
In some embodiments, the coverage report generation module is further configured to perform determining a second code coverage file, the second code coverage file being a coverage file of a historical version of the software to be tested; replacing the second code coverage file with the first code coverage file.
In some embodiments, the coverage report generation module is further configured to perform replacing a second coverage report of a current interface presentation with the first coverage report, the second coverage report generated from the second code coverage file.
In some embodiments, the coverage report generating module is further configured to execute presenting a target interface, where the target interface includes device identifications of the plurality of first electronic devices under test; acquiring a device identifier of the selected first electronic device; and acquiring the second coverage rate report associated with the equipment identifier of the first electronic equipment according to the equipment identifier of the first electronic equipment.
According to another aspect of the embodiments of the present disclosure, there is provided a code coverage testing apparatus, the apparatus including:
the first receiving unit is configured to execute receiving of a first code coverage rate file sent by first electronic equipment, wherein the first code coverage rate file is generated by the first electronic equipment through a coverage rate test based on an installation package of software to be tested and is automatically uploaded;
the acquisition unit is configured to execute acquisition of a test item of the software to be tested;
a first generating unit configured to execute generating a result catalog corresponding to the test item according to the test item;
and the second generation unit is configured to generate a first coverage report of the software to be tested according to the first code coverage file and the result directory.
In some embodiments, the obtaining unit comprises:
the determining subunit is configured to execute the determination of the software identifier of the software to be tested corresponding to the first code coverage rate file;
and the acquisition subunit is configured to execute acquisition of the test item of the software to be tested from the item file library according to the software identification.
In some embodiments, the apparatus further comprises:
a determining unit configured to perform determining a second code coverage file, the second code coverage file being a coverage file of a historical version of the software to be tested;
a replacement unit configured to perform replacement of the second code coverage file with the first code coverage file.
In some embodiments, the apparatus further comprises:
a first sending unit, configured to execute sending of a refresh instruction to a second electronic device, where the refresh instruction carries the first coverage report, and is used for the second electronic device to replace the second coverage report displayed on the current interface with the first coverage report, and the second coverage report is generated according to the second code coverage file.
In some embodiments, the apparatus further comprises:
the second sending unit is configured to respond to receiving a display request sent by the second electronic device, wherein the display request is used for displaying a target interface, and execute sending interface data of the target interface to the second electronic device, so that the second electronic device renders the target interface according to the interface data, and the target interface comprises device identifications of a plurality of first electronic devices under test;
a second receiving unit configured to perform receiving the device identifier of the selected first electronic device sent by the second electronic device, and send the second coverage report to the second electronic device according to the device identifier of the first electronic device.
In some embodiments, the apparatus further comprises:
the third receiving unit is configured to execute the test item of the software to be tested sent by a third terminal, wherein the test item is automatically generated and uploaded by the third terminal;
a storage unit configured to perform storing the test item into the item file library.
According to another aspect of the embodiments of the present disclosure, there is provided an electronic device, where the terminal includes a processor and a memory, where at least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor to implement the code coverage testing method in any one of the foregoing possible implementation manners.
According to another aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium having at least one program code stored therein, the at least one program code being loaded and executed by a processor to implement the code coverage testing method described in any one of the above possible implementation manners.
According to another aspect of the embodiments of the present disclosure, there is provided a computer program product, wherein when the program code of the computer program product is executed by a processor of an electronic device, the electronic device is enabled to execute the code coverage testing method described in any one of the above possible implementation manners.
The technical scheme provided by the embodiment of the disclosure has the following beneficial effects:
in the embodiment of the disclosure, by the code coverage rate testing method, in the process of generating the coverage rate report, the operation flow can be simplified, and the efficiency of code coverage rate testing is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art to be able to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram illustrating a code coverage testing system in accordance with an exemplary embodiment;
FIG. 2 is a schematic diagram of a code coverage test method flow provided in accordance with an exemplary embodiment;
FIG. 3 is a flowchart illustrating a method of code coverage testing in accordance with an exemplary embodiment;
FIG. 4 is a flowchart illustrating a method of code coverage testing in accordance with an exemplary embodiment;
FIG. 5 is a flowchart illustrating a method of code coverage testing in accordance with an exemplary embodiment;
FIG. 6 is a flowchart illustrating a method of code coverage testing in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating a code coverage testing apparatus in accordance with an exemplary embodiment;
FIG. 8 is a block diagram illustrating a code coverage testing apparatus in accordance with an exemplary embodiment;
FIG. 9 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
FIG. 1 is a schematic diagram illustrating a code coverage testing system in accordance with an exemplary embodiment. Referring to fig. 1, the code coverage test system implementation environment includes an installation package processing module 101 and a coverage report generating module 102.
An installation package processing module 101 configured to execute generating an installation package of software to be tested, the installation package including a coverage rate testing unit and an automatic uploading unit; the coverage rate testing unit is configured to execute a coverage rate test based on the installation package of the software to be tested to obtain a first code coverage rate file; the automatic upload unit configured to perform automatic upload of the first code coverage file to the coverage report generation module 102; the coverage report generating module 102 is configured to receive the first code coverage file, obtain an item to be tested, generate a result directory corresponding to the test item, and generate a first coverage report of the software to be tested according to the first code coverage file and the result directory.
The installation package processing module 101 and the coverage report generating module 102 perform data interaction through a wireless connection or a data interface. The software to be tested is any type of software, for example, the software to be tested is video playing software, social application software or browser software. The software to be tested comprises a plurality of functions, and different functions are realized by different code files.
The installation package comprises a coverage rate test unit and an automatic uploading unit. The coverage rate testing unit comprises a code file of the software to be tested and a source code of a testing tool for testing the code file; the automatic upload unit includes a first script file of the test tool. In some embodiments, the installation package is an installation package of any file type, for example, in response to the installation package being an installation package applied in an Android (application system) system, the installation package is an APK (Android application package). In some embodiments, the software to be tested is software in an Android (Android, an application system) system, or the software to be tested is software in an IOS (application system) or other application systems. In some embodiments, the test tool is any tool having a coverage test, for example, the test tool is JaCoCo (an open source code coverage test tool in Java). The first script file is a script file having at least a trigger for an automatic upload command, and in some embodiments, the first script file is written in any programming language, for example, the first script file is a python script file, a Java script file, or the like.
In some embodiments, referring to fig. 2, the installation package processing module 101 packages the software to be tested through a software packaging application, which is any type of software packaging application, for example, Jenkins (a persistent integrated packaging system) packaging application. The installation package processing module 101 receives a code file of the software to be tested, a source code of a testing tool for testing the code file, and a first script file of the testing tool, which are input by a developer, and packages the code file of the software to be tested, the source code of the testing tool for testing the code file, and the first script file of the testing tool, which are input by the developer. In some embodiments, the first script file has a function of triggering a copy command, in some embodiments, the installation package processing module 101 can copy the code file of the software to be tested in the other electronic device and the source code of the testing tool for testing the code file through the first script file, and in the embodiments of the present disclosure, the process of the installation package processing module 101 acquiring the code file of the software to be tested, the source code of the testing tool for testing the code file and the first script file of the testing tool is not particularly limited.
With continued reference to fig. 2, when packaging the code file of the software to be tested, the source code of the testing tool for testing the code file, and the first script file of the testing tool, the installation package processing module 101 needs to perform instrumentation on the code file of the software to be tested. When packaging a code file of software to be tested, the installation package processing module 101 compiles the code file of the software to be tested, traverses the compiled code file by executing a source code of a test tool, determines each method branch in the code file, and inserts a pointer as an identifier for each method branch, wherein if a code statement indicating a branch such as if (a code statement), else (a code statement) or switch (a code statement) is found in the traversing process, a pointer is inserted as an identifier after the branch method.
In some embodiments, the installation package processing module 101 is a module on the same electronic device; alternatively, the installation package processing module 101 is a module on a different electronic device. In response to that the installation package processing module 101 is a module on the same first electronic device, the first electronic device generates an installation package of software to be tested through the installation package processing module 101, and performs coverage rate test on the installation package through a coverage rate test unit in the installation package.
In this implementation manner, the installation package processing module 101 is installed in the first electronic device, and the installation package is packaged, installed and tested by the first electronic device, so that the code coverage testing system is simplified, the code coverage testing process is simplified, and the code coverage testing efficiency is improved.
With continued reference to fig. 2, in response to the installation package processing module 101 being a module on a different electronic device, in some embodiments, the code coverage test system includes a first electronic device and a third electronic device. The third electronic device is configured to generate an installation package of software to be tested according to the code coverage rate file, send the installation package to the first electronic device, the first electronic device is configured to receive the installation package, analyze the installation package to obtain a relevant file in the installation package, install the software to be tested according to the installation package, test the software to be tested, generate a code coverage rate file, and automatically upload the code coverage rate file to the coverage rate report generation module 102.
In this implementation manner, the installation package processing module 101 is a module on different electronic devices, and is respectively packaged and tested by different electronic devices, so that different testing steps can be performed by different electronic devices in the testing process, and after the installation package is generated, the installation package is respectively sent to different testing terminals, so that software testing is performed by a plurality of third electronic devices, and the efficiency of software testing is improved
In some embodiments, the coverage report generating module 102 is a module in a fourth electronic device that generates a coverage report from the received code coverage file via the coverage report generating module 102.
In some embodiments, the first electronic device, the second electronic device, the third electronic device, and the fourth electronic device are terminals or servers. The terminal is a mobile phone, a computer, a tablet computer or wearable equipment and the like. The servers are independent servers, or the servers are a server cluster consisting of a plurality of servers, or the servers are cloud servers and the like. In the embodiments of the present disclosure, the electronic device is not particularly limited.
In some implementations, referring to fig. 2, the coverage report generating module 102 is configured to perform determining the software identifier of the software to be tested corresponding to the first code coverage file; and acquiring the test item of the software to be tested from the item file library according to the software identification.
The coverage report generating module 102 stores a plurality of test items in the fourth electronic device, and the coverage report generating module 102 obtains the test items corresponding to the first code coverage file according to the received first code coverage file, and generates a code coverage report according to the test items and the first code coverage file.
In some implementations, the coverage report generation module 102 is further configured to perform determining a second code coverage file, the second code coverage file being a coverage file of a historical version of the software to be tested; replacing the second code coverage file with the first code coverage file.
In some implementations, the coverage report generation module 102 is further configured to perform replacing a second coverage report of a current interface presentation with the first coverage report, the second coverage report generated from the second code coverage file.
In some implementations, the coverage report generating module 102 is further configured to perform presenting a target interface, where the target interface includes device identifications of the plurality of first electronic devices under test; acquiring a device identifier of the selected first electronic device; and acquiring the second coverage rate report associated with the equipment identifier of the first electronic equipment according to the equipment identifier of the first electronic equipment.
In the embodiment of the disclosure, by the code coverage rate testing method, in the process of generating the coverage rate report, the operation flow can be simplified, and the efficiency of code coverage rate testing is improved.
FIG. 3 is a flowchart illustrating a code coverage testing method according to an exemplary embodiment, as shown in FIG. 3, the code coverage testing method including the steps of:
in step 301, a first code coverage file sent by a first electronic device is received, where the first code coverage file is generated by a coverage test performed on the first electronic device based on an installation package of software to be tested and is automatically uploaded.
In step 302, a test item of the software to be tested is obtained.
In step 303, a result list corresponding to the test item is generated according to the test item.
In step 304, a first coverage report of the software to be tested is generated according to the first code coverage file and the result directory.
In some embodiments, the obtaining the test item of the software to be tested includes:
determining the software identifier of the software to be tested corresponding to the first code coverage rate file;
and acquiring the test item of the software to be tested from the item file library according to the software identification.
In some embodiments, after receiving the first code coverage file transmitted by the first electronic device, the method further comprises:
determining a second code coverage rate file, wherein the second code coverage rate file is a coverage rate file of the historical version of the software to be tested;
replacing the second code coverage file with the first code coverage file.
In some embodiments, after the generating a first coverage report of the software to be tested according to the first code coverage file and the result directory, the method further comprises:
sending a refresh instruction to a second electronic device, where the refresh instruction carries the first coverage report, and is used for the second electronic device to replace the second coverage report displayed on the current interface with the first coverage report, and the second coverage report is generated according to the second code coverage file.
In some embodiments, the method further comprises:
responding to a display request sent by the second electronic device, wherein the display request is used for requesting to display a target interface, sending interface data of the target interface to the second electronic device, and rendering the target interface by the second electronic device according to the interface data, wherein the target interface comprises device identifications of a plurality of first electronic devices under test;
and receiving the device identification of the selected first electronic device sent by the second electronic device, and sending the second coverage rate report to the second electronic device according to the device identification of the first electronic device.
In some embodiments, the method further comprises:
receiving a test item of the software to be tested, which is sent by a third terminal, wherein the test item is automatically generated and uploaded by the third terminal;
and storing the test item into the item file library.
In the embodiment of the disclosure, by the code coverage rate testing method, in the process of generating the coverage rate report, the operation flow can be simplified, and the efficiency of code coverage rate testing is improved.
In the embodiment of the present disclosure, a first code coverage file is generated by a first electronic device, the first code coverage file is sent to a fourth electronic device, and a first coverage report is generated by the fourth electronic device according to the received first code coverage file. Before the fourth electronic device generates the first coverage report according to the first code coverage file, the first electronic device needs to send the first code coverage file generated by the test to the fourth electronic device. Fig. 4 is a flowchart illustrating a code coverage testing method according to an exemplary embodiment, which is described in the embodiment of the present disclosure by taking an example that a first electronic device generates a first code coverage file and automatically uploads the first code coverage file to a fourth electronic device. As shown in fig. 4, the code coverage test method includes the following steps:
in step 401: and the first electronic equipment performs code coverage rate test on the installation package through the source code of the test tool to obtain a first code coverage rate file of the software to be tested.
In some embodiments, the first code coverage file includes at least one of a code file corresponding to a function of the software to be tested that has been tested, a file identifier of the code file, or a pointer identifier corresponding to the code file.
After the first electronic device analyzes the installation package of the software to be tested, the software to be tested is installed, the software to be tested is operated, the code file to be tested in the code file is determined through the source code file of the testing tool of the first electronic device, and the code coverage rate test is completed. The first electronic device can run the software to be tested, display a function interface of the software to be tested, perform code coverage rate testing on the software to be tested by running different functions, and record a code file of the run function through a source code of a testing tool to obtain a first code coverage rate file of the software to be tested.
In some embodiments, the first electronic device generates a first code coverage file according to a tested function after completing testing of the function. In some embodiments, the first electronic device generates the first code coverage file of the software to be tested when receiving the generation instruction. The process of generating the first code coverage rate file by the first electronic equipment is realized by the following steps of (1) to (2), and comprises the following steps:
(1) and the first electronic equipment carries out code coverage rate test on the code file through the source code of the test tool to obtain a test result.
In this step, the first electronic device records a code file corresponding to the tested function in the code coverage rate testing process by running the source code of the testing tool, so as to obtain a testing result.
(2) And responding to the received generation instruction, and generating a first code coverage rate file of the software to be tested by the first electronic equipment according to the test result.
In some embodiments, the generation instruction is a generation instruction that the first electronic device constructs according to the proceeding degree of the code coverage rate test; or the generating instruction is a generating instruction constructed according to the triggering operation. In some embodiments, the first electronic device constructs the generation instruction upon detecting completion of the coverage test. The first electronic device can detect the duration that the test tool does not perform the function test, and in response to the duration being greater than the preset duration, the first electronic device is determined to complete the code coverage test of the software to be tested, and a generation instruction is constructed.
In an implementation mode, whether the first electronic device is still performing software testing is determined by monitoring the duration of the test file which is not updated any more, so that a generation instruction is automatically constructed in the process of performing software testing, test personnel are not required to participate, and the accuracy and efficiency of coverage rate testing are improved.
In some embodiments, the generation instruction is an instruction generated after the first electronic device receives the trigger operation. In some embodiments, the trigger operation is set and changed as needed, and in the embodiments of the present disclosure, the trigger operation is not particularly limited. The trigger operation is, for example, an operation of clicking a volume key, double-clicking a screen, or sliding in a specified direction.
In the implementation manner, the first electronic device constructs the generation instruction after receiving the trigger operation, and generates the test result into the first code coverage rate file, so that the generation process of the first code coverage rate file can be controlled, and the flexibility of generating the first code coverage rate file is improved.
In step 402: and the first electronic equipment generates an uploading command according to the installation package.
The upload command is used for instructing the first electronic device to upload the first code coverage file to the fourth electronic device. The installation package comprises an automatic uploading unit, and the first electronic equipment generates an uploading command according to the automatic uploading unit in the installation package.
In some embodiments, the first electronic device creates a storage directory of the first code coverage file when starting to perform code coverage monitoring, and stores the first code coverage file generated in the code coverage test process into the storage directory. In some embodiments, the first electronic device monitors integrity of the first code coverage file stored in the storage directory after the code coverage test is completed, and generates the upload command when the first code coverage file in the storage directory is complete. The automatic uploading unit comprises a first script file, and the first electronic equipment monitors the file integrity of the first code coverage rate file through the first script file; responsive to the file integrity for indicating that the first code coverage file is complete.
In this implementation manner, the first electronic device monitors the integrity of the first code coverage rate file before generating the upload command, and generates the upload command only when the generation of the first code coverage rate file is completed, so that the uploaded first code coverage rate file is ensured to be the complete first code coverage rate file, and the accuracy of determining the code coverage rate is improved.
In step 403: and the first electronic equipment triggers the software to be tested to construct a first uploading request by running the uploading command.
In some embodiments, the first upload request is any type of request message, for example, the first upload request is an HTTP (HyperText Transfer Protocol) request. The first electronic equipment builds a first uploading request through the installed software to be tested. The software to be tested can perform data interaction with the fourth electronic device. In some embodiments, a target interface is configured in the fourth electronic device for the software to be tested, and the fourth electronic device receives a first upload request sent by the software to be tested through the target interface. The process of the first electronic device forming the first upload request is thus realized by the following steps (1) - (2), including:
(1) the first electronic device determines a target interface for the fourth electronic device to receive the first code coverage file.
In this step, the first electronic device obtains, through the first script file, a target interface of the software to be tested, which performs data interaction with the fourth electronic device. The target interface is written according to a frame of a different fourth electronic device, for example, in response to that the fourth electronic device is a frame of a backend using SpringBoot in Java, the target interface is a written interface in combination with a MySQL (MyStructure Quest Language) database; in response to that the fourth electronic device is a flush backend framework in Python, the target interface is an interface written in combination with the flush backend framework in Python, which is not specifically limited in the embodiment of the present disclosure. In some embodiments, the interface is a getCovergeFile interface.
(2) The first electronic device triggers the software to be tested to construct the first uploading request by running the uploading command according to the target interface, and a receiver of the first uploading request is the target interface of the fourth electronic device.
In this step, the first electronic device runs the upload command, triggers the software to be tested to construct a first upload request for data interaction with the fourth electronic device through the upload command, and sets a receiver of the first upload request as a target interface of the fourth electronic device.
In the implementation mode, the first electronic device establishes the first uploading request through the first script file by the software to be tested, so that the first electronic device can perform data interaction with the fourth electronic device according to the generation of the software to be tested when the test is completed, the first code coverage file is uploaded to the fourth electronic device, and the code coverage test efficiency is improved.
In step 404, the first electronic device adds the first code coverage file to the first upload request to obtain a second upload request.
Wherein, the second upload request carries the first code coverage file. And the first electronic equipment adds the generated first code coverage rate to the first uploading request to obtain a second uploading request carrying the first code coverage rate file.
In step 405, the first electronic device sends the second upload request to the fourth electronic device.
In this step, the first electronic device sends the second upload request to the fourth electronic device according to the target interface. And the first electronic equipment uploads the first code coverage rate file to the fourth electronic equipment through the second uploading request.
In the embodiment of the disclosure, by the code coverage rate testing method, in the process of generating the coverage rate report, the operation flow can be simplified, and the efficiency of code coverage rate testing is improved.
And after receiving the first code coverage rate file automatically uploaded by the first electronic equipment, the fourth electronic equipment generates a first coverage rate report according to the first code coverage rate file. FIG. 5 is a flowchart illustrating a code coverage testing method according to an exemplary embodiment, as shown in FIG. 5, the code coverage testing method including the steps of:
in step 501, the fourth electronic device receives the first code coverage file sent by the first electronic device.
The first code coverage rate file is generated by the first electronic device through a coverage rate test based on an installation package of software to be tested and automatically uploaded. And after the first electronic equipment generates the first code coverage rate file, the first electronic equipment sends the generated first code coverage rate file to the fourth electronic equipment.
And a project file library is arranged in the fourth electronic equipment, and a plurality of test projects corresponding to the software to be tested are stored in the project file library. And the fourth electronic equipment generates a coverage report according to the code coverage file and the corresponding test item. In some embodiments, the fourth electronic device is an electronic device implemented by any of the backend frames. For example, the backend framework of the fourth electronic device is a backend framework using SpringBoot in Java (a programming language), or a backend framework using flush in Python (a programming language). In the embodiments of the present disclosure, this is not particularly limited.
In this step, the fourth electronic device receives the second upload request sent by the first electronic device, and continues to be in the first code coverage file from the second upload request.
In some embodiments, after receiving the second upload request sent by the first electronic device, the fourth electronic device stores the first code coverage file carried in the second upload request in the fourth electronic device. And the fourth electronic equipment constructs a storage directory of the to-be-tested software corresponding to the first code coverage rate file, and stores the first code coverage rate file in the corresponding storage directory of the to-be-tested software. After receiving the first code coverage rate file, the fourth electronic device detects whether a storage directory of the to-be-tested software corresponding to the first code coverage rate file is established or not, responds to the situation that the storage directory of the to-be-tested software corresponding to the first code coverage rate file is not established, establishes the storage directory of the to-be-tested software corresponding to the first code coverage rate file, and stores the first code coverage rate file in the storage directory of the to-be-tested software; and in response to the construction of the storage directory of the software to be tested corresponding to the first code coverage rate file, the fourth electronic device replaces the second code coverage rate file stored in the storage directory of the software to be tested with the first code coverage rate file. The process is realized by the following steps (1) to (2), and comprises the following steps:
(1) the fourth electronic device determines a second code coverage file.
Wherein the second code coverage file is a coverage file of the historical version of the software to be tested. In this step, the fourth electronic device determines the storage directory of the software to be tested corresponding to the first code coverage, and determines the second code coverage file of the storage directory of the software to be tested in response to the existence of the storage directory of the software to be tested.
(2) The fourth electronic device replaces the second code coverage file with the first code coverage file.
In this step, the fourth electronic device deletes the second code coverage file in the storage directory of the software to be tested, and stores the first code coverage file in the storage directory of the software to be tested.
In this implementation manner, the fourth electronic device updates the second code coverage file in the fourth electronic device according to the received first code coverage file, thereby ensuring that the code coverage in the fourth electronic device can be automatically updated, ensuring that the fourth electronic device can determine a coverage report in real time, and improving the real-time performance of determining the coverage report.
In step 502, the fourth electronic device determines the software identifier of the software to be tested corresponding to the first code coverage rate file.
The test item includes at least a code file of the software to be tested. In some embodiments, the first code coverage rate carries a software identifier of the software to be tested. The software identification is the identification of the software name, the test serial number and the like of the software to be tested. In some embodiments, a second script file is configured in the fourth electronic device, and the second script file is used to pull the test item in the item file library.
In some embodiments, the item file library stores a plurality of test items, and also stores the corresponding relationship between the test items and the software identifications. Before the step, the fourth electronic device constructs a project file library, receives the test projects uploaded by the first electronic device, and constructs the project file library according to the test projects.
The process is realized by the following steps (a1) - (a2), including:
(A1) and the fourth electronic equipment receives a fourth uploading request sent by the first electronic equipment, wherein the fourth uploading request carries the test item of the software to be tested.
The fourth request is constructed by the first electronic device through running a copy command, the copy command is generated by a first script file of a testing tool, and the testing tool is a tool for testing the software to be tested.
In some embodiments, the first script file is further configured to generate a copy command, the copy command configured to copy a test item received by the first electronic device to the software to be tested to the fourth electronic device, so that the fourth electronic device can store the test item. The test item at least comprises a code file of the software to be tested.
(A2) The fourth electronic device stores the test item in the item file library.
In this implementation manner, the first electronic device copies the test items of the software to be tested to the item file library of the fourth electronic device through the first script file, so that the item file library can store a plurality of test items, and the fourth electronic device can pull the test software in the test items.
In step 503, the fourth electronic device obtains the test item of the software to be tested from the item file library according to the software identifier.
And the fourth electronic equipment extracts the software identification of the software to be tested in the first coverage rate file and determines the test item corresponding to the software identification according to the software identification. The process is realized by the following steps (B1) - (B2), including:
(B1) and the fourth electronic equipment inquires the test item corresponding to the software identification from the item file library according to the software identification.
In this step, the fourth electronic device queries the test item corresponding to the software identifier from the item file library.
(B2) The fourth electronic device invokes the test item.
And responding to the fourth electronic equipment to inquire the test item, and calling the test item from the item file library by the fourth electronic equipment.
In the implementation manner, the fourth electronic device determines the test item corresponding to the test software through the software identifier of the software to be tested, and automatically pulls the test item corresponding to the first code coverage rate file through the first script file, so that a tester does not need to manually copy the first code coverage rate file to the test item, and the test efficiency of the code coverage test is improved.
In step 504, the fourth electronic device generates a result catalog corresponding to the test item according to the test item.
In this step, the fourth electronic device generates a creation command for creating a result directory of the test item according to the second script file and the test item. In some embodiments, the second script file is a script file written using the same programming language as the first script file, or the second script file is a script file written using another programming language, which is not particularly limited in the embodiments of the present disclosure. The result directory is used for storing the test items and the first code coverage file. In some embodiments, the result directory is written by merge directory, and in the embodiments of the present disclosure, the writing manner of the result directory is not particularly limited.
In step 505, the fourth electronic device generates a first coverage report for the code file based on the first code coverage file and the result directory.
In this step, the fourth electronic device creates the result directory in the fourth electronic device by executing the create command, generates a first coverage report of the first code coverage file by executing the coverage report generating script, and stores the first coverage report in the result directory.
In the embodiment of the disclosure, by the code coverage rate testing method, in the process of generating the coverage rate report, the operation flow can be simplified, and the efficiency of code coverage rate testing can be improved
In some embodiments, the fourth electronic device, after generating the first coverage report, sends the first coverage report to the second electronic device, which displays the first coverage report. The second electronic device can display the first coverage rate reports corresponding to the first electronic devices. Fig. 6 is a flow chart illustrating a coverage test method according to an exemplary embodiment, as shown in fig. 6, the coverage test method including the steps of:
in step 601, the second electronic device sends a presentation request to the fourth electronic device.
Wherein, the display request is used for requesting to display the target interface. A target application for presenting the first coverage report is installed in the second electronic device. The second electronic device receives a first display instruction of a target interface through the target application, and generates a display request according to the first display instruction of the target interface, wherein the display request comprises a device identifier of the second electronic device.
The target interface is an interface in the second electronic device for presenting the first coverage report. In some embodiments, the target interface is a browser interface or the like. A first coverage report corresponding to a plurality of first electronic devices can be displayed in the target interface.
In step 602, the fourth electronic device receives a presentation request sent by the second electronic device.
In step 603, the fourth electronic device sends the interface data of the target interface to the second electronic device, so that the second electronic device renders the target interface according to the interface data, where the target interface includes device identifiers of the first electronic devices under test.
In some embodiments, the interface data of the target interface is HTML (HyperText Markup Language) type data for rendering the data of the target interface into the second electronic device.
And the fourth electronic equipment generates the interface data of the target interface by using the equipment identification of the first electronic equipment and the first coverage rate file corresponding to each first electronic equipment.
Step 604: the second electronic device receives interface data of the target interface.
And after receiving the interface data of the target interface, the second electronic equipment performs page rendering on the interface data to obtain a displayable target interface, and displays the target interface.
In the embodiment of the disclosure, the second electronic device obtains the first coverage files of the plurality of first electronic devices from the first electronic device, and displays the coverage files of the plurality of first electronic devices in the target interface, so that a tester can view coverage reports of different electronic devices.
In some embodiments, the tester further selects, through the second electronic device, a first coverage file corresponding to the first electronic device from the target interface to view the first coverage file of the first electronic device. Prior to this step, the first electronic device associates a device identification of the first electronic device with the first coverage report.
In some embodiments, the device identification of the first electronic device is a hardware identification of the first electronic device, a software identification of software to be tested for testing using the first electronic device, or the like.
And when the fourth electronic device generates a first coverage rate report, determining to-be-tested software corresponding to the first coverage rate report, and determining a device identifier of the first electronic device which is used for installing the to-be-tested software to perform code coverage rate testing according to the to-be-tested software. In some embodiments, the second upload request further carries an equipment identifier of the first electronic equipment, and the fourth electronic equipment obtains the equipment identifier of the first electronic equipment from the second upload request.
The second electronic device sends an acquisition request to a fourth electronic device, wherein the acquisition request carries the device identifier of the first electronic device, and the fourth electronic device sends a first coverage rate report corresponding to the first electronic device to the second electronic device according to the device identifier of the first electronic device. The second electronic device presents the received first coverage report of the first electronic device.
In this implementation manner, the fourth electronic device sends a first coverage report corresponding to one first electronic device to the second electronic device according to the acquisition request of the second electronic device, and displays the first coverage report of any first electronic device in the second electronic device, so that a tester can select the first coverage report of the first electronic device to be checked, and the checked first coverage report is more targeted.
In some embodiments, the second electronic device can also send a refresh request to the fourth electronic device requesting that the currently displayed page be refreshed. The process is realized by the following steps (1) to (4), and comprises the following steps:
(1) the second electronic device sends a refresh request to a fourth electronic device.
Wherein the refresh indication carries the first coverage report, and is used for the second electronic device to replace the second coverage report displayed on the current interface with the first coverage report, and the second coverage report is generated according to the second code coverage file.
In some embodiments, the second electronic device receives a refresh command through the target interface and generates a refresh request according to the refresh command. For example, the second electronic device receives a click operation input by a user through the target interface, determines a device identifier of the first electronic device selected by the user according to the click operation, generates a refresh request according to the device identifier, and sends the refresh request to the fourth electronic device.
(2) And the fourth electronic equipment receives the refresh request sent by the second electronic equipment.
(3) The fourth electronic device determines a first coverage report associated with the device identity of the first electronic device according to the device identity of the first electronic device.
(4) And the fourth electronic equipment sends update data to the second electronic equipment, wherein the update data carries a second coverage rate report and is used for replacing the first coverage rate report displayed on the current interface by the second electronic equipment.
In this implementation manner, the newly generated second coverage report is sent to the second electronic device through the fourth electronic device, and the first coverage report displayed in the second electronic device is updated through the second coverage report. Therefore, when the coverage rate test is updated, the second electronic equipment can refresh the target interface and display a new coverage rate report, so that the software to be tested is tested while the coverage rate test report is updated, and the real-time performance of the coverage rate test report is improved.
In the embodiment of the disclosure, by the code coverage rate testing method, in the process of generating the coverage rate report, the operation flow can be simplified, and the efficiency of code coverage rate testing is improved.
FIG. 7 is a block diagram illustrating a code coverage testing apparatus according to an example embodiment. Referring to fig. 7, the apparatus includes:
a first receiving unit 701, configured to execute receiving a first code coverage rate file sent by a first electronic device, where the first code coverage rate file is generated by the first electronic device based on a coverage rate test performed on an installation package of software to be tested and is automatically uploaded;
an obtaining unit 702 configured to perform obtaining a test item of the software to be tested;
a first generating unit 703 configured to perform generating a result list corresponding to the test item according to the test item;
a second generating unit 704 configured to generate a first coverage report of the software to be tested according to the first code coverage file and the result directory.
In some embodiments, referring to fig. 8, the obtaining unit 702 includes:
a determining subunit 7021, configured to perform determining a software identifier of the software to be tested corresponding to the first code coverage rate file;
an obtaining subunit 7022, configured to execute obtaining, according to the software identifier, a test item of the software to be tested from the item repository.
In some embodiments, referring to fig. 8, the apparatus further comprises:
a determining unit 705 configured to perform determining a second code coverage file, the second code coverage file being a coverage file of a historical version of the software to be tested;
a replacement unit 706 configured to perform a replacement of the second code coverage file with the first code coverage file.
In some embodiments, referring to fig. 8, the apparatus further comprises:
a first sending unit 707 configured to perform sending, to a second electronic device, a refresh instruction, where the refresh instruction carries the first coverage report, so that the second electronic device replaces the second coverage report of the current interface display with the first coverage report, and the second coverage report is generated according to the second code coverage file.
In some embodiments, referring to fig. 8, the apparatus further comprises:
a second sending unit 708, configured to, in response to receiving a display request sent by the second electronic device, where the display request is used to display a target interface, execute sending, to the second electronic device, interface data of the target interface, where the target interface is rendered by the second electronic device according to the interface data, and includes device identifiers of multiple first electronic devices under test;
a second receiving unit 709 configured to perform receiving the device identifier of the selected first electronic device sent by the second electronic device, and send the second coverage report to the second electronic device according to the device identifier of the first electronic device.
In some embodiments, referring to fig. 8, the apparatus further comprises:
a third receiving unit 710 configured to execute a test item for receiving the software to be tested sent by a third terminal, where the test item is automatically generated and uploaded by the third terminal;
and the storage unit is configured to store the test item into the item file library.
In the embodiment of the disclosure, by the code coverage rate testing method, in the process of generating the coverage rate report, the operation flow can be simplified, and the efficiency of code coverage rate testing is improved.
It should be noted that: in the code coverage rate testing apparatus provided in the above embodiment, when performing the code coverage rate test, only the division of each functional module is illustrated, and in practical applications, the function distribution is completed by different functional modules according to needs, that is, the internal structure of the terminal is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the code coverage rate testing apparatus provided in the above embodiment and the code coverage rate testing method embodiment belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
FIG. 9 is a block diagram illustrating an electronic device in accordance with an example embodiment. In some embodiments, the electronic device 900 is: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group audio Layer III, motion Picture Experts compression standard audio Layer 3), an MP4 player (Moving Picture Experts Group audio Layer IV, motion Picture Experts compression standard audio Layer 4), a notebook computer, or a desktop computer. The electronic device 900 may also be referred to by other names such as user equipment, portable terminals, laptop terminals, desktop terminals, and the like.
In general, the electronic device 900 includes: a processor 901 and a memory 902.
In some embodiments, processor 901 includes one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. In some embodiments, the processor 901 is implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable logic Array). In some embodiments, processor 901 also includes a main processor and a coprocessor, the main processor is a processor for Processing data in the wake state, also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 901 is integrated with a GPU (graphics processing Unit), which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, processor 901 further includes an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
In some embodiments, memory 902 includes one or more computer-readable storage media that are non-transitory. In some embodiments, memory 902 also includes high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 902 is used to store at least one instruction for execution by processor 901 to implement the code coverage test method provided by method embodiments in the present disclosure.
In some embodiments, the electronic device 900 may further optionally include: a peripheral interface 903 and at least one peripheral. In some embodiments, the processor 901, the memory 902, and the peripheral interface 903 are connected by buses or signal lines. Each peripheral is connected to the peripheral interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 904, a touch display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908, and a power supply 909.
The peripheral interface 903 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, memory 902, and peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902 and the peripheral interface 903 are implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 904 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 904 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 904 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 904 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. In some embodiments, the radio frequency circuitry 904 communicates with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 904 further includes NFC (Near Field Communication) related circuitry, which is not limited by this disclosure.
The display screen 905 is used to display a UI (User Interface). In some embodiments, the UI includes graphics, text, icons, video, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to capture touch signals on or over the surface of the display screen 905. In some embodiments, the touch signal is input to the processor 901 as a control signal for processing. In this case, the display 905 is also used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 905 is one, providing the front panel of the electronic device 900; in other embodiments, the number of the display panels 905 is at least two, and the display panels are respectively disposed on different surfaces of the electronic device 900 or in a folding design; in still other embodiments, the display 905 is a flexible display disposed on a curved surface or on a folded surface of the electronic device 900. Even more, the display screen 905 is arranged in a non-rectangular irregular figure, i.e. a shaped screen. In some embodiments, the Display panel 905 is made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or the like.
The camera assembly 906 is used to capture images or video. Optionally, camera assembly 906 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 906 also includes a flash. The flash lamp is a single-color temperature flash lamp or a double-color temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp and can be used for light compensation under different color temperatures.
In some embodiments, audio circuitry 907 includes a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 901 for processing, or inputting the electric signals to the radio frequency circuit 904 for realizing voice communication. In some embodiments, multiple microphones may be provided at different locations of the electronic device 900 for stereo sound acquisition or noise reduction purposes. In some embodiments, the microphone is also an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. In some embodiments, the speaker is a conventional membrane speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only the electric signal can be converted into a sound wave audible to human, but also the electric signal can be converted into a sound wave inaudible to human for use in distance measurement or the like. In some embodiments, audio circuit 907 also includes a headphone jack.
The positioning component 908 is used to locate a current geographic location of the electronic device 900 to implement navigation or LBS (location based Service). In some embodiments, the Positioning component 908 is a Positioning component based on the united states GPS (Global Positioning System), the chinese beidou System, the russian graves System, or the european union galileo System.
The power supply 909 is used to supply power to various components in the electronic device 900. In some embodiments, power source 909 is alternating current, direct current, disposable batteries, or rechargeable batteries. When the power source 909 includes a rechargeable battery, the rechargeable battery supports wired charging or wireless charging. The rechargeable battery is also used to support fast charge technology.
In some embodiments, the electronic device 900 also includes one or more sensors 910. The one or more sensors 910 include, but are not limited to: acceleration sensor 911, gyro sensor 912, pressure sensor 913, fingerprint sensor 914, optical sensor 915, and proximity sensor 916.
The acceleration sensor 911 is capable of detecting the magnitude of acceleration in three coordinate axes of a coordinate system established with the electronic apparatus 900. For example, the acceleration sensor 911 is used to detect the components of the gravitational acceleration in three coordinate axes. The processor 901 can control the touch display 905 to display a user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 911. The acceleration sensor 911 is also used for acquisition of motion data of a game or a user.
The gyro sensor 912 can detect the body direction and the rotation angle of the electronic device 900, and in some embodiments, the gyro sensor 912 and the acceleration sensor 911 cooperate to acquire the 3D motion of the user on the electronic device 900. The processor 901 can implement the following functions according to the data collected by the gyro sensor 912: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
In some embodiments, the pressure sensors 913 are disposed on the side bezel of the electronic device 900 and/or underneath the touch display screen 905. When the pressure sensor 913 is disposed on the side frame of the electronic device 900, the user's holding signal of the electronic device 900 can be detected, and the processor 901 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 913. When the pressure sensor 913 is disposed at a lower layer of the touch display 905, the processor 901 controls the operability control on the UI interface according to the pressure operation of the user on the touch display 905. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 914 is used for collecting a fingerprint of the user, and the processor 901 identifies the user according to the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 identifies the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, processor 901 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. In some embodiments, the fingerprint sensor 914 is disposed on a front, back, or side of the electronic device 900. When a physical button or vendor Logo is provided on the electronic device 900, the fingerprint sensor 914 is integrated with the physical button or vendor Logo.
The optical sensor 915 is used to collect ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the touch display 905 based on the ambient light intensity collected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 905 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 905 is turned down. In another embodiment, processor 901 is further capable of dynamically adjusting the shooting parameters of camera assembly 906 based on the ambient light intensity collected by optical sensor 915.
The proximity sensor 916, also known as a distance sensor, is typically disposed on the front panel of the electronic device 900. The proximity sensor 916 is used to capture the distance between the user and the front of the electronic device 900. In one embodiment, when the proximity sensor 916 detects that the distance between the user and the front face of the electronic device 900 gradually decreases, the processor 901 controls the touch display 905 to switch from the bright screen state to the dark screen state; when the proximity sensor 916 detects that the distance between the user and the front surface of the electronic device 900 becomes gradually larger, the processor 901 controls the touch display 905 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 9 does not constitute a limitation of the electronic device 900, and can include more or fewer components than shown, or combine certain components, or employ a different arrangement of components.
In an exemplary embodiment, a computer readable storage medium is also provided, in which at least one program code is stored, the at least one program code being executable by a processor in an electronic device to perform the code coverage testing method in the above embodiments. For example, the computer-readable storage medium is a ROM (Read-Only Memory), a RAM (Random Access Memory), a CD-ROM (compact disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, and the like.
The present disclosure also provides a computer program product, wherein when a program code in the computer program product is executed by a processor of a terminal or a server, the electronic device is enabled to execute the code coverage testing method provided by the above-mentioned method embodiments.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (10)
1. A method for code coverage testing, the method comprising:
receiving a first code coverage rate file sent by first electronic equipment, wherein the first code coverage rate file is generated by the first electronic equipment through a coverage rate test based on an installation package of software to be tested and is automatically uploaded;
acquiring a test item of the software to be tested;
generating a result catalog corresponding to the test item according to the test item;
and generating a first coverage rate report of the software to be tested according to the first code coverage rate file and the result directory.
2. The method of claim 1, wherein said obtaining test items of said software under test comprises:
determining a software identifier of the software to be tested corresponding to the first code coverage rate file;
and acquiring the test items of the software to be tested from an item file library according to the software identification.
3. The method of claim 1, wherein after receiving the first code coverage file transmitted by the first electronic device, the method further comprises:
determining a second code coverage rate file, wherein the second code coverage rate file is a coverage rate file of a historical version of the software to be tested;
replacing the second code coverage file with the first code coverage file.
4. The method of claim 3, wherein after generating a first coverage report for the software under test from the first code coverage file and the result catalog, the method further comprises:
sending a refresh instruction to a second electronic device, where the refresh instruction carries the first coverage report, and is used for replacing the second coverage report displayed on the current interface with the first coverage report by the second electronic device, and the second coverage report is generated according to the second code coverage file.
5. The method of claim 4, further comprising:
responding to a display request sent by the second electronic device, wherein the display request is used for requesting to display a target interface, sending interface data of the target interface to the second electronic device, and using the second electronic device to render the target interface according to the interface data, wherein the target interface comprises device identifications of a plurality of first electronic devices under test;
and receiving the device identification of the selected first electronic device sent by the second electronic device, and sending the second coverage rate report to the second electronic device according to the device identification of the first electronic device.
6. A code coverage test system, the system comprising: the system comprises an installation package processing module and a coverage rate report generating module;
the installation package processing module is configured to execute an installation package for generating software to be tested, and the installation package comprises a coverage rate testing unit and an automatic uploading unit;
the coverage rate testing unit is configured to execute a coverage rate test based on the installation package of the software to be tested to obtain a first code coverage rate file;
the automatic uploading unit is configured to automatically upload the first code coverage rate file to the coverage rate report generation module;
the coverage report generating module is configured to execute receiving the first code coverage file, obtain an item to be tested, generate a result directory corresponding to the test item, and generate a first coverage report of the software to be tested according to the first code coverage file and the result directory.
7. An apparatus for code coverage testing, the apparatus comprising:
the first receiving unit is configured to execute receiving of a first code coverage rate file sent by first electronic equipment, wherein the first code coverage rate file is generated by the first electronic equipment through a coverage rate test based on an installation package of software to be tested and is automatically uploaded;
the acquisition unit is configured to execute acquisition of a test item of the software to be tested;
a first generating unit configured to execute generating a result catalog corresponding to the test item according to the test item;
and the second generation unit is configured to generate a first coverage report of the software to be tested according to the first code coverage file and the result directory.
8. An electronic device, characterized in that the terminal comprises a processor and a memory, in which at least one program code is stored, which is loaded and executed by the processor to implement the code coverage test method according to any of claims 1-5.
9. A computer-readable storage medium having stored therein at least one program code, the at least one program code being loaded and executed by a processor, to implement the code coverage testing method of any one of claims 1-5.
10. A computer program product, characterized in that program code in the computer program product is executed by a processor of an electronic device to implement the code coverage testing method according to any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010725448.5A CN111858367A (en) | 2020-07-24 | 2020-07-24 | Code coverage rate testing method, system, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010725448.5A CN111858367A (en) | 2020-07-24 | 2020-07-24 | Code coverage rate testing method, system, device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111858367A true CN111858367A (en) | 2020-10-30 |
Family
ID=72950762
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010725448.5A Pending CN111858367A (en) | 2020-07-24 | 2020-07-24 | Code coverage rate testing method, system, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111858367A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114546820A (en) * | 2020-11-24 | 2022-05-27 | 华为技术有限公司 | Application program debugging method and electronic equipment |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104391795A (en) * | 2014-12-03 | 2015-03-04 | 北京京东尚科信息技术有限公司 | Method and system for automatically testing coverage rate in distributed system |
IN2015DN01249A (en) * | 2012-08-24 | 2015-06-26 | Tesa Se | |
CN105589805A (en) * | 2015-12-16 | 2016-05-18 | 北京奇虎科技有限公司 | Method and device for generating code coverage rate report |
CN105630670A (en) * | 2015-12-16 | 2016-06-01 | 北京奇虎科技有限公司 | Code coverage rate test method and device |
CN108959059A (en) * | 2017-05-19 | 2018-12-07 | 腾讯科技(深圳)有限公司 | A kind of test method and test platform |
CN109002395A (en) * | 2018-07-06 | 2018-12-14 | 北京京东金融科技控股有限公司 | A kind of code coverage management method and device |
CN109388566A (en) * | 2018-09-27 | 2019-02-26 | 北京城市网邻信息技术有限公司 | A kind of code coverage rate analysis method, apparatus, equipment and storage medium |
CN110795329A (en) * | 2018-08-02 | 2020-02-14 | 阿里巴巴集团控股有限公司 | Coverage rate testing method and system, processor and storage medium |
-
2020
- 2020-07-24 CN CN202010725448.5A patent/CN111858367A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
IN2015DN01249A (en) * | 2012-08-24 | 2015-06-26 | Tesa Se | |
CN104391795A (en) * | 2014-12-03 | 2015-03-04 | 北京京东尚科信息技术有限公司 | Method and system for automatically testing coverage rate in distributed system |
CN105589805A (en) * | 2015-12-16 | 2016-05-18 | 北京奇虎科技有限公司 | Method and device for generating code coverage rate report |
CN105630670A (en) * | 2015-12-16 | 2016-06-01 | 北京奇虎科技有限公司 | Code coverage rate test method and device |
CN108959059A (en) * | 2017-05-19 | 2018-12-07 | 腾讯科技(深圳)有限公司 | A kind of test method and test platform |
CN109002395A (en) * | 2018-07-06 | 2018-12-14 | 北京京东金融科技控股有限公司 | A kind of code coverage management method and device |
CN110795329A (en) * | 2018-08-02 | 2020-02-14 | 阿里巴巴集团控股有限公司 | Coverage rate testing method and system, processor and storage medium |
CN109388566A (en) * | 2018-09-27 | 2019-02-26 | 北京城市网邻信息技术有限公司 | A kind of code coverage rate analysis method, apparatus, equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
于艳: "《软件测试策略、设计及其自动化实战》", 西安电子科技大学出版社, pages: 109 - 112 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114546820A (en) * | 2020-11-24 | 2022-05-27 | 华为技术有限公司 | Application program debugging method and electronic equipment |
CN114546820B (en) * | 2020-11-24 | 2022-12-30 | 华为技术有限公司 | Application program debugging method and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109582579A (en) | Applied program testing method, device, electronic equipment and storage medium | |
CN111338910B (en) | Log data processing method, log data display method, log data processing device, log data display device, log data processing equipment and log data storage medium | |
CN108897659B (en) | Method, device and storage medium for modifying log level | |
CN111177013A (en) | Log data acquisition method and device, computer equipment and storage medium | |
CN111752666A (en) | Window display method and device and terminal | |
CN110837473A (en) | Application program debugging method, device, terminal and storage medium | |
CN112770177B (en) | Multimedia file generation method, multimedia file release method and device | |
CN113076051A (en) | Slave control terminal synchronization method, device, terminal and storage medium | |
CN111737100A (en) | Data acquisition method, device, equipment and storage medium | |
CN111210280A (en) | Content item conversion tracking method, device, terminal, server and medium | |
CN111858382A (en) | Application program testing method, device, server, system and storage medium | |
CN112052167A (en) | Method and device for generating test script code | |
CN110968815A (en) | Page refreshing method, device, terminal and storage medium | |
CN113377647A (en) | Page processing method, device, server, terminal and readable storage medium | |
CN109634872B (en) | Application testing method, device, terminal and storage medium | |
CN110569064B (en) | Interface identifier generation method, device, equipment and storage medium | |
CN113971123A (en) | Application program testing method and device, testing terminal and storage medium | |
CN111858367A (en) | Code coverage rate testing method, system, device, electronic equipment and storage medium | |
CN110825465A (en) | Log data processing method and device, electronic equipment and storage medium | |
CN113591090B (en) | Program bug reporting method, device, equipment and storage medium | |
CN112000576A (en) | Code data detection method, device, equipment and storage medium | |
CN113051485A (en) | Group searching method, device, terminal and storage medium | |
CN112860261A (en) | Static code checking method and device, computer equipment and readable storage medium | |
CN112783533A (en) | Version information updating method, version information updating device, terminal and storage medium | |
CN112596810A (en) | Loading prompt information display method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |