Method and device for automatically converting test script based on test case, medium and product

Through the conversion tool, the field values ​​of the interface test cases are automatically parsed and combined, and the target script type test script is generated, which solves the problem of inefficient writing of traditional tests, improves test efficiency and reduces costs.

CN119537207APending Publication Date: 2025-02-28TUS CLOUD CONTROL (BEIJING) TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411452457.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In autonomous driving testing, traditional test cases and test scripts are inefficient in writing, resulting in high human resources costs and long test time.

Method used

Through the conversion tool, select interface test cases, call the writing format specification, parse the use cases, obtain field values, and combine field values ​​according to the target script type to generate interface test scripts.

Benefits of technology

It realizes automatic conversion of test cases into test scripts, improves testing efficiency, reduces human resources costs, and shortens the overall time-consuming of the test process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537207A_ABST
    Figure CN119537207A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of image processing, and discloses a method and equipment for automatically converting a test script based on a test case, a medium and a product. The method comprises the following steps: opening a conversion tool, and selecting an interface test case which needs to be converted; calling a writing format specification of the interface test case; analyzing the interface test case according to a writing format specification to obtain different field values; and combining the different field values according to the target script type to obtain an interface test script of the target script type. By adopting the scheme, the test case can be automatically converted into the test script through the conversion tool, so that the test efficiency is improved, the effect of writing the test case and the test script on human resources is reduced, and meanwhile, the overall time consumption of the test process is also shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, medium and product for automatically converting a test script based on a test case. Background Art

[0002] In recent years, with the rapid development of Internet technology, the field of autonomous driving has developed rapidly. For the autonomous driving industry, because there are many tests to be conducted and they are relatively complex, in daily testing work, the traditional testing process uses manual writing of test cases and test scripts, which not only has extremely high threshold requirements for practitioners, but also has relatively low testing efficiency. A large amount of writing work leads to an increase in human resource costs and a long overall testing time. Therefore, how to improve testing efficiency is one of the industry pain points in this field. Summary of the invention

[0003] One purpose of the present application is to provide a method, device, medium and product for automatically converting test scripts based on test cases, at least to solve the problems of low test efficiency, high human resource cost, and long overall test time. The present application uses a conversion tool, after selecting the interface test case to be converted, to retrieve the writing format specification of the interface test case, and parse the interface test case according to the writing format specification to obtain different field values, so that different field values ​​can be combined according to the target script type to obtain the interface test script of the target script type. By adopting this solution, the test case can be automatically converted into a test script through the conversion tool, which improves the test efficiency, reduces the effect of the writing of test cases and test scripts on human resources, and also shortens the overall time of the test process.

[0004] To achieve the above objectives, some embodiments of the present application provide the following aspects:

[0005] In a first aspect, some embodiments of the present application further provide a method for automatically converting a test script based on a test case, comprising:

[0006] Open the conversion tool and select the interface test case that needs to be converted;

[0007] Retrieve the writing format specification of the interface test case;

[0008] Parsing the interface test case according to the writing format specification to obtain different field values;

[0009] Different field values ​​are combined according to the target script type to obtain an interface test script of the target script type.

[0010] In a second aspect, some embodiments of the present application further provide an electronic device, comprising: one or more processors; and a memory storing computer program instructions, wherein the computer program instructions, when executed, cause the processor to perform the steps of the method described above.

[0011] In a third aspect, some embodiments of the present application further provide a computer-readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method as described above.

[0012] In a fourth aspect, some embodiments of the present application further provide a computer program product, comprising a computer program / instruction, which implements the steps of the method described above when executed by a processor.

[0013] Compared with the related art, in the solution provided by the embodiment of the present application, by opening the conversion tool and selecting the interface test case to be converted; calling the writing format specification of the interface test case; parsing the interface test case according to the writing format specification to obtain different field values; combining different field values ​​according to the target script type to obtain the interface test script of the target script type. By adopting this solution, the test case can be automatically converted into a test script through the conversion tool, which improves the test efficiency, reduces the effect of the writing of test cases and test scripts on human resources, and also shortens the overall time consumption of the test process. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0015] Figure 1 An exemplary flow chart of a method for automatically converting a test script based on a test case according to some embodiments of the present application;

[0016] Figure 2 An exemplary flow chart of an automated conversion method for a test case provided according to some embodiments of the present application;

[0017] Figure 3 An exemplary flow chart of a method for automatically converting a test script based on a test case according to some embodiments of the present application;

