Automated test construction method, device, equipment and storage medium

By using file transfer protocol server and continuous integration trigger flags in the R&D intranet and local private network isolation environment, a fully automated construction process of product testing is realized, solving the problem of inefficient testing and improving the accuracy and efficiency of testing.

CN115757185BActive Publication Date: 2025-09-05CHONGQING UNISINSIGHT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211566982.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-07
Publication Date
2025-09-05
Estimated Expiration
2042-12-07

AI Technical Summary

Technical Problem

When the R&D intranet and local private network are isolated, product testing cannot be automatically built, resulting in inefficient testing and manual testing errors and delay problems.

Method used

By compiling the target product test package and uploading it to the specified path to the file transfer protocol server, the local private network construction server can obtain the test package, generate a continuous integration trigger flag, execute a test script, obtain a build report, generate an automated test build result email and send it to the target mailbox, realizing a fully automated test process.

Benefits of technology

In the case of isolation between intranet and local private network, full automation of product testing is achieved, manual testing is avoided, testing efficiency and accuracy is improved, and labor waste is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757185B_ABST
    Figure CN115757185B_ABST
Patent Text Reader

Abstract

The present application provides an automated test construction method, apparatus, device and storage medium, which compiles a target product test package and uploads it to a first designated path of a file transfer protocol server so that a local private network construction server can obtain the target product test package, generates a continuous integration trigger flag and uploads it to a second designated path of the file transfer protocol server so that the local private network construction server can monitor the continuous integration trigger flag, obtains a construction report on a third designated path of the file transfer protocol server, generates an email header file and an email body file based on the construction report, reads the text of the email header file and the email body file, generates an automated test construction result email and sends it to a target mailbox. When the R&D intranet and the local private network are isolated, manual testing is no longer required for product testing, thereby achieving full automation of the entire product testing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated testing technology, and in particular to an automated testing construction method, device, equipment and storage medium. Background Art

[0002] With the rapid development of automation technology, not only the production process has been automated, but the testing process of many products has also been automated. Some companies also have special testing systems to test their products. However, some products have many functions and are cumbersome. In addition to testing their software, they must also test the software and hardware together. After compiling the test package every day, it is necessary to quickly verify whether the important basic functions of the tested object in the test package are normal. Some products have more and more version iterations. When releasing a certain version, it is necessary to quickly verify whether there are any problems with the basic functions from a long time ago. At this time, a large number of manual tests are often introduced, but manual testing leads to low overall test efficiency, and errors are likely to occur during manual operations, affecting the accuracy of the test results. Therefore, automated and efficient testing products are particularly important for product testing.

[0003] At present, some companies' test environments are located locally, and products are tested by accessing their own private network environment. The test server and related test scripts are all located on the local private network, but the product code, compilation environment, daily compiled test packages, and some build servers are all located on the R&D intranet. Daily emails are also sent and received on the R&D intranet, and the R&D intranet is completely isolated from the local private network. When testing the product, the build after the daily package is released can only be manually retrieved from the yellow zone to the local through the FTP (File Transfer Protocol) server, and then manually automated build is performed. The build results and reports are manually uploaded to the yellow zone, and then notified to the relevant personnel by email. Manual testing still needs to be introduced. Therefore, how to achieve automatic build after the daily test package is released and automatically notify the relevant personnel of the daily build results and reports, so as to fully realize product automated testing, has become a difficult point. Summary of the Invention

[0004] In view of the shortcomings of the prior art described above, the purpose of the present invention is to provide an automated test construction method, device and storage medium to solve the technical problem that product testing cannot be automatically constructed when the R&D intranet and the local private network are isolated.

[0005] In order to solve the above problems, the present invention provides an automated test construction method, which includes:

[0006] Compile a target product test package and upload it to a first designated path of a file transfer protocol server, so that a local private network construction server can obtain the target product test package from the first designated path;

[0007] generating a continuous integration trigger flag and uploading the flag to a second designated path of the file transfer protocol server, so that the local private network build server can monitor the continuous integration trigger flag from the second designated path, and the continuous integration trigger flag can trigger the local private network build server to execute a test script;

[0008] Obtaining a build report on the third specified path of the file transfer protocol server, the build report being obtained by the local private network build server in response to the target product test package and the continuous integration trigger flag, thereby executing a target test script, wherein there is a one-to-one correspondence between product test packages and test scripts;

[0009] generating an email header file and an email body file according to the construction report;

[0010] The text of the email title file and the email body file is read, an automated test build result email is generated, and the email is sent to a target mailbox.

[0011] In one embodiment of the present invention, obtaining a construction report on the third designated path of the file transfer protocol server includes:

[0012] Receive continuous integration trigger report scripts sent by the distributed version control system server on the R&D intranet;

[0013] Executing the continuous integration trigger report script and logging into the R&D intranet computer terminal, so that the R&D intranet computer terminal executes the first monitoring script within a preset monitoring time, downloads the build report monitored from the third designated path, and sends the build report to the R&D intranet distributed version control system server;

[0014] Receive the build report sent by the R&D intranet distributed version control system server.

[0015] In one embodiment of the present invention, the process of causing the R&D intranet computer to execute a first monitoring script within a preset monitoring time, download the build report monitored from the third designated path, and send the build report to the R&D intranet distributed version control system server further includes:

[0016] If the build report is not detected on the third designated path of the file transfer protocol server within the preset monitoring time, writing the local private network test timeout text into the email header file, and writing the local private network test environment detection to find the cause into the email body file;

[0017] The step of reading the text of the email title file and the email body file, generating an automated test build result email and sending the email to a target mailbox comprises:

[0018] The text of local private network test timeout in the email title file and the text of detecting the local private network test environment to find the cause in the email body file are read, and an automated test build result email is generated and sent to the target mailbox.

[0019] In one embodiment of the present invention, before the R&D intranet computer downloads the build report monitored from the third designated path and sends the build report to the R&D intranet distributed version control system server, the method further includes:

[0020] The R&D intranet computer sends the local private network test build completion file and continuous integration end mark file for the target product to the first designated path of the file transfer protocol server. The test build completion file includes the department, landmark version and continuous integration deployment result.

[0021] In one embodiment of the present invention, generating an email title file and an email body file according to the construction report further includes:

[0022] The build report includes the execution status of the target test script, and determines whether all scripts in the target test script are executed successfully according to the execution status;

[0023] If it is determined that all scripts in the target test script are executed successfully, a success mark is added to the email title file; if it is determined that at least one script in the target test script fails to execute, a failure mark is added to the email title file.

[0024] In one embodiment of the present invention, the local private network build server responds to the target product test package and the continuous integration trigger flag to execute the target product test script to obtain the build report, including:

[0025] Obtaining the target product test package from the first specified path of the file transfer protocol server;

[0026] Executing a second monitoring script in the background and monitoring the continuous integration trigger flag of the second designated path of the file transfer protocol server;

[0027] Triggering the execution environment deployment task corresponding to the target product test package based on the continuous integration trigger flag;

[0028] Download the test script corresponding to the target product test package from the local private network distributed version control system server;

[0029] Execute the target test script according to the trigger parameters carried by the continuous integration trigger flag to obtain the build report, and upload the build report to the third specified path of the file transfer protocol server, so that the R&D intranet build server obtains the build report from the third specified path of the file transfer protocol server.

[0030] In one embodiment of the present invention, before obtaining the target product test package in the first designated path of the file transfer protocol server, the method further includes:

[0031] A first network card of a local private network computer can communicate with the local private network build server, and a second network card can communicate with the file transfer protocol server. The first network card and the second network card are configured so that the second network card shares the first network card, and the gateway of the continuous integration server is configured to the Internet Protocol address of the first network card, so that the local private network build server can communicate with the file transfer protocol server.

[0032] An embodiment of the present invention further provides an automated test construction device, the device comprising:

[0033] a compiling module, configured to compile a target product test package and upload the package to a first designated path of a file transfer protocol server, so that a local private network construction server can obtain the target product test package from the first designated path;

[0034] a trigger flag generation module, configured to generate a continuous integration trigger flag and upload the flag to a second designated path of the file transfer protocol server, so that a local private network build server can monitor the continuous integration trigger flag from the second designated path, and the continuous integration trigger flag can trigger the local private network build server to execute a product test script;

[0035] a build report acquisition module, configured to acquire a build report on the third specified path of the file transfer protocol server, the build report being obtained by the local private network build server in response to the target product test package and the continuous integration trigger flag, thereby executing a target product test script, wherein there is a one-to-one correspondence between product test packages and test scripts;

[0036] A file generation module, configured to generate an email title file and an email body file according to the construction report;

[0037] The mail sending module is used to read the text in the email title file and the email body file, generate an automated test build result email and send it to a target mailbox.

[0038] An embodiment of the present invention further provides an electronic device, including a processor, a memory, and a communication bus;

[0039] The communication bus is used to connect the processor and the memory;

[0040] The processor is configured to execute the computer program stored in the memory to implement the method as described in any one of the above embodiments.

[0041] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is used to enable the computer to execute the method as described in any one of the above embodiments.

[0042] As described above, the embodiments of the present invention provide an automated test construction method, apparatus, device, and storage medium, which have the following beneficial effects:

[0043] By compiling the target product test package and uploading it to the first designated path of the file transfer protocol server, so that the local private network build server can obtain the target product test package from the above-mentioned first designated path, then generating a continuous integration trigger flag and uploading it to the second designated path of the file transfer protocol server, so that the local private network build server can listen to the continuous integration trigger flag from the second designated path, wherein the continuous integration trigger flag can trigger the local private network build server to execute the test script and obtain the build report on the third designated path of the file transfer protocol server. The build report is obtained by the local private network build server in response to the target product test package and the continuous integration trigger flag, thereby executing the target test script, wherein there is a one-to-one correspondence between the product test package and the test script, according to the above-mentioned build report, an email header file and an email body file are generated, and finally the text of the email header file and the email body file are read, and an automated test build result email is generated and sent to the target mailbox. When the R&D intranet and the local private network are isolated, manual testing is no longer required for product testing, and the entire product testing process is fully automated. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 is a schematic diagram of an implementation environment of an automated test construction device shown in an exemplary embodiment of the present application;

[0045] Figure 2is a flowchart of an automated test construction method shown in an exemplary embodiment of the present application;

