WO2023115397A1 - Method and apparatus for generating automated script - Google Patents

Method and apparatus for generating automated script Download PDF

Info

Publication number
WO2023115397A1
WO2023115397A1 PCT/CN2021/140549 CN2021140549W WO2023115397A1 WO 2023115397 A1 WO2023115397 A1 WO 2023115397A1 CN 2021140549 W CN2021140549 W CN 2021140549W WO 2023115397 A1 WO2023115397 A1 WO 2023115397A1
Authority
WO
WIPO (PCT)
Prior art keywords
automation script
data
item
function
automation
Prior art date
Application number
PCT/CN2021/140549
Other languages
French (fr)
Chinese (zh)
Inventor
袁翔宇
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN202180033485.2A priority Critical patent/CN116648689A/en
Priority to PCT/CN2021/140549 priority patent/WO2023115397A1/en
Publication of WO2023115397A1 publication Critical patent/WO2023115397A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Definitions

  • the present application relates to the technical field of testing, and more specifically, to a method and device for generating automation scripts.
  • Hardware in the loop is a technology for the development and testing of complex device controllers. Through HIL testing, the physical part of a machine or system is replaced by a simulator. HIL has rich test functions and high safety, and has a wide range of applications in the vehicle development process. For example, in vehicle driving tests, weather, driving style, route details and complex limit conditions can all be tested in HIL Simulated in the simulation, but also to avoid test personnel and vehicle components in unnecessary dangerous test conditions.
  • test case is a specific set of input data, operations, environment settings and expected results provided to the test system for the implementation of the test.
  • the automated script is for testing.
  • the script written is essentially a series of instructions for a specific test. These instructions can be executed by automated testing tools, and the writing of automated scripts must correspond to the corresponding test cases.
  • the present application provides a method and device for generating an automation script.
  • the method generates a corresponding automation script according to data input by a user on a user interface and a preset automation script template, avoiding manual writing and saving manpower.
  • a method for generating an automation script comprising: acquiring at least one first item to be set in a user interface and data input by a user in the at least one first item to be set; according to at least one The first item to be set determines at least one first automation script template, at least one first automation script template includes data to be set; at least one first automation is set according to the data input by the user in at least one first item to be set The data to be set in the script template to obtain the first automation script.
  • the method for generating an automation script in the embodiment of the present application generates the automation script corresponding to the item to be set according to the data of the item to be set input by the user on the user interface and the preset automation script template, avoids manual writing, saves manpower, and abandons the existing
  • the database in the technology does not need to be converted into automated scripts according to the data of the items to be set in the database, which realizes the lightweight architecture.
  • the item to be set here can be a complete test case or a part of a test case.
  • the items to be set may include fixed data, which does not need to be input by the user, or may include data to be input, which needs to be input by the user by filling in the blanks or selecting.
  • one first automation script template corresponds to one first item to be set, or one first automation script template corresponds to multiple first items to be set.
  • the automation script template is mainly represented as a format, so a corresponding automation script template can be set for each item to be set, or, when the items to be set have a similar format, multiple similar formats to be set Setup projects can also use the same automation script template.
  • the data input by the user in at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations, according to the user's at least
  • the data input in a first item to be set sets the data to be set in at least one first automation script template to obtain the first automation script, including: according to one or more operations and parameters corresponding to one or more operations Determine the parameters of the preset function, the parameters of the preset function and the preset function are the data to be set in at least one first automation script template; the parameters of the preset function and the preset function are filled in at least one
  • the first automation script template gets the first automation script.
  • each operation has a corresponding function, which is preset by the developer.
  • the function corresponding to each operation may be the same or different.
  • the same pre-operations can be performed for each operation, which facilitates unified management.
  • the pre-operations of each operation actually correspond to a series of codes, and the embodiment of the present application encapsulates a series of codes into functional functions.
  • the parameters of the function function corresponding to the one or more operations determine the parameters of the function function corresponding to the one or more operations, wherein the specific execution code of each operation is also encapsulated into a corresponding function as a parameter of the function function,
  • the parameters corresponding to the operation are also converted into parameters of the function function to determine the specific execution degree of the operation.
  • the pre-operation of each operation is encapsulated as a function function, and the specific execution of the operation and its parameters are used as parameters of the function function, so that the operation steps on the user interface and the operation steps in the automation script can be consistent in number and order,
  • the series of codes corresponding to the function functions are realized by the underlying logic.
  • the method further includes: parsing the second automation script to obtain the data of the second item to be set corresponding to the second automation script; and the data of the second to-be-set item are displayed on the second user interface.
  • the method of the embodiment of the present application also includes obtaining the data of the items to be set on the user interface according to the automation script in the background, and displaying the data on the user interface.
  • the method for generating the automation script in the background is not limited in this embodiment of the present application.
  • the automation script may be generated by the existing technology, or may be generated by the method for generating an automation script in the embodiment of the present application.
  • the method for parsing the second automation script includes any one of regularity extraction, keyword matching, and AI identification.
  • the method further includes: obtaining the directory of the second automation script; generating the directory of the second item to be set according to the directory of the second automation script; The directory of is displayed on the second user interface.
  • the user often needs to edit the directories of the multiple items to be set by himself, which is time-consuming and labor-intensive for the user.
  • the directory of the item to be set on the user interface can also be obtained according to the directory of the automation script in the background, because the automation script code During operation, the corresponding directory will be automatically generated, and the directory of the project to be set on the corresponding user interface will be created according to the directory of the automation script, which can prevent the user from writing multiple directories of the project to be set, which can reduce the workload of the user and improve user experience.
  • the method further includes: modifying the parameters of the second function function in the second automation script; the second automation script corresponding to the second user interface to be set The data of the project changes with the modification of the parameters of the function function.
  • the data of the items to be set on the user interface can be obtained according to the automation script in the background, that is, the data of the automation script in the background is in one-to-one correspondence with the data of the items to be set on the user interface, so when the data in the background When the parameter of the function is modified in the automation script, the data of the item to be set corresponding to the automation script on the user interface will also change correspondingly with the modification of the parameter of the function. In this way, when the developer detects that there is any need to modify the automation script in the background, he can directly modify it in the automation script code, and the corresponding data on the user interface will also change accordingly. Real-time management of the user interface.
  • the method also includes: modifying the directory of the second automation script; Vary with modification.
  • the functional function includes a decorator function.
  • the functional functions in the embodiments of the present application include decorator functions, which are functions used to modify other functions.
  • decorator functions are functions used to modify other functions.
  • parameter generalization for example, it is necessary to repeatedly execute certain steps of the project to be set or For operations such as loops, related steps can be put into the decorator function and controlled by adjusting the parameters of the decorator function.
  • a device for generating an automation script comprising: an acquisition unit configured to acquire at least one item to be set in the user interface and data input by the user in the at least one item to be set; a processing unit , used to determine at least one automation script template according to at least one item to be set, at least one automation script template includes data to be set; set at least one first automation according to data input by the user in at least one first item to be set The data to be set in the script template to obtain the first automation script.
  • one first automation script template corresponds to one first item to be set, or one first automation script template corresponds to multiple first items to be set.
  • the data input by the user in at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations, according to the user's at least
  • the data input in a first item to be set sets the data to be set in at least one first automation script template to obtain the first automation script, including: according to one or more operations and parameters corresponding to one or more operations Determine the parameters of the first functional function, and the parameters of the preset functional function and the preset functional function are the data to be set in at least one first automation script template; the parameters of the preset functional function and the preset functional function are filled in at least one The first automation script template gets the first automation script.
  • the preset functions corresponding to the same operation are the same.
  • the processing unit is further configured to: parse the second automation script to obtain the data of the second item to be set corresponding to the second automation script; Data of the setting items and the second to-be-set items are displayed on the second user interface.
  • the method for parsing the second automation script includes any one of regularity extraction, keyword matching, and AI identification.
  • the obtaining unit is also used to obtain the directory of the second automation script; the processing unit is also used to generate the directory of the second item to be set according to the directory of the second automation script ; The processing unit is also used to display the directory of the second to-be-set item on the second user interface.
  • the processing unit is further configured to: modify the parameters of the function functions in the second automation script;
  • the data of the project changes with the modification of the parameters of the function function.
  • the processing unit is also used to: modify the directory of the second automation script; the directory of the second item to be set on the second user interface follows the The catalog changes.
  • the functional function includes a decorator function.
  • a computing device including: at least one processor and a memory; at least one processor is coupled to the memory, and is used to read and execute instructions in the memory, so that the computing device implements any of the above-mentioned second aspects.
  • a device for generating automated scripts including: at least one processor and a memory; at least one processor is coupled to the memory, and is used to read and execute instructions in the memory, so that the computing device implements any of the above-mentioned second aspects.
  • a computer-readable storage medium stores program codes, and when the computer program codes run on a computer, the computer executes the method described in any one of the above-mentioned first aspects.
  • Fig. 1 is a schematic architecture diagram of an existing method for generating an automation script according to an embodiment of the present application
  • Fig. 2 is a schematic structural diagram of a method for generating an automation script according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of two application scenarios of the embodiment of the present application.
  • FIG. 4 is a schematic architecture diagram of a computing device according to an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a method for generating an automation script according to an embodiment of the present application
  • FIG. 6 is a schematic diagram of a user interface for writing a test case for vehicle development according to an embodiment of the present application
  • FIG. 7 is a schematic diagram of two possible automation script templates for a project to be set according to the embodiment of the present application.
  • FIG. 8 is a schematic diagram of several operations and functional functions corresponding to the parameters of the operations in the embodiment of the present application.
  • FIG. 9 is a schematic diagram of function multiplexing in an embodiment of the present application.
  • Fig. 10 is a schematic diagram of reading the data in the automation script of the background according to the embodiment of the present application.
  • FIG. 11 is a schematic diagram of a decorator function application in an embodiment of the present application.
  • Fig. 12 is a schematic block diagram of a method for generating an automation script according to an embodiment of the present application.
  • FIG. 13 is a schematic block diagram of an apparatus for generating an automation script according to an embodiment of the present application.
  • Fig. 14 is a schematic structural diagram of an apparatus for generating an automation script according to an embodiment of the present application.
  • the B/S architecture is the architecture corresponding to the client/server (C/S) architecture, both of which are application program architectures, and the C/S architecture is built on the basis of the local area network.
  • the corresponding client needs to be installed when using it; the B/S architecture is based on the wide area network, and its characteristic is that there is no need to install the client, just use a browser.
  • the B/S architecture concentrates the core part of the system function realization on the server On the one hand, it simplifies the development, maintenance and use of the system. When it is necessary to update and upgrade, there is no need to upgrade multiple clients, just upgrade the server.
  • the client only needs to have a browser, and the database is installed on the server. The browser communicates with the database through the server. to interact.
  • the MVC architecture belongs to a type of B/S architecture, including a model layer, a view layer, and a control layer.
  • the top layer is a view layer that directly faces users.
  • the view layer represents a user interaction interface and is used to display information to users.
  • the bottom layer is the model layer, which can also be called the data layer, that is, the data or information that the program needs to operate.
  • the model layer is responsible for storing the central data of the system. It is the processing of business processes/states and the formulation of business rules, and the processing of business processes.
  • the process is a black-box operation for other layers, and the model layer receives the data requested by the view layer and returns the final processing result.
  • the middle layer is the control layer.
  • the control layer is responsible for selecting the data in the model layer according to the instructions input by the user from the view layer, and then performing corresponding operations on it to generate the final result. Specifically, it can be understood as receiving a request from the user and converting the model layer Match with the view layer to complete the user's request.
  • the control layer does not do any data processing. For example, when the user clicks a link, the control layer does not process the business information after receiving the request, but only passes the user's information to the model layer , and tell the model layer what to do, select the view that meets the requirements and return it to the user.
  • These three layers are closely connected but independent of each other. The internal changes of each layer do not affect other layers.
  • Each layer provides an interface for the upper layer to call, so that the software can be modularized, modify the appearance or change the data. There is no need to modify other layers, which greatly facilitates maintenance and upgrades.
  • Fig. 1 shows a schematic architecture diagram of an existing method for generating automated scripts, as shown in Fig. 1, wherein the front-end user interface (user interface, UI) layer is equivalent to the view layer, and the background service layer is equivalent to the control layer , the database layer is equivalent to the model layer, so the front-end UI layer, background service layer and database layer in Figure 1 together constitute an MVC architecture.
  • the front-end UI layer is used as the interface for users to operate test cases, and directly connects with users;
  • the background service layer is responsible for processing the data generated by users’ operations in the front-end UI layer and storing them in the database;
  • the database layer is responsible for storing relevant data of test cases.
  • the architecture in FIG. 1 also includes a data conversion layer and an executor layer, the data conversion layer is used to convert data into corresponding automation scripts, and the executor layer is used to execute the automation scripts.
  • the architecture shown in Figure 1 can generate automation scripts, but the architecture shown in Figure 1 is bloated and complex, the workload of generating automation scripts is relatively large, and there is a large maintenance cost. For example, when the basic parameters in the test case or After the project is changed, the corresponding data of the test case also needs to be changed. However, since the data of the test case in the architecture shown in Figure 1 is stored in the database, in practical applications, it is difficult to change the data from the database, so a huge amount of work is required to remove Developing a transplant module increases costs.
  • Fig. 2 shows a schematic structural diagram of a method for generating an automation script according to an embodiment of the present application.
  • the architecture in Fig. 2 compared with the architecture in Fig. 1, the architecture in Fig. 2 abandons the database layer and directly automates Scripts are used as data storage.
  • the script layer can be shared by multiple client users through the server.
  • the architecture shown in Figure 2 effectively simplifies the development workload of the test case writing platform, and can realize rapid development and deployment of the platform.
  • the embodiment of the present application provides a method for generating automated scripts.
  • the method generates automated scripts based on the MVC architecture, avoids manually writing a large number of automated scripts, and improves writing efficiency; meanwhile, the method for generating automated scripts in the embodiments of the present application directly uses Automated scripts are used as data storage, avoiding the use of databases to save data, simplifying the architecture, reducing the development workload, and improving the flexibility of data processing.
  • FIG. 3 shows schematic diagrams of two application scenarios of the method in the embodiment of the present application. Since the architecture of the embodiment of the present application is lightweight and easy to deploy, the method of the embodiment of the present application can be deployed in a personal computer, as shown in scene 1 in Figure 3, wherein the front end is the user interface in the personal computer, and the service layer It can be the server in the personal computer, or the service layer in Figure 2, the background is used to store automation scripts, when the user inputs data in the front-end user interface in the personal computer, the service layer processes the data, and according to the embodiment of the application The corresponding automation script is generated by the method, and the automation script is stored in the background.
  • the front end is the user interface in the personal computer
  • the service layer It can be the server in the personal computer, or the service layer in Figure 2
  • the background is used to store automation scripts, when the user inputs data in the front-end user interface in the personal computer, the service layer processes the data, and according to the embodiment of the application
  • the corresponding automation script is generated by
  • the method in the embodiment of the present application can also be deployed as a network service on a network platform or other automation platforms, as shown in scenario 2 in Figure 3.
  • a network platform as a network service
  • many A user can use a local personal computer to log in to the network platform.
  • the personal computers of multiple users are used as the front end to receive the data input by the user through interface interaction.
  • the server of the network platform is deployed in the cloud to process the data input by the user.
  • the method in the embodiment of the present application generates a corresponding automation script.
  • the automation script can be synchronized to the code warehouse through code synchronization.
  • the code warehouse can be a storage in the cloud.
  • the The generated corresponding automation script can be sent to the corresponding personal computer, so that the local personal computer can run the corresponding automation script to execute the data input by the user in the user interface; correspondingly, the developer can check or check the automation script in the cloud modification, etc., and the corresponding modification can also be synchronized to the user's personal computer.
  • a computing device provided by an embodiment of the present application will be described in detail below with reference to FIG. 4 .
  • the computing device can be used to implement the method for generating an automation script in the embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a computing device 400 provided by an embodiment of the present application.
  • the computing device 400 may be a server or a computer or other devices with computing capabilities.
  • the computing device 400 shown in FIG. 4 includes: at least one processor 410 and a memory 420 .
  • the processor 410 executes the instructions in the memory 420, so that the computing device 400 implements the method for generating an automation script provided in this application, for example, implements the steps performed by the device for generating an automation script.
  • the processor 410 executes the instructions in the memory 420, so that the computing device 400 implements the apparatus for generating an automation script provided in this application, for example, implements each functional module included in the apparatus for generating an automation script.
  • the computing device 400 further includes a system bus, wherein the processor 410 and the memory 420 are respectively connected to the system bus.
  • the processor 410 can access the memory 420 through the system bus, for example, the processor 410 can read and write data or execute codes in the memory 420 through the system bus.
  • the system bus is a peripheral component interconnect express (PCI) bus or an extended industry standard architecture (EISA) bus or the like.
  • PCI peripheral component interconnect express
  • EISA extended industry standard architecture
  • the system bus is divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in Fig. 4, but it does not mean that there is only one bus or one type of bus.
  • the function of the processor 410 is mainly to interpret instructions (or codes) of computer programs and process data in computer software.
  • the instructions of the computer program and the data in the computer software can be stored in the memory 420 or the cache 416 .
  • the processor 410 may be an integrated circuit chip, which has a signal processing capability.
  • the processor 410 is a general purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), an off-the-shelf programmable gate array (field programmable gate array, FPGA) ) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • the general-purpose processor is a microprocessor or the like.
  • the processor 410 is a central processing unit (central processing unit, CPU).
  • each processor 410 includes at least one processing unit 412 and a memory control unit 414 .
  • the processing unit 412 is also called a core (core) or core, and is the most important component of the processor.
  • the processing unit 412 is manufactured by a certain production process of single crystal silicon, and all calculations, receiving commands, storing commands, and processing data of the processor are executed by the core.
  • the processing units run the program instructions independently, and use the ability of parallel computing to speed up the running speed of the program.
  • Various processing units have a fixed logical structure.
  • a processing unit includes logical units such as a first-level cache, a second-level cache, an execution unit, an instruction-level unit, and a bus interface.
  • the memory control unit 414 is configured to control data interaction between the memory 420 and the processing unit 412 . Specifically, the memory control unit 414 receives a memory access request from the processing unit 412, and controls access to memory based on the memory access request.
  • the memory control unit is a device such as a memory management unit (memory management unit, MMU).
  • each memory control unit 414 addresses the memory 420 through a system bus.
  • an arbiter (not shown in the figure) is configured in the system bus, and the arbiter is responsible for processing and coordinating the competing accesses of multiple processing units 412 .
  • the processing unit 412 and the memory control unit 414 are communicatively connected through a connection line inside the chip, such as an address line, so as to realize communication between the processing unit 412 and the memory control unit 414 .
  • each processor 410 also includes a cache 416, wherein a cache is a buffer (referred to as cache) for data exchange.
  • a cache is a buffer (referred to as cache) for data exchange.
  • the processing unit 412 wants to read data, it will first search for the required data from the cache, if it finds it, it will execute it directly, if it cannot find it, it will find it from the memory. Since the cache runs much faster than the memory, the role of the cache is to help the processing unit 412 run faster.
  • the memory (memory) 420 can provide running space for the processes in the computing device 400 , for example, the memory 420 stores computer programs (specifically, program codes) for generating processes. After the computer program is run by the processor to generate a process, the processor allocates a corresponding storage space for the process in the memory 420 . Further, the above storage space further includes a text segment, an initialization data segment, a bit initialization data segment, a stack segment, a heap segment, and the like. The memory 420 stores data generated during the running of the process in the storage space corresponding to the above process, for example, intermediate data, process data, and the like.
  • the internal memory is also referred to as an internal memory, which is used to temporarily store calculation data in the processor 410 and exchange data with external storage such as a hard disk.
  • the processor 410 transfers the data to be calculated into the memory for calculation, and the processing unit 412 transmits the result after the calculation is completed.
  • memory 420 is either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory.
  • non-volatile memory is read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable In addition to programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • Volatile memory is random access memory (RAM), which acts as external cache memory.
  • RAM random access memory
  • static RAM static random access memory
  • dynamic RAM dynamic random access memory
  • DRAM dynamic random access memory
  • synchronous dynamic random access memory synchronous DRAM, SDRAM
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • serial link DRAM SLDRAM
  • direct memory bus random access memory direct rambus RAM, DR RAM
  • the structure of the computing device 400 listed above is only illustrative, and the present application is not limited thereto.
  • the computing device 400 includes various hardware in the computing system in the prior art.
  • the computing device 400 also includes other than the memory 420.
  • Other storage for example, disk storage, etc.
  • the computing device 400 may also include other devices necessary for normal operation.
  • the above computing device 400 may also include hardware devices for implementing other additional functions.
  • the above-mentioned computing device 400 may only include components necessary to realize the embodiment of the present application, and does not necessarily include all the components shown in FIG. 4 .
  • the method for generating an automation script according to the embodiment of the present application will be described in detail below in conjunction with FIG. 5 .
  • the method can be executed by the computing device 400 shown in FIG. 4 to implement the method for generating an automation script provided in the embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a method for generating an automation script according to an embodiment of the present application. As shown in FIG. 5 , the method includes steps 501 to 503, which will be introduced respectively below.
  • the method in FIG. 5 can generate a corresponding automation script according to the data input by the user on the front-end user interface.
  • the item to be set can be a complete test case or a part of a test case.
  • the items to be set may include fixed data, which does not need to be input by the user, or may include data to be input, which needs to be input by the user by filling in the blanks or selecting.
  • Figure 6 shows a user interface for writing test cases for vehicle development.
  • the item to be set can be the entire test case shown in Figure 6, including "Use case information" and "test process” can also be part of the test case shown in Figure 6, for example, the item to be set is only “test process", or even just "test steps” in the "test process”.
  • the data input by the user in the project to be set can be filled in or selected.
  • the "use case name” in Figure 6 can be entered by the user in the form of fill in the blank.
  • the user can name the "use case name” by himself, and the data can also be provided by the user.
  • the user can choose among multiple alternatives, such as “Test Step” - "Behavior Name” in Figure 6, the user can select the alternatives “insert DC fast charging gun” and “insert DC slow charging gun” Select “Insert DC Fast Charger".
  • the user may also input data in the items to be set in other possible ways, which are not limited in this embodiment of the present application.
  • the user interface shown in Figure 6 is only an example of the user interface of the embodiment of the present application, and does not limit the application.
  • the user interface of the embodiment of the present application can also be in other forms , as long as the items to be set are included and data can be input by the user in the items to be set.
  • S502. Determine at least one automation script template according to at least one item to be set, where the at least one automation script template includes data to be set.
  • the method in the embodiment of the present application can provide multiple automation script templates, and the multiple automation script templates can be preset by humans.
  • An automation script template can be determined according to an item to be set, and one automation script template can correspond to one item to be set, or one automation script template can also correspond to multiple items to be set.
  • the automation script template is mainly represented as a format.
  • the automation script template may include fixed data in the item to be set, or may not include the fixed data in the item to be set, but only include one or more data to be set.
  • the or plurality of data to be set corresponds to data input by the user in the item to be set. For example, Fig.
  • FIG. 7 shows two possible automation script templates for an item to be set, wherein the "precondition”, “intermediate processing” and “post-processing” of the item to be set are fixed data, in In automation script template A, “preconditions”, “intermediate processing”, and “post-processing” are also fixed data, and the curly brackets are the data to be set in automation script template A.
  • automation script template B they do not include Fixed data such as “preset conditions”, “intermediate processing” and “post-processing” only include the data to be set in the automation script template B within the curly brackets. It can be seen from Figure 7 that no matter whether the automation script template includes Fixed data, all of which have a certain format, and the format is consistent with the format of the item to be set.
  • the automation script template can be determined to determine the automation script template with the same format as the item to be set.
  • the mapping relationship between the item to be set and the automation script template can be established in advance, and then according to the item to be set and the mapping relationship to determine the corresponding automation script template.
  • the data input by the user in at least one item to be set includes one or more operations and parameters corresponding to one or more operations.
  • the operation is "brake switch” and the corresponding parameter is “waiting”. 10s”, and the operation "gear” and its corresponding parameter "P gear”, etc.
  • each operation has a corresponding function, which is preset by the developer.
  • the function corresponding to each operation may be the same or different.
  • the same pre-operations can be performed for each operation, which facilitates unified management.
  • the pre-operations of each operation actually correspond to a series of codes, and the embodiment of the present application encapsulates a series of codes into functional functions. Then, according to one or more operations and their corresponding parameters, determine the parameters of the function function corresponding to the one or more operations, wherein the specific execution code of each operation is also encapsulated into a corresponding function as a parameter of the function function, The parameters corresponding to the operation are also converted into parameters of the function function to determine the specific execution degree of the operation.
  • the pre-operation of each operation is encapsulated as a function function, and the specific execution of the operation and its parameters are used as parameters of the function function, so that the operation steps on the user interface and the operation steps in the automation script can be consistent in number and order,
  • the function function corresponding to "hanging P gear” is “self.run_behavior (gear, P)"
  • the function function corresponding to "stepping on the accelerator 50%” is “self.run_behavior(stepping on the accelerator, 50% )”
  • the function function corresponding to "turn on the car air conditioner” is “self.run_behavior (turn on the car air conditioner)”
  • the function function corresponding to "step on the brake” is "self. ()”
  • the specific operation implemented by the underlying logic is "connect and log in to the HIL cabinet, open the cabinet port, and write port data".
  • the function function and the parameters of the function function are the data to be set in the automation script template.
  • the automation script can be obtained according to the function function, the parameters of the function function and the automation script template.
  • Figure 8 is only an illustration of the operation of the embodiment of the present application, its functional functions and underlying logic implementation, and does not constitute a limitation of the present application. In practical applications, developers can design functions corresponding to different operations according to actual needs. Function and specific underlying logic implementation.
  • the method of the embodiment of the present application also includes acquiring the data of the item to be set on the user interface according to the background automation script, and displaying the acquired data on the user interface.
  • the method of generating the automation script in the background is not limited in this embodiment of the present application.
  • the automation script can be generated through existing technologies, including automation scripts determined according to existing database methods and manually written
  • the automation script and the like may also be generated by the method for generating an automation script in the embodiment of the present application.
  • the code of the automation script can be parsed through the inspect method or the file parsing method, specifically through regular extraction, keyword matching, or AI recognition. Feature recognition is performed on the function functions in the obtained automation script and the parameters in the function functions, so as to obtain the data of the items to be set corresponding to the automation script.
  • the above two functions are the data under the "preset conditions", so the extracted operation and its parameters are displayed on the " Among the data to be set in "Preset Conditions", they are "Brake switch, wait 10s” and "In gear, P position”. Therefore, the method of the embodiment of the present application can realize the generation of automation scripts based on the items to be set on the user interface and their data, and can also be executed in reverse, that is, to read the data in the background automation scripts and display the data on the user interface. interface.
  • the data of the items to be set on the user interface can be obtained according to the automation script in the background, that is, the data of the automation script in the background is in one-to-one correspondence with the data of the items to be set on the user interface, so when in the automation script in the background
  • the data of the items to be set corresponding to the automation script on the user interface will also change correspondingly with the modification of the parameters of the function.
  • the developer detects that there is any need to modify the automation script in the background he can directly modify it in the automation script code, and the corresponding data on the user interface will also change accordingly. Real-time management of the user interface.
  • the user often needs to edit the directories of the multiple items to be set by himself, which is time-consuming and labor-intensive for the user.
  • the directory of the item to be set on the user interface can also be obtained according to the directory of the automation script in the background, because the automation script code During operation, the corresponding directory will be automatically generated, and the directory of the project to be set on the corresponding user interface will be created according to the directory of the automation script, which can prevent the user from writing multiple directories of the project to be set, which can reduce the workload of the user and improve user experience.
  • the functional functions of the embodiment of the present application include decorator functions, which are functions used to modify other functions, and can add new functions and additional restrictions to the decorated object without modifying the original code Conditions or help output.
  • decorator functions are functions used to modify other functions, and can add new functions and additional restrictions to the decorated object without modifying the original code Conditions or help output.
  • the operations that need to be performed by the user interface input are "setting the state of charge (SOC) of the battery", “powering on the vehicle” and “powering off the vehicle”, wherein “setting the battery SOC” It needs to be executed 3 times, and the first execution battery SOC is 1, the second execution battery SOC is 2, and the third execution battery SOC is 3, that is, cyclic execution is required. Therefore, in actual operation, the loop operation can be put into the decorator function "loop()", and the number of loops can be set to 3 times in the brackets of the decorator function. Execute 3 times, and if the parameters need to be changed each time it is executed, it can also be set in the automation script.
  • SOC state of charge
  • the method for generating an automation script in the embodiment of the present application generates the automation script corresponding to the item to be set according to the data of the item to be set input by the user on the user interface and the preset automation script template, avoids manual writing, saves manpower, and abandons the existing
  • the database in the technology does not need to be converted into automated scripts according to the data of the items to be set in the database, which realizes the lightweight architecture.
  • the automation script generated by the method of the embodiment of the present application corresponds to the data of the items to be set in the user interface. When the data of the automation script is modified in the background, the data of the items to be set in the user interface will also change accordingly, so that the development Personnel can manage the user interface in real time by editing automation scripts.
  • the method in the embodiment of the present application can create the directory of the items to be set on the user interface according to the directory of the automation script, without the need for the user to write it by himself, thereby improving the user experience.
  • the functional functions in the automation script of the embodiment of the present application can be reused in different scenarios.
  • the data of multiple items to be set is stored in the database. Find the corresponding data in the database, and then generate corresponding automation scripts according to the corresponding data in the database. Therefore, different items to be set should correspond to different data in the database, even if the operations in different items to be set are the same, they are different from each other.
  • the method for generating an automated script in the embodiment of the present application has been described in detail above in conjunction with FIGS.
  • the method of FIG. 12 may be executed by the computing device shown in FIG. 4 .
  • Fig. 12 shows a schematic block diagram of a method for generating an automation script according to an embodiment of the present application, taking the test of a vehicle as an example.
  • the items to be set include the content of "use case information" and "test process” on the user interface. Add behavior, add “behavior 0" in “test steps”, and select the behavior name as “insert DC fast charging gun”, add “behavior 1” in “post-processing”, and select the behavior name as "Pull out the DC fast charging gun", the above is the data of the items to be set entered by the user on the user interface. Then, according to the item to be set, the corresponding automation script template is determined as shown in Figure 12.
  • the format of the automation script template is consistent with the format of the item to be set on the user interface, wherein “test process”, “preset condition”, “test step” “, “Post-processing” and so on are the fixed data of the template, and the curly brackets are the data to be set in the template, which need to be set according to the data of the items to be set entered by the user in the user interface. Finally, determine the corresponding function function and its parameters according to the specific behavior in the data input by the user.
  • the function function is preset, and each optional behavior on the user interface has its corresponding function function, such as "insert DC Both the behavior of "fast charging gun” and “inserting DC slow charging gun” have their corresponding function functions.
  • the corresponding automation script of the item to be set is shown in FIG. 12 .
  • the corresponding directory will be automatically generated, such as the directory on the left side of the automation script in Figure 12, including “vehicle discharge”, “thermal management”, “vehicle charge and discharge”, etc., where “vehicle charge and discharge” also includes The subdirectories "Keyoff state plug-in fast charge” and “Keyon state plug-in fast charge”, etc., because the automation script and the items to be set on the user interface are in one-to-one correspondence, so the directory of the automation script can also be created on the user interface.
  • There are multiple directories of items to be set which avoids users from writing their own directories and saves users time.
  • FIG. 13 is a schematic block diagram of an apparatus for generating an automation script according to an embodiment of the present application.
  • the apparatus for generating an automation script includes an acquisition unit 1301 and a processing unit 1302 , which are briefly introduced below.
  • the acquiring unit 1301 is configured to acquire at least one item to be set in the user interface and data input by the user in the at least one item to be set.
  • the processing unit 1302 is configured to determine at least one automation script template according to at least one item to be set, and at least one automation script template includes one or more data to be set.
  • the processing unit 1302 is further configured to set the data to be set in the at least one first automation script template according to the data input by the user in the at least one first item to be set, so as to obtain the first automation script.
  • one first automation script template corresponds to one first item to be set, or one first automation script template corresponds to multiple first items to be set.
  • the data input by the user in the at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations, according to the user input in the at least one first item to be set Set the data to be set in at least one first automation script template to obtain the first automation script, including: determining the parameters of the first function function according to one or more operations and parameters corresponding to the one or more operations, and presetting
  • the parameters of the function function and the preset function function are the data to be set in at least one first automation script template; the parameters of the preset function function and the preset function function are filled in at least one first automation script template to obtain the first automation script.
  • the preset functions corresponding to the same operation are the same.
  • the processing unit 1302 is further configured to: parse the second automation script to obtain the data of the second item to be set corresponding to the second automation script; The data of is displayed on the second user interface.
  • the method for parsing the second automation script includes any one of regularity extraction, keyword matching, and AI identification.
  • the obtaining unit 1302 is also used to obtain the directory of the second automation script; the processing unit 1302 is also used to generate the directory of the second item to be set according to the directory of the second automation script; the processing unit 1302 is also used to to display the directory of the second to-be-set item on the second user interface.
  • the processing unit 1302 is further configured to: modify the parameters of the function function in the second automation script; Changes with parameter modification.
  • the processing unit 1302 is further configured to: modify the directory of the second automation script; and change the directory of the second item to be set on the second user interface as the directory in the second automation script is modified.
  • the functional functions include decorator functions.
  • the device for generating an automation script shown in FIG. 13 can be used to implement the above-mentioned method 500 for generating an automation script, wherein the acquisition unit 1301 is used to implement step 501, and the processing unit 1302 is used to implement steps 502 and 503.
  • the device for generating an automated script shown in FIG. 6 can also be used to implement the method for generating an automated script described in FIGS. .
  • the device 1300 in the embodiment of the present application may be implemented by software, for example, a computer program or instruction having the above-mentioned functions, and the corresponding computer program or instruction may be stored in the internal memory of the terminal and read by the processor.
  • the corresponding computer programs or instructions inside the memory realize the above functions.
  • the apparatus 1300 in the embodiment of the present application may also be implemented by hardware.
  • the processing unit 1302 is a processor (such as a processor in an NPU, GPU, or system chip), and the acquisition unit 1301 is a data interface.
  • the apparatus 1300 in the embodiment of the present application may also be implemented by a combination of a processor and a software unit.
  • the obtaining unit 1301 may be an interface circuit of a processor, configured to obtain data of items to be set input by a user on a user interface, and send the data to the processor interface circuit.
  • FIG. 14 is a schematic structural diagram of an apparatus 1400 for generating an automation script according to an embodiment of the present application.
  • the device 1400 shown in FIG. 14 includes a memory 1401 , a processor 1402 , a communication interface 1403 and a bus 1404 .
  • the memory 1401 , the processor 1402 , and the communication interface 1403 are connected to each other through a bus 1404 .
  • the acquiring unit 1301 in FIG. 13 may be equivalent to the communication interface 1403 in the device 1400
  • the processing unit 1302 may be equivalent to the processor 1402 in the device 1400 .
  • Each unit and units in the device 1400 will be described in detail below.
  • the memory 1401 may be a read only memory (read only memory, ROM), a static storage device, a dynamic storage device or a random access memory (random access memory, RAM).
  • the memory 1401 may store a program, and when the program stored in the memory 1401 is executed by the processor 1402, the processor 1402 is configured to execute each step of the method in the embodiment of the present application.
  • the processor 1402 may be configured to execute step 502 and step 503 in the method shown in FIG. 5 and the process of processing data shown in FIGS. 6 to 12 .
  • step 503 and the process of processing data shown in FIGS. Set the project to determine the corresponding automation script target, and get the automation script according to the data entered by the user and the automation script template.
  • the processor 1402 may be a general-purpose central processing unit (central processing unit, CPU), a microprocessor, an application specific integrated circuit (application specific integrated circuit, ASIC), a graphics processing unit (graphics processing unit, GPU) or one or more
  • the integrated circuit is configured to execute related programs to implement the methods in the embodiments of the present application.
  • the processor 1402 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the method of the present application may be completed by an integrated logic circuit of hardware in the processor 1402 or instructions in the form of software.
  • the above-mentioned processor 1402 can also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit (ASIC), a ready-made programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, Discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processing
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • Various methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the methods disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor.
  • the software unit may be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory 1401, and the processor 1402 reads the information in the memory 1401, and combines its hardware to complete the functions required by the units included in the device, or execute the method of the method embodiment of the present application.
  • the communication interface 1403 implements communication between the apparatus 1400 and other devices or communication networks by using a transceiver device such as but not limited to a transceiver.
  • a transceiver device such as but not limited to a transceiver.
  • the data input by the user in the items to be set can be obtained from the user interface through the communication interface 1403 .
  • the bus 1404 may include pathways for transferring information between various components of the device 1400 (eg, memory 1401 , processor 1402 , communication interface 1403 ).
  • the embodiment of the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium stores program codes.
  • the computer program codes run on the computer, the computer executes the methods described above in FIGS. 5 to 12 .
  • the embodiment of the present application also provides a computing device, including: at least one processor and a memory, at least one processor is coupled with the memory, and is used to read and execute instructions in the memory, so as to execute the above-mentioned steps described in FIG. 5 to FIG. 12 .
  • a computing device including: at least one processor and a memory, at least one processor is coupled with the memory, and is used to read and execute instructions in the memory, so as to execute the above-mentioned steps described in FIG. 5 to FIG. 12 .
  • each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.
  • the methods disclosed in the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware. To avoid repetition, no detailed description is given here.
  • a component may be, but is not limited to being, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer.
  • an application running on a computing device and the computing device can be components.
  • One or more components can reside within a process and/or thread of execution and a component can be localized on one computer and/or distributed between two or more computers.
  • these components can execute from various computer readable media having various data structures stored thereon.
  • a component may, for example, be based on a signal having one or more packets of data (e.g., data from two components interacting with another component between a local system, a distributed system, and/or a network, such as the Internet via a signal interacting with other systems). Communicate through local and/or remote processes.
  • packets of data e.g., data from two components interacting with another component between a local system, a distributed system, and/or a network, such as the Internet via a signal interacting with other systems.
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

Provided in the present application is a method for generating an automated script. The method comprises: acquiring at least one first project to be set from a user interface and data, which is input by a user into the at least one said first project; determining at least one first automated script template according to the at least one said first project, wherein the at least one first automated script template comprises data to be set; and according to the data, which is input by the user into the at least one said first project, setting data to be set in the at least one first automated script template, so as to obtain a first automated script. By means of the method for generating an automated script in the embodiments of the present application, a corresponding automated script is generated according to data, which is input by a user via a user interface, and a preset automated script template, manual writing is omitted, and manpower is saved.

Description

生成自动化脚本的方法和装置Method and device for generating automated scripts 技术领域technical field
本申请涉及测试技术领域,并且更具体地,涉及一种生成自动化脚本的方法和装置。The present application relates to the technical field of testing, and more specifically, to a method and device for generating automation scripts.
背景技术Background technique
硬件在环(hardware in the loop,HIL)是一种用于复杂设备控制器的开发与测试的技术,通过HIL测试,机器或系统的物理部分被仿真器所替代。HIL具有丰富的测试功能和较高的安全性,在车辆研发过程中具有广泛的应用,例如,在车辆驾驶测试中,天气、驾驶风格、路线细节和复杂的极限工况等都可以在HIL测试中模拟仿真出,同时也可以避免测试人员和车辆部件处于不必要的危险测试条件中。Hardware in the loop (hardware in the loop, HIL) is a technology for the development and testing of complex device controllers. Through HIL testing, the physical part of a machine or system is replaced by a simulator. HIL has rich test functions and high safety, and has a wide range of applications in the vehicle development process. For example, in vehicle driving tests, weather, driving style, route details and complex limit conditions can all be tested in HIL Simulated in the simulation, but also to avoid test personnel and vehicle components in unnecessary dangerous test conditions.
为了保证测试的充分性和完备性,往往需要大量的测试用例,测试用例是为了实施测试而向测试系统提供的输入数据、操作、环境设置和期望结果的特定集合,自动化脚本是为了进行测试而编写的脚本,本质是一个特定测试的一系列指令,这些指令可以被自动化测试工具执行,自动化脚本的编写必须对应相应的测试用例。In order to ensure the adequacy and completeness of the test, a large number of test cases are often required. The test case is a specific set of input data, operations, environment settings and expected results provided to the test system for the implementation of the test. The automated script is for testing. The script written is essentially a series of instructions for a specific test. These instructions can be executed by automated testing tools, and the writing of automated scripts must correspond to the corresponding test cases.
在现有的生成自动化脚本的方法中,通常是先根据测试需要创建测试用例,然后使用python或lua等脚本语言编写出对应的自动化脚本,在测试时运行自动化脚本完成相应的测试。由于HIL等测试涉及大量测试用例,人工编写工作量巨大,且测试用例的代码重复内容较多,编写过程机械而枯燥。In the existing method for generating automation scripts, usually first create test cases according to the test needs, then use scripting languages such as python or lua to write corresponding automation scripts, and run the automation scripts during testing to complete corresponding tests. Since HIL and other tests involve a large number of test cases, the workload of manual writing is huge, and the codes of test cases are repetitive, making the writing process mechanical and boring.
发明内容Contents of the invention
本申请提供一种生成自动化脚本的方法和装置,该方法根据用户在用户界面输入的数据和预设的自动化脚本模板生成对应的自动化脚本,避免人工编写,节省人力。The present application provides a method and device for generating an automation script. The method generates a corresponding automation script according to data input by a user on a user interface and a preset automation script template, avoiding manual writing and saving manpower.
第一方面,提供了一种生成自动化脚本的方法,该方法包括:获取用户界面中的至少一个第一待设置的项目和用户在至少一个第一待设置的项目中输入的数据;根据至少一个第一待设置的项目确定至少一个第一自动化脚本模板,至少一个第一自动化脚本模板中包括待设置的数据;根据用户在至少一个第一待设置的项目中输入的数据设置至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本。In a first aspect, a method for generating an automation script is provided, the method comprising: acquiring at least one first item to be set in a user interface and data input by a user in the at least one first item to be set; according to at least one The first item to be set determines at least one first automation script template, at least one first automation script template includes data to be set; at least one first automation is set according to the data input by the user in at least one first item to be set The data to be set in the script template to obtain the first automation script.
本申请实施例的生成自动化脚本的方法根据用户在用户界面输入的待设置项目的数据和预设的自动化脚本模板生成待设置项目对应的自动化脚本,避免人工编写,节省人力,且摒弃了现有技术中的数据库,无需根据数据库中的待设置项目的数据转换为自动化脚本,实现了架构的轻量级。The method for generating an automation script in the embodiment of the present application generates the automation script corresponding to the item to be set according to the data of the item to be set input by the user on the user interface and the preset automation script template, avoids manual writing, saves manpower, and abandons the existing The database in the technology does not need to be converted into automated scripts according to the data of the items to be set in the database, which realizes the lightweight architecture.
此外,对于测试用例来说,这里的待设置的项目可以是一个完整的测试用例,也可以是一个测试用例的一个部分。待设置的项目中可以包括固定的数据,固定的数据无需用户输入,也可以包括待输入的数据,需要由用户以填空或选择的方式输入。In addition, for the test case, the item to be set here can be a complete test case or a part of a test case. The items to be set may include fixed data, which does not need to be input by the user, or may include data to be input, which needs to be input by the user by filling in the blanks or selecting.
结合第一方面,在第一方面的某些实现方式中,一个第一自动化脚本模板对应于一个 第一待设置的项目,或者一个第一自动化脚本模板对应于多个第一待设置的项目。With reference to the first aspect, in some implementation manners of the first aspect, one first automation script template corresponds to one first item to be set, or one first automation script template corresponds to multiple first items to be set.
本申请实施例中,自动化脚本模板主要表现为一种格式,因此可以为每个待设置项目分别设置相应的自动化脚本模板,或者,当待设置项目具有相似的格式时,多个相似格式的待设置项目也可以使用同一个自动化脚本模板。In the embodiment of the present application, the automation script template is mainly represented as a format, so a corresponding automation script template can be set for each item to be set, or, when the items to be set have a similar format, multiple similar formats to be set Setup projects can also use the same automation script template.
结合第一方面,在第一方面的某些实现方式中,用户在至少一个第一待设置的项目中输入的数据包括一个或多个操作和一个或多个操作对应的参数,根据用户在至少一个第一待设置的项目中输入的数据设置至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本,包括:根据一个或多个操作和一个或多个操作对应的参数确定预设功能函数的参数,预设功能函数和预设功能函数的参数为至少一个第一自动化脚本模板中的待设置的数据;将预设功能函数、预设功能函数的参数填入至少一个第一自动化脚本模板得到第一自动化脚本。With reference to the first aspect, in some implementation manners of the first aspect, the data input by the user in at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations, according to the user's at least The data input in a first item to be set sets the data to be set in at least one first automation script template to obtain the first automation script, including: according to one or more operations and parameters corresponding to one or more operations Determine the parameters of the preset function, the parameters of the preset function and the preset function are the data to be set in at least one first automation script template; the parameters of the preset function and the preset function are filled in at least one The first automation script template gets the first automation script.
本申请实施例中,每个操作均具有相应的功能函数,该功能函数为开发人员预先设置,在实际应用中,每个操作对应的功能函数可以相同,也可以不同,优选地,如果每个操作对应的功能函数相同,则可以为每个操作执行相同的前置操作,便于统一管理。每个操作的前置操作实际对应一系列代码,本申请实施例将一系列代码封装为功能函数。然后根据一个或多个操作和其对应的参数确定该一个或多个操作对应的功能函数的参数,其中,每个操作的具体执行代码也被封装为对应的函数,以作为功能函数的参数,而操作对应的参数也被转换为功能函数的参数,用于确定操作的具体执行程度。将每个操作的前置操作封装为功能函数,而操作的具体执行和其参数作为功能函数的参数,使得用户界面上的操作步骤与自动化脚本中的操作步骤在数量和顺序上可以保持一致,而功能函数对应的一系列代码为底层逻辑实现。In the embodiment of the present application, each operation has a corresponding function, which is preset by the developer. In practical applications, the function corresponding to each operation may be the same or different. Preferably, if each If the functions corresponding to the operations are the same, the same pre-operations can be performed for each operation, which facilitates unified management. The pre-operations of each operation actually correspond to a series of codes, and the embodiment of the present application encapsulates a series of codes into functional functions. Then, according to one or more operations and their corresponding parameters, determine the parameters of the function function corresponding to the one or more operations, wherein the specific execution code of each operation is also encapsulated into a corresponding function as a parameter of the function function, The parameters corresponding to the operation are also converted into parameters of the function function to determine the specific execution degree of the operation. The pre-operation of each operation is encapsulated as a function function, and the specific execution of the operation and its parameters are used as parameters of the function function, so that the operation steps on the user interface and the operation steps in the automation script can be consistent in number and order, The series of codes corresponding to the function functions are realized by the underlying logic.
结合第一方面,在第一方面的某些实现方式中,当不同待设置项目包括相同操作时,相同操作对应的功能函数相同。With reference to the first aspect, in some implementation manners of the first aspect, when different items to be set include the same operation, the functions corresponding to the same operation are the same.
本申请实施例中,由于将操作对应的一系列代码封装为功能函数,因此对于相同的操作,即便在不同的待设置项目中也可以实现功能函数的复用。在现有技术中,对于不同厂商或不同应用场景中的项目必须分别编写对应的自动化脚本,即使项目A与项目B中具有大量相同的测试用例,也难以将项目A的自动化脚本移植到项目B中,而使用本申请实施例的方法,可以实现不同待设置项目的功能函数的复用,提升测试用例的复用率,降低移植成本。In the embodiment of the present application, since a series of codes corresponding to the operations are encapsulated into function functions, for the same operation, function functions can be reused even in different items to be set. In the existing technology, corresponding automation scripts must be written for projects in different manufacturers or different application scenarios. Even if there are a large number of identical test cases in project A and project B, it is difficult to transplant the automation script of project A to project B Among them, using the method of the embodiment of the present application can realize the reuse of functions of different items to be set, improve the reuse rate of test cases, and reduce the cost of transplantation.
结合第一方面,在第一方面的某些实现方式中,方法还包括:对第二自动化脚本进行解析,以获取第二自动化脚本对应的第二待设置项目的数据;将第二待设置项目和第二待设置项目的数据显示在第二用户界面上。With reference to the first aspect, in some implementations of the first aspect, the method further includes: parsing the second automation script to obtain the data of the second item to be set corresponding to the second automation script; and the data of the second to-be-set item are displayed on the second user interface.
本申请实施例的方法除了根据用户在用户界面输入的待设置项目的数据生成对应的自动化脚本,还包括根据后台的自动化脚本获取用户界面上待设置项目的数据,并显示在用户界面上。其中后台的自动化脚本的生成方式本申请实施例在此不做限定,例如该自动化脚本可以是通过现有技术生成的,也可以是通过本申请实施例的生成自动化脚本的方法生成的。In addition to generating corresponding automation scripts according to the data of the items to be set entered by the user on the user interface, the method of the embodiment of the present application also includes obtaining the data of the items to be set on the user interface according to the automation script in the background, and displaying the data on the user interface. The method for generating the automation script in the background is not limited in this embodiment of the present application. For example, the automation script may be generated by the existing technology, or may be generated by the method for generating an automation script in the embodiment of the present application.
结合第一方面,在第一方面的某些实现方式中,对第二自动化脚本进行解析的方法包括正则提取、关键字匹配和AI识别中的任一种。With reference to the first aspect, in some implementation manners of the first aspect, the method for parsing the second automation script includes any one of regularity extraction, keyword matching, and AI identification.
结合第一方面,在第一方面的某些实现方式中,方法还包括:获取第二自动化脚本的目录;根据第二自动化脚本的目录生成第二待设置项目的目录;将第二待设置项目的目录显示在第二用户界面上。With reference to the first aspect, in some implementations of the first aspect, the method further includes: obtaining the directory of the second automation script; generating the directory of the second item to be set according to the directory of the second automation script; The directory of is displayed on the second user interface.
在现有技术中,对于用户界面上的多个待设置项目,为了方便管理,往往需要用户自行编辑该多个待设置项目的目录,对于用户来说耗时耗力。而使用本申请实施例的方法,在根据后台的自动化脚本获取用户界面上待设置项目的数据的同时,还可以根据后台的自动化脚本的目录获取用户界面上待设置项目的目录,由于自动化脚本代码在运行中会自动生成相应的目录,根据自动化脚本的目录创建相应的用户界面上的待设置项目的目录,可以避免用户再自行编写多个待设置项目的目录,可以减少用户的工作量,提高用户体验。结合第一方面,在第一方面的某些实现方式中,方法还包括:修改第二自动化脚本中的第二功能函数的参数;第二自动化脚本在第二用户界面上对应的第二待设置项目的数据随的功能函数的参数的修改而变化。In the prior art, for the convenience of management of multiple items to be set on the user interface, the user often needs to edit the directories of the multiple items to be set by himself, which is time-consuming and labor-intensive for the user. And using the method of the embodiment of the present application, when obtaining the data of the item to be set on the user interface according to the automation script in the background, the directory of the item to be set on the user interface can also be obtained according to the directory of the automation script in the background, because the automation script code During operation, the corresponding directory will be automatically generated, and the directory of the project to be set on the corresponding user interface will be created according to the directory of the automation script, which can prevent the user from writing multiple directories of the project to be set, which can reduce the workload of the user and improve user experience. With reference to the first aspect, in some implementations of the first aspect, the method further includes: modifying the parameters of the second function function in the second automation script; the second automation script corresponding to the second user interface to be set The data of the project changes with the modification of the parameters of the function function.
本申请实施例中,由于可以根据后台的自动化脚本获取用户界面上待设置项目的数据,即后台的自动化脚本的数据与用户界面上待设置项目的数据是一一对应的,如此当在后台的自动化脚本中修改功能函数的参数时,该自动化脚本在用户界面上对应的待设置项目的数据也会随功能函数的参数的修改而相应变化。如此,当开发人员检测到后台的自动化脚本中有任何需要修改的地方时,可以直接在自动化脚本代码中进行修改,用户界面上的相应的数据也会随之改变,由此可以实现开发人员对用户界面的实时管理。In the embodiment of the present application, since the data of the items to be set on the user interface can be obtained according to the automation script in the background, that is, the data of the automation script in the background is in one-to-one correspondence with the data of the items to be set on the user interface, so when the data in the background When the parameter of the function is modified in the automation script, the data of the item to be set corresponding to the automation script on the user interface will also change correspondingly with the modification of the parameter of the function. In this way, when the developer detects that there is any need to modify the automation script in the background, he can directly modify it in the automation script code, and the corresponding data on the user interface will also change accordingly. Real-time management of the user interface.
结合第一方面,在第一方面的某些实现方式中,方法还包括:修改第二自动化脚本的目录;第二用户界面上的第二待设置项目的目录随第二自动化脚本中的目录的修改而变化。In combination with the first aspect, in some implementations of the first aspect, the method also includes: modifying the directory of the second automation script; Vary with modification.
本申请实施例中,当修改自动化脚本目录时,由于用户界面上的待设置项目的目录是根据自动化脚本的目录生成的,因此用户界面上的待设置项目的目录也会随自动化脚本中的目录的修改而变化。In the embodiment of the present application, when modifying the automation script directory, since the directory of the items to be set on the user interface is generated according to the directory of the automation script, the directory of the items to be set on the user interface will also follow the directory of the automation script. changes due to modifications.
结合第一方面,在第一方面的某些实现方式中,功能函数包括装饰器函数。With reference to the first aspect, in some implementation manners of the first aspect, the functional function includes a decorator function.
本申请实施例的功能函数包括装饰器函数,装饰器函数是用于修改其他函数功能的函数,在实际应用中,如果需要实现参数泛化,例如需要对待设置项目的某些步骤进行反复执行或循环之类的操作,可以将相关的步骤放入装饰器函数中,通过调整装饰器函数的参数进行控制。The functional functions in the embodiments of the present application include decorator functions, which are functions used to modify other functions. In practical applications, if it is necessary to achieve parameter generalization, for example, it is necessary to repeatedly execute certain steps of the project to be set or For operations such as loops, related steps can be put into the decorator function and controlled by adjusting the parameters of the decorator function.
第二方面,提供了一种生成自动化脚本的装置,该装置包括:获取单元,用于获取用户界面中的至少一个待设置的项目和用户在至少一个待设置的项目中输入的数据;处理单元,用于根据至少一个待设置的项目确定至少一个自动化脚本模板,至少一个自动化脚本模板中包括待设置的数据;根据用户在至少一个第一待设置的项目中输入的数据设置至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本。In a second aspect, there is provided a device for generating an automation script, the device comprising: an acquisition unit configured to acquire at least one item to be set in the user interface and data input by the user in the at least one item to be set; a processing unit , used to determine at least one automation script template according to at least one item to be set, at least one automation script template includes data to be set; set at least one first automation according to data input by the user in at least one first item to be set The data to be set in the script template to obtain the first automation script.
结合第二方面,在第二方面的某些实现方式中,一个第一自动化脚本模板对应于一个第一待设置的项目,或者一个第一自动化脚本模板对应于多个第一待设置的项目。With reference to the second aspect, in some implementation manners of the second aspect, one first automation script template corresponds to one first item to be set, or one first automation script template corresponds to multiple first items to be set.
结合第二方面,在第二方面的某些实现方式中,用户在至少一个第一待设置的项目中输入的数据包括一个或多个操作和一个或多个操作对应的参数,根据用户在至少一个第一待设置的项目中输入的数据设置至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本,包括:根据一个或多个操作和一个或多个操作对应的参数确定第一功能 函数的参数,预设功能函数和预设功能函数的参数为至少一个第一自动化脚本模板中的待设置的数据;将预设功能函数、预设功能函数的参数填入至少一个第一自动化脚本模板得到第一自动化脚本。With reference to the second aspect, in some implementations of the second aspect, the data input by the user in at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations, according to the user's at least The data input in a first item to be set sets the data to be set in at least one first automation script template to obtain the first automation script, including: according to one or more operations and parameters corresponding to one or more operations Determine the parameters of the first functional function, and the parameters of the preset functional function and the preset functional function are the data to be set in at least one first automation script template; the parameters of the preset functional function and the preset functional function are filled in at least one The first automation script template gets the first automation script.
结合第二方面,在第二方面的某些实现方式中,当不同待设置项目包括相同操作时,相同操作对应的预设功能函数相同。With reference to the second aspect, in some implementation manners of the second aspect, when different items to be set include the same operation, the preset functions corresponding to the same operation are the same.
结合第二方面,在第二方面的某些实现方式中,处理单元还用于:对第二自动化脚本进行解析,以获取第二自动化脚本对应的第二待设置项目的数据;将第二待设置项目和第二待设置项目的数据显示在第二用户界面上。With reference to the second aspect, in some implementation manners of the second aspect, the processing unit is further configured to: parse the second automation script to obtain the data of the second item to be set corresponding to the second automation script; Data of the setting items and the second to-be-set items are displayed on the second user interface.
结合第二方面,在第二方面的某些实现方式中,对第二自动化脚本进行解析的方法包括正则提取、关键字匹配和AI识别中的任一种。With reference to the second aspect, in some implementation manners of the second aspect, the method for parsing the second automation script includes any one of regularity extraction, keyword matching, and AI identification.
结合第二方面,在第二方面的某些实现方式中,获取单元还用于获取第二自动化脚本的目录;处理单元还用于,根据第二自动化脚本的目录生成第二待设置项目的目录;处理单元还用于,将第二待设置项目的目录显示在第二用户界面上。In conjunction with the second aspect, in some implementations of the second aspect, the obtaining unit is also used to obtain the directory of the second automation script; the processing unit is also used to generate the directory of the second item to be set according to the directory of the second automation script ; The processing unit is also used to display the directory of the second to-be-set item on the second user interface.
结合第二方面,在第二方面的某些实现方式中,处理单元还用于:修改第二自动化脚本中的功能函数的参数;第二自动化脚本在第二用户界面上对应的第二待设置项目的数据随的功能函数的参数的修改而变化。In conjunction with the second aspect, in some implementations of the second aspect, the processing unit is further configured to: modify the parameters of the function functions in the second automation script; The data of the project changes with the modification of the parameters of the function function.
结合第二方面,在第二方面的某些实现方式中,处理单元还用于:修改第二自动化脚本的目录;第二用户界面上的第二待设置项目的目录随第二自动化脚本中的目录的修改而变化。In conjunction with the second aspect, in some implementation manners of the second aspect, the processing unit is also used to: modify the directory of the second automation script; the directory of the second item to be set on the second user interface follows the The catalog changes.
结合第二方面,在第二方面的某些实现方式中,功能函数包括装饰器函数。With reference to the second aspect, in some implementation manners of the second aspect, the functional function includes a decorator function.
第三方面,提供一种计算设备,包括:至少一个处理器和存储器;至少一个处理器与存储器耦合,用于读取并执行存储器中的指令,使得所述计算设备部署上述第二方面中任一项所述的生成自动化脚本的装置。In a third aspect, a computing device is provided, including: at least one processor and a memory; at least one processor is coupled to the memory, and is used to read and execute instructions in the memory, so that the computing device implements any of the above-mentioned second aspects. A device for generating automated scripts.
第四方面,提供一种计算机可读存储介质,计算机可读存储介质存储有程序代码,当计算机程序代码在计算机上运行时,使得计算机执行上述第一方面中任一项所述的方法。In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores program codes, and when the computer program codes run on a computer, the computer executes the method described in any one of the above-mentioned first aspects.
附图说明Description of drawings
图1是本申请实施例的一种现有的生成自动化脚本的方法的示意性架构图;Fig. 1 is a schematic architecture diagram of an existing method for generating an automation script according to an embodiment of the present application;
图2是本申请实施例的生成自动化脚本的方法的示意性结构图;Fig. 2 is a schematic structural diagram of a method for generating an automation script according to an embodiment of the present application;
图3是本申请实施例的两种应用场景的示意图;FIG. 3 is a schematic diagram of two application scenarios of the embodiment of the present application;
图4是本申请实施例的一种计算设备的示意性架构图;FIG. 4 is a schematic architecture diagram of a computing device according to an embodiment of the present application;
图5是本申请实施例的生成自动化脚本的方法的示意性流程图;FIG. 5 is a schematic flowchart of a method for generating an automation script according to an embodiment of the present application;
图6是本申请实施例的一种针对车辆开发的测试用例写作的用户界面示意图;FIG. 6 is a schematic diagram of a user interface for writing a test case for vehicle development according to an embodiment of the present application;
图7是本申请实施例的对于一个待设置项目的两种可能的自动化脚本模板的示意图;FIG. 7 is a schematic diagram of two possible automation script templates for a project to be set according to the embodiment of the present application;
图8是本申请实施例的几种操作和操作的参数对应的功能函数的示意图;FIG. 8 is a schematic diagram of several operations and functional functions corresponding to the parameters of the operations in the embodiment of the present application;
图9是本申请实施例的功能函数复用的示意图;FIG. 9 is a schematic diagram of function multiplexing in an embodiment of the present application;
图10是本申请实施例的读取后台的自动化脚本中的数据的示意图;Fig. 10 is a schematic diagram of reading the data in the automation script of the background according to the embodiment of the present application;
图11是本申请实施例的装饰器函数应用的示意图;FIG. 11 is a schematic diagram of a decorator function application in an embodiment of the present application;
图12是本申请实施例的生成自动化脚本的方法的示意性框图;Fig. 12 is a schematic block diagram of a method for generating an automation script according to an embodiment of the present application;
图13是本申请实施例的生成自动化脚本的装置的示意性框图;FIG. 13 is a schematic block diagram of an apparatus for generating an automation script according to an embodiment of the present application;
图14是本申请实施例的生成自动化脚本的装置的结构示意图。Fig. 14 is a schematic structural diagram of an apparatus for generating an automation script according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图,对本申请中的技术方案进行描述。The technical solution in this application will be described below with reference to the accompanying drawings.
由于手工编写自动化脚本耗时耗力,因此发展出另一种基于浏览器/服务器(browser/server,B/S)架构的生成自动化脚本的方法,该方法通过传统的模型-视图-控制(model view controller,MVC)架构生成测试用例的相关数据,然后再通过转码系统将数据转化为自动化脚本代码,从而实现自动化脚本的生成。Due to the time-consuming and labor-intensive manual writing of automation scripts, another method for generating automation scripts based on browser/server (browser/server, B/S) architecture has been developed. This method uses the traditional model-view-control (model view controller (MVC) architecture to generate relevant data of test cases, and then convert the data into automated script codes through the transcoding system, thereby realizing the generation of automated scripts.
其中,B/S架构是与客户端/服务器(client/server,C/S)架构相对应的架构,二者均为应用程序架构,C/S架构建立在局域网的基础上,其特点是用户使用时需要安装相应的客户端;而B/S架构是建立在广域网的基础上,其特点是无需安装客户端,使用浏览器即可,B/S架构将系统功能实现的核心部分集中到服务器上,简化了系统的开发、维护和使用,当需要更新升级时,无需升级多个客户端,升级服务器即可,客户端上只需有浏览器,服务器上安装数据库,浏览器通过服务器与数据库进行交互。Among them, the B/S architecture is the architecture corresponding to the client/server (C/S) architecture, both of which are application program architectures, and the C/S architecture is built on the basis of the local area network. The corresponding client needs to be installed when using it; the B/S architecture is based on the wide area network, and its characteristic is that there is no need to install the client, just use a browser. The B/S architecture concentrates the core part of the system function realization on the server On the one hand, it simplifies the development, maintenance and use of the system. When it is necessary to update and upgrade, there is no need to upgrade multiple clients, just upgrade the server. The client only needs to have a browser, and the database is installed on the server. The browser communicates with the database through the server. to interact.
MVC架构属于B/S架构的一种,包括模型层、视图层和控制层,其中最上面的一层为直接面向用户的视图层,视图层代表用户交互界面,用于将信息显示给用户。最下面一层为模型层,也可称为数据层,即程序需要操作的数据或信息,模型层负责存储系统的中心数据,是业务流程/状态的处理与业务规则的制定,业务流程的处理过程对其他层来说是黑箱操作,模型层接收视图层请求的数据,并返回最终的处理结果。中间一层为控制层,控制层负责根据用户从视图层输入的指令,选取模型层中的数据,然后对其进行相应的操作,产生最终结果,具体可以理解为从用户接收请求,将模型层与视图层匹配在一起,共同完成用户的请求,控制层并不做任何的数据处理,例如,用户点击一个连接,控制层接收请求后并不处理业务信息,只是将用户的信息传递给模型层,并告诉模型层需要做什么,选择符合要求的视图返回给用户。这三层是紧密联系在一起但又相互独立,每一层内部的变化不影响其他层,每一层都对外提供接口,供上一层调用,如此软件可以实现模块化,修改外观或者变更数据都不必修改其他层,极大方便了维护和升级。The MVC architecture belongs to a type of B/S architecture, including a model layer, a view layer, and a control layer. The top layer is a view layer that directly faces users. The view layer represents a user interaction interface and is used to display information to users. The bottom layer is the model layer, which can also be called the data layer, that is, the data or information that the program needs to operate. The model layer is responsible for storing the central data of the system. It is the processing of business processes/states and the formulation of business rules, and the processing of business processes. The process is a black-box operation for other layers, and the model layer receives the data requested by the view layer and returns the final processing result. The middle layer is the control layer. The control layer is responsible for selecting the data in the model layer according to the instructions input by the user from the view layer, and then performing corresponding operations on it to generate the final result. Specifically, it can be understood as receiving a request from the user and converting the model layer Match with the view layer to complete the user's request. The control layer does not do any data processing. For example, when the user clicks a link, the control layer does not process the business information after receiving the request, but only passes the user's information to the model layer , and tell the model layer what to do, select the view that meets the requirements and return it to the user. These three layers are closely connected but independent of each other. The internal changes of each layer do not affect other layers. Each layer provides an interface for the upper layer to call, so that the software can be modularized, modify the appearance or change the data. There is no need to modify other layers, which greatly facilitates maintenance and upgrades.
图1示出了现有的一种生成自动化脚本的方法的示意性架构图,如图1所示,其中前端用户界面(user interface,UI)层相当于视图层,后台服务层相当于控制层,数据库层相当于模型层,因此图1中的前端UI层、后台服务层和数据库层共同构成了一个MVC架构。前端UI层作为用户操作测试用例的界面,与用户直接对接;后台服务层负责处理用户在前端UI层操作所产生的数据,并将其存储在数据库中;数据库层负责存储测试用例的相关数据。此外图1中的架构还包括数据转换层和执行器层,数据转换层用于将数据转换为相应的自动化脚本,执行器层用于执行该自动化脚本。Fig. 1 shows a schematic architecture diagram of an existing method for generating automated scripts, as shown in Fig. 1, wherein the front-end user interface (user interface, UI) layer is equivalent to the view layer, and the background service layer is equivalent to the control layer , the database layer is equivalent to the model layer, so the front-end UI layer, background service layer and database layer in Figure 1 together constitute an MVC architecture. The front-end UI layer is used as the interface for users to operate test cases, and directly connects with users; the background service layer is responsible for processing the data generated by users’ operations in the front-end UI layer and storing them in the database; the database layer is responsible for storing relevant data of test cases. In addition, the architecture in FIG. 1 also includes a data conversion layer and an executor layer, the data conversion layer is used to convert data into corresponding automation scripts, and the executor layer is used to execute the automation scripts.
图1所示的架构可以实现生成自动化脚本,但是图1所示的架构较为臃肿复杂,生成自动化脚本的工作量较大,同时有较大的维护成本,例如,当测试用例中的基础参数或者项目变更后,则测试用例的相应数据也需要变更,然而由于图1的架构中测试用例的数据存储在数据库中,在实际应用中,从数据库中更改数据难以操作,因此需要巨大的工作量去开发移植模块,增加成本。The architecture shown in Figure 1 can generate automation scripts, but the architecture shown in Figure 1 is bloated and complex, the workload of generating automation scripts is relatively large, and there is a large maintenance cost. For example, when the basic parameters in the test case or After the project is changed, the corresponding data of the test case also needs to be changed. However, since the data of the test case in the architecture shown in Figure 1 is stored in the database, in practical applications, it is difficult to change the data from the database, so a huge amount of work is required to remove Developing a transplant module increases costs.
图2示出了本申请实施例的生成自动化脚本的方法的示意性结构图,如图2所示,相比于图1中的架构,图2中的架构摒弃了数据库层,而直接将自动化脚本作为数据存储,相应的,也就无需从数据库到脚本的数据转换层和执行层,同时脚本层可以通过服务器同步共享给多个客户端的用户使用。图2所示的架构有效精简了测试用例写作平台的开发工作量,可以实现平台的快速开发和部署。Fig. 2 shows a schematic structural diagram of a method for generating an automation script according to an embodiment of the present application. As shown in Fig. 2, compared with the architecture in Fig. 1, the architecture in Fig. 2 abandons the database layer and directly automates Scripts are used as data storage. Correspondingly, there is no need for a data conversion layer and an execution layer from the database to scripts. At the same time, the script layer can be shared by multiple client users through the server. The architecture shown in Figure 2 effectively simplifies the development workload of the test case writing platform, and can realize rapid development and deployment of the platform.
因此,本申请实施例提供一种生成自动化脚本的方法,该方法基于MVC架构生成自动化脚本,避免人工编写大量的自动化脚本,提高了写作效率;同时本申请实施例的生成自动化脚本的方法直接将自动化脚本作为数据存储,避免使用数据库保存数据,精简了架构,减少了开发工作量,提高了数据处理的灵活程度。Therefore, the embodiment of the present application provides a method for generating automated scripts. The method generates automated scripts based on the MVC architecture, avoids manually writing a large number of automated scripts, and improves writing efficiency; meanwhile, the method for generating automated scripts in the embodiments of the present application directly uses Automated scripts are used as data storage, avoiding the use of databases to save data, simplifying the architecture, reducing the development workload, and improving the flexibility of data processing.
图3示出了本申请实施例的方法两种应用场景示意图。由于本申请实施例的架构轻量化,部署简单,因此本申请实施例的方法可以部署在个人电脑中,如图3中的场景一所示,其中前端即为个人电脑中的用户界面,服务层可以为个人电脑中的服务器,或者图2中的服务层,后台用于存储自动化脚本,当用户在个人电脑中前端的用户界面输入数据后,服务层对数据进行处理,并根据本申请实施例的方法生成对应的自动化脚本,自动化脚本存储在后台中。此外,本申请实施例的方法还可以作为网络服务部署在网络平台或其他自动化平台中,如图3中的场景二,当本申请实施例的方法还可以作为网络服务部署在网络平台时,多个用户可以使用本地的个人电脑登录该网络平台,此时多个用户的个人电脑作为前端,通过界面交互接收用户输入的数据,网络平台的服务器部署在云端,对用户输入的数据进行处理,通过本申请实施例的方法生成对应的自动化脚本,可选的,可以通过代码同步将自动化脚本同步到代码仓,代码仓可以是云端的存储器,根据每个用户在本地个人电脑上输入的数据在云端生成的对应的自动化脚本可以再发送给相应的个人电脑,如此本地的个人电脑可以运行相应的自动化脚本以执行用户在用户界面输入的数据;相应的,开发人员可以对云端的自动化脚本进行检查或修改等,而相应的修改也可以同步到用户的个人电脑中。FIG. 3 shows schematic diagrams of two application scenarios of the method in the embodiment of the present application. Since the architecture of the embodiment of the present application is lightweight and easy to deploy, the method of the embodiment of the present application can be deployed in a personal computer, as shown in scene 1 in Figure 3, wherein the front end is the user interface in the personal computer, and the service layer It can be the server in the personal computer, or the service layer in Figure 2, the background is used to store automation scripts, when the user inputs data in the front-end user interface in the personal computer, the service layer processes the data, and according to the embodiment of the application The corresponding automation script is generated by the method, and the automation script is stored in the background. In addition, the method in the embodiment of the present application can also be deployed as a network service on a network platform or other automation platforms, as shown in scenario 2 in Figure 3. When the method in the embodiment of the present application can also be deployed on a network platform as a network service, many A user can use a local personal computer to log in to the network platform. At this time, the personal computers of multiple users are used as the front end to receive the data input by the user through interface interaction. The server of the network platform is deployed in the cloud to process the data input by the user. The method in the embodiment of the present application generates a corresponding automation script. Optionally, the automation script can be synchronized to the code warehouse through code synchronization. The code warehouse can be a storage in the cloud. According to the data input by each user on the local personal computer, the The generated corresponding automation script can be sent to the corresponding personal computer, so that the local personal computer can run the corresponding automation script to execute the data input by the user in the user interface; correspondingly, the developer can check or check the automation script in the cloud modification, etc., and the corresponding modification can also be synchronized to the user's personal computer.
下面结合图4,对本申请实施例提供的一种计算设备进行详细描述,该计算设备可以用于实现本申请实施例的生成自动化脚本的方法。A computing device provided by an embodiment of the present application will be described in detail below with reference to FIG. 4 . The computing device can be used to implement the method for generating an automation script in the embodiment of the present application.
图4是本申请实施例提供的一种计算设备400的架构示意图。该计算设备400可以是服务器或者计算机或者其他具有计算能力的设备。图4所示的计算设备400包括:至少一个处理器410和内存420。FIG. 4 is a schematic structural diagram of a computing device 400 provided by an embodiment of the present application. The computing device 400 may be a server or a computer or other devices with computing capabilities. The computing device 400 shown in FIG. 4 includes: at least one processor 410 and a memory 420 .
处理器410执行内存420中的指令,使得计算设备400实现本申请提供的生成自动化脚本的方法,例如实现由生成自动化脚本的装置执行的步骤。或者,处理器410执行内存420中的指令,使得计算设备400实现本申请提供的生成自动化脚本的装置,例如实现生成自动化脚本的装置包括的各功能模块。The processor 410 executes the instructions in the memory 420, so that the computing device 400 implements the method for generating an automation script provided in this application, for example, implements the steps performed by the device for generating an automation script. Alternatively, the processor 410 executes the instructions in the memory 420, so that the computing device 400 implements the apparatus for generating an automation script provided in this application, for example, implements each functional module included in the apparatus for generating an automation script.
可选地,计算设备400还包括系统总线,其中,处理器410和内存420分别与系统总线连接。处理器410能够通过系统总线访问内存420,例如,处理器410能够通过系统总线在内存420中进行数据读写或代码执行。该系统总线是快捷外设部件互连标准(peripheral component interconnect express,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。所述系统总线分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一条粗线表示,但并不表示仅有一根总线或一种类型 的总线。Optionally, the computing device 400 further includes a system bus, wherein the processor 410 and the memory 420 are respectively connected to the system bus. The processor 410 can access the memory 420 through the system bus, for example, the processor 410 can read and write data or execute codes in the memory 420 through the system bus. The system bus is a peripheral component interconnect express (PCI) bus or an extended industry standard architecture (EISA) bus or the like. The system bus is divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in Fig. 4, but it does not mean that there is only one bus or one type of bus.
一种可能的实现方式,处理器410的功能主要是解释计算机程序的指令(或者说,代码)以及处理计算机软件中的数据。其中,该计算机程序的指令以及计算机软件中的数据能够保存在内存420或者缓存416中。In a possible implementation manner, the function of the processor 410 is mainly to interpret instructions (or codes) of computer programs and process data in computer software. Wherein, the instructions of the computer program and the data in the computer software can be stored in the memory 420 or the cache 416 .
可选地,处理器410可能是集成电路芯片,具有信号的处理能力。作为示例而非限定,处理器410是通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。其中,通用处理器是微处理器等。例如,该处理器410是中央处理单元(central processing unit,CPU)。Optionally, the processor 410 may be an integrated circuit chip, which has a signal processing capability. As an example and not limitation, the processor 410 is a general purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), an off-the-shelf programmable gate array (field programmable gate array, FPGA) ) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Among them, the general-purpose processor is a microprocessor or the like. For example, the processor 410 is a central processing unit (central processing unit, CPU).
可选地,每个处理器410包括至少一个处理单元412和内存控制单元414。Optionally, each processor 410 includes at least one processing unit 412 and a memory control unit 414 .
可选地,处理单元412也称为核心(core)或内核,是处理器最重要的组成部分。处理单元412是由单晶硅以一定的生产工艺制造出来的,处理器所有的计算、接受命令、存储命令、处理数据都由核心执行。处理单元分别独立地运行程序指令,利用并行计算的能力加快程序的运行速度。各种处理单元都具有固定的逻辑结构,例如,处理单元包括例如,一级缓存、二级缓存、执行单元、指令级单元和总线接口等逻辑单元。Optionally, the processing unit 412 is also called a core (core) or core, and is the most important component of the processor. The processing unit 412 is manufactured by a certain production process of single crystal silicon, and all calculations, receiving commands, storing commands, and processing data of the processor are executed by the core. The processing units run the program instructions independently, and use the ability of parallel computing to speed up the running speed of the program. Various processing units have a fixed logical structure. For example, a processing unit includes logical units such as a first-level cache, a second-level cache, an execution unit, an instruction-level unit, and a bus interface.
一种实现举例,内存控制单元414用于控制内存420与处理单元412之间的数据交互。具体地说,内存控制单元414从处理单元412接收内存访问请求,并基于该内存访问请求控制针对内存的访问。作为示例而非限定,内存控制单元是内存管理单元(memory management unit,MMU)等器件。In an implementation example, the memory control unit 414 is configured to control data interaction between the memory 420 and the processing unit 412 . Specifically, the memory control unit 414 receives a memory access request from the processing unit 412, and controls access to memory based on the memory access request. As an example but not limitation, the memory control unit is a device such as a memory management unit (memory management unit, MMU).
一种实现举例,各内存控制单元414通过系统总线进行针对内存420的寻址。并且在系统总线中配置仲裁器(图中未示出),该仲裁器负责处理和协调多个处理单元412的竞争访问。In an implementation example, each memory control unit 414 addresses the memory 420 through a system bus. And an arbiter (not shown in the figure) is configured in the system bus, and the arbiter is responsible for processing and coordinating the competing accesses of multiple processing units 412 .
一种实现举例,处理单元412和内存控制单元414通过芯片内部的连接线,例如地址线,通信连接,从而实现处理单元412和内存控制单元414之间的通信。In an implementation example, the processing unit 412 and the memory control unit 414 are communicatively connected through a connection line inside the chip, such as an address line, so as to realize communication between the processing unit 412 and the memory control unit 414 .
可选地,每个处理器410还包括缓存416,其中,缓存是数据交换的缓冲区(称作cache)。当处理单元412要读取数据时,会首先从缓存中查找需要的数据,如果找到了则直接执行,找不到的话则从内存中找。由于缓存的运行速度比内存快得多,故缓存的作用就是帮助处理单元412更快地运行。Optionally, each processor 410 also includes a cache 416, wherein a cache is a buffer (referred to as cache) for data exchange. When the processing unit 412 wants to read data, it will first search for the required data from the cache, if it finds it, it will execute it directly, if it cannot find it, it will find it from the memory. Since the cache runs much faster than the memory, the role of the cache is to help the processing unit 412 run faster.
内存(memory)420能够为计算设备400中的进程提供运行空间,例如,内存420中保存用于生成进程的计算机程序(具体地说,是程序的代码)。计算机程序被处理器运行而生成进程后,处理器在内存420中为该进程分配对应的存储空间。进一步的,上述存储空间进一步包括文本段、初始化数据段、位初始化数据段、栈段、堆段等等。内存420在上述进程对应的存储空间中保存进程运行期间产生的数据,例如,中间数据,或过程数据等等。The memory (memory) 420 can provide running space for the processes in the computing device 400 , for example, the memory 420 stores computer programs (specifically, program codes) for generating processes. After the computer program is run by the processor to generate a process, the processor allocates a corresponding storage space for the process in the memory 420 . Further, the above storage space further includes a text segment, an initialization data segment, a bit initialization data segment, a stack segment, a heap segment, and the like. The memory 420 stores data generated during the running of the process in the storage space corresponding to the above process, for example, intermediate data, process data, and the like.
可选地,内存也称为内存储器,其作用是用于暂时存放处理器410中的运算数据,以及与硬盘等外部存储器交换的数据。只要计算机在运行中,处理器410就会把需要运算的数据调到内存中进行运算,当运算完成后处理单元412再将结果传送出来。Optionally, the internal memory is also referred to as an internal memory, which is used to temporarily store calculation data in the processor 410 and exchange data with external storage such as a hard disk. As long as the computer is running, the processor 410 transfers the data to be calculated into the memory for calculation, and the processing unit 412 transmits the result after the calculation is completed.
作为示例而非限定,内存420是易失性存储器或非易失性存储器,或可包括易失性和 非易失性存储器两者。其中,非易失性存储器是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的内存420旨在包括但不限于这些和任意其它适合类型的存储器。By way of example and not limitation, memory 420 is either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. Among them, non-volatile memory is read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable In addition to programmable read-only memory (electrically EPROM, EEPROM) or flash memory. Volatile memory is random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, many forms of RAM are available such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM ) and direct memory bus random access memory (direct rambus RAM, DR RAM). It should be noted that the memory 420 of the systems and methods described herein is intended to include, but not be limited to, these and any other suitable types of memory.
以上列举的计算设备400的结构仅为示例性说明,本申请并未限定于此,计算设备400包括现有技术中计算系统中的各种硬件,例如,计算设备400还包括除内存420以外的其他存储器,例如,磁盘存储器等。本领域的技术人员应当理解,计算设备400还可以包括实现正常运行所必须的其他器件。同时,根据具体需要,本领域的技术人员应当理解,上述计算设备400还可包括实现其他附加功能的硬件器件。此外,本领域的技术人员应当理解,上述计算设备400也可仅仅包括实现本申请实施例所必须的器件,而不必包括图4中所示的全部器件。The structure of the computing device 400 listed above is only illustrative, and the present application is not limited thereto. The computing device 400 includes various hardware in the computing system in the prior art. For example, the computing device 400 also includes other than the memory 420. Other storage, for example, disk storage, etc. Those skilled in the art should understand that the computing device 400 may also include other devices necessary for normal operation. Meanwhile, according to specific needs, those skilled in the art should understand that the above computing device 400 may also include hardware devices for implementing other additional functions. In addition, those skilled in the art should understand that the above-mentioned computing device 400 may only include components necessary to realize the embodiment of the present application, and does not necessarily include all the components shown in FIG. 4 .
以下结合图5对本申请实施例的生成自动化脚本的方法进行详细的介绍,该方法可以由图4所示的计算设备400执行,以实现本申请实施例提供的生成自动化脚本的方法。The method for generating an automation script according to the embodiment of the present application will be described in detail below in conjunction with FIG. 5 . The method can be executed by the computing device 400 shown in FIG. 4 to implement the method for generating an automation script provided in the embodiment of the present application.
图5是本申请实施例的生成自动化脚本的方法的示意性流程图,如图5所示,该方法包括步骤501至步骤503,以下分别进行介绍。FIG. 5 is a schematic flowchart of a method for generating an automation script according to an embodiment of the present application. As shown in FIG. 5 , the method includes steps 501 to 503, which will be introduced respectively below.
S501,获取用户界面中的至少一个待设置的项目和用户在该至少一个待设置的项目中输入的数据。S501. Acquire at least one item to be set in a user interface and data input by a user in the at least one item to be set.
图5的方法可以根据用户在前端的用户界面输入的数据生成相应的自动化脚本。对于测试用例来说,待设置的项目可以是一个完整的测试用例,也可以是一个测试用例的一个部分。待设置的项目中可以包括固定的数据,固定的数据无需用户输入,也可以包括待输入的数据,需要由用户以填空或选择的方式输入。The method in FIG. 5 can generate a corresponding automation script according to the data input by the user on the front-end user interface. For a test case, the item to be set can be a complete test case or a part of a test case. The items to be set may include fixed data, which does not need to be input by the user, or may include data to be input, which needs to be input by the user by filling in the blanks or selecting.
以图6为例,图6示出了一种针对车辆开发的测试用例写作的用户界面,在图5所示的用户界面中,待设置的项目可以是图6所示的整个测试用例,包括“用例信息”和“测试过程”,也可以是图6所示的测试用例的部分,例如待设置项目只是“测试过程”,甚至只是“测试过程”中的“测试步骤”。用户在待设置的项目中输入数据可以以填空或选择的方式输入,例如图6中“用例名称”可以由用户以填空的方式输入,用户可以自行命名该“用例名称”,数据也可以由用户以选择的方式输入,用户可以在多个备选项中进行选择,例如图6中“测试步骤”-“行为名称”,用户在备选项“插入直流快充枪”和“插入直流慢充枪”中选择了“插入直流快充枪”。除了以填空或选择的方式输入数据之外,用户还可以以其他可能的方式在待设置项目中输入数据,本申请实施例在此不做限定。应理解,图6所示的用户界面只是对本申请实施例的用户界面的举例,并不对本申请构成限定,除了图6所示的用户界面,本申请实施例的用户界面还可以是其他的形式,只要包括待设置的项目并且 可以由用户在待设置项目中输入数据即可。Taking Figure 6 as an example, Figure 6 shows a user interface for writing test cases for vehicle development. In the user interface shown in Figure 5, the item to be set can be the entire test case shown in Figure 6, including "Use case information" and "test process" can also be part of the test case shown in Figure 6, for example, the item to be set is only "test process", or even just "test steps" in the "test process". The data input by the user in the project to be set can be filled in or selected. For example, the "use case name" in Figure 6 can be entered by the user in the form of fill in the blank. The user can name the "use case name" by himself, and the data can also be provided by the user. Input by selection, the user can choose among multiple alternatives, such as "Test Step" - "Behavior Name" in Figure 6, the user can select the alternatives "insert DC fast charging gun" and "insert DC slow charging gun" Select "Insert DC Fast Charger". In addition to inputting data by filling in the blanks or selecting, the user may also input data in the items to be set in other possible ways, which are not limited in this embodiment of the present application. It should be understood that the user interface shown in Figure 6 is only an example of the user interface of the embodiment of the present application, and does not limit the application. In addition to the user interface shown in Figure 6, the user interface of the embodiment of the present application can also be in other forms , as long as the items to be set are included and data can be input by the user in the items to be set.
S502,根据至少一个待设置的项目确定至少一个自动化脚本模板,该至少一个自动化脚本模板中包括待设置的数据。S502. Determine at least one automation script template according to at least one item to be set, where the at least one automation script template includes data to be set.
本申请实施例的方法可以提供多个自动化脚本模板,该多个自动化脚本模板可以由人为预先设置。根据一个待设置的项目可以确定一个自动化脚本模板,一个自动化脚本模板对应于一个待设置的项目,或者一个自动化脚本模板也可以对应于多个待设置的项目。自动化脚本模板主要表现为一种格式,自动化脚本模板中可以包括待设置项目中的固定数据,也可以不包括待设置项目中的固定数据,而只包括一个或多个待设置的数据,该一个或多个待设置的数据对应于用户在待设置的项目中输入的数据。例如图7,图7示出了对于一个待设置项目的两种可能的自动化脚本模板,其中,待设置项目的“预置条件”、“中间处理”、“后置处理”为固定数据,在自动化脚本模板A中,“预置条件”、“中间处理”、“后置处理”也为固定数据,大括号内为自动化脚本模板A的待设置的数据,在自动化脚本模板B中,不包括“预置条件”、“中间处理”、“后置处理”等固定数据,只包括大括号内的自动化脚本模板B的待设置的数据,从图7中可以看出,不论自动化脚本模板是否包括固定数据,其均具有一定的格式,且该格式与待设置的项目的格式一致。因此根据待设置的项目可以确定自动化脚本模板即为确定与该待设置的项目具有相同格式的自动化脚本模板,具体可以预先为待设置项目和自动化脚本模板建立映射关系,之后根据待设置项目和映射关系即可确定相应的自动化脚本模板。The method in the embodiment of the present application can provide multiple automation script templates, and the multiple automation script templates can be preset by humans. An automation script template can be determined according to an item to be set, and one automation script template can correspond to one item to be set, or one automation script template can also correspond to multiple items to be set. The automation script template is mainly represented as a format. The automation script template may include fixed data in the item to be set, or may not include the fixed data in the item to be set, but only include one or more data to be set. The or plurality of data to be set corresponds to data input by the user in the item to be set. For example, Fig. 7 shows two possible automation script templates for an item to be set, wherein the "precondition", "intermediate processing" and "post-processing" of the item to be set are fixed data, in In automation script template A, "preconditions", "intermediate processing", and "post-processing" are also fixed data, and the curly brackets are the data to be set in automation script template A. In automation script template B, they do not include Fixed data such as "preset conditions", "intermediate processing" and "post-processing" only include the data to be set in the automation script template B within the curly brackets. It can be seen from Figure 7 that no matter whether the automation script template includes Fixed data, all of which have a certain format, and the format is consistent with the format of the item to be set. Therefore, according to the item to be set, the automation script template can be determined to determine the automation script template with the same format as the item to be set. Specifically, the mapping relationship between the item to be set and the automation script template can be established in advance, and then according to the item to be set and the mapping relationship to determine the corresponding automation script template.
S503,根据用户在至少一个待设置的项目中输入的数据设置至少一个自动化脚本模板中的待设置的数据,以得到自动化脚本。S503. Set the data to be set in at least one automation script template according to the data input by the user in the at least one item to be set, so as to obtain an automation script.
具体的,用户在至少一个待设置的项目中输入的数据包括一个或多个操作和一个或多个操作对应的参数,例如图7中,操作为“制动开关”,对应的参数为“等待10s”,以及操作“挂挡”和其对应的参数“P档”等。本申请实施例中,每个操作均具有相应的功能函数,该功能函数为开发人员预先设置,在实际应用中,每个操作对应的功能函数可以相同,也可以不同,优选地,如果每个操作对应的功能函数相同,则可以为每个操作执行相同的前置操作,便于统一管理。每个操作的前置操作实际对应一系列代码,本申请实施例将一系列代码封装为功能函数。然后根据一个或多个操作和其对应的参数确定该一个或多个操作对应的功能函数的参数,其中,每个操作的具体执行代码也被封装为对应的函数,以作为功能函数的参数,而操作对应的参数也被转换为功能函数的参数,用于确定操作的具体执行程度。将每个操作的前置操作封装为功能函数,而操作的具体执行和其参数作为功能函数的参数,使得用户界面上的操作步骤与自动化脚本中的操作步骤在数量和顺序上可以保持一致,而功能函数对应的一系列代码为底层逻辑实现。例如对于操作“制动开关”和对应的参数为“等待10s”,其对应的功能函数为“self.run_behavior()”,而功能函数的参数为“制动开关,delay=10”,因此自动化脚本模板中的待设置的数据为“self.run_behavior(制动开关,delay=10)”,应理解,这里功能函数中的“制动开关”实际对应具体的函数,该函数由开发人员预先设置,具体形式本申请实施例在此不做限定。图8列举出了本申请实施例的几种操作和操作的参数对应的功能函数,一般来说,用户界面上的操作数量是可以穷举的,因此操作对应的函数可以人为预先定义,在实际应用中,根据用户输入的操作在预先定义的多个函数中可以找到对应的函数。例如,如图8所示,“挂P档”对应的功能函数为 “self.run_behavior(挂挡,P)”,“踩踏油门50%”对应的功能函数为“self.run_behavior(油门踩踏,50)”,“打开车载空调”对应的功能函数为“self.run_behavior(打开车载空调)”,“踩踏刹车”对应的功能函数为“self.run_behavior(踩踏刹车)”,而功能函数“self.run_behavior()”底层逻辑实现的具体操作为“连接登录HIL机柜,打开机柜端口,写入端口数据……”。功能函数和功能函数的参数即为自动化脚本模板中的待设置的数据,因此,根据功能函数、功能函数的参数和自动化脚本模板即可得到自动化脚本。应理解,图8只是对本申请实施例的操作及其功能函数和底层逻辑实现的举例说明,并不构成对本申请的限定,在实际应用中,开发人员可以根据实际需要自行设计不同操作对应的功能函数和具体底层逻辑实现。Specifically, the data input by the user in at least one item to be set includes one or more operations and parameters corresponding to one or more operations. For example, in FIG. 7, the operation is "brake switch" and the corresponding parameter is "waiting". 10s", and the operation "gear" and its corresponding parameter "P gear", etc. In the embodiment of the present application, each operation has a corresponding function, which is preset by the developer. In practical applications, the function corresponding to each operation may be the same or different. Preferably, if each If the functions corresponding to the operations are the same, the same pre-operations can be performed for each operation, which facilitates unified management. The pre-operations of each operation actually correspond to a series of codes, and the embodiment of the present application encapsulates a series of codes into functional functions. Then, according to one or more operations and their corresponding parameters, determine the parameters of the function function corresponding to the one or more operations, wherein the specific execution code of each operation is also encapsulated into a corresponding function as a parameter of the function function, The parameters corresponding to the operation are also converted into parameters of the function function to determine the specific execution degree of the operation. The pre-operation of each operation is encapsulated as a function function, and the specific execution of the operation and its parameters are used as parameters of the function function, so that the operation steps on the user interface and the operation steps in the automation script can be consistent in number and order, The series of codes corresponding to the function functions are realized by the underlying logic. For example, for the operation "brake switch" and the corresponding parameter is "wait 10s", the corresponding function function is "self.run_behavior()", and the parameter of the function function is "brake switch, delay=10", so the automation The data to be set in the script template is "self.run_behavior(brake switch, delay=10)". It should be understood that the "brake switch" in the function function here actually corresponds to a specific function, which is preset by the developer , the specific form of the embodiment of the present application is not limited here. Figure 8 lists the functional functions corresponding to several operations and operating parameters in the embodiment of the present application. Generally speaking, the number of operations on the user interface can be exhaustive, so the functions corresponding to the operations can be artificially pre-defined. In the application, according to the operation input by the user, the corresponding function can be found among multiple predefined functions. For example, as shown in Figure 8, the function function corresponding to "hanging P gear" is "self.run_behavior (gear, P)", and the function function corresponding to "stepping on the accelerator 50%" is "self.run_behavior(stepping on the accelerator, 50% )", the function function corresponding to "turn on the car air conditioner" is "self.run_behavior (turn on the car air conditioner)", the function function corresponding to "step on the brake" is "self. ()" The specific operation implemented by the underlying logic is "connect and log in to the HIL cabinet, open the cabinet port, and write port data...". The function function and the parameters of the function function are the data to be set in the automation script template. Therefore, the automation script can be obtained according to the function function, the parameters of the function function and the automation script template. It should be understood that Figure 8 is only an illustration of the operation of the embodiment of the present application, its functional functions and underlying logic implementation, and does not constitute a limitation of the present application. In practical applications, developers can design functions corresponding to different operations according to actual needs. Function and specific underlying logic implementation.
本申请实施例中,由于将操作对应的一系列代码封装为功能函数,因此对于相同的操作,即便在不同的待设置项目中也可以实现功能函数的复用。如图9所示,对于测试用例“制动开关,等待10s”,其对应的完整的功能函数为“self.run_behavior(制动开关,delay=10)”,对于测试用例“挂P档”对应的完整的功能函数为“self.run_behavior(挂挡,P)”,在项目A、项目B、项目C中均需要使用这两个测试用例进行测试,其中项目A、项目B、项目C可以是不同厂商或不同应用场景中的项目,因此在实际应用中,可以为测试用例和其对应的地址建立映射关系,如此,在项目A、项目B、项目C中只需填入对应的地址即可根据映射关系获取相应的测试用例的功能函数,并执行该功能函数。其中项目A、项目B、项目C可能会有不同的附加条件,在实际操作中,只需将该附加条件对应的函数或参数填入功能函数之后,即可结合附加条件执行该功能函数,例如项目A中对于“制动开关”的附加条件为“aa”,对应“挂挡”的附加条件为“bb”。在现有技术中,对于不同厂商或不同应用场景中的项目必须分别编写对应的自动化脚本,即使项目A与项目B中具有大量相同的测试用例,也难以将项目A的自动化脚本移植到项目B中,而使用本申请实施例的方法,可以实现不同待设置项目的功能函数的复用,提升测试用例的复用率,降低移植成本。In the embodiment of the present application, since a series of codes corresponding to the operations are encapsulated into function functions, for the same operation, function functions can be reused even in different items to be set. As shown in Figure 9, for the test case "brake switch, wait 10s", the corresponding complete functional function is "self. The complete functional function is "self.run_behavior(in gear, P)". In project A, project B, and project C, these two test cases need to be used for testing. Among them, project A, project B, and project C can be Projects from different manufacturers or different application scenarios. Therefore, in practical applications, you can establish a mapping relationship between test cases and their corresponding addresses. In this way, you only need to fill in the corresponding addresses in project A, project B, and project C. Obtain the functional function of the corresponding test case according to the mapping relationship, and execute the functional function. Among them, project A, project B, and project C may have different additional conditions. In actual operation, you only need to fill in the function or parameters corresponding to the additional conditions in the function function, and then execute the function function in combination with the additional conditions, for example In item A, the additional condition for "brake switch" is "aa", and the additional condition corresponding to "gear" is "bb". In the existing technology, corresponding automation scripts must be written for projects in different manufacturers or different application scenarios. Even if there are a large number of identical test cases in project A and project B, it is difficult to transplant the automation script of project A to project B Among them, using the method of the embodiment of the present application can realize the reuse of functions of different items to be set, improve the reuse rate of test cases, and reduce the cost of transplantation.
本申请实施例的方法除了根据用户在用户界面输入的待设置项目的数据生成对应的自动化脚本,还包括根据后台的自动化脚本获取用户界面上待设置项目的数据,并且将获取的数据显示在用户界面上,其中后台的自动化脚本的生成方式本申请实施例在此不做限定,例如该自动化脚本可以是通过现有技术生成的,包括根据现有的数据库方法确定的自动化脚本和人工手动编写的自动化脚本等,也可以是通过本申请实施例的生成自动化脚本的方法生成的。具体的,当后台已经存在用户界面上的待设置项目对应的自动化脚本时,可以通过inspect方法或者解析文件方法对自动化脚本的代码进行解析,具体可以通过正则提取、关键字匹配或AI识别等方式对得到自动化脚本中的功能函数和功能函数中的参数进行特征识别,从而得到自动化脚本对应的待设置项目的数据。例如图10所示,对应自动化脚本,使用正则提取的方式对自动化脚本代码进行解析,提取功能函数中的参数,例如对于功能函数“self.run_behavior(制动开关,delay=10)”,通过正则提取的方式可以获取其对应的操作为“制动开关”,而操作对应的参数为“10”,因此功能函数“self.run_behavior(挂挡,P)”,可通过正则提取的方式可以获取其对应的操作为“挂挡”,而操作对应的参数为“P”,以上两个功能函数为“预置条件”下的数据,因此将提取到的操作和其参数显示在用户界面上的“预置条件”的待设置数据中,即为“制动开关,等待10s”和“挂挡,P档”。由此,本申请实施例的方法既可以实现根据用户界面上的待设置项目和其数 据生成自动化脚本,也可以反向执行,即读取后台的自动化脚本中的数据,将该数据显示在用户界面上。In addition to generating the corresponding automation script according to the data of the item to be set input by the user on the user interface, the method of the embodiment of the present application also includes acquiring the data of the item to be set on the user interface according to the background automation script, and displaying the acquired data on the user interface. On the interface, the method of generating the automation script in the background is not limited in this embodiment of the present application. For example, the automation script can be generated through existing technologies, including automation scripts determined according to existing database methods and manually written The automation script and the like may also be generated by the method for generating an automation script in the embodiment of the present application. Specifically, when the automation script corresponding to the item to be set on the user interface already exists in the background, the code of the automation script can be parsed through the inspect method or the file parsing method, specifically through regular extraction, keyword matching, or AI recognition. Feature recognition is performed on the function functions in the obtained automation script and the parameters in the function functions, so as to obtain the data of the items to be set corresponding to the automation script. For example, as shown in Figure 10, corresponding to the automation script, use the regular extraction method to analyze the automation script code and extract the parameters in the function function, for example, for the function function "self.run_behavior(brake switch, delay=10)", through regular The method of extraction can obtain its corresponding operation as "brake switch", and the corresponding parameter of the operation is "10", so the function "self.run_behavior(in gear, P)" can obtain its corresponding operation through regular extraction The corresponding operation is "gear", and the parameter corresponding to the operation is "P". The above two functions are the data under the "preset conditions", so the extracted operation and its parameters are displayed on the " Among the data to be set in "Preset Conditions", they are "Brake switch, wait 10s" and "In gear, P position". Therefore, the method of the embodiment of the present application can realize the generation of automation scripts based on the items to be set on the user interface and their data, and can also be executed in reverse, that is, to read the data in the background automation scripts and display the data on the user interface. interface.
相应的,由于可以根据后台的自动化脚本获取用户界面上待设置项目的数据,即后台的自动化脚本的数据与用户界面上待设置项目的数据是一一对应的,如此当在后台的自动化脚本中修改功能函数的参数时,该自动化脚本在用户界面上对应的待设置项目的数据也会随功能函数的参数的修改而相应变化。如此,当开发人员检测到后台的自动化脚本中有任何需要修改的地方时,可以直接在自动化脚本代码中进行修改,用户界面上的相应的数据也会随之改变,由此可以实现开发人员对用户界面的实时管理。而现有技术无法做到这一点,这是由于现有技术中用户界面上的待设置项目的数据被存储到数据库中,然后根据数据库中的数据转换为自动化脚本,因此现有技术中的自动化脚本与用户界面上的待设置项目的数据并不能达成直接联系,当修改自动化脚本的数据时,用户界面上的数据也不会有相应的变化。Correspondingly, since the data of the items to be set on the user interface can be obtained according to the automation script in the background, that is, the data of the automation script in the background is in one-to-one correspondence with the data of the items to be set on the user interface, so when in the automation script in the background When the parameters of the function are modified, the data of the items to be set corresponding to the automation script on the user interface will also change correspondingly with the modification of the parameters of the function. In this way, when the developer detects that there is any need to modify the automation script in the background, he can directly modify it in the automation script code, and the corresponding data on the user interface will also change accordingly. Real-time management of the user interface. And prior art can't accomplish this, this is because the data of the item to be set on the user interface in the prior art is stored in the database, then according to the data conversion in the database into automation script, so the automation in the prior art There is no direct connection between the script and the data of the items to be set on the user interface, and when the data of the automation script is modified, the data on the user interface will not change accordingly.
在现有技术中,对于用户界面上的多个待设置项目,为了方便管理,往往需要用户自行编辑该多个待设置项目的目录,对于用户来说耗时耗力。而使用本申请实施例的方法,在根据后台的自动化脚本获取用户界面上待设置项目的数据的同时,还可以根据后台的自动化脚本的目录获取用户界面上待设置项目的目录,由于自动化脚本代码在运行中会自动生成相应的目录,根据自动化脚本的目录创建相应的用户界面上的待设置项目的目录,可以避免用户再自行编写多个待设置项目的目录,可以减少用户的工作量,提高用户体验。In the prior art, for the convenience of management of multiple items to be set on the user interface, the user often needs to edit the directories of the multiple items to be set by himself, which is time-consuming and labor-intensive for the user. And using the method of the embodiment of the present application, when obtaining the data of the item to be set on the user interface according to the automation script in the background, the directory of the item to be set on the user interface can also be obtained according to the directory of the automation script in the background, because the automation script code During operation, the corresponding directory will be automatically generated, and the directory of the project to be set on the corresponding user interface will be created according to the directory of the automation script, which can prevent the user from writing multiple directories of the project to be set, which can reduce the workload of the user and improve user experience.
自然相应的,当修改自动化脚本目录时,由于用户界面上的待设置项目的目录是根据自动化脚本的目录生成的,因此用户界面上的待设置项目的目录也会随自动化脚本中的目录的修改而变化。Correspondingly, when modifying the directory of the automation script, since the directory of the items to be set on the user interface is generated according to the directory of the automation script, the directory of the items to be set on the user interface will also follow the modification of the directory in the automation script And change.
此外,本申请实施例的功能函数包括装饰器函数,装饰器函数是用于修改其他函数功能的函数,可以在不修改原有代码的情况下,为被装饰的对象增加新的功能、附加限制条件或者帮助输出,在实际应用中,如果需要实现参数泛化,例如需要对待设置项目的某些步骤进行反复执行或循环之类的操作,可以将相关的步骤放入装饰器函数中,通过调整装饰器函数的参数进行控制。例如图11所示的示例,用户界面输入需要执行的操作为“设置电池的荷电状态(state of charge,SOC)”、“车辆上电”和“车辆下电”,其中“设置电池SOC”需要执行3次,且第一次执行电池SOC为1,第二次执行电池SOC为2,第三次执行电池SOC为3,即需要进行循环执行。因此在实际操作中,可以将循环操作放入装饰器函数“loop()”中,并在装饰器函数的括号内设置循环的次数为3次,在具体执行时,即可对该相同的参数执行3次,其中每次执行时如果参数需要改变也可以在自动化脚本中设定。In addition, the functional functions of the embodiment of the present application include decorator functions, which are functions used to modify other functions, and can add new functions and additional restrictions to the decorated object without modifying the original code Conditions or help output. In practical applications, if you need to achieve parameter generalization, for example, you need to perform operations such as repeated execution or looping of certain steps of the project to be set, you can put the relevant steps into the decorator function. By adjusting The parameters of the decorator function are controlled. For example, in the example shown in Figure 11, the operations that need to be performed by the user interface input are "setting the state of charge (SOC) of the battery", "powering on the vehicle" and "powering off the vehicle", wherein "setting the battery SOC" It needs to be executed 3 times, and the first execution battery SOC is 1, the second execution battery SOC is 2, and the third execution battery SOC is 3, that is, cyclic execution is required. Therefore, in actual operation, the loop operation can be put into the decorator function "loop()", and the number of loops can be set to 3 times in the brackets of the decorator function. Execute 3 times, and if the parameters need to be changed each time it is executed, it can also be set in the automation script.
本申请实施例的生成自动化脚本的方法根据用户在用户界面输入的待设置项目的数据和预设的自动化脚本模板生成待设置项目对应的自动化脚本,避免人工编写,节省人力,且摒弃了现有技术中的数据库,无需根据数据库中的待设置项目的数据转换为自动化脚本,实现了架构的轻量级。本申请实施例的方法生成的自动化脚本与用户界面的待设置项目的数据是一一对应的,当在后台修改自动化脚本的数据时用户界面的待设置项目的数据也会随之变化,使得开发人员可以通过编辑自动化脚本而对用户界面进行及时的管理。本申请实施例的方法可以根据自动化脚本的目录创建用户界面上的待设置项目的目录,无需用户自行编写,提高用户使用体验。此外,本申请实施例的自动化脚本中的功能函数可以实现 不同场景下的复用,在现有技术中,多个待设置项目的数据被存储到数据库中,在应用时,需要根据待设置项目找到其在数据库中对应的数据,然后根据数据库中对应的数据生成相应的自动化脚本,因此不同待设置项目在数据库中应该分别对应不同的数据,即使不同待设置项目中的操作是相同的,彼此之间也不能复用,因此不同待设置项目必须在数据库中预先存储对应的数据,开发工作量大;而本申请实施例将操作封装为功能函数,功能函数可以复用,在实际应用中,即便不同的待设置项目也可以引用相同的功能函数,无需每个待设置项目都分别设计对应的代码,从而可以减小工作量。The method for generating an automation script in the embodiment of the present application generates the automation script corresponding to the item to be set according to the data of the item to be set input by the user on the user interface and the preset automation script template, avoids manual writing, saves manpower, and abandons the existing The database in the technology does not need to be converted into automated scripts according to the data of the items to be set in the database, which realizes the lightweight architecture. The automation script generated by the method of the embodiment of the present application corresponds to the data of the items to be set in the user interface. When the data of the automation script is modified in the background, the data of the items to be set in the user interface will also change accordingly, so that the development Personnel can manage the user interface in real time by editing automation scripts. The method in the embodiment of the present application can create the directory of the items to be set on the user interface according to the directory of the automation script, without the need for the user to write it by himself, thereby improving the user experience. In addition, the functional functions in the automation script of the embodiment of the present application can be reused in different scenarios. In the prior art, the data of multiple items to be set is stored in the database. Find the corresponding data in the database, and then generate corresponding automation scripts according to the corresponding data in the database. Therefore, different items to be set should correspond to different data in the database, even if the operations in different items to be set are the same, they are different from each other. It cannot be reused between them, so different items to be set must pre-store corresponding data in the database, and the development workload is large; and the embodiment of the present application encapsulates the operation into a function function, and the function function can be reused. In practical applications, Even different items to be set can refer to the same function, and there is no need to design corresponding codes for each item to be set, thereby reducing the workload.
以上结合图5至图11对本申请实施例的生成自动化脚本的方法进行了详细的介绍,以下再结合图12的具体示例对本申请实施例的生成自动化脚本的方法的流程进行系统介绍,应理解,图12的方法可以由图4所示的计算设备执行。The method for generating an automated script in the embodiment of the present application has been described in detail above in conjunction with FIGS. The method of FIG. 12 may be executed by the computing device shown in FIG. 4 .
图12以对车辆的测试为例,示出了本申请实施例的生成自动化脚本的方法的示意性框图。如图12所示,待设置项目包括用户界面上的“用例信息”和“测试过程”的内容,用户在“用例名称”中输入“Keyoff状态插抢快充”,“预置条件”中未添加行为,在“测试步骤”中添加了“行为0”,并选择了行为名称为“插入直流快充枪”,在“后置处理”中添加了“行为1”,并选择了行为名称为“拔出直流快充枪”,以上即为用户在用户界面输入的待设置项目的数据。然后根据该待设置项目确定了对于的自动化脚本模板如图12所示,该自动化脚本模板的格式与用户界面上待设置项目的格式一致,其中“测试过程”、“预置条件”“测试步骤”、“后置处理”等为模板的固定数据,大括号内为模板的待设置数据,需要根据用户在用户界面输入的待设置项目的数据设置。最后,根据用户输入的数据中的具体行为确定其对应的功能函数及其参数,功能函数为预先设置的,用户界面上的每个可选的行为均有其对应的功能函数,例如“插入直流快充枪”行为和“插入直流慢充枪”均有其对应的功能函数,根据具体行为确定其对应的功能函数及其参数,然后填入自动化脚本模板中的大括号内,由此可以得到待设置项目的对应的自动化脚本如图12所示。在自动化脚本运行时会自动生成相应的目录,如图12中自动化脚本左侧的目录,包括“整车放电”、“热管理”、“车辆充放电”等,其中“车辆充放电”还包括子目录“Keyoff状态插抢快充”和“Keyon状态插抢快充”等,由于自动化脚本与用户界面上的待设置项目是一一对应的,因此根据自动化脚本的目录也可以创建用户界面上多个待设置的项目的目录,避免用户自行编写目录,节省用户时间。Fig. 12 shows a schematic block diagram of a method for generating an automation script according to an embodiment of the present application, taking the test of a vehicle as an example. As shown in Figure 12, the items to be set include the content of "use case information" and "test process" on the user interface. Add behavior, add "behavior 0" in "test steps", and select the behavior name as "insert DC fast charging gun", add "behavior 1" in "post-processing", and select the behavior name as "Pull out the DC fast charging gun", the above is the data of the items to be set entered by the user on the user interface. Then, according to the item to be set, the corresponding automation script template is determined as shown in Figure 12. The format of the automation script template is consistent with the format of the item to be set on the user interface, wherein "test process", "preset condition", "test step" ", "Post-processing" and so on are the fixed data of the template, and the curly brackets are the data to be set in the template, which need to be set according to the data of the items to be set entered by the user in the user interface. Finally, determine the corresponding function function and its parameters according to the specific behavior in the data input by the user. The function function is preset, and each optional behavior on the user interface has its corresponding function function, such as "insert DC Both the behavior of "fast charging gun" and "inserting DC slow charging gun" have their corresponding function functions. Determine the corresponding function function and its parameters according to the specific behavior, and then fill them in the curly brackets in the automation script template, so that you can get The corresponding automation script of the item to be set is shown in FIG. 12 . When the automation script is running, the corresponding directory will be automatically generated, such as the directory on the left side of the automation script in Figure 12, including "vehicle discharge", "thermal management", "vehicle charge and discharge", etc., where "vehicle charge and discharge" also includes The subdirectories "Keyoff state plug-in fast charge" and "Keyon state plug-in fast charge", etc., because the automation script and the items to be set on the user interface are in one-to-one correspondence, so the directory of the automation script can also be created on the user interface. There are multiple directories of items to be set, which avoids users from writing their own directories and saves users time.
上文结合附图对本申请实施例的方法进行了详细的描述,下面对本申请实施例的装置进行描述,应理解,本申请实施例的装置能够执行本申请实施例的方法的各个步骤,下面在介绍本申请实施例的装置时适当省略重复的描述。The method of the embodiment of the present application has been described in detail above with reference to the accompanying drawings, and the device of the embodiment of the present application is described below. It should be understood that the device of the embodiment of the present application can perform each step of the method of the embodiment of the present application. Repeated descriptions are appropriately omitted when introducing the devices of the embodiments of the present application.
图13为本申请实施例的生成自动化脚本的装置的示意性框图,如图13所示,该生成自动化脚本的装置包括获取单元1301,处理单元1302,以下进行简要介绍。FIG. 13 is a schematic block diagram of an apparatus for generating an automation script according to an embodiment of the present application. As shown in FIG. 13 , the apparatus for generating an automation script includes an acquisition unit 1301 and a processing unit 1302 , which are briefly introduced below.
获取单元1301,用于获取用户界面中的至少一个待设置的项目和用户在至少一个待设置的项目中输入的数据。The acquiring unit 1301 is configured to acquire at least one item to be set in the user interface and data input by the user in the at least one item to be set.
处理单元1302,用于根据至少一个待设置的项目确定至少一个自动化脚本模板,至少一个自动化脚本模板中包括一个或多个待设置的数据。The processing unit 1302 is configured to determine at least one automation script template according to at least one item to be set, and at least one automation script template includes one or more data to be set.
处理单元1302还用于根据用户在至少一个第一待设置的项目中输入的数据设置至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本。The processing unit 1302 is further configured to set the data to be set in the at least one first automation script template according to the data input by the user in the at least one first item to be set, so as to obtain the first automation script.
在某些实现方式中,一个第一自动化脚本模板对应于一个第一待设置的项目,或者一个第一自动化脚本模板对应于多个第一待设置的项目。In some implementation manners, one first automation script template corresponds to one first item to be set, or one first automation script template corresponds to multiple first items to be set.
在某些实现方式中,用户在至少一个第一待设置的项目中输入的数据包括一个或多个操作和一个或多个操作对应的参数,根据用户在至少一个第一待设置的项目中输入的数据设置至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本,包括:根据一个或多个操作和一个或多个操作对应的参数确定第一功能函数的参数,预设功能函数和预设功能函数的参数为至少一个第一自动化脚本模板中的待设置的数据;将预设功能函数、预设功能函数的参数填入至少一个第一自动化脚本模板得到第一自动化脚本。In some implementations, the data input by the user in the at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations, according to the user input in the at least one first item to be set Set the data to be set in at least one first automation script template to obtain the first automation script, including: determining the parameters of the first function function according to one or more operations and parameters corresponding to the one or more operations, and presetting The parameters of the function function and the preset function function are the data to be set in at least one first automation script template; the parameters of the preset function function and the preset function function are filled in at least one first automation script template to obtain the first automation script.
在某些实现方式中,当不同待设置项目包括相同操作时,相同操作对应的预设功能函数相同。In some implementation manners, when different items to be set include the same operation, the preset functions corresponding to the same operation are the same.
在某些实现方式中,处理单元1302还用于:对第二自动化脚本进行解析,以获取第二自动化脚本对应的第二待设置项目的数据;将第二待设置项目和第二待设置项目的数据显示在第二用户界面上。In some implementations, the processing unit 1302 is further configured to: parse the second automation script to obtain the data of the second item to be set corresponding to the second automation script; The data of is displayed on the second user interface.
在某些实现方式中,对第二自动化脚本进行解析的方法包括正则提取、关键字匹配和AI识别中的任一种。In some implementation manners, the method for parsing the second automation script includes any one of regularity extraction, keyword matching, and AI identification.
在某些实现方式中,获取单元1302还用于获取第二自动化脚本的目录;处理单元1302还用于,根据第二自动化脚本的目录生成第二待设置项目的目录;处理单元1302还用于,将第二待设置项目的目录显示在第二用户界面上。In some implementations, the obtaining unit 1302 is also used to obtain the directory of the second automation script; the processing unit 1302 is also used to generate the directory of the second item to be set according to the directory of the second automation script; the processing unit 1302 is also used to to display the directory of the second to-be-set item on the second user interface.
在某些实现方式中,处理单元1302还用于:修改第二自动化脚本中的功能函数的参数;第二自动化脚本在第二用户界面上对应的第二待设置项目的数据随的功能函数的参数的修改而变化。In some implementations, the processing unit 1302 is further configured to: modify the parameters of the function function in the second automation script; Changes with parameter modification.
在某些实现方式中,处理单元1302还用于:修改第二自动化脚本的目录;第二用户界面上的第二待设置项目的目录随第二自动化脚本中的目录的修改而变化。In some implementation manners, the processing unit 1302 is further configured to: modify the directory of the second automation script; and change the directory of the second item to be set on the second user interface as the directory in the second automation script is modified.
在某些实现方式中,功能函数包括装饰器函数。In some implementations, the functional functions include decorator functions.
应理解,图13所示的生成自动化脚本的装置可以用于实现上述生成自动化脚本的方法500,其中获取单元1301用于实现步骤501,处理单元1302用于实现步骤502和步骤503,图13所示的生成自动化脚本的装置还可以用于实现图6至图12所述的生成自动化脚本的方法,具体步骤可以参照上述对于图6至图12的描述,为了简洁,本申请在此不再赘述。It should be understood that the device for generating an automation script shown in FIG. 13 can be used to implement the above-mentioned method 500 for generating an automation script, wherein the acquisition unit 1301 is used to implement step 501, and the processing unit 1302 is used to implement steps 502 and 503. The device for generating an automated script shown in FIG. 6 can also be used to implement the method for generating an automated script described in FIGS. .
应理解的是,本申请实施例中的装置1300可以由软件实现,例如,具有上述功能的计算机程序或指令来实现,相应计算机程序或指令可以存储在终端内部的存储器中,通过处理器读取该存储器内部的相应计算机程序或指令来实现上述功能。或者,本申请实施例中的装置1300还可以由硬件来实现。其中处理单元1302为处理器(如NPU、GPU、系统芯片中的处理器),获取单元1301为数据接口。或者,本申请实施例中的装置1300还可以由处理器和软件单元的结合实现。具体地,获取单元1301可以为处理器的接口电路,用于获取用户在用户界面输入的待设置项目的数据,并发送给处理器接口电路。It should be understood that the device 1300 in the embodiment of the present application may be implemented by software, for example, a computer program or instruction having the above-mentioned functions, and the corresponding computer program or instruction may be stored in the internal memory of the terminal and read by the processor. The corresponding computer programs or instructions inside the memory realize the above functions. Alternatively, the apparatus 1300 in the embodiment of the present application may also be implemented by hardware. The processing unit 1302 is a processor (such as a processor in an NPU, GPU, or system chip), and the acquisition unit 1301 is a data interface. Alternatively, the apparatus 1300 in the embodiment of the present application may also be implemented by a combination of a processor and a software unit. Specifically, the obtaining unit 1301 may be an interface circuit of a processor, configured to obtain data of items to be set input by a user on a user interface, and send the data to the processor interface circuit.
图14是本申请实施例的生成自动化脚本的装置1400的结构示意图。图14所示的装置1400包括存储器1401、处理器1402、通信接口1403以及总线1404。其中,存储器1401、处理器1402、通信接口1403通过总线1404实现彼此之间的通信连接。FIG. 14 is a schematic structural diagram of an apparatus 1400 for generating an automation script according to an embodiment of the present application. The device 1400 shown in FIG. 14 includes a memory 1401 , a processor 1402 , a communication interface 1403 and a bus 1404 . Wherein, the memory 1401 , the processor 1402 , and the communication interface 1403 are connected to each other through a bus 1404 .
应理解,图13中的获取单元1301可以相当于装置1400中的通信接口1403,处理单元1302可以相当于装置1400中的处理器1402。下面对装置1400中的各个单元和单元进行详细的介绍。It should be understood that the acquiring unit 1301 in FIG. 13 may be equivalent to the communication interface 1403 in the device 1400 , and the processing unit 1302 may be equivalent to the processor 1402 in the device 1400 . Each unit and units in the device 1400 will be described in detail below.
存储器1401可以是只读存储器(read only memory,ROM),静态存储设备,动态存储设备或者随机存取存储器(random access memory,RAM)。存储器1401可以存储程序,当存储器1401中存储的程序被处理器1402执行时,处理器1402用于执行本申请实施例的方法的各个步骤。The memory 1401 may be a read only memory (read only memory, ROM), a static storage device, a dynamic storage device or a random access memory (random access memory, RAM). The memory 1401 may store a program, and when the program stored in the memory 1401 is executed by the processor 1402, the processor 1402 is configured to execute each step of the method in the embodiment of the present application.
具体地,处理器1402可用于执行图5所示的方法中的步骤502、步骤503以及图6至图12所示的处理数据的过程。Specifically, the processor 1402 may be configured to execute step 502 and step 503 in the method shown in FIG. 5 and the process of processing data shown in FIGS. 6 to 12 .
当处理器1402执行步骤502、步骤503以及图6至图12所示的处理数据的过程时,处理器1402可以通过通信接口1403从用户界面获取用户在待设置项目中输入的数据,并根据待设置项目确定相应的自动化脚本目标,在根据用户输入的数据和自动化脚本模板得到自动化脚本。When the processor 1402 executes step 502, step 503 and the process of processing data shown in FIGS. Set the project to determine the corresponding automation script target, and get the automation script according to the data entered by the user and the automation script template.
处理器1402可以采用通用的中央处理器(central processing unit,CPU),微处理器,应用专用集成电路(application specific integrated circuit,ASIC),图形处理器(graphics processing unit,GPU)或者一个或多个集成电路,用于执行相关程序,以实现本申请实施例的方法。The processor 1402 may be a general-purpose central processing unit (central processing unit, CPU), a microprocessor, an application specific integrated circuit (application specific integrated circuit, ASIC), a graphics processing unit (graphics processing unit, GPU) or one or more The integrated circuit is configured to execute related programs to implement the methods in the embodiments of the present application.
处理器1402还可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,本申请的方法的各个步骤可以通过处理器1402中的硬件的集成逻辑电路或者软件形式的指令完成。The processor 1402 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the method of the present application may be completed by an integrated logic circuit of hardware in the processor 1402 or instructions in the form of software.
上述处理器1402还可以是通用处理器、数字信号处理器(digital signal processing,DSP)、专用集成电路(ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件单元组合执行完成。软件单元可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1401,处理器1402读取存储器1401中的信息,结合其硬件完成装置中包括的单元所需执行的功能,或者执行本申请方法实施例的方法。The above-mentioned processor 1402 can also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit (ASIC), a ready-made programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, Discrete gate or transistor logic devices, discrete hardware components. Various methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the methods disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor. The software unit may be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory 1401, and the processor 1402 reads the information in the memory 1401, and combines its hardware to complete the functions required by the units included in the device, or execute the method of the method embodiment of the present application.
通信接口1403使用例如但不限于收发器一类的收发装置,来实现装置1400与其他设备或通信网络之间的通信。例如,可以通过通信接口1403从用户界面获取用户在待设置项目中输入的数据。The communication interface 1403 implements communication between the apparatus 1400 and other devices or communication networks by using a transceiver device such as but not limited to a transceiver. For example, the data input by the user in the items to be set can be obtained from the user interface through the communication interface 1403 .
总线1404可包括在装置1400各个部件(例如,存储器1401、处理器1402、通信接口1403)之间传送信息的通路。The bus 1404 may include pathways for transferring information between various components of the device 1400 (eg, memory 1401 , processor 1402 , communication interface 1403 ).
本申请实施例还提供了一种计算机可读存储介质,计算机可读存储介质存储有程序代码,当计算机程序代码在计算机上运行时,使得计算机执行上述图5至图12所述的方法。The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium stores program codes. When the computer program codes run on the computer, the computer executes the methods described above in FIGS. 5 to 12 .
本申请实施例还提供了一种计算设备,包括:至少一个处理器和存储器,至少一个处理器与存储器耦合,用于读取并执行存储器中的指令,以执行上述图5至图12所述的方 法。The embodiment of the present application also provides a computing device, including: at least one processor and a memory, at least one processor is coupled with the memory, and is used to read and execute instructions in the memory, so as to execute the above-mentioned steps described in FIG. 5 to FIG. 12 . Methods.
在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施例所公开的方法可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The methods disclosed in the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware. To avoid repetition, no detailed description is given here.
在本说明书中使用的术语“部件”、“模块”、“系统”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件、或执行中的软件。例如,部件可以是但不限于,在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或计算机。通过图示,在计算设备上运行的应用和计算设备都可以是部件。一个或多个部件可驻留在进程和/或执行线程中,部件可位于一个计算机上和/或分布在2个或更多个计算机之间。此外,这些部件可从在上面存储有各种数据结构的各种计算机可读介质执行。部件可例如根据具有一个或多个数据分组(例如来自与本地系统、分布式系统和/或网络间的另一部件交互的二个部件的数据,例如通过信号与其它系统交互的互联网)的信号通过本地和/或远程进程来通信。The terms "component", "module", "system" and the like are used in this specification to refer to a computer-related entity, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component may be, but is not limited to being, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer. By way of illustration, both an application running on a computing device and the computing device can be components. One or more components can reside within a process and/or thread of execution and a component can be localized on one computer and/or distributed between two or more computers. In addition, these components can execute from various computer readable media having various data structures stored thereon. A component may, for example, be based on a signal having one or more packets of data (e.g., data from two components interacting with another component between a local system, a distributed system, and/or a network, such as the Internet via a signal interacting with other systems). Communicate through local and/or remote processes.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而 前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (22)

  1. 一种生成自动化脚本的方法,其特征在于,包括:A method for generating automated scripts, comprising:
    获取用户界面中的至少一个第一待设置的项目和用户在所述至少一个第一待设置的项目中输入的数据;Acquiring at least one first item to be set in the user interface and data input by the user in the at least one first item to be set;
    根据所述至少一个第一待设置的项目确定至少一个第一自动化脚本模板,所述至少一个第一自动化脚本模板中包括待设置的数据;Determine at least one first automation script template according to the at least one first item to be set, the at least one first automation script template includes data to be set;
    根据所述用户在所述至少一个第一待设置的项目中输入的数据设置所述至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本。The data to be set in the at least one first automation script template is set according to the data input by the user in the at least one first to-be-set item, so as to obtain a first automation script.
  2. 如权利要求1所述的方法,其特征在于,一个所述第一自动化脚本模板对应于一个所述第一待设置的项目,或者一个所述第一自动化脚本模板对应于多个所述第一待设置的项目。The method according to claim 1, wherein one said first automation script template corresponds to one said first item to be set, or one said first automation script template corresponds to a plurality of said first Items to be set.
  3. 如权利要求1或2所述的方法,其特征在于,所述用户在所述至少一个第一待设置的项目中输入的数据包括一个或多个操作和所述一个或多个操作对应的参数,所述根据所述用户在所述至少一个第一待设置的项目中输入的数据设置所述至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本,包括:The method according to claim 1 or 2, wherein the data input by the user in the at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations , setting the data to be set in the at least one first automation script template according to the data input by the user in the at least one first to-be-set item, to obtain a first automation script, comprising:
    根据所述一个或多个操作和所述一个或多个操作对应的参数确定预设功能函数的参数,所述预设功能函数和所述预设功能函数的参数为所述至少一个第一自动化脚本模板中的待设置的数据;Determine parameters of preset function functions according to the one or more operations and parameters corresponding to the one or more operations, where the preset function functions and the parameters of the preset function functions are the at least one first automation The data to be set in the script template;
    将所述预设功能函数、所述预设功能函数的参数填入所述至少一个第一自动化脚本模板得到所述第一自动化脚本。Filling the preset function and parameters of the preset function into the at least one first automation script template to obtain the first automation script.
  4. 如权利要求3所述的方法,其特征在于,当不同待设置项目包括相同操作时,所述相同操作对应的预设功能函数相同。The method according to claim 3, wherein when different items to be set include the same operation, the preset functions corresponding to the same operation are the same.
  5. 如权利要求1至4中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 4, further comprising:
    对第二自动化脚本进行解析,以获取所述第二自动化脚本对应的第二待设置项目的数据;Analyzing the second automation script to obtain the data of the second item to be set corresponding to the second automation script;
    将所述第二待设置项目和所述第二待设置项目的数据显示在第二用户界面上。displaying the second to-be-set item and the data of the second to-be-set item on a second user interface.
  6. 如权利要求5所述的方法,其特征在于,所述对所述第二自动化脚本进行解析的方法包括正则提取、关键字匹配和人工智能AI识别中的任一种。The method according to claim 5, wherein the method for parsing the second automation script includes any one of regular extraction, keyword matching and artificial intelligence AI identification.
  7. 如权利要求5或6所述的方法,其特征在于,所述方法还包括:The method according to claim 5 or 6, wherein the method further comprises:
    获取所述第二自动化脚本的目录;obtaining the directory of the second automation script;
    根据所述第二自动化脚本的目录生成所述第二待设置项目的目录;generating the directory of the second item to be set according to the directory of the second automation script;
    将所述第二待设置项目的目录显示在所述第二用户界面上。Displaying the list of the second to-be-set items on the second user interface.
  8. 如权利要求5至7中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 5 to 7, further comprising:
    修改所述第二自动化脚本中的功能函数的参数;modifying the parameters of the functional functions in the second automation script;
    所述第二自动化脚本在所述第二用户界面上对应的第二待设置项目的数据随所述的功能函数的参数的修改而变化。The data of the second to-be-set item corresponding to the second automation script on the second user interface changes as the parameter of the function function is modified.
  9. 如权利要求5至8中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 5 to 8, further comprising:
    修改所述第二自动化脚本的目录;modifying the directory of the second automation script;
    所述第二用户界面上的第二待设置项目的目录随所述第二自动化脚本中的目录的修改而变化。The directory of the second to-be-set item on the second user interface changes with the modification of the directory in the second automation script.
  10. 如权利要求5至9中任一项所述的方法,其特征在于,所述功能函数包括装饰器函数。The method according to any one of claims 5 to 9, wherein the functional function comprises a decorator function.
  11. 一种生成自动化脚本的装置,其特征在于,包括:A device for generating automated scripts, characterized in that it comprises:
    获取单元,用于获取用户界面中的至少一个待设置的项目和用户在所述至少一个待设置的项目中输入的数据;an acquisition unit, configured to acquire at least one item to be set in the user interface and data input by the user in the at least one item to be set;
    处理单元,用于根据所述至少一个待设置的项目确定至少一个自动化脚本模板,所述至少一个自动化脚本模板中包括待设置的数据;A processing unit, configured to determine at least one automation script template according to the at least one item to be set, and the at least one automation script template includes data to be set;
    根据所述用户在所述至少一个第一待设置的项目中输入的数据设置所述至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本。The data to be set in the at least one first automation script template is set according to the data input by the user in the at least one first to-be-set item, so as to obtain a first automation script.
  12. 如权利要求11所述的装置,其特征在于,一个所述第一自动化脚本模板对应于一个所述第一待设置的项目,或者一个所述第一自动化脚本模板对应于多个所述第一待设置的项目。The device according to claim 11, wherein one said first automation script template corresponds to one said first item to be set, or one said first automation script template corresponds to a plurality of said first Items to be set.
  13. 如权利要求11或12所述的装置,其特征在于,所述用户在所述至少一个第一待设置的项目中输入的数据包括一个或多个操作和所述一个或多个操作对应的参数,所述根据所述用户在所述至少一个第一待设置的项目中输入的数据设置所述至少一个第一自动化脚本模板中的待设置的数据,以得到第一自动化脚本,包括:The device according to claim 11 or 12, wherein the data input by the user in the at least one first item to be set includes one or more operations and parameters corresponding to the one or more operations , setting the data to be set in the at least one first automation script template according to the data input by the user in the at least one first to-be-set item, to obtain a first automation script, comprising:
    根据所述一个或多个操作和所述一个或多个操作对应的参数确定所述预设功能函数的参数,所述预设功能函数和所述预设功能函数的参数为所述至少一个第一自动化脚本模板中的待设置的数据;Determine parameters of the preset function function according to the one or more operations and parameters corresponding to the one or more operations, where the preset function function and the parameters of the preset function function are the at least one first Data to be set in the automation script template;
    将所述预设功能函数、所述预设功能函数的参数填入所述至少一个第一自动化脚本模板得到所述第一自动化脚本。Filling the preset function and parameters of the preset function into the at least one first automation script template to obtain the first automation script.
  14. 如权利要求13所述的装置,其特征在于,当不同待设置项目包括相同操作时,所述相同操作对应的预设功能函数相同。The device according to claim 13, wherein when different items to be set include the same operation, the preset functions corresponding to the same operation are the same.
  15. 如权利要求11至14中任一项所述的装置,其特征在于,Apparatus according to any one of claims 11 to 14, characterized in that
    所述处理单元还用于:The processing unit is also used for:
    对第二自动化脚本进行解析,以获取所述第二自动化脚本对应的第二待设置项目的数据;Analyzing the second automation script to obtain the data of the second item to be set corresponding to the second automation script;
    将所述第二待设置项目和所述第二待设置项目的数据显示在第二用户界面上。displaying the second to-be-set item and the data of the second to-be-set item on a second user interface.
  16. 如权利要求15所述的装置,其特征在于,所述对所述第二自动化脚本进行解析的方法包括正则提取、关键字匹配和AI识别中的任一种。The device according to claim 15, wherein the method for parsing the second automation script comprises any one of regularity extraction, keyword matching and AI recognition.
  17. 如权利要求15或16所述的装置,其特征在于,所述获取单元还用于获取所述第二自动化脚本的目录;The device according to claim 15 or 16, wherein the acquiring unit is further configured to acquire the directory of the second automation script;
    所述处理单元还用于,根据所述第二自动化脚本的目录生成所述第二待设置项目的目录;The processing unit is further configured to generate the directory of the second item to be set according to the directory of the second automation script;
    所述处理单元还用于,将所述第二待设置项目的目录显示在所述第二用户界面上。The processing unit is further configured to display the list of the second to-be-set items on the second user interface.
  18. 如权利要求15至17中任一项所述的装置,其特征在于,所述处理单元还用于:The device according to any one of claims 15 to 17, wherein the processing unit is further configured to:
    修改所述第二自动化脚本中的功能函数的参数;modifying the parameters of the functional functions in the second automation script;
    所述第二自动化脚本在所述第二用户界面上对应的第二待设置项目的数据随所述的功能函数的参数的修改而变化。The data of the second to-be-set item corresponding to the second automation script on the second user interface changes as the parameter of the function function is modified.
  19. 如权利要求15至18中任一项所述的装置,其特征在于,所述处理单元还用于:The device according to any one of claims 15 to 18, wherein the processing unit is further configured to:
    修改所述第二自动化脚本的目录;modifying the directory of the second automation script;
    所述第二用户界面上的第二待设置项目的目录随所述第二自动化脚本中的目录的修改而变化。The directory of the second to-be-set item on the second user interface changes with the modification of the directory in the second automation script.
  20. 如权利要求15至19中任一项所述的装置,其特征在于,所述功能函数包括装饰器函数。The apparatus according to any one of claims 15 to 19, wherein the functional function comprises a decorator function.
  21. 一种计算设备,其特征在于,包括处理器和存储器;所述处理器运行所述存储器中的指令,使得所述计算设备部署如权利要求11至20中任一项所述的装置。A computing device, characterized by comprising a processor and a memory; the processor executes instructions in the memory, so that the computing device deploys the apparatus according to any one of claims 11 to 20.
  22. 一种计算机可读存储介质,其特征在于,包括指令;所述指令用于实现如权利要求1至10中任一项所述的方法。A computer-readable storage medium, characterized by comprising instructions; the instructions are used to implement the method according to any one of claims 1-10.
PCT/CN2021/140549 2021-12-22 2021-12-22 Method and apparatus for generating automated script WO2023115397A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202180033485.2A CN116648689A (en) 2021-12-22 2021-12-22 Method and device for generating automation script
PCT/CN2021/140549 WO2023115397A1 (en) 2021-12-22 2021-12-22 Method and apparatus for generating automated script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/140549 WO2023115397A1 (en) 2021-12-22 2021-12-22 Method and apparatus for generating automated script

Publications (1)

Publication Number Publication Date
WO2023115397A1 true WO2023115397A1 (en) 2023-06-29

Family

ID=86901043

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/140549 WO2023115397A1 (en) 2021-12-22 2021-12-22 Method and apparatus for generating automated script

Country Status (2)

Country Link
CN (1) CN116648689A (en)
WO (1) WO2023115397A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108710489A (en) * 2018-05-23 2018-10-26 中国平安人寿保险股份有限公司 Automate derivative scenario generation method, device, computer equipment
CN110413524A (en) * 2019-07-26 2019-11-05 中国工商银行股份有限公司 For generating method and apparatus, the automated testing method of test script
CN111736815A (en) * 2020-06-28 2020-10-02 武汉精立电子技术有限公司 Test file script modular development tool, system and method
CN111949518A (en) * 2020-07-29 2020-11-17 苏州浪潮智能科技有限公司 Method, system, terminal and storage medium for generating fault detection script
CN112052167A (en) * 2020-08-25 2020-12-08 北京梧桐车联科技有限责任公司 Method and device for generating test script code
CN112799656A (en) * 2021-04-15 2021-05-14 智道网联科技(北京)有限公司 Script file configuration method, device, equipment and storage medium for automation operation
CN112989781A (en) * 2021-03-11 2021-06-18 携程旅游网络技术(上海)有限公司 Automatic form data execution method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108710489A (en) * 2018-05-23 2018-10-26 中国平安人寿保险股份有限公司 Automate derivative scenario generation method, device, computer equipment
CN110413524A (en) * 2019-07-26 2019-11-05 中国工商银行股份有限公司 For generating method and apparatus, the automated testing method of test script
CN111736815A (en) * 2020-06-28 2020-10-02 武汉精立电子技术有限公司 Test file script modular development tool, system and method
CN111949518A (en) * 2020-07-29 2020-11-17 苏州浪潮智能科技有限公司 Method, system, terminal and storage medium for generating fault detection script
CN112052167A (en) * 2020-08-25 2020-12-08 北京梧桐车联科技有限责任公司 Method and device for generating test script code
CN112989781A (en) * 2021-03-11 2021-06-18 携程旅游网络技术(上海)有限公司 Automatic form data execution method and device, electronic equipment and storage medium
CN112799656A (en) * 2021-04-15 2021-05-14 智道网联科技(北京)有限公司 Script file configuration method, device, equipment and storage medium for automation operation

Also Published As

Publication number Publication date
CN116648689A (en) 2023-08-25

Similar Documents

Publication Publication Date Title
CN110825362B (en) Low-code application software development system and method
US11314907B2 (en) Simulation including multiple simulators
CN106155755B (en) Program compiling method and program compiler
CN105022630B (en) A kind of assembly management system and assembly management method
CN106484394A (en) A kind of fast software development system with double engines
WO2018036342A1 (en) Csar-based template design visualization method and device
US20200057654A1 (en) Method and system for mirror image package preparation and application operation
US20140068410A1 (en) User interface for composing test scenarios
US11645438B2 (en) Generating a template-driven schematic from a netlist of electronic circuits
CN107015914B (en) Data calibration method and system
WO2022120717A1 (en) Simulation task scheduling method, execution method, simulation implementation method and device
CN105824616A (en) Development method and frame for equipment control system program
CN104865904A (en) Undisturbed configuration method facing multi-cycle operation task
WO2023039741A1 (en) Online development method and apparatus based on microservice system, device, and storage medium
CN109213465B (en) Multi-display identification method and system for education operation system
WO2023115397A1 (en) Method and apparatus for generating automated script
US20230171179A1 (en) Method for testing pressure, electronic device and storage medium
US20200387642A1 (en) Data processing method for blueprint design, plm widget and computation device
TW202338655A (en) Integrated circuit design verification with module swapping
CN115562989A (en) Automatic test sequence conversion method, system, equipment and medium
CN114428702A (en) Information physical test system containing general interface module
CN103546527A (en) Expandable industrial configuration or simulation software communication method
CN109947407A (en) A kind of data capture method and device
CN113238491A (en) Simulation test method and device for actuating mechanism, intelligent arm support and engineering vehicle
CN109918727B (en) Dynamic management method for multiple simulation scenes

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202180033485.2

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21968546

Country of ref document: EP

Kind code of ref document: A1