[0018] Figure 4 An exemplary flow chart of a method for automatically converting a test script based on a test case according to some embodiments of the present application;

[0019] Figure 5 An exemplary structural diagram of the electronic device is disclosed. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0021] First embodiment

[0022] The first embodiment of the present application relates to a method for automatically converting test scripts based on test cases. Figure 1 As shown, the method may include the following steps:

[0023] Step S101, open the conversion tool and select the interface test case to be converted;

[0024] The conversion tool may be a tool for automatically converting test cases into test scripts, wherein a selection page or window may be provided for the staff to select the test cases to be converted.

[0025] In this solution, it can be understood that the selected test case can be an interface test case. In addition, a performance test case can also be selected. The interface test case can include: a test case number, which is used to uniquely identify each test case for easy tracking and management. Interface name, which specifies the name of the interface to be tested for quick positioning. Use case description, which briefly describes the test purpose and scenario of the test case. Input parameters, which lists the input parameters required by the interface, including parameter name, type, value range, etc. Required parameters and optional parameters should be distinguished. Expected results, which describe the expected output results of the interface under given input parameters. Including the type, content, format, etc. of the return value. For possible error conditions, the expected error code and error message should also be clearly stated. Actual results, after executing the test case, record the actual results obtained. Test conclusion, based on the comparison between the actual results and the expected results, draw a conclusion on whether the test passes or fails. Performance test cases can include: a test case number, which is also used to uniquely identify the performance test case. Test scenario, which describes the specific scenario of the performance test, such as concurrent login, high-load query, etc. Performance indicators, which clearly specify the performance indicator requirements of the test, such as response time, throughput, number of concurrent users, etc. Test data: prepare test data for performance testing, including data volume, data distribution, etc. Test steps: describe in detail the steps for performing performance testing, including how to simulate concurrent users, how to set load, etc. Expected results: determine the expected results in this test scenario based on the performance index requirements. Actual results: record the actual performance data after performing the performance test. Analysis and conclusion: analyze the actual results to determine whether the performance index requirements are met and draw test conclusions.

[0026] Step S102, retrieving the writing format specification of the interface test case;

[0027] The format of the interface test case is different, and the writing format specification may also be different, or the purpose is different, and the writing format specification may also be different. Therefore, it is necessary to call its writing format specification after determining the interface test case. For example, the writing format specification can be: ID->module->case name->request url->request type->request header->request parameters->pass parameters->expected results.

[0028] Step S103, parsing the interface test case according to the writing format specification to obtain different field values;

[0029] In this solution, the corresponding database can be used to parse the test case file. For example, the interface test case Excel file can be read through the pandas library, and different fields in the Excel file can be parsed to obtain different field values.

[0030] Step S104, combining different field values ​​according to the target script type to obtain an interface test script of the target script type.

[0031] After obtaining different field values, different field values ​​may be combined according to a desired script type, that is, a target script type, to obtain an interface test script of the target script type.

[0032] Among them, a script template is required before the combination, and the script template can be provided by a conversion tool. For example, the conversion tool can generate script templates according to various script types in advance, so that after combining different field values, according to the requirements of the script template, or according to the requirements of the actual generated script, it is added to the script template to obtain the interface test script of the target script type.

[0033] The solution provided in this embodiment is to open the conversion tool and select the interface test case to be converted; retrieve the writing format specification of the interface test case; parse the interface test case according to the writing format specification to obtain different field values; combine different field values ​​according to the target script type to obtain the interface test script of the target script type. By adopting this solution, the test case can be automatically converted into a test script through the conversion tool, which improves the test efficiency, reduces the effect of the writing of test cases and test scripts on human resources, and also shortens the overall time consumption of the test process.

[0034] In a preferred embodiment, the method further comprises:

[0035] Convert between XMind functional test case and Excel functional test case formats.

[0036] Figure 2 The following is an exemplary flow chart of a method for automatically converting test cases according to some embodiments of the present application. XMind is a mind mapping and brainstorming tool that can help organize and visualize your ideas and information. Excel is a spreadsheet software developed by Microsoft, which is widely used for data processing, analysis and reporting. Figure 2As shown, in a scenario, the XMind functional test case and the Excel functional test case format can be converted to each other. Among them, the conversion between the XMind functional test case and the Excel functional test case format is specified in the XMind and functional test case writing format (module->scenario->case title->precondition->operation steps->expected results). XMind is converted into a test case using the XMindparser third-party library function to convert XMind into a dictionary format, and then the corresponding module, scenario, case title, precondition, operation steps, and expected result field results are found from the converted dictionary results according to the standard format. Test case conversion XMind uses the XMind third-party library function to add the Excel test case to XMind format.