[0046] Figure 3 1 is a schematic diagram of an exemplary test build completion file table structure shown in an exemplary embodiment of the present application;

[0047] Figure 4 is a schematic diagram of an exemplary construction information table structure shown in an exemplary embodiment of the present application;

[0048] Figure 5 This is a schematic diagram of an exemplary continuous integration automated test result table structure shown in an exemplary embodiment of the present application;

[0049] Figure 6 This is a flowchart of a specific automated test construction method shown in an exemplary embodiment of the present application;

[0050] Figure 7 is a block diagram of an automated test builder device shown in an exemplary embodiment of the present application;

[0051] Figure 8 This is a structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0052] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.

[0053] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.

[0054] For product testing, some companies place their test environments locally, and then test the products by accessing the private network environment they build. The test servers and related test scripts are also placed on the local private network, but the product code compilation environment, daily compiled test packages, and some build servers are all placed on the R&D intranet. Daily email sending and receiving are all carried out on the R&D intranet. On the one hand, since the product test scenarios themselves are relatively complex, there are many types of storage products, and the storage products themselves involve testing of various disk and hardware-related scenarios, the test environment must be released for manual testing after the product test build task is completed. On the other hand, placing product code on a private network is unsafe and can easily be copied out of the company, which poses a risk of product code leakage. Therefore, product code can only be compiled on the R&D intranet. For automated test builds, the test server needs to be placed locally, and it must cover various network card anomalies, network packet loss and error anomalies, switch anomalies, and other problems. Therefore, you can only build a local area network for product testing.

[0055] However, when testing the product, the test build after the daily package release can only be manually retrieved from the yellow zone to the local through the file transfer protocol server, and then manually automated build, and then manually uploaded to the yellow zone build results and reports, and then notified to the relevant personnel by email, that is, manual testing is still needed. In addition, the daily product compilation and package release are basically started in the early morning and can only be performed manually during working hours. In this way, product testing is delayed, and performing repetitive work every day also wastes manpower, resulting in low product testing efficiency, waste of manpower, and untimely testing.

[0056] To solve the above problem, see Figure 1 , Figure 1 FIG. 1 is a schematic diagram of an implementation environment of an automated test construction device according to an exemplary embodiment of the present application. Figure 1As shown, it is divided into the R&D intranet part and the local private network part, including the R&D intranet construction server 101, the R&D intranet computer terminal 102, the R&D intranet distributed version control system server 103, the file transfer protocol server 104, the local private network construction server 105, the local private network computer terminal 106 and the local private network distributed version control system server 107. Among them, the R&D intranet construction server 101 only has the authority to upload files to the file transfer protocol server 103 but does not have the authority to read files. Therefore, the R&D intranet construction service weapon 101 transfers the R&D intranet cable to the R&D intranet through the R&D intranet. The brain terminal 102 communicates with the file transfer protocol server 104. Similarly, the local private network construction server 105 communicates with the file transfer protocol server 104 through the local private network. In the R&D intranet part, the R&D intranet construction server 103 communicates with the R&D intranet distributed version control system server 104. The R&D computer terminal 102 can transfer the obtained files to the R&D intranet distributed version control system controller 103. In the local private network part, the local private network construction server 105 communicates with the local private network distributed version control system 107. During product testing, the R&D intranet compiles the product package and uploads it to the file transfer protocol server 104, which then triggers the automated build task. The automated build task on the R&D intranet triggers the automated build task on the local private network through the file transfer protocol server 104, performs product test build, and sends its build report to the R&D intranet through the file transfer protocol server 104. The R&D intranet then parses the build report to obtain the product test build results, and generates an email to send to relevant personnel. When the R&D intranet and the local private network are isolated, manual testing is no longer required for product testing, thus achieving full automation of the entire product testing process.

[0057] Therefore, this application embodiment provides an automated test construction method, see Figure 2 , Figure 2 This is a flowchart of an automated test construction method shown in an exemplary embodiment of the present application. This method can be applied to Figure 1 The implementation environment shown is specifically implemented by the association parsing module in the implementation environment. It should be understood that the method can also be applied to other exemplary implementation environments and specifically implemented by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable. To address these issues, the embodiments of the present application respectively propose an automated test construction method, an automated test construction device, an electronic device, and a computer-readable storage medium. These embodiments will be described in detail below.

[0058] like Figure 2As shown, in an exemplary embodiment, the automated test construction method includes at least steps S201 to S205, which are described in detail as follows:

[0059] Step S201 : compile a target product test package and upload it to a first designated path of a file transfer protocol server, so that a local private network construction server can obtain the target product test package from the first designated path.

[0060] When the R&D intranet is isolated from the local private network, the R&D intranet build server (R&D intranet Jenkins server) can upload the target product test package compiled by itself to the first designated path of the file transfer protocol server. The file can be obtained by the local private network build server from the above-mentioned first designated path, so that the R&D intranet build server and the local private network build server can continue the subsequent automated test build tasks. This can ensure that the product test package is automatically built in time after it is released for automated testing of the product.

[0061] Step S202 : Generate a continuous integration trigger flag and upload it to a second designated path of the file transfer protocol server, so that the local private network build server can monitor the continuous integration trigger flag from the second designated path.

