CN108388548A - Method and device for realizing script parameterization - Google Patents

Method and device for realizing script parameterization Download PDF

Info

Publication number
CN108388548A
CN108388548A CN201810157340.3A CN201810157340A CN108388548A CN 108388548 A CN108388548 A CN 108388548A CN 201810157340 A CN201810157340 A CN 201810157340A CN 108388548 A CN108388548 A CN 108388548A
Authority
CN
China
Prior art keywords
character string
encoded
parameterized
script
target
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.)
Granted
Application number
CN201810157340.3A
Other languages
Chinese (zh)
Other versions
CN108388548B (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.)
Inspur Software Co Ltd
Original Assignee
Inspur Software Group 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 Inspur Software Group Co Ltd filed Critical Inspur Software Group Co Ltd
Priority to CN201810157340.3A priority Critical patent/CN108388548B/en
Publication of CN108388548A publication Critical patent/CN108388548A/en
Application granted granted Critical
Publication of CN108388548B publication Critical patent/CN108388548B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities

Abstract

The invention provides a method and a device for realizing script parameterization, wherein the method comprises the following steps: determining an encoded original character string from an encoded script to be parameterized, wherein the original character string comprises a parameterized object; acquiring at least one target object corresponding to the parameterized object; decoding the encoded original character string to generate an original character string; identifying each parameterized object from the original string; for each parameterized object, performing: identifying an encoded target character string corresponding to the current parameterized object from the encoded original character string; generating an encoded replacement character string corresponding to each target object according to the current parameterized object; and replacing the encoded target character string in the encoded script to be parameterized with a replacement parameter, wherein the replacement parameter can take a value of any one of at least one encoded replacement character string. The invention can improve the speed of realizing script parameterization.

Description