[0037] Among them, XMind third-party library is a Python library for creating and editing XMind files. XMindparser is a Python library for parsing XMind files.

[0038] In a preferred solution, when the interface test case is an Excel interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including:

[0039] If the interface script type is Pytest, the parsed different field values ​​are combined into the corresponding Pytest script according to the format of the Pytest script;

[0040] or,

[0041] If the interface script type is Unittest, the parsed different field values ​​are combined into a corresponding Unittest script according to the format of the Unittest script.

[0042] In this solution, the Excel interface test case automatically generates the Pytest or Unittest interface automation test script and combines it with the Allure test report.

[0043] Among them, Pytest is a popular Python testing framework that helps write and run tests. Unittest is a testing framework in the Python standard library that helps write and run tests.

[0044] The writing format of the interface test case is (ID->module->case name->request url->request type->request header->request parameters->passed parameters->expected result). According to the selected interface script type Pytest or Unittest, read the interface test case Excel file through the pandas library, parse the different fields in the Excel file, and then combine the parsed different field values ​​into the corresponding Pytest or Unittest script format according to the format of the Pytest and Unittest scripts, make interface requests in the Requests mode, and combine with the Allure test report, place the module and case name in the test case in the epic and title in Allure respectively for the test report display.

[0045] Among them, Requests is a Python library for sending HTTP requests. Pandas is a very powerful data analysis library that can help you process and analyze data. You can use pandas to read and write data in various formats, such as CSV, Excel, SQL, etc., and perform various data operations and analysis. Epic is in the Allure report. Epic is a label used to organize and classify test cases. Title is in the Allure report. Title is a title used to describe a test case or test step.

[0046] Among them, Allure is a flexible, open source, multi-language test reporting tool for generating rich, visual test reports.

[0047] This solution can automatically generate Pytest or Unittest interface automation test scripts through Excel interface test cases, thereby improving the generation efficiency of Pytest or Unittest interface automation test scripts, eliminating the need for manual writing by staff and reducing the consumption of human resources.

[0048] In a preferred solution, when the interface test case is an Excel interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including:

[0049] If the interface script type is Locust, the parsed different field values ​​are combined into the corresponding Locust script according to the format of the Locust script.

[0050] In this solution, the Excel interface automated test case automatically generates the Locust interface performance automated test script.

[0051] Among them, Locust is an open source load testing tool used to simulate user behavior and test system performance.

[0052] The writing format of the interface test case is (ID->module->case name->request url->request type->request header->request parameters->pass parameters). The Excel test case is read through the Openpyxl library, and then the corresponding Locust script is generated according to the format of the Locust script for the parsed different field values, and then the interface performance automation test is performed through Locust's HttpUser and task.

[0053] Among them, Openpyxl is a Python library for reading and writing Excel files. HttpUser is a class used to define HTTP user behavior. The HttpUser class inherits from the locust.User class and defines user behavior, such as sending HTTP requests, processing responses, etc. Task is a function used to define user behavior. The task function can be an HTTP request, a database query, or a custom Python function.

[0054] This solution can automatically generate Locust scripts through Excel interface test cases, thereby improving the efficiency of Locust script generation, eliminating the need for manual writing by staff and reducing the consumption of human resources.

[0055] In a preferred solution, when the interface test case is an Excel interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including:

[0056] If the interface script type is Postman's JSON structure, the parsed different field values ​​are combined into the corresponding Postman's JSON structure script according to the format of the Postman's JSON structure script.

[0057] Among them, Postman is a popular API testing tool that can help test, debug and monitor APIs.

[0058] In the process of automatically generating Postman scripts from Excel interface automated test cases, the writing format of interface test cases is (ID->module->case name->request url->request type->request header->request parameters->passed parameters->expected results). The Excel test cases are read through the Openpyxl library, the corresponding fields are extracted, and then the corresponding Postman JSON script is generated according to the Postman JSON structure. Among them, JSON is a module in the Python standard library for processing JSON data.

[0059] This solution can automatically generate Postman's JSON script through Excel interface test cases, thereby improving the generation efficiency of Postman's JSON script.

[0060] In a preferred solution, when the interface test case is a Postman interface test case, the interface test case is parsed according to the writing format specification to obtain different field values, including:

[0061] Parse Postman's JSON file through Python and extract different field values ​​in Postman's JSON file;