[0062] Among them, the continuous integration trigger flag can trigger the local private network build server to execute the test script.

[0063] After the R&D intranet build server completes the compilation and output of the target product test package, it starts its own automated test build task. The first step is to generate a continuous integration trigger flag. The continuous integration trigger flag is uploaded to the second designated path of the file transfer protocol server and can be monitored by the local private network build service. This triggers the local private network build server to start the automated build test task and subsequently execute the test script.

[0064] Step S203: Obtain a construction report on a third designated path of the file transfer protocol server.

[0065] The build report is obtained by the local private network build server responding to the target product test package and the continuous integration trigger flag, thereby executing the target test script. There is a one-to-one correspondence between the product test package and the test script.

[0066] After the R&D intranet build server uploads the continuous integration trigger flag, it enters a waiting state. When the local private network build server executes the target test package according to the target product test package and the continuous integration trigger flag it receives, and completes the automated build test task, it will upload the build report to the third designated path of the file transfer protocol server. It should be understood that after determining the target product test package, since there is a one-to-one correspondence between the product test package and the test script, the target test script can be determined. At this time, the R&D intranet build server can obtain the build report from the third designated path of the file transfer protocol server.

[0067] In one embodiment, obtaining a construction report on a third designated path of a file transfer protocol server includes:

[0068] Receive continuous integration trigger report scripts sent by the distributed version control system server on the R&D intranet;

[0069] Execute the continuous integration trigger report script and log in to the R&D intranet computer, so that the R&D intranet computer executes the first monitoring script within the preset monitoring time, downloads the build report monitored from the third specified path, and sends the build report to the R&D intranet distributed version control system server;

[0070] Receive build reports sent by the distributed version control system server on the R&D intranet.

[0071] When the R&D intranet build server completes the compilation of the target product test package and releases the package, it starts its own automated test build task, first entering the trigger step. At this time, the R&D intranet distributed version control system server will send a continuous integration trigger report script to the R&D intranet build server, so that the R&D intranet build server executes the script and then logs in to the R&D intranet computer to let the R&D intranet computer execute the first monitoring script within the preset time, thereby monitoring the build report on the third specified path of the file transfer protocol server. After the R&D intranet computer monitors the build report on the above path, it downloads it and sends it to the R&D intranet build server through the R&D intranet distributed version control system server.

[0072] It should be understood that the R&D intranet build server only has the permission to upload files to the FTP server, but not the permission to read files. The tester's account and password do have the permission to upload and read files on the FTP server. Therefore, it is necessary to log in to the R&D intranet computer and log in to the FTP server using the tester's account and password. Two accounts and passwords are involved here: one is the account and password for logging in to the R&D intranet computer, and the other is the account and password for the tester's FTP server that is used to log in to the FTP server after successfully logging in to the computer. The R&D intranet build server logs in to the R&D intranet computer by running the continuous integration trigger report script, passing the public account name and password for logging in to the R&D intranet computer as parameters. Only the public account of the R&D intranet computer can be used here, because only logging in with a public account will not affect other users logging into this computer. This ensures that when the R&D intranet build server is logging in to the R&D intranet computer, other people can also use the computer normally without affecting each other's use. After the R&D intranet build server successfully logs in to the computer, it starts to log in to the file transfer protocol server, and then runs the first monitoring script of the file transfer protocol server in the computer monitoring script directory to monitor whether a build report is generated on the third specified path of the file transfer protocol server. Here, if the user name and password of the file transfer protocol server entered are incorrect, the connection will fail and the process will be exited directly.

[0073] In one embodiment, the steps of causing a computer on the R&D intranet to execute a first monitoring script within a preset monitoring time, download a build report monitored from a third designated path, and send the build report to a distributed version control system server on the R&D intranet further include:

[0074] If no build report is detected on the third designated path of the file transfer protocol server within the preset monitoring time, a local private network test timeout text is written into the email title file, and a local private network test environment is detected to find the cause is written into the email body file;

[0075] Among them, reading the text of the email title file and the email body file, generating the automated test build result email and sending it to the target mailbox includes;

[0076] The system reads the local private network test timeout text in the email header file and the text in the email body file for detecting the local private network test environment to find the cause, generates an automated test build result email, and sends it to the target mailbox.

[0077] When the R&D intranet computer monitors whether a build report is generated on the third designated path of the file transfer protocol server, the duration of the R&D intranet computer running the first monitoring script will be set. If within the preset duration, the R&D intranet computer will detect whether a new file is generated on the third designated path of the file transfer protocol server at a certain time interval, that is, whether a build report is monitored. If not, it will continue to wait for a certain interval before detecting again. Once a build report is monitored within the preset duration, the build report will be downloaded to the computer's X_Jenkins_cicd path, where X represents the product name. After the download is completed, the build report under the computer's X_Jenkins_cicd path is uploaded to the R&D intranet distributed version control system server; if the R&D intranet computer's monitoring time has exceeded the preset duration and no build report on the third designated path is monitored, it indicates that an abnormality has occurred in the target product test build on the local private network, and the "local private network test timeout" text is directly written to the email title (email_head) file of the R&D intranet build server private network, and the "Check console output to view the local private network test environment to find the cause" is directly written to the email title (email_head) file of the R&D intranet build server private network. The results) are written into the email body (email_body) file of the R&D intranet build server private network, indicating the end of the build task. The process then directly proceeds to the text step of reading the email title file and the email body file. That is, the text about the local private network test timeout in the email title file and the text about detecting the local private network test environment to find the cause in the email body file are read. The automated test build result email is generated and sent to the target mailbox.

