CN117009214A - Method, device and storage medium for detecting script quality - Google Patents

Method, device and storage medium for detecting script quality Download PDF

Info

Publication number
CN117009214A
CN117009214A CN202310701967.1A CN202310701967A CN117009214A CN 117009214 A CN117009214 A CN 117009214A CN 202310701967 A CN202310701967 A CN 202310701967A CN 117009214 A CN117009214 A CN 117009214A
Authority
CN
China
Prior art keywords
detection
script
compliance
robustness
detection result
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
CN202310701967.1A
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.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech 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 China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202310701967.1A priority Critical patent/CN117009214A/en
Publication of CN117009214A publication Critical patent/CN117009214A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/577Assessing vulnerabilities and evaluating computer system security

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method, a device and a storage medium for detecting script quality. The method comprises the following steps: acquiring a robustness detection reference, a safety detection reference and a compliance detection reference through variable setting; acquiring script content; extracting target data of script content; and respectively carrying out robustness detection, safety detection and compliance detection on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result. The application detects the script quality through the robustness detection, the security detection and the compliance detection, so that the script detection is more comprehensive, the execution error caused by the fact that the script is not strictly written can be reduced, the script quality is improved, the program running efficiency is improved, and the robustness detection standard, the security detection standard and the compliance detection standard are set through the variables, so that different service requirements can be met, the application range is wider, and the flexibility is stronger.

Description