[0062] Combine different field values ​​according to the target script type to obtain the interface test script of the target script type, including:

[0063] If the interface script type is Pytest, the parsed different field values ​​are combined into the corresponding Pytest script according to the format of the Pytest script;

[0064] or,

[0065] If the interface script type is Unittest, the parsed different field values ​​are combined into a corresponding Unittest script according to the format of the Unittest script.

[0066] Among them, the Postman collection automatically generates Pytest or Unittest interface automation test scripts and combines them with the Allure test report. Among them, Postman can export and generate the corresponding Postman JSON collection file after capturing the package through the third-party tool. Then parse the Postman JSON file through python, extract the required field format in the JSON file, and then combine the parsed different field values ​​into the corresponding Pytest or Unittest script format according to the format of the Pytest and Unittest scripts, make interface requests in the Requests way, and combine with the Allure test report, and place the module and use case names in the test case into the epic and title in Allure for the display of the test report.

[0067] This solution can automatically generate Pytest scripts or Unittest scripts after capturing Postman test cases, thereby improving the efficiency of script generation.

[0068] In a preferred solution, when the interface test case is a Postman interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including:

[0069] If the interface script type is Locust, the different field values ​​parsed are combined into a corresponding Locust script according to the format of the Locust script, and the interface test is performed through the HttpUser and task of the Locust script.

[0070] In the process of automatically generating Locust interface performance automation test scripts from Postman collection, Postman can export the corresponding Postman JSON collection file after capturing the package through a third-party tool. Then parse the Postman JSON file through python to extract the required field format in the JSON file. Then generate the corresponding Locust script according to the format of the Locust script for the parsed different field values, and then perform interface performance automation testing through Locust's HttpUser and task.

[0071] Through such settings, this solution can improve the efficiency of generating automated test scripts in the scenario where Postman automatically generates Locust interface performance automated test scripts.

[0072] Figure 3 The following is an exemplary flow chart of a method for automatically converting test scripts based on test cases according to some embodiments of the present application. Figure 3 As shown, this solution opens the automated conversion tool, selects the file to be converted, and the automatic conversion method. Direct conversion will automatically be performed according to the selected conversion method. The currently supported conversion scenarios are as follows:

[0073] Scenario 1: Conversion between XMind functional test case and Excel functional test case formats;

[0074] Scenario 2: Excel interface test cases automatically generate Pytest or Unittest interface automation test scripts and combine them with Allure test reports;

[0075] Scenario 3: Excel interface automated test cases automatically generate Locust interface performance automated test scripts;

[0076] Scenario 4: Excel interface automated test cases automatically generate Postman scripts;

[0077] Scenario 5: Postman automatically generates Pytest or Unittest interface automation test scripts and combines them with Allure test reports;

[0078] Scenario 6: Postman collection automatically generates Locust interface performance automation test scripts;

[0079] Scenario 7: Postman collection automatically generates interface automation test cases.

[0080] Among them, the specific working process of the automated conversion tool based on different scenarios is as follows:

[0081] Scenario 1: Conversion between XMind functional test case and Excel functional test case formats;

[0082] The writing format of XMind and functional test cases is (module->scenario->case title->precondition->operation steps->expected results). XMind conversion to test cases uses XMindparser third-party library function to convert XMind into dictionary form, and then finds the corresponding module, scenario, case title, precondition, operation steps, and expected result field results from the converted dictionary results according to the standard format. Test case conversion XMind uses XMind third-party library function to add Excel test cases to XMind format.

[0083] Scenario 2: Excel interface test cases automatically generate Pytest or Unittest interface automation test scripts and combine them with Allure test reports;

[0084] The writing format of the interface test case is (ID->module->case name->request url->request type->request header->request parameters->passed parameters->expected result). According to the selected interface script type Pytest or Unittest, read the interface test case Excel file through the pandas library, parse the different fields in the Excel file, and then combine the parsed different field values ​​into the corresponding Pytest or Unittest script format according to the format of the Pytest and Unittest scripts, make interface requests in the Requests mode, and combine with the Allure test report, place the module and case name in the test case in the epic and title in Allure respectively for the test report display.

[0085] Scenario 3: Excel interface automated test cases automatically generate Locust interface performance automated test scripts;

[0086] The writing format of the interface test case is (ID->module->case name->request url->request type->request header->request parameters->pass parameters). The Excel test case is read through the Openpyxl library, and then the corresponding Locust script is generated according to the format of the Locust script for the parsed different field values, and then the interface performance automation test is performed through Locust's HttpUser and task.