A kind of method and device for realizing script argument
Technical field
The present invention relates to field of computer technology, more particularly to a kind of method and device for realizing script argument.
Background technology
Existing script is usually the script after coding, has unreadable property, such as:It is compiled by Base64 Code.During using script, it is often necessary to be replaced certain part in script.How to the script after this coding In partial content be replaced, realize that the parametrization of script is urgent problem.
In the prior art, the parametrization of script is completed generally by manually.Specifically, by manually finding needs The content of replacement, then by being manually replaced.When there is more content to need to replace, need to consume the plenty of time.It is existing Technology realizes that the speed of script argument is slower.
Invention content
An embodiment of the present invention provides a kind of method and devices for realizing script argument, can improve realization script argument The speed of change.
On the one hand, an embodiment of the present invention provides a kind of methods for realizing script argument, including:
Encoded original character string is determined from encoded script to be parameterized, wherein in the original character string Including parameterized object;
Obtain the corresponding at least one target object of the parameterized object;
The encoded original character string is decoded, the original character string is generated;
Each parameterized object is identified from the original character string;
For each parameterized object, execute:
From encoded original character string, the corresponding encoded target string of parameter current object is identified;
According to the parameter current object, the corresponding encoded substitute character string of each target object is generated;
Encoded target string in script to be parameterized described in will be encoded replaces with alternative parameter, wherein The alternative parameter can be at least one encoded substitute character string of value any one.
Further,
It is described from encoded original character string, identify the corresponding encoded target character of parameter current object String, including:
In the original character string, determine the first character of the original character string to the parameter current object Previous character the first number of characters;
The first remainder behind first number of characters divided by 3 is determined, using first remainder as the digit taken forward;
It regard the sum of number of characters of the digit taken forward and the parameter current object as the second number of characters;
Determine the second remainder behind second number of characters divided by 3;
According to second remainder, the digit taken backward is determined, wherein described to take backward when second remainder is 0 Digit be 0, when second remainder be 1 when, the digit taken backward be 2, when second remainder be 2 when, it is described to The digit taken afterwards is 1;
According to formula one, determine that the first character of the target string is m-th of encoded original character string Character, wherein the formula one is:
Wherein, d is first number of characters, and q is the digit taken forward;
According to formula two, determine that the length of the target string is n, wherein the formula two is:
Wherein, c is the number of characters of the parameter current object, and h is described to be taken backward Digit;
According to the m and the n, determine that the parameter current object is corresponding from encoded original character string The target string of coding.
Further,
It is described according to the parameter current object, generate the corresponding encoded substitute character of each target object String, including:
It is adjacent with the parameter current object before determining the parameter current object in the original character string Q character constitute the first character string;
In the original character string, determine after the parameter current object with the parameter current object phase The second character string that h adjacent character is constituted;
For each target object, execute:
By first character string, current target object and second character string, it is combined into third character string, wherein The third character string is from left to right first character string, the current target object and second character string successively;
The third character string is encoded, the corresponding encoded substitute character of the current target object is generated String;
Wherein, the number of characters of each target object is identical as the number of characters of the parameterized object.
Further,
This method further comprises:Pre-set script implementation strategy;
Described according to the parameter current object, the corresponding encoded replacement word of each target object is generated After symbol string, further comprise:
For each parameterized object, the corresponding each encoded substitute character string of parameter current object is write Enter into the corresponding Parameter File of the parameter current object;
According to each corresponding Parameter File of parameterized object and the script implementation strategy, configuration code is generated;
The configuration code is appended in the script argument configuration file of the script to be parameterized, so that described wait joining Numberization script can be run according to each corresponding Parameter File of character string to be replaced and the script implementation strategy.
Further,
Script to be parameterized includes described in encoded:Script to be parameterized described in after being encoded by base64;
The encoded original character string includes:The original character string after being encoded by base64;
It is described to be decoded the encoded original character string, the original character string is generated, including:
The encoded original character string is decoded by base64, generates the original character string;
It is described according to the parameter current object, generate the corresponding encoded substitute character of each target object String, including:
According to the parameter current object, the corresponding volume encoded by base64 of each target object is generated The substitute character string of code.
On the other hand, an embodiment of the present invention provides a kind of devices for realizing script argument, including:
Originally determined unit, for determining encoded original character string from encoded script to be parameterized, wherein The original character string includes parameterized object;
Acquiring unit, for obtaining the corresponding at least one target object of the parameterized object;
Original decoded unit generates the original character string for the encoded original character string to be decoded;
Recognition unit, for identifying each parameterized object from the original character string;
Parameterized units, for for each parameterized object, executing:
From encoded original character string, the corresponding encoded target string of parameter current object is identified;
According to the parameter current object, the corresponding encoded substitute character string of each target object is generated;
Encoded target string in script to be parameterized described in will be encoded replaces with alternative parameter, wherein The alternative parameter can be at least one encoded substitute character string of value any one.
Further,
The parameterized units, it is described from encoded original character string executing, identify parameter current object When corresponding encoded target string, it is specifically used for:
In the original character string, determine the first character of the original character string to the parameter current object Previous character the first number of characters;
The first remainder behind first number of characters divided by 3 is determined, using first remainder as the digit taken forward;
It regard the sum of number of characters of the digit taken forward and the parameter current object as the second number of characters;
Determine the second remainder behind second number of characters divided by 3;
According to second remainder, the digit taken backward is determined, wherein described to take backward when second remainder is 0 Digit be 0, when second remainder be 1 when, the digit taken backward be 2, when second remainder be 2 when, it is described to The digit taken afterwards is 1;
According to formula one, determine that the first character of the target string is m-th of encoded original character string Character, wherein the formula one is:
Wherein, d is first number of characters, and q is the digit taken forward;
According to formula two, determine that the length of the target string is n, wherein the formula two is:
Wherein, c is the number of characters of the parameter current object, and h is described to be taken backward Digit;
According to the m and the n, determine that the parameter current object is corresponding from encoded original character string The target string of coding.
Further,
The parameterized units, it is described according to the parameter current object executing, generate each target object When corresponding encoded substitute character string, it is specifically used for:
It is adjacent with the parameter current object before determining the parameter current object in the original character string Q character constitute the first character string;
In the original character string, determine after the parameter current object with the parameter current object phase The second character string that h adjacent character is constituted;
For each target object, execute:
By first character string, current target object and second character string, it is combined into third character string, wherein The third character string is from left to right first character string, the current target object and second character string successively;
The third character string is encoded, the corresponding encoded substitute character of the current target object is generated String;
Wherein, the number of characters of each target object is identical as the number of characters of the parameterized object.
Further,
The device further comprises:Storage unit, for preserving script implementation strategy;
The parameterized units are further used for generating each mesh according to the parameter current object described After marking the corresponding encoded substitute character string of object, execute:
For each parameterized object, the corresponding each encoded substitute character string of parameter current object is write Enter into the corresponding Parameter File of the parameter current object;
According to each corresponding Parameter File of parameterized object and the script implementation strategy, configuration code is generated;
The configuration code is appended in the script argument configuration file of the script to be parameterized, so that described wait joining Numberization script can be run according to each corresponding Parameter File of character string to be replaced and the script implementation strategy.
Further,
Script to be parameterized includes described in encoded:Script to be parameterized described in after being encoded by base64;
The encoded original character string includes:The original character string after being encoded by base64;
The original decoded unit, for decoding the encoded original character string by base64, described in generation Original character string;
The parameterized units, it is described according to the parameter current object executing, generate each target object When corresponding encoded substitute character string, it is specifically used for:
According to the parameter current object, the corresponding volume encoded by base64 of each target object is generated The substitute character string of code.
In embodiments of the present invention, original character string, getting parms pair are decoded from encoded original character string As corresponding at least one target object, identify that each parameterized object is corresponding from encoded script to be parameterized The target string of coding has been compiled using each parameterized object of the corresponding alternative parameter replacement of each parameterized object is corresponding The target string of code, realizes that the parametrization of script to be parameterized, whole process are automatically performed, and participates in, carries without artificial The high speed for realizing script argument.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is the present invention Some embodiments for those of ordinary skill in the art without creative efforts, can also basis These attached drawings obtain other attached drawings.
Fig. 1 is a kind of flow chart for method for realizing script argument that one embodiment of the invention provides;
Fig. 2 is the flow chart for another method for realizing script argument that one embodiment of the invention provides;
Fig. 3 is a kind of schematic diagram for device for realizing script argument that one embodiment of the invention provides;
Fig. 4 is the schematic diagram for another device for realizing script argument that one embodiment of the invention provides.
Specific implementation mode
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments, based on the embodiments of the present invention, those of ordinary skill in the art The every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
As shown in Figure 1, an embodiment of the present invention provides a kind of method for realizing script argument, this method may include with Lower step:
Step 101:Encoded original character string is determined from encoded script to be parameterized, wherein described original Character string includes parameterized object;
Step 102:Obtain the corresponding at least one target object of the parameterized object;
Step 103:The encoded original character string is decoded, the original character string is generated;
Step 104:Each parameterized object is identified from the original character string;
Step 105:For each parameterized object, execute:
From encoded original character string, the corresponding encoded target string of parameter current object is identified;
According to the parameter current object, the corresponding encoded substitute character string of each target object is generated;
Encoded target string in script to be parameterized described in will be encoded replaces with alternative parameter, wherein The alternative parameter can be at least one encoded substitute character string of value any one.
In embodiments of the present invention, original character string, getting parms pair are decoded from encoded original character string As corresponding at least one target object, identify that each parameterized object is corresponding from encoded script to be parameterized The target string of coding has been compiled using each parameterized object of the corresponding alternative parameter replacement of each parameterized object is corresponding The target string of code, realizes that the parametrization of script to be parameterized, whole process are automatically performed, and participates in, carries without artificial The high speed for realizing script argument.
In embodiments of the present invention, it there may be multiple parameters object in original character string, needs to parameterize these Object is parameterized.Wherein, parameterized object can be specified with user.For example, parameterized object is " zhangsan ", In one section of original character string, in different positions there are multiple " zhangsan ", these " zhangsan " are parametrizations pair As being required for being replaced by corresponding alternative parameter for each " zhangsan ".
In an embodiment of the present invention, described from encoded original character string, identify parameter current object pair The encoded target string answered, including:
In the original character string, determine the first character of the original character string to the parameter current object Previous character the first number of characters;
The first remainder behind first number of characters divided by 3 is determined, using first remainder as the digit taken forward;
It regard the sum of number of characters of the digit taken forward and the parameter current object as the second number of characters;
Determine the second remainder behind second number of characters divided by 3;
According to second remainder, the digit taken backward is determined, wherein described to take backward when second remainder is 0 Digit be 0, when second remainder be 1 when, the digit taken backward be 2, when second remainder be 2 when, it is described to The digit taken afterwards is 1;
According to formula one, determine that the first character of the target string is m-th of encoded original character string Character, wherein the formula one is:
Wherein, d is first number of characters, and q is the digit taken forward;
According to formula two, determine that the length of the target string is n, wherein the formula two is:
Wherein, c is the number of characters of the parameter current object, and h is described to be taken backward Digit;
According to the m and the n, determine that the parameter current object is corresponding from encoded original character string The target string of coding.
For example, one section of original character string is:[usercode:zhangsan,password:123456, username:Zhang San].Parameterized object is [zhangsan].[zhangsan] previous character be [:], the first number of characters is [usercode:] length, that is, 9, the first remainder is 0, then, the digit taken forward is 0.The word of parameter current object It is 8 to accord with number, and the second number of characters is 8, and the second remainder is 2, then, the digit taken backward is 1.
In an embodiment of the present invention, described according to the parameter current object, generate each target object pair The encoded substitute character string answered, including:
It is adjacent with the parameter current object before determining the parameter current object in the original character string Q character constitute the first character string;
In the original character string, determine after the parameter current object with the parameter current object phase The second character string that h adjacent character is constituted;
For each target object, execute:
By first character string, current target object and second character string, it is combined into third character string, wherein The third character string is from left to right first character string, the current target object and second character string successively;
The third character string is encoded, the corresponding encoded substitute character of the current target object is generated String;
Wherein, the number of characters of each target object is identical as the number of characters of the parameterized object.
In embodiments of the present invention, it is needed with the corresponding third character of parameterized object for the parametrization of parameterized object String is unit, for identical parameterized object, since position of the parameters object in original character string is different, with And the character difference that parameters object is adjacent, corresponding third character string may also be different.
Specifically, third character string can be encoded by base64.
Continue with [usercode:zhangsan,password:123456,username:Zhang San] this original character string For, it since q is 0, determines that [zhangsan] corresponding first character string is sky, since h is 1, determines that [zhangsan] is corresponding The second character string be [,].One of target object is [chenxing], and [zhangsan] this parameterized object is corresponding Third character string is [chenxing ,], is encoded to [chenxing ,], and [zhangsan] this parameterized object pair is generated The encoded substitute character string answered.
In an embodiment of the present invention, this method further comprises:Pre-set script implementation strategy;
Described according to the parameter current object, the corresponding encoded replacement word of each target object is generated After symbol string, further comprise:
For each parameterized object, the corresponding each encoded substitute character string of parameter current object is write Enter into the corresponding Parameter File of the parameter current object;
According to each corresponding Parameter File of parameterized object and the script implementation strategy, configuration code is generated;
The configuration code is appended in the script argument configuration file of the script to be parameterized, so that described wait joining Numberization script can be run according to each corresponding Parameter File of character string to be replaced and the script implementation strategy.
In embodiments of the present invention, the additional configuration code into script argument configuration file so that running parameter Change when parameterize script, the corresponding alternative parameter of encoded substitute character string replacement in Parameter File can be utilized. Also, script to be parameterized can be run according to script implementation strategy.
Specifically, script argument configuration file can be [the name prm of script to be parameterized] file.
Specifically, script implementation strategy can specify that in user different in script to be parameterized, different iterations Parameter this how value.
For example, script implementation strategy may include the following contents:
select next row:Users different sequential/random/unique how value:Sequentially/random/ It is fixed
update value on:The same users of eachiteration/eachoccurrence/once how value: Each iteration/appearance/fixation every time
when out of values:Abort vuser/ContinueCycle/ContinueWithLast parameter values are not Strategy when enough:Interrupt Virtual User/cycle/with the last one value
Allocate Vuser Values:Automatically/Allocate Valus be each user distribution how much Row data:Automatic distribution/distribution fixed quantity
In an embodiment of the present invention, the encoded script to be parameterized includes:Institute after being encoded by base64 State script to be parameterized;
The encoded original character string includes:The original character string after being encoded by base64;
It is described to be decoded the encoded original character string, the original character string is generated, including:
The encoded original character string is decoded by base64, generates the original character string;
It is described according to the parameter current object, generate the corresponding encoded substitute character of each target object String, including:
According to the parameter current object, the corresponding volume encoded by base64 of each target object is generated The substitute character string of code.
In embodiments of the present invention, various codings can be realized by base64 codings, correspondingly, various decodings pass through Base64 decodes to realize.
As shown in Fig. 2, an embodiment of the present invention provides a kind of method for realizing script argument, this method may include with Lower step:
Step 201:It is determined from the script to be parameterized encoded by base64 through the original of base64 codings Character string, wherein original character string includes parameterized object.
Specifically, it can be obtained from action.c files by the base64 scripts to be parameterized encoded.
For example, it is by the base64 original character strings encoded: [dXNlcmNvZGU6emhhbmdzYW4scGFzc3dvcmQ6MTIzNDU2LHVzZXJuYW1lOj8/]。
Step 202:The corresponding at least one target object of getting parms object, wherein the character of each target object Number is identical as the number of characters of parameterized object.
For example, parameterized object is [zhangsan], and the number of characters of each target object is 8, this is at least one Target object may include:chenxing、xiaoming.
Step 203:It will be decoded by base64 by the base64 original character strings encoded, generate original character string.
For example, the original character string obtained after decoding is:[usercode:zhangsan,password:123456, username:Zhang San].
Step 204:Each parameterized object is identified from original character string.
For example, it is identified from original character string each [zhangsan].
Step 205:For each parameterized object, execute:From encoded original character string, parameter current is identified Change the corresponding encoded target string of object;According to parameter current object, generate that each target object is corresponding have been compiled The substitute character string of code;Encoded target string in encoded script to be parameterized is replaced with into alternative parameter, In, alternative parameter can be at least one encoded substitute character string of value any one.
Specifically, alternative parameter can be realized by the format of " parameter _ number ".Number can be according to the sequence of parameter To determine.
For example, the corresponding alternative parameter of first parameterized object is:[name_01].By first parametrization pair As corresponding encoded target string replaces with [name_01].
Specifically, the corresponding all encoded substitute character strings of parameter current object can be saved in name_ It, will be under the storage to the store path of encoded script to be parameterized of name_01.dat files in 01.dat files.The name_ 01.dat files are the corresponding Parameter File of parameter current object.
For example, to [e:Chenxing, p] it is encoded by base64, generate [e:Chenxing, p] it corresponding has compiled The substitute character string of code.
To [e:Xiaoming, p] it is encoded by base64, generate [e:Xiaoming, p] corresponding encoded replacement word Symbol string.
In addition, this method can also include:According to the foot each parameterized object corresponding Parameter File and be generated in advance This implementation strategy generates configuration code, configuration code is appended in the script argument configuration file of script to be parameterized.
For example, which can be as follows:
[parameter:【name_03】]
Delimiter=", "
ParamName="【name_03】"
TableLocation=" Local "
ColumnName=" Col 1 "
Table="【name_03】.dat"
GenerateNewVal="【EachIteration】/【EachOccurrence】/【Once】"
Type=" Table "
Value_for_each_vuser="【Numerical value】/"
OriginalValue=" "
Auto_allocate_block_size="【1】/【0】"
SelectNextRow="【Sequential】/【Random】/【Unique】"
StartRow=" 1 "
OutOfRangePolicy="【AbortVuser】/【ContinueCyclic】/【ContinueWithLast】"
After the completion of the operation executes, script implementation strategy is also provided with completion, and entire parametrization is fully completed, without carrying out two Secondary setting.
The embodiment of the present invention can be realized by following code:
Through the embodiment of the present invention, it can realize that parameter generates, parameter is replaced, the automation of parameter setting, settle at one go, Without secondary setting;Save parameter lookup, the time of replacement can greatly carry especially when there are many quantity of parametrization Working efficiency is risen, test resource is saved.
As shown in Figure 3, Figure 4, an embodiment of the present invention provides a kind of devices for realizing script argument.Device embodiment can By software realization, can also be realized by way of hardware or software and hardware combining.For hardware view, such as Fig. 3 institutes Show, is a kind of hardware structure diagram of equipment where a kind of device for realizing script argument provided in an embodiment of the present invention, in addition to Except processor shown in Fig. 3, memory, network interface and nonvolatile memory, the equipment in embodiment where device is logical It often can also include other hardware, such as be responsible for the forwarding chip of processing message.For implemented in software, as shown in figure 4, making It is by the CPU of equipment where it by corresponding computer journey in nonvolatile memory for the device on a logical meaning Sequence instruction reads what operation in memory was formed.A kind of device for realizing script argument provided in this embodiment, including:
Originally determined unit 401, for determining encoded original character string from encoded script to be parameterized, In, the original character string includes parameterized object;
Acquiring unit 402, for obtaining the corresponding at least one target object of the parameterized object;
Original decoded unit 403 generates the original character for the encoded original character string to be decoded String;
Recognition unit 404, for identifying each parameterized object from the original character string;
Parameterized units 405, for for each parameterized object, executing:
From encoded original character string, the corresponding encoded target string of parameter current object is identified;
According to the parameter current object, the corresponding encoded substitute character string of each target object is generated;
Encoded target string in script to be parameterized described in will be encoded replaces with alternative parameter, wherein The alternative parameter can be at least one encoded substitute character string of value any one.
In an embodiment of the present invention, the parameterized units, it is described from encoded original character string executing, know When not going out the corresponding encoded target string of parameter current object, it is specifically used for:
In the original character string, determine the first character of the original character string to the parameter current object Previous character the first number of characters;
The first remainder behind first number of characters divided by 3 is determined, using first remainder as the digit taken forward;
It regard the sum of number of characters of the digit taken forward and the parameter current object as the second number of characters;
Determine the second remainder behind second number of characters divided by 3;
According to second remainder, the digit taken backward is determined, wherein described to take backward when second remainder is 0 Digit be 0, when second remainder be 1 when, the digit taken backward be 2, when second remainder be 2 when, it is described to The digit taken afterwards is 1;
According to formula one, determine that the first character of the target string is m-th of encoded original character string Character, wherein the formula one is:
Wherein, d is first number of characters, and q is the digit taken forward;
According to formula two, determine that the length of the target string is n, wherein the formula two is:
Wherein, c is the number of characters of the parameter current object, and h is described to be taken backward Digit;
According to the m and the n, determine that the parameter current object is corresponding from encoded original character string The target string of coding.
In an embodiment of the present invention, the parameterized units, it is described according to the parameter current object executing, it is raw When encoded substitute character string corresponding at each target object, it is specifically used for:
It is adjacent with the parameter current object before determining the parameter current object in the original character string Q character constitute the first character string;
In the original character string, determine after the parameter current object with the parameter current object phase The second character string that h adjacent character is constituted;
For each target object, execute:
By first character string, current target object and second character string, it is combined into third character string, wherein The third character string is from left to right first character string, the current target object and second character string successively;
The third character string is encoded, the corresponding encoded substitute character of the current target object is generated String;
Wherein, the number of characters of each target object is identical as the number of characters of the parameterized object.
In an embodiment of the present invention, which further comprises:Storage unit, for preserving script implementation strategy;
The parameterized units are further used for generating each mesh according to the parameter current object described After marking the corresponding encoded substitute character string of object, execute:
For each parameterized object, the corresponding each encoded substitute character string of parameter current object is write Enter into the corresponding Parameter File of the parameter current object;
According to each corresponding Parameter File of parameterized object and the script implementation strategy, configuration code is generated;
The configuration code is appended in the script argument configuration file of the script to be parameterized, so that described wait joining Numberization script can be run according to each corresponding Parameter File of character string to be replaced and the script implementation strategy.
In an embodiment of the present invention, the encoded script to be parameterized includes:Institute after being encoded by base64 State script to be parameterized;
The encoded original character string includes:The original character string after being encoded by base64;
The original decoded unit, for decoding the encoded original character string by base64, described in generation Original character string;
The parameterized units, it is described according to the parameter current object executing, generate each target object When corresponding encoded substitute character string, it is specifically used for:
According to the parameter current object, the corresponding volume encoded by base64 of each target object is generated The substitute character string of code.
The contents such as the information exchange between each unit, implementation procedure in above-mentioned apparatus, due to implementing with the method for the present invention Example is based on same design, and particular content can be found in the narration in the method for the present invention embodiment, and details are not described herein again.
An embodiment of the present invention provides a kind of readable mediums, including execute instruction, when the processor of storage control executes It is described when executing instruction, the storage control execute it is provided in an embodiment of the present invention any one realize the side of script argument Method.
An embodiment of the present invention provides a kind of storage controls, including:Processor, memory and bus;
The memory is executed instruction for storing, and the processor is connect with the memory by the bus, when When the storage control operation, the processor executes executing instruction for the memory storage, so that the storage controls The method that device executes any one realization script argument provided in an embodiment of the present invention.
The each embodiment of the present invention at least has the advantages that:
1, in embodiments of the present invention, original character string, getting parms are decoded from encoded original character string The corresponding at least one target object of object, identifies that each parameterized object is corresponding from encoded script to be parameterized It is corresponding to replace each parameterized object using the corresponding alternative parameter of each parameterized object for encoded target string The target string of coding realizes that the parametrization of script to be parameterized, whole process are automatically performed, and is participated in without artificial, Improve the speed for realizing script argument.
2, through the embodiment of the present invention, it can realize that parameter generates, parameter is replaced, the automation of parameter setting, a step arrives Position is not necessarily to secondary setting;The time that parameter is searched, replaced is saved, it, can be greatly especially when there are many quantity of parametrization Working efficiency is promoted, test resource is saved.
It should be noted that herein, such as first and second etc relational terms are used merely to an entity Or operation is distinguished with another entity or operation, is existed without necessarily requiring or implying between these entities or operation Any actual relationship or order.Moreover, the terms "include", "comprise" or its any other variant be intended to it is non- It is exclusive to include, so that the process, method, article or equipment including a series of elements includes not only those elements, But also include other elements that are not explicitly listed, or further include solid by this process, method, article or equipment Some elements.In the absence of more restrictions, the element limited by sentence " including one ", is not arranged Except there is also other identical factors in the process, method, article or apparatus that includes the element.
One of ordinary skill in the art will appreciate that:Realize that all or part of step of above method embodiment can pass through The relevant hardware of program instruction is completed, and program above-mentioned can be stored in computer-readable storage medium, the program When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned includes:ROM, RAM, magnetic disc or light In the various media that can store program code such as disk.
Finally, it should be noted that:The foregoing is merely presently preferred embodiments of the present invention, is merely to illustrate the skill of the present invention Art scheme, is not intended to limit the scope of the present invention.Any modification for being made all within the spirits and principles of the present invention, Equivalent replacement, improvement etc., are included within the scope of protection of the present invention.