[0078] In one embodiment, before the R&D intranet computer downloads the build report monitored from the third designated path and sends the build report to the R&D intranet distributed version control system server, the method further includes:

[0079] The R&D intranet computer sends the local private network test build completion file and the continuous integration end marker file for the target product to the first designated path of the file transfer protocol server. The test build completion file includes the department, landmark version and continuous integration deployment results.

[0080] After the R&D intranet computer downloads the build report monitored from the third specified path, it will send the local private network test build completion file and the continuous integration end marker file for the target product to the first specified path of the file transfer protocol server. The test build completion file includes the department, roadmap version, and continuous integration deployment results. See Figure 3 , Figure 3This is an exemplary test build completion file table structure diagram shown in an exemplary embodiment of the present application, and then the build report is sent to the R&D intranet distributed version control system server.

[0081] Step S204: Generate an email title file and an email body file according to the construction report.

[0082] After receiving the build report, the R&D intranet build server analyzes the information in the build report and then writes the parsed information into the email header file and email body file, generating an email header file and an email body file. The build report includes build information and continuous integration automated test results. The build information includes the task name, execution time, build number, trigger reason, task URL, and working directory. The continuous integration automated test results include the test type, department, roadmap version, test results, and the number of target test scripts, the number of successfully executed scripts, and the number of failed scripts. The email header file is generated based on the task name and build number, and the email body file is generated based on the execution time, build number, trigger reason, task URL, working directory, test type, department, roadmap version, test results, and the number of target test scripts, the number of successfully executed scripts, and the number of failed scripts.

[0083] See Figure 4 , Figure 4 This is a schematic diagram of an exemplary structure of an information table shown in an exemplary embodiment of the present application. Figure 4 As shown, the build information in the build report includes task name, execution time, build number, trigger reason, task URL, and working directory information.

[0084] See Figure 5 , Figure 5 This is a schematic diagram of an exemplary continuous integration automated test result table structure shown in an exemplary embodiment of the present application. Figure 5 As shown, the continuous integration automation test results in the build report include the test type, department, milestone version, test results, and the number of target test scripts (Total), the number of successfully executed scripts (Pass), and the number of failed scripts (Fail).

[0085] Step S205 , reading the text of the email title file and the email body file, generating an automated test build result email and sending it to a target mailbox.

[0086] After generating the email title file and email body file, the R&D intranet build server enters the process of writing and sending the email, that is, reading the text in the email title file and email body file, generating the corresponding automated build result email and sending it to the target email. It should be understood that the target email belongs to the person in charge of product testing, so that he can know the status of the product automated testing framework in a timely manner and deal with any problems with the product in a timely manner.

[0087] In one embodiment, generating an email header file and an email body file according to the construction report further includes:

[0088] The build report includes the execution status of the target test script, and determines whether all scripts in the target test script are executed successfully based on the execution status;

[0089] If it is determined that all the scripts in the target test script are executed successfully, a success mark is added to the email title file; if it is determined that at least one script in the target test script fails to execute, a failure mark is added to the email title file.

[0090] It should be understood that the target test script contains several scripts. When executing these scripts, only if all of them are executed successfully does it indicate that the target test script is executed successfully. Conversely, if at least one of these scripts fails to execute, it indicates that the target test script fails to execute. When the target test script is executed successfully, a success mark is added to the email title file, such as Successful. When the target test script fails to execute, a failure mark is added to the email title file, such as Fail, to indicate whether the automated test build of the local private network is successful.

[0091] In one embodiment, the local private network build server responds to the target product test package and the continuous integration trigger flag to execute the target product test script to obtain the build report, including:

[0092] Obtain the target product test package from the first specified path of the file transfer protocol server;

[0093] Execute the second monitoring script in the background and monitor the continuous integration trigger flag of the second specified path of the file transfer protocol server;

[0094] Trigger the corresponding execution environment deployment task of the target product test package based on the continuous integration trigger flag;

[0095] Download the test script corresponding to the target product test package from the local private network distributed version control system server;

[0096] Execute the target test script according to the trigger parameters carried by the continuous integration trigger flag to obtain a build report, and upload the build report to the third designated path of the file transfer protocol server, so that the R&D intranet build server obtains the build report from the third designated path of the file transfer protocol server.

[0097] An automated test build task is performed in a local private network. First, the local private network build server obtains the target product test package from the first specified path of the file transfer protocol server. It should be understood that it is necessary to log in to the file transfer protocol server with a specified username and password, and obtain the latest target product test package from the first specified path of the file transfer protocol server to the local private network build server. Then, the second listening script is executed in the background and the continuous integration trigger flag of the second specified path of the file transfer protocol server is monitored. When the continuous integration trigger flag is received, the corresponding execution environment deployment task of the target product test package is triggered based on the continuous integration trigger flag. Finally, the test script corresponding to the target product test package is downloaded from the local private network distributed version control system server, and the target test script is executed according to the trigger parameters carried by the continuous integration trigger flag to obtain a build report, and the above-mentioned build report is uploaded to the third specified path of the file transfer protocol server, so that the R&D intranet build server can obtain the build report from the third specified path of the file transfer protocol server.