Method, device and storage medium for detecting script quality
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a storage medium for detecting script quality.
Background
With the development of the internet, various application systems are more and more, and the demand for resources is more and more. With the expansion of the scale of server resources, the maintenance of the system by operation and maintenance personnel is more and more complicated. Based on this situation, various automation tools and scripts have been created, and the automation tools are channels only, and the finally realized automation operations are implemented based on shell scripts. More of the shell scripts are currently defined specifications, such as command specifications, layout specifications, file format specifications, input-output specifications, log specifications, and the like for the scripts. Therefore, execution errors due to the imprecise script writing often occur, resulting in production problems.
Disclosure of Invention
The embodiment of the application aims to provide a method, a device and a storage medium for detecting script quality, which are used for solving the problem that execution errors are easy to occur due to incomplete script quality detection in the prior art.
To achieve the above object, a first aspect of the present application provides a method for detecting script quality, the method comprising:
acquiring a robustness detection reference, a safety detection reference and a compliance detection reference through variable setting;
acquiring script content;
extracting target data of script content;
and respectively carrying out robustness detection, safety detection and compliance detection on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result.
In the embodiment of the application, the target data comprises a robustness parameter, a safety parameter and a compliance parameter, and the robustness detection, the safety detection and the compliance detection are respectively carried out on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result, wherein the steps comprise:
comparing the robustness parameter with a robustness detection reference to obtain a robustness detection result;
comparing the security parameter with a security detection reference to obtain a security detection result;
and comparing the compliance parameter with a compliance detection reference to obtain a compliance detection result.
In the embodiment of the application, comparing the robustness parameter with a robustness detection reference to obtain a robustness detection result comprises the following steps:
judging whether the input parameters of the script accord with preset input parameter references or not;
judging whether the script contains preset execution environment parameters or not;
judging whether the script contains preset environment compatibility checking parameters or not;
and under the condition that the input parameters of the script accord with the preset input parameter standard, the script comprises the preset execution environment parameters and the script comprises the preset environment compatibility checking parameters, judging that the robustness detection of the script is qualified.
In the embodiment of the application, comparing the security parameter with the security detection reference to obtain the security detection result comprises the following steps:
judging whether a target variable of the script is defined or not;
and in the case that the target variable of the script is defined, judging that the security detection of the script is qualified.
In the embodiment of the application, comparing the compliance parameter with the compliance detection standard to obtain a compliance detection result comprises the following steps:
judging whether a log output file of the script is defined or not;
judging whether the script has an execution result detection command or not;
and in the case that the log output file of the script is defined and the script has an execution result detection command, judging that the compliance detection of the script is qualified.
In an embodiment of the present application, the method further includes:
and outputting a target detection report according to the robustness detection result, the safety detection result and the compliance detection result.
In the embodiment of the application, outputting the target detection report according to the robustness detection result, the safety detection result and the compliance detection result comprises the following steps:
under the condition that the compliance detection result is qualified, listing key contents;
listing non-compliance content under the condition that the compliance detection result is unqualified;
and generating a target detection report according to the robustness detection result and the security detection result and key content or non-compliance content in the compliance detection result.
A second aspect of the present application provides an apparatus for detecting script quality, the apparatus comprising:
a memory configured to store instructions; and
a processor configured to invoke the instructions from the memory and when executing the instructions is capable of implementing a method for detecting script quality according to the above.
A third aspect of the application provides a machine-readable storage medium having stored thereon instructions which, when executed by a processor, cause the processor to be configured to perform the above-described method for detecting script quality.
A fourth aspect of the application provides a computer program product comprising a computer program which, when executed by a processor, implements the method for detecting script quality described above.
According to the technical scheme, the target data of the script content are firstly extracted, then the target data are subjected to robustness detection, safety detection and compliance detection respectively to obtain the robustness detection result, the safety detection result and the compliance detection result, the script quality is detected through the robustness detection, the safety detection and the compliance detection, so that the script is detected more comprehensively, the condition that execution errors are caused by the fact that script writing is not strict can be reduced, the quality of the script is improved, the program running efficiency is improved, and the robustness detection standard, the safety detection standard and the compliance detection standard are set through variables, so that different service requirements can be met, the application range is wider, and the flexibility is stronger.
Additional features and advantages of embodiments of the application will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of embodiments of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain, without limitation, the embodiments of the application. In the drawings:
FIG. 1 schematically illustrates a flow chart of a method for detecting script quality in accordance with an embodiment of the present application;
FIG. 2 schematically illustrates a flow chart of a method for detecting script quality in accordance with another embodiment of the present application;
FIG. 3 schematically illustrates a flowchart of a method for detecting script quality, in accordance with a particular embodiment of the present application;
FIG. 4 schematically shows a block diagram of an apparatus for detecting script quality in accordance with an embodiment of the present application;
fig. 5 schematically shows an internal structural view of a computer device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the detailed description described herein is merely for illustrating and explaining the embodiments of the present application, and is not intended to limit the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that, if directional indications (such as up, down, left, right, front, and rear … …) are included in the embodiments of the present application, the directional indications are merely used to explain the relative positional relationship, movement conditions, etc. between the components in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indications are correspondingly changed.
In addition, if there is a description of "first", "second", etc. in the embodiments of the present application, the description of "first", "second", etc. is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present application.
FIG. 1 schematically illustrates a flow chart of a method for detecting script quality in accordance with an embodiment of the present application. As shown in fig. 1, in an embodiment of the present application, a method for detecting script quality is provided, which may include the steps of:
102, acquiring a robustness detection reference, a safety detection reference and a compliance detection reference through variable setting;
104, acquiring script content;
step 106, extracting target data of script content;
and step 108, respectively performing robustness detection, safety detection and compliance detection on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result.
In the embodiment of the application, the script is an executable file written according to a certain format by using a specific descriptive language. Taking a shell script as an example, the shell script is a program file which is convenient for one-time execution and convenient for an administrator to set or manage by utilizing the function of shell command interpretation and using various commands to be put into a file in advance. Shell can be used directly on Windows/Unix/Linux and can call a number of functions inside the system to interpret the execution. The prior art defines specifications for script writing, and more often defines script writing specifications and detection of script grammar, such as command specifications, board specifications, file format specifications, input and output specifications, log specifications and the like for scripts. However, since the script contents are not checked for security and normalization, there is a possibility that a production problem occurs due to execution errors caused by the imprecise script writing. For example, when the script is executed, a certain line of execution error may be encountered, if no error is set to automatically exit, the execution of the later part of the script may be continued, and at this time, an execution problem may occur. For another example, if the rm operation is performed according to the variable while the script executes the deleted file, if the variable is not declared successful, the deleted file may be caused, thereby creating an execution problem. Therefore, the embodiment of the application performs security compliance checking on script content by setting a mode of robustness detection, security detection and compliance detection.
In the embodiment of the application, the robustness detection reference refers to a standard for judging a robustness detection result, the safety detection reference refers to a standard for judging a safety detection result, and the compliance detection reference refers to a standard for judging a compliance detection result. The variable setting refers to setting of a reference by the processor based on the input variable. The detection standard of each test is set through the variable, so that the robustness detection, the safety detection and the compliance detection are simpler and more universal. And each reference is set to be a configurable reference value in a variable form, and different service requirements can be met by adding and deleting detection references, so that the application range is wider and the flexibility is stronger.
In the embodiment of the application, the robustness detection refers to the detection of the robustness of the script, which is also called fault tolerance test, and is used for testing whether the system can automatically recover or ignore the fault to continue when the system fails. The robustness of the script, i.e., the stability of script execution. The security detection means detecting the security of the script. Compliance testing is a non-functional test method for determining whether a built system meets established standards of an organization, also referred to as "compliance testing. The target data refers to data in the script that can be compared with a preset reference. The preset reference refers to a standard for judging each item of test qualification of the script. The processor acquires input script content firstly, wherein the script content comprises target data. Thus, the processor needs to extract the required target data from the script. For example, for robustness detection of a script, the processor needs to extract robustness parameters from the script; for security detection of scripts, the processor needs to extract security parameters from the script; for compliance detection of scripts, compliance parameters need to be extracted from the script. And respectively comparing the robustness parameter, the safety parameter and the compliance parameter with respective references, namely respectively performing robustness detection, safety detection and compliance detection, and respectively obtaining a robustness detection result, a safety detection result and a compliance detection result. Thereby completing the detection of script quality. The detection results of each item can be divided into qualified and unqualified, the detection quality of script robustness detection, security detection and compliance detection can be obtained according to the detection results, and if the detection results are qualified, the quality of the detection is over-closed, otherwise, further debugging is needed.
According to the embodiment of the application, the target data of the script content is firstly extracted, and then the target data is respectively subjected to the robustness detection, the safety detection and the compliance detection to obtain the robustness detection result, the safety detection result and the compliance detection result, and the script quality is detected through the robustness detection, the safety detection and the compliance detection, so that the script is detected more comprehensively, the condition that execution errors are caused by the fact that script writing is not strict can be reduced, the quality of the script is improved, the program running efficiency is improved, and the robustness detection standard, the safety detection standard and the compliance detection standard are set through variables, so that different service requirements can be met, the application range is wider, and the flexibility is stronger.
In the embodiment of the present application, the target data may include a robustness parameter, a security parameter and a compliance parameter, and step 108 of performing robustness detection, security detection and compliance detection on the target data to obtain a robustness detection result, a security detection result and a compliance detection result may include:
comparing the robustness parameter with a robustness detection reference to obtain a robustness detection result;
comparing the security parameter with a security detection reference to obtain a security detection result;
and comparing the compliance parameter with a compliance detection reference to obtain a compliance detection result.
In an embodiment of the present application, the target data of the script may include a robustness parameter for robustness detection, a security parameter for security detection, and a compliance parameter for compliance detection. The robustness parameters may include, among other things, input parameters, execution environment parameters, and compatibility environment parameters. The security parameters may include target variables. The compliance parameters may include log output files and execution result commands. Each test corresponds to a word reference, the robustness detection includes a robustness detection reference, the security detection includes a security detection reference, and the compliance detection includes a compliance detection reference. The processor compares the robustness parameter with a robustness detection reference, compares the security parameter with a security detection reference, and compares the compliance parameter with a compliance detection reference, so that a robustness detection result, a security detection result and a compliance detection result can be obtained respectively. By comparing the parameters with the reference, the quality detection of the script is simpler and more universal, and the accuracy is higher.
In the embodiment of the present application, comparing the robustness parameter with the robustness detection reference to obtain the robustness detection result may include:
judging whether the input parameters of the script accord with preset input parameter references or not;
judging whether the script contains preset execution environment parameters or not;
judging whether the script contains preset environment compatibility checking parameters or not;
and under the condition that the input parameters of the script accord with the preset input parameter standard, the script comprises the preset execution environment parameters and the script comprises the preset environment compatibility checking parameters, judging that the robustness detection of the script is qualified.
In embodiments of the present application, the robustness detection may include input parameter detection, execution environment parameter detection, and environment compatibility detection.
The input parameter detection means that before executing the script, the processor first checks the input parameter to determine whether the input parameter matches with a preset input parameter reference, i.e. whether the input parameter meets the preset input parameter reference. For example, it is determined whether the number of input parameters is correct, whether the format meets the requirements, or the like. And under the condition that the input parameters of the script accord with the preset input parameter standard, the input parameters are qualified in detection.
The execution environment parameter detection refers to determining whether the script contains preset execution environment parameters. For example, assuming that the preset execution environment parameter is set-e, it is determined whether the script contains set-e, i.e., when the command return value is not 0, the execution of the script is immediately exited. This parameter can help to capture errors in time and avoid further problems caused by the erroneous continued execution. And under the condition that the script contains the preset execution environment parameters, judging that the execution environment parameters of the script are qualified in detection.
The environmental compatibility detection refers to judging whether the script contains preset environmental compatibility checking parameters. Because of the differences in commands (e.g., shell commands) and function support under different systems and environments, it is necessary to add related environmental compatibility checks to the script to ensure portability and stability of the script. For example, the name of the current system may be obtained using the uneme command and a determination may be made as to whether the system supports a particular command or option. And under the condition that the script contains preset environment compatibility checking parameters, the script indicates that the environment compatibility of the script is qualified in detection.
And under the condition that the input parameter detection, the execution environment parameter detection and the environment compatibility detection are all qualified, judging that the robustness detection of the script is qualified. The embodiment of the application can detect the robustness of the script more comprehensively, conveniently and efficiently through input parameter detection, execution environment parameter detection and environment compatibility checking parameter detection.
In the embodiment of the present application, comparing the security parameter with the security detection reference to obtain the security detection result may include:
judging whether a target variable of the script is defined or not;
and in the case that the target variable of the script is defined, judging that the security detection of the script is qualified.
In an embodiment of the application, the security detection includes a variable presence check. Before using a certain variable, i.e. a target variable, in the script, the processor may first determine whether the target variable has been defined and the magnitude, and in the case that the target variable of the script has been defined, determine that the security test of the script is acceptable. Through the variable existence check, the safety detection of the script can be more convenient and efficient.
In the embodiment of the present application, comparing the compliance parameter with the compliance detection standard to obtain the compliance detection result may include:
judging whether a log output file of the script is defined or not;
judging whether the script has an execution result detection command or not;
and in the case that the log output file of the script is defined and the script has an execution result detection command, judging that the compliance detection of the script is qualified.
In embodiments of the present application, compliance detection may include log output file detection and execution result command detection.
Log output file detection refers to determining whether a log output file of a script has been defined. For errors that may occur, it is necessary to add a corresponding error handling code in the script and output the relevant information to the log file for subsequent investigation. Therefore, in the case where the log output file of the script has been defined, it can be determined that the log output file of the script is qualified for detection.
The execution result command detection refers to judging whether the script has an execution result detection command. The execution result detection command may be through a special variable $? And acquiring an execution result of the last command, defining a judging process as a function, and judging the result by referring to the functions at different key positions by the script. And when the script has the execution result detection command, judging that the execution result command of the script is qualified in detection.
And under the condition that the log output file detection and the execution result command detection of the script are both qualified, judging that the compliance detection result of the script is qualified. The embodiment of the application can detect the compliance of the script more comprehensively, conveniently and efficiently through the detection of the log output file and the detection of the execution result command.
Fig. 2 schematically shows a flow chart of a method for detecting script quality according to another embodiment of the application. In another embodiment of the present application, as shown in fig. 2, the method may further include:
and 110, outputting a target detection report according to the robustness detection result, the safety detection result and the compliance detection result.
In the embodiment of the application, the processor can output the target detection report according to the robustness detection result, the safety detection result and the compliance detection result. The target detection report is a detection report obtained according to the requirements of users. The processor can generate a corresponding target detection report according to the template selected by the user, so that the method has higher flexibility and interactivity. The target detection report can display each detection result, pass or fail respectively, and give comprehensive evaluation, so that a user can know the quality detection result of the current script more clearly and intuitively.
In the embodiment of the present application, outputting the target detection report according to the robustness detection result, the security detection result, and the compliance detection result may include:
under the condition that the compliance detection result is qualified, listing key contents;
listing non-compliance content under the condition that the compliance detection result is unqualified;
and generating a target detection report according to the robustness detection result and the security detection result and key content or non-compliance content in the compliance detection result.
In the embodiment of the application, the output result of the target detection report is the output of three types of detection. The target detection report may first detect whether the script is compliant. Under the condition that the compliance detection result is qualified, listing key contents; and if the compliance detection result is unqualified, listing the unqualified content. And generating a target detection report according to the results of the security detection and the robustness detection. Through the mode, the target detection report can be more visual and clear.
Fig. 3 schematically shows a flow chart of a method for detecting script quality according to a specific embodiment of the application. As shown in fig. 3, in a specific embodiment, a method for detecting script quality is provided, which may include the steps of:
s301, performing robustness check (namely robustness detection) on the script;
s302, judging whether the robustness check passes, if so, entering a step S303, otherwise, entering a step S408;
s303, performing definition variable inspection (namely security detection) on the script;
s304, judging whether the definition variable passes the check, if so, entering step S305, otherwise, entering step S308;
s305, performing key result judgment and check (namely compliance detection) on the script;
s306, judging whether the key result judgment check passes, if so, entering a step S307, otherwise, entering a step S308;
s307, outputting a detection result;
s308, ending.
In the implementation of the application, the script can be subjected to robustness detection, and security detection is entered under the condition that the robustness detection passes; entering compliance detection if the security detection passes; if the compliance detection is also passed, the detection result is output, and the detection is ended. In case the robustness detection, the security detection or the compliance detection fails, the current detection is ended.
It should be noted that, this embodiment is only one of the methods for detecting script quality. The embodiment of the application can also change the detection sequence, and can also output a detection report after the next detection is carried out under the condition that each test fails. The actual detection process can be set according to the requirements of operators.
It should be understood that, although the steps in the flowcharts described above are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described above may include a plurality of sub-steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with at least a part of the sub-steps or stages of other steps or other steps.
Fig. 4 schematically shows a block diagram of an apparatus for detecting script quality according to an embodiment of the present application. As shown in fig. 4, an embodiment of the present application provides an apparatus for detecting script quality, which may include:
a memory 410 configured to store instructions; and
processor 420 is configured to invoke instructions from memory 410 and when executing instructions can implement a method for detecting script quality in accordance with the above.
Specifically, in one embodiment of the application, the processor 420 may be configured to:
acquiring a robustness detection reference, a safety detection reference and a compliance detection reference through variable setting;
acquiring script content;
extracting target data of script content;
and respectively carrying out robustness detection, safety detection and compliance detection on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result.
Further, the processor 420 may be further configured to:
respectively carrying out robustness detection, safety detection and compliance detection on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result, wherein the steps include:
comparing the robustness parameter with a robustness detection reference to obtain a robustness detection result;
comparing the security parameter with a security detection reference to obtain a security detection result;
and comparing the compliance parameter with a compliance detection reference to obtain a compliance detection result.
Further, the processor 420 may be further configured to:
comparing the robustness parameter with a robustness detection reference to obtain a robustness detection result comprises:
judging whether the input parameters of the script accord with preset input parameter references or not;
judging whether the script contains preset execution environment parameters or not;
judging whether the script contains preset environment compatibility checking parameters or not;
and under the condition that the input parameters of the script accord with the preset input parameter standard, the script comprises the preset execution environment parameters and the script comprises the preset environment compatibility checking parameters, judging that the robustness detection of the script is qualified.
Further, the processor 420 may be further configured to:
comparing the security parameter with a security detection reference to obtain a security detection result includes:
judging whether a target variable of the script is defined or not;
and in the case that the target variable of the script is defined, judging that the security detection of the script is qualified.
Further, the processor 420 may be further configured to:
comparing the compliance parameter with a compliance detection benchmark to obtain a compliance detection result comprises:
judging whether a log output file of the script is defined or not;
judging whether the script has an execution result detection command or not;
and in the case that the log output file of the script is defined and the script has an execution result detection command, judging that the compliance detection of the script is qualified.
Further, the processor 420 may be further configured to:
and outputting a target detection report according to the robustness detection result, the safety detection result and the compliance detection result.
Further, the processor 420 may be further configured to:
outputting the target detection report according to the robustness detection result, the safety detection result and the compliance detection result comprises:
under the condition that the compliance detection result is qualified, listing key contents;
listing non-compliance content under the condition that the compliance detection result is unqualified;
and generating a target detection report according to the robustness detection result and the security detection result and key content or non-compliance content in the compliance detection result.
According to the technical scheme, the target data of the script content are firstly extracted, then the target data are subjected to robustness detection, safety detection and compliance detection respectively to obtain the robustness detection result, the safety detection result and the compliance detection result, the script quality is detected through the robustness detection, the safety detection and the compliance detection, so that the script is detected more comprehensively, the condition that execution errors are caused by the fact that script writing is not strict can be reduced, the quality of the script is improved, the program running efficiency is improved, and the robustness detection standard, the safety detection standard and the compliance detection standard are set through variables, so that different service requirements can be met, the application range is wider, and the flexibility is stronger.
Embodiments of the present application also provide a machine-readable storage medium having instructions stored thereon, which when executed by a processor, cause the processor to be configured to perform the above-described method for detecting script quality.
Fig. 5 schematically shows an internal structural view of a computer device according to an embodiment of the present application. As shown in fig. 5, in one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 5. The computer apparatus includes a processor a01, a network interface a02, a display screen a04, an input device a05, and a memory (not shown in the figure) which are connected through a system bus. Wherein the processor a01 of the computer device is adapted to provide computing and control capabilities. The memory of the computer device includes an internal memory a03 and a nonvolatile storage medium a06. The nonvolatile storage medium a06 stores an operating system B01 and a computer program B02. The internal memory a03 provides an environment for the operation of the operating system B01 and the computer program B02 in the nonvolatile storage medium a06. The network interface a02 of the computer device is used for communication with an external terminal through a network connection. The computer program is executed by the processor a01 to implement a method for detecting script quality. The display screen a04 of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device a05 of the computer device may be a touch layer covered on the display screen, or may be a key, a track ball or a touch pad arranged on a casing of the computer device, or may be an external keyboard, a touch pad or a mouse.
It will be appreciated by those skilled in the art that the structure shown in FIG. 5 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
The embodiments of the present application also provide a computer program product comprising a computer program adapted to perform, when executed on a data processing apparatus, an initialization of the program with the method steps of:
in one embodiment, script content is obtained; extracting target data of script content; and respectively carrying out robustness detection, safety detection and compliance detection on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result.
In one embodiment, the robustness detection reference, the security detection reference, and the compliance detection reference are obtained by variable settings.
In one embodiment, the robustness parameter is compared with a robustness detection reference to obtain a robustness detection result; comparing the security parameter with a security detection reference to obtain a security detection result; and comparing the compliance parameter with a compliance detection reference to obtain a compliance detection result.
In one embodiment, whether the input parameters of the script meet preset input parameter references is judged; judging whether the script contains preset execution environment parameters or not; judging whether the script contains preset environment compatibility checking parameters or not; and under the condition that the input parameters of the script accord with the preset input parameter standard, the script comprises the preset execution environment parameters and the script comprises the preset environment compatibility checking parameters, judging that the robustness detection of the script is qualified.
In one embodiment, a determination is made as to whether a target variable of the script has been defined; and in the case that the target variable of the script is defined, judging that the security detection of the script is qualified.
In one embodiment, a determination is made as to whether a log output file of the script has been defined; judging whether the script has an execution result detection command or not; and in the case that the log output file of the script is defined and the script has an execution result detection command, judging that the compliance detection of the script is qualified.
In one embodiment, the target detection report is output based on the robustness detection result, the security detection result, and the compliance detection result.
In one embodiment, in the event that the compliance detection results are acceptable, listing the key content; listing non-compliance content under the condition that the compliance detection result is unqualified; and generating a target detection report according to the robustness detection result and the security detection result and key content or non-compliance content in the compliance detection result.
According to the technical scheme, the target data of the script content are firstly extracted, then the target data are subjected to robustness detection, safety detection and compliance detection respectively to obtain the robustness detection result, the safety detection result and the compliance detection result, the script quality is detected through the robustness detection, the safety detection and the compliance detection, so that the script is detected more comprehensively, the condition that execution errors are caused by the fact that script writing is not strict can be reduced, the quality of the script is improved, the program running efficiency is improved, and the robustness detection standard, the safety detection standard and the compliance detection standard are set through variables, so that different service requirements can be met, the application range is wider, and the flexibility is stronger.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer-readable media include both permanent and non-permanent, removable and non-removable media, and information storage may be implemented by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (10)