Claims (10)

1. a kind of method for realizing script argument, which is characterized in that including:
Encoded original character string is determined from encoded script to be parameterized, wherein the original character string includes Parameterized object;
Obtain the corresponding at least one target object of the parameterized object;
The encoded original character string is decoded, the original character string is generated;
Each parameterized object is identified from the original character string;
For each parameterized object, execute:
From encoded original character string, the corresponding encoded target string of parameter current object is identified;
According to the parameter current object, the corresponding encoded substitute character string of each target object is generated;
Encoded target string in script to be parameterized described in will be encoded replaces with alternative parameter, wherein described Alternative parameter can be at least one encoded substitute character string of value any one.
2. according to the method described in claim 1, it is characterized in that,
It is described to identify the corresponding encoded target string of parameter current object from encoded original character string, Including:
In the original character string, before the first character to the parameter current object for determining the original character string First number of characters of one character;
The first remainder behind first number of characters divided by 3 is determined, using first remainder as the digit taken forward;
It regard the sum of number of characters of the digit taken forward and the parameter current object as the second number of characters;
Determine the second remainder behind second number of characters divided by 3;
According to second remainder, the digit taken backward is determined, wherein when second remainder is 0, the position taken backward Number is 0, and when second remainder is 1, the digit taken backward is 2, described to take backward when second remainder is 2 Digit be 1;
According to formula one, determine that the first character of the target string is m-th of character of encoded original character string, Wherein, the formula one is:
Wherein, d is first number of characters, and q is the digit taken forward;
According to formula two, determine that the length of the target string is n, wherein the formula two is:
Wherein, c is the number of characters of the parameter current object, and h is the digit taken backward;
According to the m and the n, determine that the parameter current object is corresponding encoded from encoded original character string Target string.
3. according to the method described in claim 2, it is characterized in that,
It is described that the corresponding encoded substitute character string of each target object is generated according to the parameter current object, Including:
In the original character string, the q adjacent with the parameter current object before determining the parameter current object The first character string that a character is constituted;
In the original character string, determine adjacent with the parameter current object after the parameter current object The second character string that h character is constituted;
For each target object, execute:
By first character string, current target object and second character string, it is combined into third character string, wherein described Third character string is from left to right first character string, the current target object and second character string successively;
The third character string is encoded, the corresponding encoded substitute character string of the current target object is generated;
Wherein, the number of characters of each target object is identical as the number of characters of the parameterized object.
4. according to the method described in claim 1, it is characterized in that,
Further comprise:Pre-set script implementation strategy;
Described according to the parameter current object, the corresponding encoded substitute character string of each target object is generated Later, further comprise:
For each parameterized object, the corresponding each encoded substitute character string of parameter current object is written to In the corresponding Parameter File of the parameter current object;
According to each corresponding Parameter File of parameterized object and the script implementation strategy, configuration code is generated;
The configuration code is appended in the script argument configuration file of the script to be parameterized, so that described wait parameterizing Script can be run according to each corresponding Parameter File of character string to be replaced and the script implementation strategy.
5. method according to any one of claims 1-4, which is characterized in that
Script to be parameterized includes described in encoded:Script to be parameterized described in after being encoded by base64;
The encoded original character string includes:The original character string after being encoded by base64;
It is described to be decoded the encoded original character string, the original character string is generated, including:
The encoded original character string is decoded by base64, generates the original character string;
It is described that the corresponding encoded substitute character string of each target object is generated according to the parameter current object, Including:
According to the parameter current object, it is corresponding by the encoded of base64 codings to generate each target object Substitute character string.
6. a kind of device for realizing script argument, which is characterized in that including:
Originally determined unit, for determining encoded original character string from encoded script to be parameterized, wherein described Original character string includes parameterized object;
Acquiring unit, for obtaining the corresponding at least one target object of the parameterized object;
Original decoded unit generates the original character string for the encoded original character string to be decoded;
Recognition unit, for identifying each parameterized object from the original character string;
Parameterized units, for for each parameterized object, executing:
From encoded original character string, the corresponding encoded target string of parameter current object is identified;
According to the parameter current object, the corresponding encoded substitute character string of each target object is generated;
Encoded target string in script to be parameterized described in will be encoded replaces with alternative parameter, wherein described Alternative parameter can be at least one encoded substitute character string of value any one.
7. device according to claim 6, which is characterized in that
The parameterized units, it is described from encoded original character string executing, identify that parameter current object corresponds to Encoded target string when, be specifically used for:
In the original character string, before the first character to the parameter current object for determining the original character string First number of characters of one character;
The first remainder behind first number of characters divided by 3 is determined, using first remainder as the digit taken forward;
It regard the sum of number of characters of the digit taken forward and the parameter current object as the second number of characters;
Determine the second remainder behind second number of characters divided by 3;
According to second remainder, the digit taken backward is determined, wherein when second remainder is 0, the position taken backward Number is 0, and when second remainder is 1, the digit taken backward is 2, described to take backward when second remainder is 2 Digit be 1;
According to formula one, determine that the first character of the target string is m-th of character of encoded original character string, Wherein, the formula one is:
Wherein, d is first number of characters, and q is the digit taken forward;
According to formula two, determine that the length of the target string is n, wherein the formula two is:
Wherein, c is the number of characters of the parameter current object, and h is the digit taken backward;
According to the m and the n, determine that the parameter current object is corresponding encoded from encoded original character string Target string.
8. device according to claim 7, which is characterized in that
The parameterized units, it is described according to the parameter current object executing, it generates each target object and corresponds to Encoded substitute character string when, be specifically used for:
In the original character string, the q adjacent with the parameter current object before determining the parameter current object The first character string that a character is constituted;
In the original character string, determine adjacent with the parameter current object after the parameter current object The second character string that h character is constituted;
For each target object, execute:
By first character string, current target object and second character string, it is combined into third character string, wherein described Third character string is from left to right first character string, the current target object and second character string successively;
The third character string is encoded, the corresponding encoded substitute character string of the current target object is generated;
Wherein, the number of characters of each target object is identical as the number of characters of the parameterized object.
9. device according to claim 6, which is characterized in that
Further comprise:Storage unit, for preserving script implementation strategy;
The parameterized units are further used for generating each target pair according to the parameter current object described After corresponding encoded substitute character string, execute:
For each parameterized object, the corresponding each encoded substitute character string of parameter current object is written to In the corresponding Parameter File of the parameter current object;
According to each corresponding Parameter File of parameterized object and the script implementation strategy, configuration code is generated;
The configuration code is appended in the script argument configuration file of the script to be parameterized, so that described wait parameterizing Script can be run according to each corresponding Parameter File of character string to be replaced and the script implementation strategy.
10. according to any device in claim 6-9, which is characterized in that
Script to be parameterized includes described in encoded:Script to be parameterized described in after being encoded by base64;
The encoded original character string includes:The original character string after being encoded by base64;
The original decoded unit generates described original for decoding the encoded original character string by base64 Character string;
The parameterized units, it is described according to the parameter current object executing, it generates each target object and corresponds to Encoded substitute character string when, be specifically used for:
According to the parameter current object, it is corresponding by the encoded of base64 codings to generate each target object Substitute character string.
CN201810157340.3A 2018-02-24 2018-02-24 Method and device for realizing script parameterization Active CN108388548B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810157340.3A CN108388548B (en) 2018-02-24 2018-02-24 Method and device for realizing script parameterization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810157340.3A CN108388548B (en) 2018-02-24 2018-02-24 Method and device for realizing script parameterization