[0098] It should be understood that the local private network build server will execute the target test script according to the trigger parameters carried by the continuous integration trigger flag, and the trigger parameters carried by the continuous integration trigger flag include all.name or x.name, where x is the directory name of the test script. When the trigger parameter carried by the continuous integration trigger flag is all.name, it indicates that all scripts in the test script need to be executed, and the test script will be used as the target test script and executed. When the trigger parameter carried by the continuous integration trigger flag is all.name, it indicates that only the scripts in the x directory need to be executed, and the x test script below the test script target will be used as the target test script and executed. The above shows that according to the specific needs of product testing, some scripts in the test script corresponding to the test product can be selected for execution.

[0099] In one embodiment, before obtaining the target product test package in the first designated path of the file transfer protocol server, the method further includes:

[0100] The first network card of the local private network computer can communicate with the local private network build server, and the second network card can communicate with the file transfer protocol server. The first network card and the second network card are set so that the second network card shares the first network card, and the gateway of the continuous integration server is configured to the Internet Protocol address of the first network card, so that the local private network build server can communicate with the file transfer protocol server.

[0101] In the local private network, there are two network cards on the local private network computer. One network port is connected to the local private network and communicates with the local private network build server, and the other is connected to the company's public network for communication with the file transfer protocol server. Therefore, the local private network build server cannot directly communicate with the file transfer protocol server. Therefore, the continuous integration trigger flag cannot be obtained by relying solely on the local private network build server. Therefore, the two network cards on the local private network computer are combined into one, that is, the second network card is set to share the first network card. Then, the gateway of the local private network build server is configured to use the IP address of the local private network computer's first network card. However, the previously configured IP addresses 1 and 2 of the first and second network cards are not modified. This is equivalent to the local private network being used as a router, and the local private network build server and the file transfer protocol can be communicated through the local private network computer.

[0102] The automated test build method provided in the above embodiment compiles the target product test package and uploads it to the first designated path of the file transfer protocol server, so that the local private network build server can obtain the target product test package from the above first designated path, then generates a continuous integration trigger flag and uploads it to the second designated path of the file transfer protocol server, so that the local private network build server can listen for the continuous integration trigger flag from the second designated path, wherein the continuous integration trigger flag can trigger the local private network build server to execute the test script and obtain a build report on the third designated path of the file transfer protocol server. The build report is obtained by the local private network build server in response to the target product test package and the continuous integration trigger flag, thereby executing the target test script, wherein there is a one-to-one correspondence between the product test package and the test script. According to the above build report, an email header file and an email body file are generated, and finally the text of the email header file and the email body file are read to generate an automated test build result email and send it to the target mailbox. When the R&D intranet and the local private network are isolated, manual testing is no longer required for product testing, and the entire product testing process is fully automated.

[0103] See Figure 6 , Figure 6 This is a flowchart of a specific automated test construction method shown in an exemplary embodiment of the present application. The automated test construction method provided in the above embodiment is further illustrated below in detail.

[0104] In step S601, the R&D intranet build server (Jenkins) runs the product compilation task and puts the compiled target product test package into path 1 on the file transfer protocol (ftp) server.

[0105] Step S602, after step S601 successfully completes, starts the overall build task on the R&D intranet Jenkins server, and step S602 includes the following steps:

[0106] (1) After the build task is triggered, the Trigger Stage configured on the Jenkins server in the R&D intranet will generate a continuous integration (CI) trigger flag. The CI trigger flag is generally a file with a command in the format of x.nam, where x represents the script directory name.

[0107] (2) Upload the CI trigger flag generated in step (1) to path 2 of the FTP server;

[0108] (3) After the Trigger Stage on the R&D intranet Jenkins server is completed, the Wait Stage is executed. After entering the Wait Stage process, the report_trigger script is pulled from the R&D intranet distributed version control system server (git);

[0109] (4) The Jenkins server in the R&D intranet only has upload permissions but no read permissions on the FTP server. The tester's account and password have upload and read permissions on the FTP server, so it is necessary to log in to the Windows computer in the R&D intranet and then log in to the FTP server with the R&D tester's account and password;

[0110] (5) After successfully logging into the R&D intranet computer, the ftp server listening script in the script_listen directory of the computer will be run. The username and password for logging into the ftp server are passed in at the same time as step (4). If the username and password passed in are incorrect, the connection will fail and the process will be exited directly. Log in to the ftp server and then listen to the ftp server path 3 to see if there are any new files generated. Here, the duration of the ftp listening script running on the R&D intranet Windows computer will be counted:

[0111] If the build time exceeds the preset duration, for example, 2 hours, and no new files are generated in FTP path 3, the build task will be terminated and the process will proceed directly to step S608.

[0112] If the running time is less than 2 hours, then at regular intervals, such as 60 seconds, check whether there are new files generated in path 3 of the ftp server. If no new files are generated, wait another 60 seconds before checking again. If new files are generated, download the files in path 3 to the X_Jenkins_cicd path of the Windows computer in the R&D intranet, where X represents the product name. Then upload a file end.name and a CI end marker file to path 1 of the ftp server, and upload the files in the X_Jenkins_cicd path on the computer to the git server in the R&D intranet. After the upload is successful, proceed to step (6);

