Automatic test method and system for high-precision map interface of unmanned mine and storage medium

By converting high-precision map interface files into json and yml files, and generating and executing test cases, the problems of incomplete coverage of test cases and difficulty in problem positioning in the existing technology are solved, and an efficient testing and development process is achieved, and the quality and credibility of high-precision map management are improved.

CN119576773APending Publication Date: 2025-03-07JIANGSU XCMG STATE KEY LAB TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411634529.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing high-precision map business test mainly relies on black box testing methods, and cannot deeply understand the internal implementation details and logic of the code, resulting in incomplete coverage of test cases and difficulty in positioning problems, which increases testing costs and waste of time.

Method used

By obtaining the high-precision map interface file of the unmanned mine, preprocessing it to generate a json file, formatting it into a yml file, parsing the yml file to generate a test case, and automatically executing the test case to generate a test report, gaining in-depth understanding of the internal implementation details and logic of the code, and comprehensively covering the test cases.

Benefits of technology

It has achieved an in-depth understanding of the internal implementation details and logic of the code, comprehensively covers test cases, can quickly and accurately locate problems, minimize time waste, improve testing and development efficiency, and improve the quality and credibility of high-precision map management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576773A_ABST
    Figure CN119576773A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic test method and system for an unmanned mine high-precision map interface and a storage medium, and belongs to the technical field of mine high-precision map interface test.The method comprises the steps that an unmanned mine high-precision map interface file is obtained, a high-precision map interface is preprocessed, json files corresponding to all elements in all layers of a high-precision map are obtained, and json files corresponding to all elements in all the layers of the high-precision map are obtained; wherein the pattern layer comprises a planar pattern layer, a linear pattern layer and a dotted pattern layer; performing formatting processing on the json files according to a preset format to obtain yml files corresponding to the json files; the yml file is analyzed, and a test case is generated; and executing the test case and generating a test report. According to the high-precision map interface automatic test scheme, internal implementation details and logic of codes can be deeply known, test cases can be more comprehensively covered, when the test cases fail, problems can be accurately positioned, time waste is reduced to the maximum extent, and test and development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of mine high-precision map interface testing, and in particular, relates to an unmanned mine high-precision map interface automated testing method, system and storage medium. Background Art

[0002] The high-precision map of the unmanned open-pit mine intuitively displays the map elements in the actual production process on site, which helps to accurately record the location data during the vehicle driving process. In the actual production process of the unmanned mine, the business logic of the high-precision map will be modified according to the project requirements. In the existing high-precision map business testing process, the black box testing method has been used, and the underlying code logic is not involved. The test cases of black box testing are written from the perspective of the requirements document. When the requirements document is not clear, the test cases will be omitted and the coverage will not be comprehensive. Due to the complex logic of the high-precision map, modifying part of the business logic may involve multiple interfaces. Black box testing does not directly access the code. Therefore, when problems occur in the test, the underlying implementation logic of the code will be shielded, resulting in the inability of testers to quickly and accurately feedback the problem, and developers need to spend a lot of time and energy to find the root of the problem. In addition, since black box testing cannot determine the execution path of the code, when the requirements or code are frequently changed, the test cases need to be frequently repeated, which increases the testing cost and wastes manpower.

[0003] Therefore, as the functions of high-precision maps become more and more complete and the implementation logic becomes more and more complex, there is an urgent need to provide an automated testing method that can deeply understand the internal implementation details and logic of the code and can comprehensively cover test cases. Summary of the invention

[0004] The present invention provides an automated testing method, system and storage medium for the high-precision map interface of an unmanned mine. By converting the business logic interface involved in the requirements into test cases and automatically executing the test cases to generate test reports, the internal implementation details and logic of the code can be deeply understood, and the test cases can be covered more comprehensively. Problems can be accurately located from the test reports, thereby minimizing time waste and improving testing and development efficiency.

