CN113407229B - Method and device for generating offline scripts - Google Patents

Method and device for generating offline scripts Download PDF

Info

Publication number
CN113407229B
CN113407229B CN202010184816.XA CN202010184816A CN113407229B CN 113407229 B CN113407229 B CN 113407229B CN 202010184816 A CN202010184816 A CN 202010184816A CN 113407229 B CN113407229 B CN 113407229B
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.)
Active
Application number
CN202010184816.XA
Other languages
Chinese (zh)
Other versions
CN113407229A (en
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010184816.XA priority Critical patent/CN113407229B/en
Publication of CN113407229A publication Critical patent/CN113407229A/en
Application granted granted Critical
Publication of CN113407229B publication Critical patent/CN113407229B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Landscapes

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

Abstract

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

Description

Method and device for generating offline scripts
Technical Field
Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method and apparatus for generating an offline script.
Background
In the process of providing online service, the online system can be iteratively upgraded, and the offline data used by the online system is continuously updated. Offline data may be dynamically loaded by the online system and validated on-line. Such dynamically loaded offline data, typically produced by offline batch task offline scripts, is pushed to the online system via a variety of 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, embodiments of the present disclosure provide a method for generating an offline script, the method comprising: generating an initial offline script file based on a script code template and a script configuration template, wherein the initial offline script file comprises a script code file and a script configuration file; testing script code files and script configuration files included in the initial offline script files in parallel; and marking the initial offline script file as a target offline script file in response to the test results of the script code file and the script configuration file being normal, wherein the target offline script file is used for an online system.
In some embodiments, generating the 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; responding to detection of a confirmation instruction 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 input information in the script code template and input information in the script configuration template; and establishing the association 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, embodiments of the present disclosure provide a method for invoking an offline script, the method comprising: responding to an offline script calling instruction sent by an online system, and acquiring a target offline script file indicated by the offline script calling instruction; controlling the target offline script file to run on the first device, and monitoring the running state of the first device in real time; and in response to detecting that the running state is a fault, migrating the target offline script file to the second device to continue running.
In some embodiments, the target offline script file includes a script code file and a script configuration file, and the migrating the target offline script file to the second device continues to run, including: 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, embodiments of the present disclosure provide an apparatus for generating an offline script, the apparatus 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 included in the initial offline script file in parallel; and the target offline script file acquisition unit is used for responding to the normal test results of the script code file and the script configuration file and is configured to mark 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 initial offline script file generating unit includes: a template display subunit configured to display a script code template and a script configuration template in response to detecting the script generation request; a file generation subunit, responsive to detecting a confirmation instruction corresponding to the script code template and the script configuration template, configured to generate a script code file and a script configuration file according to input information in the script code template and input information in the script configuration template, respectively; and the initial offline script file establishing subunit is configured to establish the association relation 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 code information to be processed and configuration information to be processed from the current offline script file; and the file generation unit is configured to respectively import 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 fourth aspect, embodiments of the present disclosure provide an apparatus for invoking an offline script, the apparatus comprising: the file acquisition unit is used for responding to the offline script calling instruction sent by the online system and is configured to acquire a target offline script file indicated by the offline script calling instruction; an operation control unit 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; and the file migration unit is used for migrating the target offline script file to the second equipment to continue to operate in response to the detection that the operation state is a fault.
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, embodiments of the present disclosure provide an electronic device, comprising: one or more processors; and 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, embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method for generating an offline script of the first aspect or the method for invoking an offline script of the second aspect described above.
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 offline 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 through the script code template and the script configuration template can normally run, and the initial offline script file is marked as a target offline script file which can accept the call of the online system. Therefore, the flexibility and the reliability of the operation of the target offline script file are improved, and the operation stability of the online system is improved.
Drawings
Other features, objects and advantages of the present disclosure will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings:
FIG. 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
FIG. 2 is a flow chart 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 chart of one embodiment of a method for invoking offline scripts in accordance with the present disclosure;
FIG. 5 is a schematic structural diagram of one embodiment of an apparatus for generating offline scripts in accordance with the present disclosure;
FIG. 6 is a schematic diagram of an 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 drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that, without conflict, the embodiments of the present disclosure and features of the embodiments may be combined with each other. 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 offline scripts or an apparatus for generating offline scripts 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 is used as a medium to provide communication links between the terminal devices 101, 102, 103, the off-line server 105 and the on-line server 106. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the offline server 105 and the online server 106 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping class application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 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 smartphones, tablet computers, laptop and desktop computers, and the like. When the terminal devices 101, 102, 103 are software, they can be installed in the above-listed electronic devices. Which may be implemented as multiple software or software modules (e.g., to provide distributed services), or as a single software or software module, without limitation.
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 to cause the online system to provide online services for the terminal devices 101, 102, 103.
The presence server 106 may be a server on which a presence system is installed and which provides various presence services to the terminal devices 101, 102, 103.
It should be noted that, the method for generating an offline script provided by the embodiments of the present disclosure is generally performed by the offline server 105, and accordingly, the apparatus for generating an offline script is generally disposed in the offline server 105.
The server may be hardware or software. When the server is hardware, the server may be implemented as a distributed server cluster formed by a plurality of 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 a distributed service), or may be implemented as a single software or software module, which is not specifically limited 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 implementation.
With continued reference to fig. 2, a flow 200 of one embodiment of a method for generating offline scripts 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 a 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 as required by the script code template and the script configuration template. It should be noted that the wireless connection may include, but is not limited to, 3G/4G connection, wiFi connection, bluetooth connection, wiMAX connection, zigbee connection, UWB (Ultra Wideband) connection, and other now known or later developed wireless connection.
Existing offline script files vary according to the online system to which they are applied. And the offline script file needs to call the resources on the device in use, so that hard coding exists. Once the device fails, the offline script file may not call resources, thereby disabling the online system from operating properly. After the offline script file is generated, the code information and the configuration information in the offline script file exist in the same file, so that the parallel test of the code information and the configuration information cannot be performed, and the test efficiency is not high. When the offline script file is called by an online system, the offline script file needs to be called according to a timing program, so that an operation fault cannot be found timely; because the existing offline script file contains both code information and configuration information, and the code information and the configuration information are hard coded. Therefore, the offline script file is not easy to migrate to other devices in time and then normally run when the offline script file runs out of order.
To this end, the execution subject 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 configuration information of the offline script file into a script configuration file. Thereafter, the execution body may 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.
And 202, testing the script code file and the script configuration file included in the initial offline script file in parallel.
After the two files, namely 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. Thus, the test efficiency of the initial offline script file can be improved.
And 203, marking the initial offline script file as a target offline script file in response to the test results of the script code file and the script configuration file being normal.
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 through the script code template and the script configuration template can be combined to form an initial offline script file, so that corresponding functions are realized, and the test can be independently performed to complete the independent functions. At this time, the execution subject may mark the initial offline script file as the target offline script file. That is, the target offline script file described above may be used in an online system.
With continued reference to fig. 3, a flow 300 of one embodiment of a method for generating offline scripts in accordance with the present disclosure is shown. The method for generating the offline script comprises the following steps:
in response to detecting the script generation request, a script code template and a script configuration template are displayed, step 301.
In this embodiment, an execution subject of a 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 a technician edits an offline script file, a script generation request may be issued to an execution subject. The execution body may display the script code template and the script configuration template according to the script generation request so that a technician edits the 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 according to the needs of the current service. The updated online system may or may not be the same type of online data as the previous online system process. When the updated online system is different from the online data types processed by the previous online system, in order to adapt to the needs of the online system, when the online data types of the online system are changed, the execution subject can generate the initial offline script file according to the online data types. The execution body may modify the script code template and the script configuration template according to the online data type, so that the script code file and the script configuration file obtained based on the script code template and the script configuration template satisfy the requirement of the online data type.
Step 302, responding to the detection of the confirmation instruction 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;
When the technician edits the corresponding code information and configuration information through the script code template and the script configuration template, a confirmation instruction may be sent to the execution subject. The confirmation instruction can be sent through a script code template, a completion key on a script configuration template and the like. After receiving the confirmation instruction, the execution main body can respectively 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.
And 303, establishing the association relation 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 relation between the script code file and the script configuration file to obtain an initial offline script file. Since the script code file and the script configuration file are generated by the script code template and the script configuration template, respectively, the script code template and the script configuration template are corresponding relations. Accordingly, 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 relation is established, the script code file and the script configuration file can be combined into an initial offline script file, so that corresponding functions are realized.
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 step 202 and will not be described in detail here.
And step 305, marking the initial offline script file as a target offline script file in response to the test results of the script code file and the script configuration file being normal.
The content of step 305 is the same as that of step 203, and will not be described in detail here.
In some optional implementations of this embodiment, the method may further include the steps of:
and the first step, acquiring the code information to be processed and the configuration information to be processed from the current offline script file.
In order to improve the efficiency of acquiring the offline script, the existing script can be directly converted into the initial offline script file of the application. For this purpose, the execution body may acquire the code information to be processed and the configuration information to be processed from the current offline script file.
And step two, 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.
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 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, wherein 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 offline 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 through the script code template and the script configuration template can normally run, and the initial offline script file is marked as a target offline script file which can accept the call of the online system. Therefore, the flexibility and the reliability of the operation of the target offline script file are improved, and the operation stability of the online system is improved.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a method for invoking offline scripts is shown. The process 400 of the method for invoking offline scripts includes the steps of:
step 401, in response to receiving an offline script calling instruction sent by the online system, acquiring a target offline script file indicated by the offline script calling instruction.
In this embodiment, the execution body (for example, the offline server 105 shown in fig. 1) of the method for invoking the offline script may receive the offline script invoking instruction sent by the online system through a wired connection manner or a wireless connection manner.
The execution body and the online server 106 establish a data connection through the network 104. When the online server 106 needs to call an offline script file on the execution body, an offline script call instruction may be sent to the execution body. And the execution main body acquires the corresponding target offline script file according to the offline script calling instruction.
And 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 body may control the target offline script file to run on the first device such that the online system provides the online service. In this process, the execution body may monitor the operation state of the first device in real time.
And step 403, in response to detecting that the running state is a fault, migrating the target offline script file to the second device to continue running.
And when the operation state is detected to be a fault, the target offline script file cannot normally operate on the first device. The execution body may migrate the target offline script file to the second device for continued operation. The second device may provide the resources required for normal operation for the target offline script file. Thus, 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 implementations of this embodiment, the migrating the target offline script file to the second device to continue 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 the script configuration file needs to acquire resource path information when a resource is called on the first device. When migrating a target offline script file to a second device, the path of resources required by the script configuration file may be different from the path of resources on the first device. For this, 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 foregoing 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 is particularly applicable 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. Wherein, the initial offline script file generating unit 501 is configured to generate an initial offline script file based on the script code template and the script configuration template, where the initial offline script file includes a script code file and a script configuration file; a test 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 is configured to mark the initial offline script file as a target offline script file for use in the online system in response to the test results of the script code file and the script configuration file being normal.
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 is configured to display a script code template and a script configuration template in response to detecting the script generation request; a file generation subunit, responsive to detecting a confirmation instruction corresponding to the script code template and the script configuration template, configured to generate a script code file and a script configuration file according to input information in the script code template and input information in the script configuration template, respectively; and the initial offline script file establishing subunit is configured to establish the association relation between the script code file and the script configuration file to obtain an initial offline script file.
In some optional implementations of this embodiment, the apparatus 500 for generating an offline script may include: a data type obtaining unit (not shown in the figure) configured to obtain an online data type of a current online system, and generate the initial offline script file according to the online data type.
In some optional implementations of this embodiment, the apparatus 500 for generating an offline script may include: an information extraction unit (not shown in the figure) and a file generation unit (not shown in the figure). The information extraction unit is configured to acquire code information to be processed and configuration information to be processed from the current offline script file; and the file generation unit is configured to respectively import 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.
With further reference to fig. 6, as an implementation of the method shown in the foregoing figures, the present disclosure provides an embodiment of an apparatus for invoking offline scripts, where the apparatus embodiment corresponds to the method embodiment shown in fig. 4, and the apparatus may be specifically applied in various electronic devices.
As shown in fig. 6, the apparatus 600 for invoking an offline script of the present embodiment may include: a file acquisition unit 601, a running control unit 602, and a file migration unit 603. The file obtaining unit 601 is configured to obtain a target offline script file indicated by an offline script call instruction in response to receiving the offline script call instruction sent by the online system; an operation control unit 602 configured to control the target offline script file to operate on the first device, and monitor an operation state of the first device in real time; the file migration unit 603 is configured to migrate the target offline script file to the second device to continue operation in response to detecting that the operation state is a failure.
In some optional implementations 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 in the figure) configured to modify the script configuration file of the target offline script file according to the resource information of the second device.
The embodiment also provides an electronic device, including: one or more processors; and 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 or the method for invoking an offline script.
The present embodiment also provides a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements the above-described method for generating an offline script or method for invoking an offline script.
Referring now to FIG. 7, there is illustrated a schematic diagram of a computer system 700 suitable for use with an electronic device (e.g., offline server 105 of FIG. 1) for implementing embodiments of the present disclosure. The electronic device shown in fig. 7 is only one example and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 7, the electronic device 700 may include a processing means (e.g., a central processor, a graphics processor, etc.) 701, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage means 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
In general, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; 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 shows an electronic device 700 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 7 may represent one device or a plurality of devices as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to 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 shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 709, or installed from storage 708, or installed from ROM 702. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 701.
It should be noted that, the above-mentioned computer readable medium according to the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the above-mentioned two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 an embodiment of the present 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. Whereas in embodiments of the present disclosure, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated 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 a script code template and a script configuration template, wherein the initial offline script file comprises a script code file and a script configuration file; testing script code files and script configuration files included in the initial offline script files in parallel; and marking the initial offline script file as a target offline script file in response to the test results of the script code file and the script configuration file being normal, wherein the target offline script file is used for an online system.
Computer program code for carrying out operations of embodiments of the present disclosure may be written in 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts 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 involved in the embodiments described in the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, 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 constitute a limitation on the unit itself in some cases, and for example, the target offline script file acquisition unit may also be described as "a unit for generating an offline script file required for an online system".
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention referred to in this disclosure is not limited to the specific combination of features described above, but encompasses other embodiments in which features described above or their equivalents may be combined in any way without departing from the spirit of the invention. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).