[0113] (6) Enter the Report stage process of the R&D intranet Jenkins server task and pull the files uploaded to the R&D intranet git server in step (5) to the R&D intranet Jenkins server.

[0114] (7) Then decompress the file, parse the execution results, execution time and other information in the file, and then determine whether all these scripts pass:

[0115] If all scripts pass, add a success mark to the email_head file.

[0116] If a script fails, add a failure flag to the enami_head file.

[0117] (8) After all the above processes are completed, the Postaction process of the R&D intranet Jenkins server task is entered, and the information parsed in step (7) and the content read from email_head and email_body are generated into an xhtml, and then the build result is sent to the specified mailbox.

[0118] In step S603, the network card 1 of the local private network Windows computer can communicate with the local private network Jenkins server and the local private network test environment, and the network card 2 can communicate with the ftp server. That is, the local private network computer can communicate with both the ftp server and the private network environment Jenkins server and the test environment, but the local private network Jenkins server and the ftp server cannot communicate. Therefore, the local private network Jenkins server cannot perceive the CI trigger flag uploaded to the ftp server in step S602-(1). At this time, the network cards on the private network computer are combined into one, that is, network card 2 is set to share network card 1.

[0119] In step S604, the gateway of the local private network Jenkins server is configured as the network card 1ip, which is equivalent to using the local private network computer as a router as a transit, so that the local private network Jenkins server can communicate with the FTP server.

[0120] In step S605, a monitoring process is always running in the background of the local private network Jenkins server, which is used to monitor the CI trigger flag under the ftp server path 2. After detecting the CI trigger flag, a curl command is sent with the CI trigger flag as a parameter, that is, a request is sent to the local private network Jenkins server to trigger the environment deployment task on the local private network Jenkins server.

[0121] In step S606, the latest product test package is pulled from FTP server path 1 to install and deploy the environment. After the deployment is completed, the script build task is run on the local private network Jenkins server, and the CI trigger flag received in step S605 is passed as a parameter to the build task.

[0122] Step S607: Pull the test script from the local private network git server and run the corresponding script according to the received CI trigger flag parameter. Here, the value of the input parameter is divided into the following two cases:

[0123] If the CI trigger flag is all.name, all test scripts are run;

[0124] If the CI trigger flag is x.name, and x = the script directory name, only the test scripts under the x directory will be run.

[0125] Step S608: After the script is finished running, the running log is packaged and compressed, and then uploaded to the path 3 of the FTP server.

[0126] See Figure 7 , Figure 7 FIG. 1 is a block diagram of an automated test builder device shown in an exemplary embodiment of the present application. Figure 7 As shown, this embodiment provides an image association storage device 700, which includes:

[0127] Compilation module 701, used to compile the target product test package and upload it to a first designated path of the file transfer protocol server, so that the local private network construction server can obtain the target product test package from the first designated path;

[0128] a trigger flag generation module 702 for generating a continuous integration trigger flag and uploading it to a second designated path of the file transfer protocol server, so that the local private network build server can monitor the continuous integration trigger flag from the second designated path, and the continuous integration trigger flag can trigger the local private network build server to execute the product test script;

[0129] A build report acquisition module 703 is configured to acquire a build report from a third specified path on the file transfer protocol server. The build report is obtained by the local private network build server in response to the target product test package and the continuous integration trigger flag, thereby executing the target product test script. There is a one-to-one correspondence between the product test package and the test script.

[0130] A file generation module 704 is used to generate an email header file and an email body file according to the construction report;

[0131] The email sending module 705 is used to read the text in the email title file and the email body file, generate an automated test build result email, and send it to a target mailbox.

[0132] In this embodiment, the device is essentially provided with multiple modules for executing the method in any of the above embodiments. The specific functions and technical effects can be referred to the above embodiments and will not be repeated here.

[0133] See Figure 8 , an embodiment of the present invention further provides an electronic device 800, including a processor 801, a memory 802 and a communication bus 803;

[0134] The communication bus 803 is used to connect the processor 801 and the memory 802;

[0135] The processor 801 is configured to execute the computer program stored in the memory 802 to implement one or more of the methods described in the above embodiments.

[0136] The embodiment of the present invention further provides a computer-readable storage medium, characterized in that a computer program is stored thereon.

[0137] The computer program is used to enable a computer to execute the method described in any one of the above-mentioned embodiments.

[0138] An embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute the instructions (instructions) of the steps included in embodiment 1 of the embodiment of the present application.

[0139] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0140] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0141] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0142] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0143] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.

Claims