[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions: In a first aspect, the present invention provides an automated testing method for an unmanned mine high-precision map interface, comprising: Obtain the high-precision map interface file of the unmanned mine, and preprocess the high-precision map interface to obtain the json file corresponding to each element in each layer of the high-precision map; Format the json files according to a preset format to obtain yml files corresponding to each json file; Parse the yml file and generate test cases; Execute test cases and generate test reports.

[0006] Optionally, the high-precision map interface file of the unmanned mine is obtained, and the high-precision map interface is preprocessed to obtain a json file corresponding to each element in each layer of the high-precision map, including: Use springboot to integrate the swagger framework to generate the interface document of the unmanned mine high-precision map, which is divided into three layers according to the surface, line and point shapes; Export each feature in each layer as a json file, and store each json file by layer.

[0007] Optionally, the json files are formatted according to a preset format to obtain yml files corresponding to each json file, including: using python to convert the data in each json file into a corresponding yml file with a unified format, and storing each yml file in layers, wherein the format includes: use case id, use case name, request address, request method, request header, request parameter type, and assertion.

[0008] Optionally, parsing the yml file to generate a test case includes: parsing each yml file into a corresponding python format file, and storing each python file in layers, wherein the python file is named in the form of test_element name.py.

[0009] Optionally, executing the test case and generating a test report includes: Use the Redis database to cache Python test cases, and use the pytest framework to automate the testing of the data cached in the Redis database to obtain the test results. Use Allure to obtain a test report based on the test results.

[0010] Optionally, after executing the test case and generating the test report, the method further includes: feeding back the test report to the test initiator, analyzing the test report, and locating the problematic test case.

[0011] Optionally, after locating the problematic test case, the method further includes: modifying the problematic test case, and testing the modified test case until there is no problematic test case in the test report.

[0012] In a second aspect, the present invention provides an automated testing system for an unmanned mine high-precision map interface, comprising: Interface preprocessing module: used to obtain the interface file of the unmanned mine high-precision map, and preprocess the high-precision map interface to obtain the json file corresponding to each element in each layer of the high-precision map; Test case formatting module: used to format the json file according to a preset format to obtain the yml file corresponding to each json file; Test case generation module: used to parse the yml file and generate test cases; Test case execution and test report generation module: used to execute test cases and generate test reports.

[0013] In a third aspect, the present invention provides a computer storage medium having a computer program stored thereon. When the computer program is executed by a processor, the automated testing method for the high-precision map interface of an unmanned mine as described in any step of the first aspect is implemented.

[0014] In a fourth aspect, the present invention provides an electronic terminal comprising a processor and a memory connected to the processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the automated testing method for the high-precision map interface of an unmanned mine as described in any step of the first aspect is executed.

[0015] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: the high-precision map interface automated testing method proposed in this article, by exporting the mine high-precision map interface into a json file that maps all elements of the map layer, and then converting the json file into a yml file with the same format, can generate a test case in a standardized python file format, so that the internal implementation details and logic of the code can be deeply understood, the test cases can be covered more comprehensively, and the test cases can be automatically executed through the written python scripts. When the test case fails, the problem can be accurately located through the test report, which minimizes time waste, improves testing and development efficiency, and improves the quality and credibility of unmanned mine high-precision map management; the present invention stores the parameters in the Redis database cache, which shortens the automatic testing time when the number of interfaces is large; and for a large number of interfaces, the test report completion can be automatically fed back to the tester, further improving the testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 The figure is a flow chart of an automated testing method for an unmanned mine high-precision map interface in an embodiment of the present invention;

[0017] Figure 2 The figure is a flow chart of an automated testing method for an unmanned mine high-precision map interface in another embodiment of the present invention;

[0018] Figure 3The figure shows a schematic diagram of the structure of an automated testing system for an unmanned mine high-precision map interface in an embodiment of the present invention;

[0019] Figure 4 Shown is a diagram of the internal structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0021] Example 1

[0022] like Figure 1 As shown, this embodiment provides an automated testing method for an unmanned mine high-precision map interface, including:

[0023] Obtain the high-precision map interface file of the unmanned mine, and preprocess the high-precision map interface to obtain the json file corresponding to each element in each layer of the high-precision map;

[0024] Format the json files according to a preset format to obtain yml files corresponding to each json file;

[0025] Parse the yml file and generate test cases;

[0026] Execute test cases and generate test reports.