[0087] Scenario 4: Excel interface automated test cases automatically generate Postman scripts;

[0088] The writing format of the interface test case is (ID->module->case name->request url->request type->request header->request parameters->passed parameters->expected results). Read the Excel test case through the Openpyxl library, extract the corresponding fields, and then generate the corresponding Postman JSON script according to the Postman JSON structure.

[0089] Scenario 5: Postman automatically generates Pytest or Unittest interface automation test scripts and combines them with Allure test reports;

[0090] After capturing the package through a third-party tool, Postman can export and generate the corresponding Postman JSON collection file. Then use Python to parse the Postman JSON file, extract the required field format in the JSON file, and then combine the parsed different field values ​​into the corresponding Pytest or Unittest script format according to the Pytest and Unittest script formats, make interface requests in the Requests mode, and combine with the Allure test report to place the module and case names in the test case into the epic and title in Allure for test report display.

[0091] Scenario 6: Postman collection automatically generates Locust interface performance automation test scripts;

[0092] After capturing packets through third-party tools, Postman can export and generate the corresponding Postman JSON collection file. Then use Python to parse the Postman JSON file and extract the required field format in the JSON file. Then, according to the format of the Locust script, the parsed different field values ​​are used to generate the corresponding Locust script, and then the interface performance automation test is performed through Locust's HttpUser and task.

[0093] Scenario 7: Postman automatically generates interface automation test cases;

[0094] After capturing the package through a third-party tool, Postman can export and generate the corresponding Postman JSON collection file. Then use Python to parse the Postman JSON file and extract the required field format in the JSON file. Then generate Excel test cases through the Openpyxl library.

[0095] This technical solution can quickly generate test cases and automated test scripts in various formats in daily testing work, thereby improving the overall test efficiency and greatly reducing human resource costs. In order to solve the problem of low overall test efficiency, the technical method provided by the embodiment can flexibly convert the written functional test cases into different test case formats, and can flexibly perform automatic conversion between test cases and test scripts. In this way, the overall test efficiency is greatly improved and the human resource cost is reduced in the process of functional testing, interface automated testing, and interface performance automated testing.

[0096] Figure 4 The following is an exemplary flow chart of a method for automatically converting test scripts based on test cases according to some embodiments of the present application. Figure 4As shown, the conversion tool is used to generate a Locust script from Excel, and the Excel test case format (ID->module->case name->request url->request type->request header->request parameters->reverse parameters) is obtained. The Pandas library in Python is used to read the interface test case Excel file, and the corresponding Locust script is generated for the different field values ​​parsed according to the format of the Locust script. Then, the interface performance automation test is performed through Locust's HttpUser and task to generate the corresponding Locust interface performance script. The conversion tool is used to generate a Locust script from Postman. After capturing the package through a third-party tool, Postman can export and generate the corresponding Postman JSON collection file. Python parses the Postman JSON file and extracts the required field format in the JSON file. According to the format of the Locust script, the different field values ​​parsed are generated for the corresponding Locust script, and then the interface performance automation test is performed through Locust's HttpUser and task to generate the corresponding Locust interface performance script.

[0097] The technical solution provided in this embodiment can convert a set of common functional test cases into test scripts of different forms, mainly including interface test scripts and performance test scripts, through the tool scripts in the patent. It saves the time of manually writing interface test scripts and performance test scripts, and improves the overall test efficiency. This solution saves the process of converting into program scripts by writing functional scenario cases that are familiar to the staff, and can generate multiple scripts, which is more versatile.

[0098] In addition, some embodiments of the present application also provide an electronic device. The electronic device may be a digital computer in various forms, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, etc. The electronic device may also be a mobile device in various forms, such as a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices.

[0099] The electronic device includes: one or more processors; and a memory storing computer program instructions, wherein when the computer program instructions are executed, the processor executes the steps of the method provided in any one or more of the above embodiments. Figure 5 An exemplary structural diagram of the electronic device is disclosed. Figure 5As shown, the electronic device includes: one or more processors 501, a memory 502, and an interface for connecting each component, including a high-speed interface and a low-speed interface. The various components are connected to each other using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Among them, the components shown in this article, their connections and relationships, and their functions are only used as examples, and are not intended to limit the implementation of the present application described and / or required herein.

[0100] The electronic device may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.

[0101] The input device 503 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 504 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0102] To provide interaction with a user, the electronic device may be a computer. The computer has: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0103] In the embodiments of the present application, a computer program / instruction is stored on a computer-readable medium, and when the computer program / instruction is executed by a processor, the steps of the method provided by any one or more of the above embodiments are implemented. The computer-readable medium may be included in the electronic device described in the above embodiments; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more computer-readable instructions.