Publications (2)

Publication Number Publication Date
CN108388548A true CN108388548A (en) 2018-08-10
CN108388548B CN108388548B (en) 2021-08-31

Family

ID=63068612

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810157340.3A Active CN108388548B (en) 2018-02-24 2018-02-24 Method and device for realizing script parameterization

Country Status (1)

Country Link
CN (1) CN108388548B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6871320B1 (en) * 1998-09-28 2005-03-22 Fujitsu Limited Data compressing apparatus, reconstructing apparatus, and method for separating tag information from a character train stream of a structured document and performing a coding and reconstruction
US20050271282A1 (en) * 2004-06-05 2005-12-08 Messe Dusseldorf Gmbh Method of encoding and decoding character trains
CN1949175A (en) * 2006-11-03 2007-04-18 北京飞天诚信科技有限公司 Method of displacing data in software
US20080270876A1 (en) * 2007-04-27 2008-10-30 Takashi Yokokawa Decoding Apparatus, Decoding Method, and Decoding Program
CN106570356A (en) * 2016-11-01 2017-04-19 南京理工大学 Unicode coding-based text watermark embedding method and extraction method
CN106681921A (en) * 2016-12-27 2017-05-17 腾讯科技(深圳)有限公司 Method and device for achieving data parameterization

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6871320B1 (en) * 1998-09-28 2005-03-22 Fujitsu Limited Data compressing apparatus, reconstructing apparatus, and method for separating tag information from a character train stream of a structured document and performing a coding and reconstruction
US20050271282A1 (en) * 2004-06-05 2005-12-08 Messe Dusseldorf Gmbh Method of encoding and decoding character trains
CN1949175A (en) * 2006-11-03 2007-04-18 北京飞天诚信科技有限公司 Method of displacing data in software
US20080270876A1 (en) * 2007-04-27 2008-10-30 Takashi Yokokawa Decoding Apparatus, Decoding Method, and Decoding Program
CN106570356A (en) * 2016-11-01 2017-04-19 南京理工大学 Unicode coding-based text watermark embedding method and extraction method
CN106681921A (en) * 2016-12-27 2017-05-17 腾讯科技(深圳)有限公司 Method and device for achieving data parameterization

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
FERDOUS AHMED SOHEL等: "Fast Distortion Measurement Using Chord-Length Parameterization Within the Vertex-Based Rate-Distortion Optimal Shape Coding Framework", 《 IEEE SIGNAL PROCESSING LETTERS》 *