[0027] During the iteration of the high-precision map version of the unmanned mine, this embodiment aims to address the current problems of low test case coverage, difficulty in locating the root cause of the problem, and repeated execution of test cases. By converting the high-precision map interface into a json file that maps all the elements in the layer, a yml file with a unified format, and standardized test cases, the test coverage can be effectively increased, and the cause of the problem can be quickly and accurately fed back through the test report, so that it can be modified and improved, saving manpower and time costs, improving test development efficiency, and further improving the quality of high-precision map management in unmanned mines.

[0028] Example 2

[0029] Based on Example 1, this example also makes the following design.

[0030] In the unmanned mine cloud platform project, high-precision maps are an important component. According to the layer classification, they can be divided into three categories: surface, line and point. The surface layer includes elements: drivable area, structured area, reference area, loading area, unloading area, parking lot, static objects, the line layer includes elements: lane, reference boundary, point layer includes elements: lane node, unloading point, loading point, parking space. The surface and line layers have drawing, editing, deleting, cutting and merging operations, and the point layer has drawing, editing and deleting operations.

[0031] like Figure 2 As shown in the figure, the automated testing method for the high-precision map interface of unmanned mines is specifically divided into the following steps:

[0032] S1: Preprocessing high-precision map interface. The interface document of the unmanned mine high-precision map is automatically generated using the springboot integrated swagger framework. It is divided into three layers according to the surface, line, and point. Each layer contains several elements, and each element contains several operation interfaces. Each element is exported as a json file, and the json file is stored in layers to facilitate parsing and generate test cases.

[0033] S2: Format test cases. Customize the yml test case format, including: test case id, test case name, request address, request method, request header, request parameter type, assertion and other information. The test case id is named with the number_interface name and is unique, and the test case name is the interface name. Write a python script to automatically convert the data in each json file into a yml file, and store the yml file in layers for subsequent management of test cases. Define a separate Allure tag in each yml file to generate an Allure test report.

[0034] S3: Generate test cases. Write a python script to parse the yml document, generate test cases in a specific format, convert each yml file into a python file, and name it test_element name.py, so that pytest can be used to execute the test cases. The custom class in the python file contains all the operations of a single element. The class name is defined as Test_element name. Each interface corresponds to a test case, which is named test_operation_element name. The method parameters are defined as list type, and the .py files are stored by layer classification.

[0035] S4: Automatically execute test cases. Due to the large amount of test case data, if only variables are used to temporarily store the test case data, there is a possibility that the program will be stuck due to abnormalities. Therefore, the present invention uses the Redis database to cache test cases to improve data reading efficiency, reads the request address, request method, request header, request parameter type, assertion, etc. from the yml file according to the test case id and caches them in the Redis database, uses the pytest framework to read data from the Redis cache in the order of the test case and pass it into the test case method and automatically execute the test case, asserts the request return result and the expected result, and judges the test result through the assertion. If the request return result is the same as the expected result, the test passes, otherwise the test fails.

[0036] S5: Generate test case report. Collect test results, use Allure to summarize and generate test reports, intuitively reflect the success rate and failure rate of HD map interface tests according to layer classification, and conduct a unified evaluation of interface quality.

[0037] S6: Feedback test report. Establish a link with the DingTalk robot, automatically push messages to the DingTalk project group, and promptly feedback the test report to the tester for review.

[0038] S7: Analyze the test report. If the test success rate is 100%, the test is passed. Otherwise, the test cases that failed are sorted out and fed back to the developer for modification. After the developer completes the modification, continue to repeat steps S1-S6 until the test efficiency is 100%.

[0039] Example 3

[0040] like Figure 3 As shown, this embodiment provides an unmanned mine high-precision map interface automatic testing system, including:

[0041] Interface preprocessing module: used to classify, integrate and export high-precision map interfaces, and store the interface documents provided by developers in JSON format according to layer classification;

[0042] Test case formatting module: used to format the json document into a corresponding yml file, and convert the exported interface document into a test case in a specific format by customizing the test case format, so as to facilitate the subsequent maintenance of the test case;

[0043] Test case generation module: used to generate formatted yml files into test cases automatically recognized by the pytest test framework;