Claims (12)

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, comprising: in response to detecting the script generation request, displaying a script code template and a script configuration template; responding to detection of a confirmation instruction 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 input information in the script code template and input information in the script configuration template; establishing the association relation between the script code file and the script configuration file to obtain an initial offline script file, wherein the method comprises the following steps: forming the initial offline script file through the combination of the script code file and the script configuration file; the initial offline script file comprises a script code file and a script configuration file, the script code template is used for editing code information of the offline script file into the script code file, the script configuration template is used for editing configuration information of the offline script file into the script configuration file, and the script code file and the script configuration file can be independently tested to complete independent functions;
Testing script code files and script configuration files included in the initial offline script files in parallel;
and marking the initial offline script file as a target offline script file in response to the test results of the script code file and the script configuration file being normal, wherein the target offline script file is used for an online system.
2. The method according to 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.
3. The method according to 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.
4. A method for invoking an offline script, comprising:
In response to receiving an offline script call instruction sent by an online system, acquiring a target offline script file indicated by the offline script call instruction, wherein the target offline script file is generated based on the method of any one of claims 1-3;
controlling the target offline script file to run on the first equipment, and monitoring the running state of the first equipment in real time;
and in response to detecting that the running state is a fault, migrating the target offline script file to second equipment to continue running.
5. The method of claim 4, wherein the target offline script file comprises a script code file and a script configuration file, and
And migrating the target offline script file to the second device for continuous operation, wherein the method comprises the following steps:
And modifying the script configuration file of the target offline script file according to the resource information of the second equipment.
6. An apparatus for generating an offline script, comprising:
An initial offline script file generation unit configured to generate an initial offline script file based on a script code template and a script configuration template, comprising: a template display subunit configured to display a script code template and a script configuration template in response to detecting the script generation request; a file generation subunit, responsive to detecting a confirmation instruction corresponding to the script code template and the script configuration template, configured to generate a script code file and a script configuration file according to input information in the script code template and input information in the script configuration template, respectively; an initial offline script file establishing subunit configured to establish an association relationship between the script code file and the script configuration file, to obtain an initial offline script file, including: forming the initial offline script file through the combination of the script code file and the script configuration file; the initial offline script file comprises a script code file and a script configuration file, the script code template is used for editing code information of the offline script file into the script code file, the script configuration template is used for editing configuration information of the offline script file into the script configuration file, and the script code file and the script configuration file can be independently tested to complete independent functions;
the testing unit is configured to test the script code file and the script configuration file included in the initial offline script file in parallel;
and the target offline script file acquisition unit is configured to mark the initial offline script file as a target offline script file in response to the test results of the script code file and the script configuration file being normal, wherein the target offline script file is used for an online system.
7. The apparatus of claim 6, wherein the apparatus comprises:
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.
8. The apparatus of claim 6, wherein the apparatus comprises:
The information extraction unit is configured to acquire code information to be processed and configuration information to be processed from the current offline script file;
And the file generation unit is configured to respectively import 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.
9. An apparatus for invoking an offline script, comprising:
A file acquisition unit, in response to receiving an offline script call instruction sent by an online system, configured to acquire a target offline script file indicated by the offline script call instruction, wherein the target offline script file is generated based on the apparatus of any one of claims 6-8;
The operation control unit is configured to control the target offline script file to operate on the first device and monitor the operation state of the first device in real time;
And the file migration unit is used for migrating the target offline script file to the second equipment to continue running in response to detecting that the running state is a fault.
10. The apparatus of claim 9, wherein the target offline script file comprises 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.
11. 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-3 or the method of any of claims 4-5.
12. A computer readable medium on which a computer program is stored, characterized in that the program, when executed by a processor, implements the method of any one of claims 1 to 3 or the method of any one of claims 4 to 5.
CN202010184816.XA 2020-03-17 2020-03-17 Method and device for generating offline scripts Active CN113407229B (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN113407229A CN113407229A (en) 2021-09-17
CN113407229B true CN113407229B (en) 2024-05-14

Family

ID=77676999

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN113407229B (en)

Families Citing this family (1)

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

Citations (14)

* 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
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
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
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
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

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6687897B2 (en) * 2000-12-01 2004-02-03 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
US7877732B2 (en) * 2006-11-29 2011-01-25 International Business Machines Corporation Efficient stress testing of a service oriented architecture based application
US9916147B2 (en) * 2010-08-17 2018-03-13 International Business Machines Corporation Deployment of a tool for testing migrated applications
US9152542B2 (en) * 2013-03-14 2015-10-06 Sap Se Automatic generation of test scripts
US9317410B2 (en) * 2013-03-15 2016-04-19 International Business Machines Corporation Testing functional correctness and idempotence of software automation scripts
US10817272B2 (en) * 2016-12-12 2020-10-27 Sap Se Generation and usage of language-converted script
US10235280B2 (en) * 2017-04-10 2019-03-19 Fmr Llc Automated script creation and source code generation for testing mobile devices

Patent Citations (14)

* 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
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
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
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
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 (6)

* Cited by examiner, † Cited by third party
Title
A Study of Automatic Code Generation;Haode Liao et al.;IEEE;20110204;第689-691页 *
Haode Liao et al. .A Study of Automatic Code Generation.IEEE.2011,第689-691页. *
Matlab Coder生成C代码的研究与应用;廖灿灿等;计算机与现代化;20130315(第3期);第175-183页 *
廖灿灿等.Matlab Coder生成C代码的研究与应用.计算机与现代化.2013,(第3期),第175-183页. *
王彩云等.《Linux服务器管理项目教程》.北京理工大学出版社,2016,第190页. *
脚本自动生成测试系统的设计与实现;林惠娟等;四川大学学报(自然科学版);20060828;第43卷(第4期);第773-776页 *

Also Published As

Publication number Publication date
CN113407229A (en) 2021-09-17

Similar Documents

Publication Publication Date Title
CN110708346B (en) Information processing system and method
CN110232091B (en) Method, system and apparatus for synchronizing data
CN109684188B (en) Test method and device
CN111443909B (en) Method and device for generating page
CN110619100B (en) Method and apparatus for acquiring data
EP3846083A1 (en) Method and apparatus for parallel processing of information
CN114513552B (en) Data processing method, device, equipment and storage medium
CN113282444A (en) Visualization method and device for business process debugging
CN114840379A (en) Log generation method, device, server and storage medium
CN113407229B (en) Method and device for generating offline scripts
CN111400581B (en) System, method and apparatus for labeling samples
CN111506904B (en) Method and device for online bug repair
CN111324470B (en) Method and device for generating information
CN111787041B (en) Method and device for processing data
CN116662193A (en) Page testing method and device
CN113704079B (en) Protobuf-based interface testing method and device
CN115022328A (en) Server cluster, server cluster testing method and device and electronic equipment
CN110084298B (en) Method and device for detecting image similarity
CN112306858A (en) Test method and device and electronic equipment
CN111309323A (en) Parameter initialization method and device and electronic equipment
CN111767486A (en) Method, device, electronic equipment and computer readable medium for displaying page
CN114253520B (en) Interface code generation method and device
CN116561015B (en) Map application testing method, electronic device and computer readable medium
CN114398098B (en) Application script execution method, device, electronic equipment and computer readable medium
CN114513548B (en) Directional call information processing method and device

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
GR01 Patent grant
GR01 Patent grant