Also Published As

Publication number Publication date
CN108388548B (en) 2021-08-31

Similar Documents

Publication Publication Date Title
CN103631590B (en) The edit methods of automatic test script
CN110928802A (en) Test method, device, equipment and storage medium based on automatic generation of case
CN107577980B (en) A kind of Quick Response Code error-correcting decoding method and its code translator
CN109299785A (en) Method and device for realizing machine learning model
CN106155830A (en) Data storage device and error correction method
CN108388548A (en) Method and device for realizing script parameterization
CN106293862B (en) A kind of analysis method and device of expandable mark language XML data
US6957178B2 (en) Incremental automata verification
CN105336379B (en) A kind of information processing method and solid-state memory
CN107368596A (en) A kind of method and device of Bloom filter query set element
CN110989999A (en) Code generation method and device, electronic equipment and medium
CN115563116A (en) Database table scanning method, device and equipment
CN108170601A (en) A kind of test path indexing means, device, terminal and computer-readable medium
CN106897434A (en) A kind of data lead-in method, apparatus and system
CN113671924A (en) DCS real-time value setting method and system, equipment and storage medium
CN106909503B (en) Android application automatic test case simplification method
CN109656543A (en) A kind of real time workshop method based on document keyword replacement
CN109117465A (en) A kind of the global parameter replacement method and device of batch script
CN116954622B (en) Method for associating abstract syntax tree with source code coordinates, electronic device and medium
CN115618239B (en) Management method, system, terminal and medium for deep learning framework training
CN114546261B (en) Object movement optimization method and system in distributed object storage
CN104008045B (en) Step identification method and system in script recording operation
CN110096448B (en) Fuzzy test search method considering depth and breadth
CN109426720B (en) Interface parameter verification method and related device
CN101841340B (en) Difference upper limit acquiring method and device and viterbi decoding 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
TA01 Transfer of patent application right

Effective date of registration: 20210721

Address after: No. 1036, Shandong high tech Zone wave road, Ji'nan, Shandong

Applicant after: INSPUR SOFTWARE Co.,Ltd.

Address before: 250100 Ji'nan hi tech Zone No. 2877, Shandong Province

Applicant before: INSPUR GROUP Co.,Ltd.

TA01 Transfer of patent application right
CB02 Change of applicant information

Address after: 271000 middle section of Hushan Road, Tai'an City, Shandong Province

Applicant after: INSPUR SOFTWARE Co.,Ltd.

Address before: No. 1036, Shandong high tech Zone wave road, Ji'nan, Shandong

Applicant before: INSPUR SOFTWARE Co.,Ltd.

CB02 Change of applicant information
CB02 Change of applicant information

Address after: 271000 Langchao science and Technology Park, 527 Dongyue street, Tai'an City, Shandong Province

Applicant after: INSPUR SOFTWARE Co.,Ltd.

Address before: 271000 middle section of Hushan Road, Tai'an City, Shandong Province

Applicant before: INSPUR SOFTWARE Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant