CN113407229A - Method and device for generating offline script - Google Patents

Method and device for generating offline script Download PDF

Info

Publication number
CN113407229A
CN113407229A CN202010184816.XA CN202010184816A CN113407229A CN 113407229 A CN113407229 A CN 113407229A CN 202010184816 A CN202010184816 A CN 202010184816A CN 113407229 A CN113407229 A CN 113407229A
Authority
CN
China
Prior art keywords
script
file
offline
code
configuration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010184816.XA
Other languages
Chinese (zh)
Inventor
李坤
唐华溢
李真熙
辛庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Original Assignee
Baidu Online Network Technology Beijing Co Ltd
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 Baidu Online Network Technology Beijing Co Ltd filed Critical Baidu Online Network Technology Beijing Co Ltd
Priority to CN202010184816.XA priority Critical patent/CN113407229A/en
Publication of CN113407229A publication Critical patent/CN113407229A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Abstract

The embodiment of the disclosure discloses a method and a device for generating an offline script. One embodiment of the method comprises: generating an initial offline script file based on the script code template and the script configuration template; testing the script code file and the script configuration file included in the initial off-line script file in parallel; and in response to the test results of the script code file and the script configuration file being normal, marking the initial offline script file as a target offline script file, wherein the target offline script file is used for an online system. The method and the device improve the flexibility and the reliability of the operation of the target offline script file and are beneficial to improving the operation stability of an online system.

Description