1. A method for detecting script quality, the method comprising:
acquiring a robustness detection reference, a safety detection reference and a compliance detection reference through variable setting;
acquiring script content;
extracting target data of the script content;
and respectively carrying out robustness detection, safety detection and compliance detection on the target data to obtain a robustness detection result, a safety detection result and a compliance detection result.
2. The method of claim 1, wherein the target data includes a robustness parameter, a security parameter, and a compliance parameter, and wherein the performing the robustness detection, the security detection, and the compliance detection on the target data, respectively, to obtain a robustness detection result, a security detection result, and a compliance detection result includes:
comparing the robustness parameter with the robustness detection reference to obtain a robustness detection result;
comparing the safety parameter with the safety detection reference to obtain a safety detection result;
and comparing the compliance parameter with the compliance detection standard to obtain a compliance detection result.
3. The method of claim 2, wherein said comparing the robustness parameter to the robustness detection reference to obtain a robustness detection result comprises:
judging whether the input parameters of the script accord with preset input parameter references or not;
judging whether the script contains preset execution environment parameters or not;
judging whether the script contains preset environment compatibility checking parameters or not;
and under the condition that the input parameters of the script accord with the preset input parameter standard, the script comprises preset execution environment parameters and the script comprises preset environment compatibility checking parameters, judging that the robustness detection of the script is qualified.
4. The method of claim 2, wherein said comparing the security parameter to the security detection reference to obtain a security detection result comprises:
judging whether a target variable of the script is defined or not;
and under the condition that the target variable of the script is defined, judging that the security detection of the script is qualified.
5. The method of claim 2, wherein comparing the compliance parameter to the compliance detection reference to obtain a compliance detection result comprises:
judging whether a log output file of the script is defined or not;
judging whether the script has an execution result detection command or not;
and judging that the compliance detection of the script is qualified when the log output file of the script is defined and the script has an execution result detection command.
6. The method according to claim 1, wherein the method further comprises:
and outputting a target detection report according to the robustness detection result, the safety detection result and the compliance detection result.
7. The method of claim 6, wherein the outputting a target detection report based on the robustness detection result, the security detection result, and the compliance detection result comprises:
listing key contents under the condition that the compliance detection result is qualified;
listing non-compliance content under the condition that the compliance detection result is unqualified;
and generating the target detection report according to the robustness detection result and the security detection result and key content or non-compliance content in the compliance detection result.
8. An apparatus for detecting script quality, the apparatus comprising:
a memory configured to store instructions; and
a processor configured to invoke the instructions from the memory and when executing the instructions is capable of implementing the method for detecting script quality according to any of claims 1 to 7.
9. A machine-readable storage medium having instructions stored thereon, which when executed by a processor, cause the processor to be configured to perform the method for detecting script quality according to any of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the method for detecting script quality according to any of claims 1 to 7.
CN202310701967.1A 2023-06-13 2023-06-13 Method, device and storage medium for detecting script quality Pending CN117009214A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310701967.1A CN117009214A (en) 2023-06-13 2023-06-13 Method, device and storage medium for detecting script quality

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310701967.1A CN117009214A (en) 2023-06-13 2023-06-13 Method, device and storage medium for detecting script quality

Publications (1)

Publication Number Publication Date
CN117009214A true CN117009214A (en) 2023-11-07

Family

ID=88573531

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310701967.1A Pending CN117009214A (en) 2023-06-13 2023-06-13 Method, device and storage medium for detecting script quality

Country Status (1)

Country Link
CN (1) CN117009214A (en)

Similar Documents

Publication Publication Date Title
CN110764945B (en) Crash log processing method, device, equipment and storage medium
CN110851351A (en) Deployment environment testing method and device, computer equipment and storage medium
CN111124870A (en) Interface testing method and device
CA2811617C (en) Commit sensitive tests
CN115658529A (en) Automatic testing method for user page and related equipment
CN115904989A (en) Interface testing method, device, equipment and readable storage medium
CN111274130A (en) Automatic testing method, device, equipment and storage medium
CN110704311A (en) Application program testing method and device, electronic equipment and readable storage medium
CN113918465A (en) Compatibility testing method and device, electronic equipment and readable storage medium
KR20140088963A (en) System and method for testing runtime error
CN110888641B (en) Script automatic generation method and device, server and storage medium
CN117009214A (en) Method, device and storage medium for detecting script quality
CN113805861B (en) Code generation method based on machine learning, code editing system and storage medium
CN115757099A (en) Automatic test method and device for platform firmware protection recovery function
CN110096888B (en) Method and system for accelerating verification and analyzing SMM potential safety hazard
CN110096281B (en) Code analysis method, analysis server, storage medium and device
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN112015658A (en) Method and device for generating software integration test case
CN113986517B (en) API call log acquisition method and device, electronic equipment and storage medium
CN110879783B (en) Program testing method, device, equipment and storage medium
CN111309311B (en) Vulnerability detection tool generation method, device, equipment and readable storage medium
CN111209206B (en) Automatic test method and system for software products
CN117632714A (en) Code detection method and device
CN112559370A (en) Front-end-based React project unit testing method and related equipment
CN114064341A (en) Fault disposal method and system based on emergency plan

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