1. An automated test construction method, characterized in that: The method comprises: Compile a target product test package and upload it to a first designated path of a file transfer protocol server, so that a local private network construction server can obtain the target product test package from the first designated path; generating a continuous integration trigger flag and uploading the flag to a second designated path of the file transfer protocol server, so that the local private network build server can monitor the continuous integration trigger flag from the second designated path, and the continuous integration trigger flag can trigger the local private network build server to execute a test script; Obtaining a build report on the third specified path of the file transfer protocol server, the build report being obtained by the local private network build server in response to the target product test package and the continuous integration trigger flag, thereby executing a target test script, wherein there is a one-to-one correspondence between product test packages and test scripts; generating an email header file and an email body file according to the construction report; Read the text of the email title file and the email body file, generate an automated test build result email and send it to a target mailbox; Obtaining a construction report on the third specified path of the file transfer protocol server includes: Receive continuous integration trigger report scripts sent by the distributed version control system server on the R&D intranet; Executing the continuous integration trigger report script and logging into the R&D intranet computer terminal, so that the R&D intranet computer terminal executes the first monitoring script within a preset monitoring time, downloads the build report monitored from the third designated path, and sends the build report to the R&D intranet distributed version control system server; Receive the build report sent by the R&D intranet distributed version control system server.

2. The automated test construction method according to claim 1, characterized in that: The method further includes: causing the computer terminal on the R&D intranet to execute the first monitoring script within a preset monitoring time, download the build report monitored from the third designated path, and send the build report to the R&D intranet distributed version control system server; If the build report is not detected on the third designated path of the file transfer protocol server within the preset monitoring time, writing the local private network test timeout text into the email header file, and writing the local private network test environment detection to find the cause into the email body file; The step of reading the text of the email title file and the email body file, generating an automated test build result email and sending the email to a target mailbox comprises: The text of local private network test timeout in the email title file and the text of detecting the local private network test environment to find the cause in the email body file are read, and an automated test build result email is generated and sent to the target mailbox.

3. The automated test construction method according to claim 1, wherein: Before the R&D intranet computer downloads the build report monitored from the third designated path and sends the build report to the R&D intranet distributed version control system server, the method further includes: The R&D intranet computer sends the local private network test build completion file and continuous integration end mark file for the target product to the first designated path of the file transfer protocol server. The test build completion file includes the department, landmark version and continuous integration deployment result.

4. The automated test construction method according to claim 1, wherein: Generating an email header file and an email body file according to the construction report further includes: The build report includes the execution status of the target test script, and determines whether all scripts in the target test script are executed successfully according to the execution status; If it is determined that all scripts in the target test script are executed successfully, a success mark is added to the email title file; if it is determined that at least one script in the target test script fails to execute, a failure mark is added to the email title file.

5. The automated test construction method according to claim 1, wherein: The local private network build server responds to the target product test package and the continuous integration trigger flag to execute the target product test script to obtain the build report, including: Obtaining the target product test package from the first specified path of the file transfer protocol server; Executing a second monitoring script in the background and monitoring the continuous integration trigger flag of the second designated path of the file transfer protocol server; Triggering the execution environment deployment task corresponding to the target product test package based on the continuous integration trigger flag; Download the test script corresponding to the target product test package from the local private network distributed version control system server; Execute the target test script according to the trigger parameters carried by the continuous integration trigger flag to obtain the build report, and upload the build report to the third specified path of the file transfer protocol server, so that the R&D intranet build server obtains the build report from the third specified path of the file transfer protocol server.

6. The automated test construction method according to claim 5, characterized in that: Before obtaining the target product test package of the first specified path of the file transfer protocol server, the method further includes: A first network card of a local private network computer can communicate with the local private network build server, and a second network card can communicate with the file transfer protocol server. The first network card and the second network card are configured so that the second network card shares the first network card, and a gateway of the continuous integration server is configured to be the Internet Protocol address of the first network card, so that the local private network build server can communicate with the file transfer protocol server.

7. An automated test construction device, characterized in that: The device comprises: a compiling module, configured to compile a target product test package and upload the package to a first designated path of a file transfer protocol server, so that a local private network construction server can obtain the target product test package from the first designated path; a trigger flag generation module, configured to generate a continuous integration trigger flag and upload the flag to a second designated path of the file transfer protocol server, so that a local private network build server can monitor the continuous integration trigger flag from the second designated path, and the continuous integration trigger flag can trigger the local private network build server to execute a product test script; a build report acquisition module, configured to acquire a build report on the third specified path of the file transfer protocol server, the build report being obtained by the local private network build server in response to the target product test package and the continuous integration trigger flag, thereby executing a target product test script, wherein there is a one-to-one correspondence between product test packages and test scripts; A file generation module, configured to generate an email title file and an email body file according to the construction report; An email sending module is used to read the text in the email title file and the email body file, generate an automated test build result email, and send it to a target mailbox; The acquisition and construction report module is specifically used to: Receive continuous integration trigger report scripts sent by the distributed version control system server on the R&D intranet; Executing the continuous integration trigger report script and logging into the R&D intranet computer terminal, so that the R&D intranet computer terminal executes the first monitoring script within a preset monitoring time, downloads the build report monitored from the third designated path, and sends the build report to the R&D intranet distributed version control system server; Receive the build report sent by the R&D intranet distributed version control system server.

8. An electronic device, characterized in that: Includes processor, memory and communication bus; The communication bus is used to connect the processor and the memory; The processor is configured to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that A computer program is stored thereon, The computer program is used to cause the computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Continuous integration automatic test system and method, electronic equipment and storage medium

    CN113111000A

  • Coverage rate testing method based on Android application

    CN115269394A