Method and device for generating offline script
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a method and a device for generating an offline script.
Background
In the process of providing online service, the online system can be updated iteratively, and the used offline data is updated continuously. Offline data can be dynamically loaded by the online system and validated online. These dynamically loaded offline data, typically produced by off-line bulk task offline scripts, are pushed to the online system via various protocols or file systems.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for generating an offline script.
In a first aspect, an embodiment of the present disclosure provides a method for generating an offline script, where the method includes: generating an initial offline script file based on the script code template and the script configuration template, wherein the initial offline script file comprises a script code file and a script configuration file; testing the script code file and the script configuration file included in the initial off-line script file in parallel; and in response to the test results of the script code file and the script configuration file being normal, marking the initial offline script file as a target offline script file, wherein the target offline script file is used for an online system.
In some embodiments, the generating an initial offline script file based on the script code template and the script configuration template includes: in response to detecting the script generation request, displaying a script code template and a script configuration template; in response to detecting a confirmation instruction corresponding to the script code template and the script configuration template, respectively generating a script code file and a script configuration file according to the input information in the script code template and the input information in the script configuration template; and establishing the incidence relation between the script code file and the script configuration file to obtain an initial offline script file.
In some embodiments, the above method comprises: and acquiring the online data type of the current online system, and generating the initial offline script file according to the online data type.
In some embodiments, the above method comprises: acquiring code information to be processed and configuration information to be processed from a current offline script file; and respectively importing the code information to be processed and the configuration information to be processed into the script code template and the script configuration template to generate an initial offline script file.
In a second aspect, an embodiment of the present disclosure provides a method for invoking an offline script, the method including: in response to receiving an offline script calling instruction sent by an online system, acquiring a target offline script file indicated by the offline script calling instruction; controlling the target offline script file to run on first equipment, and monitoring the running state of the first equipment in real time; and in response to the detection that the running state is a fault, migrating the target offline script file to second equipment for running continuously.
In some embodiments, the migrating the target offline script file to the second device to continue running includes: and modifying the script configuration file of the target offline script file according to the resource information of the second device.
In a third aspect, an embodiment of the present disclosure provides an apparatus for generating an offline script, where the apparatus includes: an initial offline script file generating unit configured to generate an initial offline script file based on the script code template and the script configuration template, the initial offline script file including a script code file and a script configuration file; the test unit is configured to test the script code file and the script configuration file which are included in the initial off-line script file in parallel; and the target offline script file acquisition unit is used for responding to the test result of the script code file and the script configuration file being normal, and is configured to mark the initial offline script file as a target offline script file which is used for an online system.
In some embodiments, the initial offline script file generating unit includes: a template display subunit configured to display the script code template and the script configuration template in response to detecting the script generation request; a file generation subunit configured to generate a script code file and a script configuration file according to the input information in the script code template and the input information in the script configuration template, respectively, in response to detecting a confirmation instruction corresponding to the script code template and the script configuration template; and the initial offline script file establishing subunit is configured to establish the association relationship between the script code file and the script configuration file to obtain an initial offline script file.
In some embodiments, the apparatus comprises: and the data type acquisition unit is configured to acquire the online data type of the current online system and generate the initial offline script file according to the online data type.
In some embodiments, the apparatus comprises: the information extraction unit is configured to acquire the code information to be processed and the configuration information to be processed from the current offline script file; and the file generation unit is configured to import the to-be-processed code information and the to-be-processed configuration information into the script code template and the script configuration template respectively to generate an initial offline script file.
In a fourth aspect, an embodiment of the present disclosure provides an apparatus for invoking an offline script, including: the file acquisition unit is used for responding to an offline script calling instruction sent by an online system and is configured to acquire a target offline script file indicated by the offline script calling instruction; the operation control unit is configured to control the target offline script file to operate on first equipment and monitor the operation state of the first equipment in real time; and the file migration unit is used for responding to the detection that the running state is a fault and migrating the target offline script file to the second equipment to continue running.
In some embodiments, the target offline script file includes a script code file and a script configuration file, and the file migration unit includes: and the file modification subunit is configured to modify the script configuration file of the target offline script file according to the resource information of the second device.
In a fifth aspect, an embodiment of the present disclosure provides an electronic device, including: one or more processors; a memory having one or more programs stored thereon, which when executed by the one or more processors, cause the one or more processors to perform the method for generating an offline script of the first aspect or the method for invoking an offline script of the second aspect.
In a sixth aspect, an embodiment of the present disclosure provides a computer-readable medium, on which a computer program is stored, where the program is characterized in that when executed by a processor, the program implements the method for generating an offline script of the first aspect or the method for calling an offline script of the second aspect.
According to the method and the device for generating the offline script, the initial offline script file is generated based on the script code template and the script configuration template, and the initial offline script file comprises the script code file and the script configuration file, so that the independence of the initial offline script file can be improved; and the script code file and the script configuration file included in the initial off-line script file are tested in parallel, so that the testing efficiency is improved. When the test results of the script code file and the script configuration file are normal, the script code file and the script configuration file generated by the script code template and the script configuration template can run normally, at the moment, the initial offline script file is marked as a target offline script file, and the target offline script file can accept the call of an online system. Therefore, the flexibility and the reliability of the operation of the target offline script file are improved, and the operation stability of an online system is favorably improved.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for generating an offline script according to the present disclosure;
FIG. 3 is a schematic diagram of another embodiment of a method for generating offline scripts in accordance with the present disclosure;
FIG. 4 is a flow diagram for one embodiment of a method for invoking offline scripts in accordance with the present disclosure;
FIG. 5 is a schematic diagram illustrating one embodiment of an apparatus for generating offline scripts in accordance with the present disclosure;
FIG. 6 is a schematic block diagram illustrating one embodiment of an apparatus for invoking offline scripts in accordance with the present disclosure;
FIG. 7 is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 of a method for generating an offline script or an apparatus for generating an offline script to which embodiments of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, an offline server 105, and an online server 106. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103, the offline server 105 and the online server 106. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the offline server 105 and the online server 106 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices having a display screen and supporting online services, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as a plurality of software or software modules (for example, for providing distributed services), or as a single software or software module, which is not specifically limited herein.
Offline server 105 may be a server that provides various services, such as a server that provides offline script support for online server 106. The server may generate an offline script file for the online server 106 and call the offline script file according to the needs of the online server 106, so that the online system provides online services for the terminal devices 101, 102, 103.
The presence server 106 may be a server that has a presence system installed thereon and provides various presence services to the terminal apparatuses 101, 102, 103.
It should be noted that the method for generating the offline script provided by the embodiment of the present disclosure is generally performed by the offline server 105, and accordingly, the apparatus for generating the offline script is generally disposed in the offline server 105.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules (for example, to provide distributed services), or may be implemented as a single software or software module, and is not limited specifically herein.
It should be understood that the number of terminal devices, networks, offline servers, and online servers in fig. 1 are merely illustrative. There may be any number of terminal devices, networks, offline servers, and online servers, as desired for an implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for generating an offline script in accordance with the present disclosure is shown. The method for generating the offline script comprises the following steps:
step 201, an initial offline script file is generated based on the script code template and the script configuration template.
In this embodiment, an execution subject of the method for generating an offline script (e.g., the offline server 105 shown in fig. 1) may provide a script code template and a script configuration template so that a technician generates an initial offline script file according to the requirements of the script code template and the script configuration template. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
Existing offline script files vary depending on the online system to which they are applied. And the offline script file needs to call resources on the device where the offline script file is located during use, so that the situation of hard coding exists. Once the device fails, the offline script file may not be able to call resources, thereby preventing the online system from operating normally. After the offline script file is generated, because the code information and the configuration information in the offline script file exist in the same file, the code information and the configuration information cannot be tested in parallel, and the testing efficiency is not high. When the offline script file is called by an online system, the offline script needs to be called according to a timing program, so that an operation fault cannot be found in time; the existing offline script file contains both code information and configuration information, and the code information and the configuration information are in a hard-coded state. Therefore, the offline script file is not easy to migrate to other equipment to normally operate in time when the offline script file fails to operate.
To this end, the execution body of the present application provides a script code template and a script configuration template. The script code template is used for editing code information of the offline script file into a script code file; the script configuration template is used for editing the configuration information of the offline script file into a script configuration file. The execution body may then combine the code file and the configuration file to form an initial offline script file. That is, the initial offline script file includes a script code file and a script configuration file.
Step 202, testing the script code file and the script configuration file included in the initial offline script file in parallel.
After the script code file and the script configuration file included in the initial offline script file are obtained, the execution main body can test the script code file and the script configuration file in parallel. Therefore, the testing efficiency of the initial offline script file can be improved.
Step 203, in response to that the test results of the script code file and the script configuration file are normal, marking the initial offline script file as a target offline script file.
When the test results of the script code file and the script configuration file are normal, the script code file and the script configuration file generated by the script code template and the script configuration template can be combined to form an initial offline script file to realize corresponding functions, and can be tested independently to complete respective independent functions. At this point, the execution principal may mark the initial offline script file as a target offline script file. That is, the target offline script file described above can be used for an online system.
With continued reference to FIG. 3, a flow 300 of one embodiment of a method for generating an offline script in accordance with the present disclosure is shown. The method for generating the offline script comprises the following steps:
step 301, in response to detecting a script generation request, displaying a script code template and a script configuration template.
In the present embodiment, an execution agent of the method for generating an offline script (e.g., the offline server 105 shown in fig. 1) may provide a script code template and a script configuration template.
When the technician edits the offline script file, a script generation request may be issued to the executing agent. The execution main body can display the script code template and the script configuration template according to the script generation request, so that technicians can edit corresponding code information and configuration information through the script code template and the script configuration template.
In some optional implementations of this embodiment, the method may further include: and acquiring the online data type of the current online system, and generating the initial offline script file according to the online data type.
In practice, the online system needs to be updated as needed for the current service. The updated online system may or may not be the same type of online data that was processed by the previous online system. When the updated online system and the previous online system process different online data types, in order to adapt to the needs of the online system, when the online data type of the online system changes, the execution subject may generate the initial offline script file according to the online data type. The execution main body can modify the script code template and the script configuration template according to the online data type, so that a script code file and a script configuration file obtained based on the script code template and the script configuration template meet the requirements of the online data type.
Step 302, in response to detecting the confirmation instruction corresponding to the script code template and the script configuration template, respectively generating a script code file and a script configuration file according to the input information in the script code template and the input information in the script configuration template;
when the technician finishes editing the corresponding code information and configuration information through the script code template and the script configuration template, a confirmation instruction can be sent to the execution main body. The confirmation instruction can be sent through a script code template, a completion button on a script configuration template and the like. After receiving the confirmation instruction, the execution subject may generate a script code file and a script configuration file from the input information in the script code template and the input information in the script configuration template, respectively.
Step 303, establishing the association relationship between the script code file and the script configuration file to obtain an initial offline script file.
After the script code file and the script configuration file are obtained, the execution main body can establish the association relationship between the script code file and the script configuration file to obtain an initial offline script file. The script code file and the script configuration file are respectively generated by the script code template and the script configuration template, and the script code template and the script configuration template are in a corresponding relation. Therefore, the association relationship between the script code template and the script configuration template can be generated by the correspondence relationship between the script code template and the script configuration template. After the association relationship is established, the script code file and the script configuration file can be combined into an initial offline script file to realize the corresponding function.
And step 304, testing the script code file and the script configuration file included in the initial offline script file in parallel.
The content of step 304 is the same as that of step 202, and is not described in detail here.
Step 305, in response to the test result of the script code file and the script configuration file being normal, marking the initial offline script file as a target offline script file.
The content of step 305 is the same as that of step 203, and is not described in detail here.
In some optional implementations of this embodiment, the method may further include:
firstly, acquiring code information to be processed and configuration information to be processed from a current offline script file.
In order to improve the efficiency of obtaining the offline script, the existing script can be directly converted into the initial offline script file of the application. For this, the execution subject may obtain the to-be-processed code information and the to-be-processed configuration information from the current offline script file.
And secondly, importing the code information to be processed and the configuration information to be processed into the script code template and the script configuration template respectively to generate an initial offline script file.
After the code information to be processed and the configuration information to be processed of the current offline script file are imported into the script code template and the script configuration template, the corresponding script code file and the script configuration file can be generated, and the initial offline script file obtained by establishing the association relationship between the script code file and the script configuration file is also suitable for the embodiment corresponding to fig. 2.
The method provided by the embodiment of the disclosure generates the initial offline script file based on the script code template and the script configuration template, and the initial offline script file comprises the script code file and the script configuration file, so that the independence of the initial offline script file can be improved; and the script code file and the script configuration file included in the initial off-line script file are tested in parallel, so that the testing efficiency is improved. When the test results of the script code file and the script configuration file are normal, the script code file and the script configuration file generated by the script code template and the script configuration template can run normally, at the moment, the initial offline script file is marked as a target offline script file, and the target offline script file can accept the call of an online system. Therefore, the flexibility and the reliability of the operation of the target offline script file are improved, and the operation stability of an online system is favorably improved.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a method for invoking offline scripts is illustrated. The process 400 of the method for invoking an offline script comprises the steps of:
step 401, in response to receiving an offline script calling instruction sent by an online system, obtaining a target offline script file indicated by the offline script calling instruction.
In this embodiment, an execution subject (for example, the offline server 105 shown in fig. 1) of the method for calling the offline script may receive an offline script calling instruction sent by the online system through a wired connection manner or a wireless connection manner.
The executing agent and presence server 106 establish a data connection over network 104. When the online server 106 needs to call the offline script file on the execution subject, an offline script call instruction may be sent to the execution subject. And the execution main body acquires a corresponding target offline script file according to the offline script calling instruction.
Step 402, controlling the target offline script file to run on the first device, and monitoring the running state of the first device in real time.
The execution subject may control the target offline script file to run on the first device, so that the online system provides an online service. In the process, the executive body can monitor the running state of the first equipment in real time.
And step 403, in response to detecting that the running state is a fault, migrating the target offline script file to a second device for running continuously.
When the operation state is detected to be a fault, the target offline script file cannot normally operate on the first device. The execution subject may migrate the target offline script file to the second device for continued operation. And the second device can provide resources required by normal operation for the target offline script file. Therefore, the running stability of the target offline script file is improved, and the running stability of the online system is further improved.
In some optional implementation manners of this embodiment, the migrating the target offline script file to the second device for continuous operation may include: and modifying the script configuration file of the target offline script file according to the resource information of the second device.
The target offline script file comprises a script code file and a script configuration file, and resource path information needs to be acquired when the script configuration file calls resources on the first device. When migrating the target offline script file to the second device, the path of the resources required by the script configuration file may be different from the path of the resources on the first device. For this reason, the execution subject needs to modify the script configuration file of the target offline script file according to the resource information of the second device.
With further reference to fig. 5, as an implementation of the method shown in the above-mentioned figures, the present disclosure provides an embodiment of an apparatus for generating an offline script, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 5, the apparatus 500 for generating an offline script of the present embodiment may include: an initial offline script file generating unit 501, a testing unit 502 and a target offline script file acquiring unit 503. The initial offline script file generating unit 501 is configured to generate an initial offline script file based on a script code template and a script configuration template, where the initial offline script file includes a script code file and a script configuration file; a testing unit 502 configured to test the script code file and the script configuration file included in the initial offline script file in parallel; the target offline script file obtaining unit 503, in response to that the test results of the script code file and the script configuration file are normal, is configured to mark the initial offline script file as a target offline script file, where the target offline script file is used in an online system.
In some optional implementations of this embodiment, the initial offline script file generating unit 501 may include: a template display subunit (not shown), a file generation subunit (not shown), and an initial offline script file creation subunit (not shown). Wherein the template display subunit, in response to detecting the script generation request, is configured to display the script code template and the script configuration template; a file generation subunit configured to generate a script code file and a script configuration file according to the input information in the script code template and the input information in the script configuration template, respectively, in response to detecting a confirmation instruction corresponding to the script code template and the script configuration template; and the initial offline script file establishing subunit is configured to establish the association relationship between the script code file and the script configuration file to obtain an initial offline script file.
In some optional implementations of the present embodiment, the apparatus 500 for generating an offline script may include: and the data type acquisition unit (not shown in the figure) is configured to acquire an online data type of the current online system and generate the initial offline script file according to the online data type.
In some optional implementations of the present embodiment, the apparatus 500 for generating an offline script may include: an information extraction unit (not shown) and a file generation unit (not shown). The information extraction unit is configured to acquire code information to be processed and configuration information to be processed from a current offline script file; and the file generation unit is configured to import the to-be-processed code information and the to-be-processed configuration information into the script code template and the script configuration template respectively to generate an initial offline script file.
With further reference to fig. 6, as an implementation of the method shown in the above-mentioned figures, the present disclosure provides an embodiment of an apparatus for invoking an offline script, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 4, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 6, the apparatus 600 for invoking an offline script according to this embodiment may include: a file acquisition unit 601, an operation control unit 602, and a file migration unit 603. The file obtaining unit 601, in response to receiving an offline script calling instruction sent by an online system, is configured to obtain a target offline script file indicated by the offline script calling instruction; an operation control unit 602 configured to control the target offline script file to operate on a first device, and monitor an operation state of the first device in real time; the file migration unit 603, in response to detecting that the operation status is a failure, is configured to migrate the target offline script file to the second device for continuing operation.
In some optional implementation manners of this embodiment, the target offline script file includes a script code file and a script configuration file, and the file migration unit 603 may include: a file modification subunit (not shown) configured to modify the script configuration file of the target offline script file according to the resource information of the second device.
The present embodiment also provides an electronic device, including: one or more processors; a memory having one or more programs stored thereon, which when executed by the one or more processors, cause the one or more processors to perform the above-described method for generating an offline script or the method for calling an offline script.
The present embodiment also provides a computer-readable medium, on which a computer program is stored, which when executed by a processor implements the above-described method for generating an offline script or the method for calling an offline script.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with an electronic device (e.g., offline server 105 of FIG. 1) implementing an embodiment of the present disclosure. The electronic device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, electronic device 700 may include a processing means (e.g., central processing unit, graphics processor, etc.) 701 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from storage 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data necessary for the operation of the electronic apparatus 700 are also stored. The processing device 701, the ROM 702, and the RAM703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Generally, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 illustrates an electronic device 700 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 7 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication means 709, or may be installed from the storage means 708, or may be installed from the ROM 702. The computer program, when executed by the processing device 701, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium mentioned above in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: generating an initial offline script file based on the script code template and the script configuration template, wherein the initial offline script file comprises a script code file and a script configuration file; testing the script code file and the script configuration file included in the initial off-line script file in parallel; and in response to the test results of the script code file and the script configuration file being normal, marking the initial offline script file as a target offline script file, wherein the target offline script file is used for an online system.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an initial offline script file generating unit, a testing unit, and a target offline script file acquiring unit. The names of these units do not in some cases constitute a limitation on the units themselves, and for example, the target offline script file obtaining unit may also be described as a "unit for generating an offline script file required by the online system".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the inventive concept as defined above. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (14)