[0104] The memory 502 can be used as a non-transient computer-readable storage medium, which can be used to store non-transient software programs, non-transient computer executable programs and modules. The processor 501 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 502, so as to implement the program instructions / modules corresponding to the method provided by any one or more embodiments in the embodiments of the present application.

[0105] The memory 502 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory 502 may optionally include a memory remotely arranged relative to the processor 501, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0106] It should be noted that the computer-readable medium described in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, 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, Random Access Memory), a read-only memory (ROM, Read-Only Memory), 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 application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0107] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0108] Computer program code for performing the operations of the present application 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 separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via 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., via the Internet using an Internet service provider).

[0109] In the above-described embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. For example, it can be implemented by using an application specific integrated circuit (ASIC), a general-purpose computer or any other similar hardware device. In certain embodiments, the software program of the present application can be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including relevant data structures) can be stored in a computer-readable recording medium, for example, a RAM memory, a magnetic or optical drive or a floppy disk and similar devices. In addition, some steps or functions of the present application can be implemented by hardware, for example, as a circuit that cooperates with a processor to perform each step or function.

[0110] The computer program product provided in the embodiment of the present application includes one or more computer programs / instructions, and when the computer program / instructions are executed by the processor, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive solidstatedisk (SSD)), etc.

[0111] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the 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 from the order 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 flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0112] The scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim may also be implemented by one unit or device through software or hardware. The words "first", "second", etc. are only used to distinguish the description, and do not indicate any particular order, nor can they be understood as indicating or implying relative importance.

[0113] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily mention changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims, and the above embodiments should be regarded as exemplary and non-restrictive.

Claims

1. A method for automatically converting test scripts based on test cases, characterized in that: include: Open the conversion tool and select the interface test case that needs to be converted; Retrieve the writing format specification of the interface test case; Parsing the interface test case according to the writing format specification to obtain different field values; Different field values ​​are combined according to the target script type to obtain an interface test script of the target script type.

2. The method according to claim 1, characterized in that In the case where the interface test case is an Excel interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including: If the interface script type is Pytest, the parsed different field values ​​are combined into the corresponding Pytest script according to the format of the Pytest script; or, If the interface script type is Unittest, the parsed different field values ​​are combined into a corresponding Unittest script according to the format of the Unittest script.

3. The method according to claim 1, characterized in that In the case where the interface test case is an Excel interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including: If the interface script type is Locust, the parsed different field values ​​are combined into the corresponding Locust script according to the format of the Locust script.

4. The method according to claim 1, characterized in that: In the case where the interface test case is an Excel interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including: If the interface script type is Postman's JSON structure, the parsed different field values ​​are combined into the corresponding Postman's JSON structure script according to the format of the Postman's JSON structure script.

5. The method according to claim 1, characterized in that When the interface test case is a Postman interface test case, the interface test case is parsed according to the writing format specification to obtain different field values, including: Parse Postman's JSON file through Python and extract different field values ​​in Postman's JSON file; Combine different field values ​​according to the target script type to obtain the interface test script of the target script type, including: If the interface script type is Pytest, the parsed different field values ​​are combined into the corresponding Pytest script according to the format of the Pytest script; or, If the interface script type is Unittest, the parsed different field values ​​are combined into a corresponding Unittest script according to the format of the Unittest script.

6. The method according to claim 1, characterized in that In the case where the interface test case is a Postman interface test case, different field values ​​are combined according to the target script type to obtain an interface test script of the target script type, including: If the interface script type is Locust, the different field values ​​parsed are combined into a corresponding Locust script according to the format of the Locust script, and the interface test is performed through the HttpUser and task of the Locust script.

7. The method according to claim 1, characterized in that When the interface test case is a Postman interface test case, the interface test case is parsed according to the writing format specification to obtain different field values, including: Parse Postman's JSON file through Python and extract different field values ​​in Postman's JSON file; Combine different field values ​​according to the target script type to obtain the interface test script of the target script type, including: If the interface script type is Excel, the Openpyxl library is used to combine the parsed different field values ​​into corresponding Excel scripts according to the format of the Excel script.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; and A memory storing computer program instructions, which, when executed, cause the processor to perform the steps of the method as claimed in any one of claims 1 to 7.

9. A computer readable medium having a computer program / instructions stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.