[0044] Test case execution module: used to execute test cases in sequence using the automated testing tool pytest framework;

[0045] Test report generation module: used to summarize the execution results of the previous test case and generate a test report using the Allure framework;

[0046] Test report notification module: used to promptly feed back the generated test report to the tester through DingTalk, reminding the tester to check it in time, thus saving the time cost of the test process;

[0047] Test report analysis and feedback module: used to reasonably judge the test results, analyze the success / failure rate of the test report, and promptly analyze and locate the causes of test failures, and feedback the test failures to the developers for modification.

[0048] Example 4

[0049] This embodiment provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, the automated testing method for the unmanned mine high-precision map interface as described in any step of Example 2 is implemented.

[0050] Example 5

[0051] The embodiment of the present invention further provides a computer device, which may be a server, and its internal structure diagram may be as shown in FIG. Figure 4 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data obtained and generated in the method of the robot autonomously entering the packaging container. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the method of the aforementioned embodiment 2 is implemented.

[0052] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0053] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0054] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0055] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0056] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.

Claims

1. An automated testing method for an unmanned mine high-precision map interface, characterized in that: include: Obtain the high-precision map interface file of the unmanned mine, and preprocess the high-precision map interface to obtain the json file corresponding to each element in each layer of the high-precision map; Format the json files according to a preset format to obtain yml files corresponding to each json file; Parse the yml file and generate test cases; Execute test cases and generate test reports.

2. The automated testing method for the high-precision map interface of an unmanned mine according to claim 1 is characterized in that: The method of obtaining the high-precision map interface file of the unmanned mine and preprocessing the high-precision map interface to obtain the json file corresponding to each element in each layer of the high-precision map includes: Use springboot to integrate the swagger framework to generate the interface document of the unmanned mine high-precision map, which is divided into three layers according to the surface, line and point shapes; Export each feature in each layer as a json file, and store each json file by layer.

3. The automated testing method for the high-precision map interface of an unmanned mine according to claim 1 is characterized in that: The json files are formatted according to a preset format to obtain yml files corresponding to each json file, including: using python to convert the data in each json file into a corresponding yml file with a unified format, and storing each yml file in layers, wherein the format includes: use case id, use case name, request address, request method, request header, request parameter type, and assertion.

4. The automated testing method for the high-precision map interface of an unmanned mine according to claim 1 is characterized in that: The parsing of the yml file to generate a test case includes: parsing each yml file into a corresponding python format file, and storing each python file in layers, wherein the python file is named in the form of test_element name.py.

5. The automated testing method for the high-precision map interface of an unmanned mine according to claim 4 is characterized in that: The executing test cases and generating test reports include: Use the Redis database to cache Python test cases, and use the pytest framework to automate the testing of the data cached in the Redis database to obtain the test results. Use Allure to obtain a test report based on the test results.

6. The automated testing method for the high-precision map interface of an unmanned mine according to any one of claims 1 to 5, characterized in that: After executing the test case and generating the test report, the method includes: feeding back the test report to the test initiator, analyzing the test report, and locating the location of the problematic test case.

7. The automated testing method for the high-precision map interface of an unmanned mine according to claim 6 is characterized in that: After locating the problematic test case, the method includes: modifying the problematic test case, and testing the modified test case until there is no problematic test case in the test report.

8. An automated testing system for high-precision map interfaces in unmanned mines, characterized in that: include: Interface preprocessing module: used to obtain the interface file of the unmanned mine high-precision map, and preprocess the high-precision map interface to obtain the json file corresponding to each element in each layer of the high-precision map; Test case formatting module: used to format the json file according to a preset format to obtain the yml file corresponding to each json file; Test case generation module: used to parse the yml file and generate test cases; Test case execution and test report generation module: used to execute test cases and generate test reports.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the automated testing method for the high-precision map interface of an unmanned mine as described in any one of claims 1 to 7 is implemented.

10. An electronic terminal, characterized in that: It includes a processor and a memory connected to the processor, wherein a computer program is stored in the memory. When the computer program is executed by the processor, the automated testing method for the high-precision map interface of an unmanned mine as described in any one of claims 1 to 7 is executed.