1. A method for generating an offline script, comprising:
generating an initial offline script file based on the script code template and the script configuration template, wherein the initial offline script file comprises a script code file and a script configuration file;
testing the script code file and the script configuration file included in the initial off-line script file in parallel;
and in response to the test results of the script code file and the script configuration file being normal, marking the initial offline script file as a target offline script file, wherein the target offline script file is used for an online system.
2. The method of claim 1, wherein the generating an initial offline script file based on the script code template and the script configuration template comprises:
in response to detecting the script generation request, displaying a script code template and a script configuration template;
responding to the detected confirmation instructions corresponding to the script code template and the script configuration template, and respectively generating a script code file and a script configuration file according to the input information in the script code template and the input information in the script configuration template;
and establishing an incidence relation between the script code file and the script configuration file to obtain an initial offline script file.
3. The method of claim 1, wherein the method comprises:
and acquiring the online data type of the current online system, and generating the initial offline script file according to the online data type.
4. The method of claim 1, wherein the method comprises:
acquiring code information to be processed and configuration information to be processed from a current offline script file;
and respectively importing the code information to be processed and the configuration information to be processed into the script code template and the script configuration template to generate an initial offline script file.
5. A method for invoking offline scripts, comprising:
in response to receiving an offline script calling instruction sent by an online system, acquiring a target offline script file indicated by the offline script calling instruction;
controlling the target offline script file to run on first equipment, and monitoring the running state of the first equipment in real time;
and in response to the detection that the running state is a fault, migrating the target offline script file to a second device to continue running.
6. The method of claim 5, wherein the target offline script file comprises a script code file and a script configuration file, and
the migrating the target offline script file to a second device for continuous operation comprises:
and modifying the script configuration file of the target offline script file according to the resource information of the second device.
7. An apparatus for generating an offline script, comprising:
an initial offline script file generating unit configured to generate an initial offline script file based on a script code template and a script configuration template, the initial offline script file including a script code file and a script configuration file;
the testing unit is configured to test the script code file and the script configuration file which are included in the initial offline script file in parallel;
and the target offline script file acquisition unit is used for responding to the test result of the script code file and the script configuration file being normal, and is configured to mark the initial offline script file as a target offline script file which is used for an online system.
8. The apparatus of claim 7, wherein the initial offline script file generating unit comprises:
a template display subunit configured to display the script code template and the script configuration template in response to detecting the script generation request;
a file generation subunit configured to generate a script code file and a script configuration file, respectively, from input information in the script code template and input information in the script configuration template, in response to detecting a confirmation instruction corresponding to the script code template and the script configuration template;
and the initial offline script file establishing subunit is configured to establish an association relation between the script code file and the script configuration file to obtain an initial offline script file.
9. The apparatus of claim 7, wherein the apparatus comprises:
and the data type acquisition unit is configured to acquire an online data type of the current online system and generate the initial offline script file according to the online data type.
10. The apparatus of claim 7, wherein the apparatus comprises:
the information extraction unit is configured to acquire the code information to be processed and the configuration information to be processed from the current offline script file;
and the file generation unit is configured to import the code information to be processed and the configuration information to be processed into the script code template and the script configuration template respectively to generate an initial offline script file.
11. An apparatus for invoking offline scripts, comprising:
the file acquisition unit is used for responding to receiving an offline script calling instruction sent by an online system and is configured to acquire a target offline script file indicated by the offline script calling instruction;
the operation control unit is configured to control the target offline script file to operate on first equipment and monitor the operation state of the first equipment in real time;
and the file migration unit is used for responding to the detection that the running state is a fault and migrating the target offline script file to a second device to continue running.
12. The apparatus of claim 11, wherein the target offline script file comprises a script code file and a script configuration file, and
the file migration unit includes:
a file modification subunit configured to modify the script configuration file of the target offline script file according to the resource information of the second device.
13. An electronic device, comprising:
one or more processors;
a memory having one or more programs stored thereon,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-4 or the method of any of claims 5-6.
14. A computer-readable medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method of one of the claims 1 to 4 or the method of one of the claims 5 to 6.
CN202010184816.XA 2020-03-17 2020-03-17 Method and device for generating offline script Pending CN113407229A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010184816.XA CN113407229A (en) 2020-03-17 2020-03-17 Method and device for generating offline script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010184816.XA CN113407229A (en) 2020-03-17 2020-03-17 Method and device for generating offline script

Publications (1)

Publication Number Publication Date
CN113407229A true CN113407229A (en) 2021-09-17

Family

ID=77676999

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010184816.XA Pending CN113407229A (en) 2020-03-17 2020-03-17 Method and device for generating offline script

Country Status (1)

Country Link
CN (1) CN113407229A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117454847A (en) * 2023-12-26 2024-01-26 南京翼辉信息技术有限公司 Method for converting online document into offline document

Citations (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5754755A (en) * 1996-10-10 1998-05-19 Microsoft Corporation Method and system for generating test scripts
US20020091999A1 (en) * 2000-12-01 2002-07-11 Microsoft Corporation XML based script automation
US20070113282A1 (en) * 2005-11-17 2007-05-17 Ross Robert F Systems and methods for detecting and disabling malicious script code
US20080126390A1 (en) * 2006-11-29 2008-05-29 Philip Arthur Day Efficient stress testing of a service oriented architecture based application
US20120047492A1 (en) * 2010-08-17 2012-02-23 International Business Machines Corporation Deployment of a tool for testing migrated applications
CN102446090A (en) * 2010-10-09 2012-05-09 金蝶软件(中国)有限公司 Method and device for automatically generating test script
CN102486749A (en) * 2010-12-03 2012-06-06 中兴通讯股份有限公司 Method and system for data driving test
CN103885879A (en) * 2014-03-26 2014-06-25 卡斯柯信号有限公司 Script parsing method used for automatic interlocking-software testing platform system
US20140282434A1 (en) * 2013-03-15 2014-09-18 International Business Machines Corporation Testing functional correctness and idempotence of software automation scripts
US20140281721A1 (en) * 2013-03-14 2014-09-18 Sap Ag Automatic generation of test scripts
KR101437943B1 (en) * 2013-03-12 2014-11-03 (주)모비인 Smart platform apparatus, system and contol method
CN104615534A (en) * 2015-01-28 2015-05-13 广州酷狗计算机科技有限公司 Interface test method and device
US9606900B1 (en) * 2016-03-24 2017-03-28 Fmr Llc Intelligent automation of computer software test scripts and code requirements
US20180165068A1 (en) * 2016-12-12 2018-06-14 Sap Se Generation and usage of language-converted script
CN108345531A (en) * 2017-01-23 2018-07-31 阿里巴巴集团控股有限公司 A kind of test method, apparatus and system
CN108459852A (en) * 2018-01-30 2018-08-28 美通云动(北京)科技有限公司 Script processing method and device, storage medium, electronic equipment
US20180293157A1 (en) * 2017-04-10 2018-10-11 Fmr Llc Automated script creation and source code generation for testing mobile devices
CN109086199A (en) * 2018-06-22 2018-12-25 网宿科技股份有限公司 A kind of automation generates the method for test script, terminal and can storage medium
CN109101231A (en) * 2018-08-07 2018-12-28 百度在线网络技术(北京)有限公司 Scripted code generation method, device, computer equipment and storage medium
CN109189680A (en) * 2018-08-24 2019-01-11 苏州玩友时代科技股份有限公司 A kind of system and method for application publication and configuration
CN109213676A (en) * 2018-07-06 2019-01-15 中国电力科学研究院有限公司 A kind of offline adjustment method and device for test script
CN110688142A (en) * 2019-10-10 2020-01-14 星环信息科技(上海)有限公司 Method, device and storage medium for publishing application programming interface

Patent Citations (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5754755A (en) * 1996-10-10 1998-05-19 Microsoft Corporation Method and system for generating test scripts
US20020091999A1 (en) * 2000-12-01 2002-07-11 Microsoft Corporation XML based script automation
US20070113282A1 (en) * 2005-11-17 2007-05-17 Ross Robert F Systems and methods for detecting and disabling malicious script code
US20080126390A1 (en) * 2006-11-29 2008-05-29 Philip Arthur Day Efficient stress testing of a service oriented architecture based application
US20120047492A1 (en) * 2010-08-17 2012-02-23 International Business Machines Corporation Deployment of a tool for testing migrated applications
CN102446090A (en) * 2010-10-09 2012-05-09 金蝶软件(中国)有限公司 Method and device for automatically generating test script
CN102486749A (en) * 2010-12-03 2012-06-06 中兴通讯股份有限公司 Method and system for data driving test
KR101437943B1 (en) * 2013-03-12 2014-11-03 (주)모비인 Smart platform apparatus, system and contol method
US20140281721A1 (en) * 2013-03-14 2014-09-18 Sap Ag Automatic generation of test scripts
US20140282434A1 (en) * 2013-03-15 2014-09-18 International Business Machines Corporation Testing functional correctness and idempotence of software automation scripts
CN103885879A (en) * 2014-03-26 2014-06-25 卡斯柯信号有限公司 Script parsing method used for automatic interlocking-software testing platform system
CN104615534A (en) * 2015-01-28 2015-05-13 广州酷狗计算机科技有限公司 Interface test method and device
US9606900B1 (en) * 2016-03-24 2017-03-28 Fmr Llc Intelligent automation of computer software test scripts and code requirements
US20180165068A1 (en) * 2016-12-12 2018-06-14 Sap Se Generation and usage of language-converted script
CN108345531A (en) * 2017-01-23 2018-07-31 阿里巴巴集团控股有限公司 A kind of test method, apparatus and system
US20180293157A1 (en) * 2017-04-10 2018-10-11 Fmr Llc Automated script creation and source code generation for testing mobile devices
CN108459852A (en) * 2018-01-30 2018-08-28 美通云动(北京)科技有限公司 Script processing method and device, storage medium, electronic equipment
CN109086199A (en) * 2018-06-22 2018-12-25 网宿科技股份有限公司 A kind of automation generates the method for test script, terminal and can storage medium
CN109213676A (en) * 2018-07-06 2019-01-15 中国电力科学研究院有限公司 A kind of offline adjustment method and device for test script
CN109101231A (en) * 2018-08-07 2018-12-28 百度在线网络技术(北京)有限公司 Scripted code generation method, device, computer equipment and storage medium
CN109189680A (en) * 2018-08-24 2019-01-11 苏州玩友时代科技股份有限公司 A kind of system and method for application publication and configuration
CN110688142A (en) * 2019-10-10 2020-01-14 星环信息科技(上海)有限公司 Method, device and storage medium for publishing application programming interface

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
HAODE LIAO ET AL.: "A Study of Automatic Code Generation", IEEE, 4 February 2011 (2011-02-04), pages 689 - 691 *
廖灿灿等: "Matlab Coder生成C代码的研究与应用", 计算机与现代化, no. 3, 15 March 2013 (2013-03-15), pages 175 - 183 *
林惠娟等: "脚本自动生成测试系统的设计与实现", 四川大学学报(自然科学版), vol. 43, no. 4, 28 August 2006 (2006-08-28), pages 773 - 776 *
王彩云等: "《Linux服务器管理项目教程》", 31 January 2016, 北京理工大学出版社, pages: 190 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117454847A (en) * 2023-12-26 2024-01-26 南京翼辉信息技术有限公司 Method for converting online document into offline document
CN117454847B (en) * 2023-12-26 2024-03-15 南京翼辉信息技术有限公司 Method for converting online document into offline document

Similar Documents

Publication Publication Date Title
CN109684188B (en) Test method and device
CN110232091B (en) Method, system and apparatus for synchronizing data
CN113010405A (en) Application program testing method and device
CN112015654A (en) Method and apparatus for testing
CN109828830B (en) Method and apparatus for managing containers
CN115996179A (en) Service node testing method and device, readable medium and electronic equipment
CN111324470B (en) Method and device for generating information
CN110795328A (en) Interface testing method and device
CN113407229A (en) Method and device for generating offline script
CN109840109B (en) Method and apparatus for generating software development toolkit
CN113282444A (en) Visualization method and device for business process debugging
CN116662193A (en) Page testing method and device
CN114513552B (en) Data processing method, device, equipment and storage medium
CN115454956A (en) Log generation method and device, electronic equipment and storage medium
CN111626802A (en) Method and apparatus for processing information
CN114840379A (en) Log generation method, device, server and storage medium
CN115022328A (en) Server cluster, server cluster testing method and device and electronic equipment
CN113360365B (en) Flow test method and flow test system
CN112131095B (en) Pressure testing method and device
CN113704079A (en) Interface testing method and device based on Protobuf
CN109254778B (en) Method and apparatus for deploying an information flow system
CN109840073B (en) Method and device for realizing business process
CN112395194A (en) Method and device for accessing test platform
CN113468041A (en) Interface comparison test method and device
CN112306858A (en) Test method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination