CN110489341A - A kind of test method, device, storage medium and electronic equipment - Google Patents
A kind of test method, device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN110489341A CN110489341A CN201910695533.9A CN201910695533A CN110489341A CN 110489341 A CN110489341 A CN 110489341A CN 201910695533 A CN201910695533 A CN 201910695533A CN 110489341 A CN110489341 A CN 110489341A
- Authority
- CN
- China
- Prior art keywords
- code
- environment
- test
- memory
- information
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3664—Environments for testing or debugging software
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The present disclosure discloses a kind of test method, device, storage medium and electronic equipment, method includes: to obtain modification instruction information;Code is obtained from hard disk;Whether detection current environment is test environment;It is test environment in response to current environment, the code got from hard disk is modified according to modification instruction information;Modified code is loaded into memory;And modified code is run in memory;It is non-testing environments in response to current environment, the code got from hard disk is loaded into memory;And code is run in memory.The embodiment of the present disclosure is to modify during code is loaded into memory from hard disk to code, rather than code is directly modified in a hard disk, even if therefore having modified code in test environment, it will not be saved on hard disk, in this way when the code on hard disk is uploaded to distal end library or production environment, upload is also source code.This method avoid the code that will be tested in environment misinformations to production environment.
Description
Technical field
This disclosure relates to data processing field, in particular to a kind of test method, device, storage medium and electronic equipment.
Background technique
In test environment, developer may temporarily modify code for the needs of test function, still, will generation
When code is uploaded in production environment, sometimes it may forget to return code revision, so as to cause on the code of test
It passes in production environment, will lead to a series of problems in this way.For example, in order to test certain functions in internal test environment,
Developer may temporarily shield payment function, but may forget after being completed cancel shielding, so as to cause
Payment function is unable to complete in production environment.
Summary of the invention
In view of this, the embodiment of the present disclosure proposes a kind of test method, device, storage medium and electronic equipment, to
Solve the problems, such as the as follows of the prior art: the class file in test environment after tester's modification code can be by misinformation to production ring
Border, leads to a series of use problem of application programs, and serious situation can also cause economic loss to the company of application program.
On the one hand, the embodiment of the present disclosure proposes a kind of test method, comprising: obtains modification instruction information;It is obtained from hard disk
Replace code;Whether detection current environment is test environment;It is the test environment in response to the current environment, is repaired according to described
Change instruction information and modifies the code got from hard disk;Modified code is loaded into memory;And in the memory
The middle modified code of operation;It is non-testing environments in response to the current environment, the code got from hard disk is added
It is downloaded in memory;And the code is run in the memory.
On the other hand, the embodiment of the present disclosure proposes a kind of test device, comprising: first obtains module, repairs for obtaining
Change instruction information;Second obtains module, for obtaining code from hard disk;Detection module, for detecting whether current environment is survey
Test ring border;First execution module indicates information according to the modification for being the test environment in response to the current environment
Modify the code got from hard disk;Modified code is loaded into memory;And operation modification in the memory
The code afterwards;Second execution module, for being non-testing environments in response to the current environment, by what is got from hard disk
Code is loaded into memory;And the code is run in the memory.
On the other hand, the embodiment of the present disclosure proposes a kind of storage medium, is stored with computer program, computer program quilt
The method that disclosure any embodiment provides is realized when processor executes.
On the other hand, the embodiment of the present disclosure proposes a kind of electronic equipment, includes at least memory, processor, memory
On be stored with computer program, processor realizes that disclosure any embodiment is provided when executing the computer program on memory
Method.
The embodiment of the present disclosure be modify during code is loaded into memory from hard disk to code, rather than
Code is directly modified in hard disk, therefore even if having modified code in test environment, will not be saved on hard disk, is being incited somebody to action in this way
When code on hard disk uploads to distal end library or production environment, upload is also source code.This method avoid by test wrapper
Code in border is misinformated to production environment.
Detailed description of the invention
In conjunction with attached drawing and refer to following specific embodiments, the above and other feature, advantage of each embodiment of the disclosure and
Aspect will be apparent.In attached drawing, the same or similar appended drawing reference indicates the same or similar element.It should manage
Solution attached drawing is schematically that original part and element are not necessarily drawn to scale.
Fig. 1 is the flow chart for the test method that the first embodiment of the present disclosure provides;
Fig. 2 is the flow chart for the test method that the second embodiment of the present disclosure provides;
Fig. 3 is the structural schematic diagram for the test device that the third embodiment of the present disclosure provides;
Fig. 4 is a kind of structural schematic diagram for the electronic equipment that the fifth embodiment of the present disclosure provides;
Fig. 5 is another structural schematic diagram for the electronic equipment that the fifth embodiment of the present disclosure provides.
Specific embodiment
Embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the certain of the disclosure in attached drawing
Embodiment, it should be understood that, the disclosure can be realized by various forms, and should not be construed as being limited to this
In the embodiment that illustrates, providing these embodiments on the contrary is in order to more thorough and be fully understood by the disclosure.It should be understood that
It is that being given for example only property of the accompanying drawings and embodiments effect of the disclosure is not intended to limit the protection scope of the disclosure.
It should be appreciated that each step recorded in disclosed method embodiment can execute in a different order,
And/or parallel execution.In addition, method implementation may include additional step and/or omit the step of execution is shown.This public affairs
The range opened is not limited in this respect.
Terms used herein " comprising " and its deformation are that opening includes, i.e., " including but not limited to ".Term "based"
It is " being based at least partially on ".Term " one embodiment " expression " at least one embodiment ";Term " another embodiment " indicates
" at least one other embodiment ";Term " some embodiments " expression " at least some embodiments ".The correlation of other terms is fixed
Justice provides in will be described below.
It is noted that the concepts such as " first " that refers in the disclosure, " second " are only used for different devices, module or list
Member distinguishes, and is not intended to limit the sequence or relation of interdependence of function performed by these devices, module or unit.
It is noted that referred in the disclosure "one", the modification of " multiple " be schematically and not restrictive this field
It will be appreciated by the skilled person that being otherwise construed as " one or more " unless clearly indicate otherwise in context.
The being merely to illustrate property of title of the message or information that are interacted between multiple devices in disclosure embodiment
Purpose, and be not used to limit the range of these message or information.
The first embodiment of the present disclosure provides a kind of test method, and the process of this method is as shown in Figure 1, include step S101
To S105:
S101 obtains modification instruction information.
After developer has developed code, code can be put on local hard drive, if necessary to modification then generally from this
It is obtained in ground hard disk.It needs tester to carry out later period test after the completion of code development, tests the running application program of code
Various functions it is whether normal, whether these functions can have certain problems, for example, test payment function whether can normally hold
Row, and user's corresponding payment result is given after the completion of payment.
In order to allow tester is available to arrive code to be tested, tester can be needed to test by code development personnel
Code upload in the library of distal end, tester can by code to be tested from the locally downloading hard disk in distal end library, because
The various functions for needing to test the corresponding application program of code for test process, due to being test environment, so not needing true
Operation in positive production environment, but modify corresponding code and realize and effect identical in production environment, the tool of code
Holding in vivo will change.
The embodiment of the present disclosure, can be when getting modification instruction information it is confirmed that needing to modify code, such as when realizing
Fruit does not get modification instruction information and does not need modification code then, it is of course also possible to be that can centainly get the modification to refer to
Show information, the modification indicated in information or non-modification information are indicated by the modification to be confirmed whether to need to modify code.Usually
In the case of, tester tests code if necessary, and majority of case requires modification code, so the modification of the present embodiment
Indicate that information can be got in the case where needing to modify code.
S102 obtains code from hard disk.
Whether S103, detection current environment are test environment.If it is, executing S104, S105 is otherwise executed.
Above-mentioned modification instruction information can be used as a testing conditions of the process, that is, ability when getting modification instruction information
Whether detection current environment is test environment, if not getting modification instruction information, illustrates that code does not need to modify.
When whether determine current environment is test environment, it can realize as follows: obtain the ring of current environment
Border information;Obtain the specific environment information of test environment;Compare the environmental information of current environment and the specific environment of test environment
Information;It is identical as the test specific environment information of environment in response to the environmental information of current environment, determine current environment for test
Environment;It is different from the test specific environment information of environment in response to the environmental information of current environment, determine that current environment is non-survey
Test ring border.During comparing, environmental information may include a variety of, such as IP address, MAC Address, environmental variance etc.;For standard
Whether the environmental information of true detection current environment is identical as the test specific environment information of environment, can be believed with the environment of multiple types
Breath is used in conjunction with.
For example, the performing environment MAC Address of current code is 07-16-76-00-02-XX, IP address 192.168.0.X,
Presumptive test environment MAC Address is 07-16-76-00-02-XX, IP address 192.168.0.X, then either MAC Address is still
IP address, two environmental informations are all identical, then can determine that the performing environment of current code is exactly to test environment.
S104 is test environment in response to current environment, modifies the generation got from hard disk according to modification instruction information
Code;Modified code is loaded into memory;And modified code is run in memory.
It is above-mentioned it is stated that the present embodiment modification instruction information be that can be obtained in the case where needing to modify code
It arrives, therefore, can indicate any partial code needed to modify in the modification instruction information of the embodiment of the present disclosure.
For example, when modification instruction information instruction needs to modify the 15-30 line code in X-File, by 15-30 line code
Payment logic modify, then directly searching X-File from the class file that hard disk is got, and indicate information according to modification
In new payment logic Modification X-File in the code of 15-30 row that indicates.
After to code revision in memory, the code saved in class file is exactly the code used required for test, into
And be loaded into memory, and run modified code in memory, realize the purpose of test application program.
S105 is non-testing environments in response to current environment, the code got from hard disk is loaded into memory;And
Code is run in memory.
It is modification test wrapper since modification instruction information is for existing for test environment, that is, modify instruction information instruction
The code used in border does not need to modify to code if it is non-testing environments existing and modifying instruction information yet, and
It is directly to be loaded into memory code, and run the code in memory.
For the embodiment of the present disclosure after getting modification instruction information and code, whether detection current environment is test environment,
And the code got from hard disk is just modified when being to test environment, and modified code is loaded into memory, inside
The modified code for test can be run in depositing, if not test environment, then be loaded directly into code into memory and
Code is run in memory.
The embodiment of the present disclosure be modify during code is loaded into memory from hard disk to code, rather than
Code is directly modified in hard disk, therefore even if having modified code in test environment, will not be saved on hard disk, is being incited somebody to action in this way
When code on hard disk uploads to distal end library or production environment, upload is also source code.This method avoid by test wrapper
Code in border is misinformated to production environment.
The second embodiment of the present disclosure provides a kind of test method, and the process of this method is as shown in Fig. 2, include step S201
To S208:
S201 detects configuration file.
After developer has developed code, code can be put on local hard drive, from local hard after modifying if necessary
It examines and seizes and takes.Tester is needed to carry out later period test after the completion of code development, whether the test running function of code is normal, this
Whether a little functions can have certain problems, for example, whether test payment can normally execute, and to user couple after the completion of payment
The payment result answered.
In order to allow tester is available to arrive code to be tested, code development personnel can will need tester to test
Code upload in the library of distal end, tester can by code to be tested from the locally downloading hard disk in distal end library, because
The various functions of needing to test the corresponding application program of code for test process, due to being test environment, so not needing true
Operation in positive production environment, but modify corresponding code and realize and effect identical in production environment, the tool of code
Holding in vivo will change.
The embodiment of the present disclosure determines modification instruction information when realizing, through setting configuration file, and then indicates whether to deposit
In the code that needs are modified.
S202 parses configuration file, modifies instruction information to obtain, wherein modification instruction information includes at least: to be replaced
The position of code and replacement code.
When there are in the case where configuration file, so that it may be parsed to configuration file, to know in configuration file
Hold, it is generally the case that position and the replacement code of code to be replaced can be recorded in configuration file, and then in subsequent replacement code
Information can be indicated by the modification got from configuration file to modify code in the process.
S203 obtains code from hard disk.
Whether S204, detection current environment are test environment.If so, executing S205, S208 is otherwise executed.
Even if the code of modification in need is also to need in test environment just it is necessary to modification, non-testing environments is not repaired
Change code.
Above-mentioned configuration file can be used as a testing conditions of the process, that is, just detect when getting configuration file current
Whether the performing environment of code is to test environment to illustrate that code does not need to modify if not getting configuration file.
When whether determine current environment is test environment, it can realize as follows: obtain the ring of current environment
Border information;Obtain the specific environment information of test environment;Compare the environmental information of current environment and the specific environment of test environment
Information;It is identical as the test specific environment information of environment in response to the environmental information of current environment, determine current environment for test
Environment;It is different from the test specific environment information of environment in response to the environmental information of current environment, determine that current environment is non-survey
Test ring border.During comparing, environmental information may include a variety of, such as IP address, MAC Address, environmental variance etc.;For standard
Whether the environmental information of true detection current code performing environment is identical as the test specific environment information of environment, can be with multiple types
Environmental information be used in conjunction with.
For example, the performing environment MAC Address of current code is 07-16-76-00-02-XX, IP address 192.168.0.X,
Presumptive test environment MAC Address is 07-16-76-00-02-XX, IP address 192.168.0.X, then either MAC Address is still
IP address, two environmental informations are all identical, then can determine that the performing environment of current code is exactly to test environment.
S205 is test environment in response to current environment, is being got from hard disk according to the position of code to be replaced
Code to be replaced is determined in code.
Each function of a new application program, or the update packet of one application program of test are either tested, all
It is that can be related to many codes, different codes is written in different class files.In the configuration file of the present embodiment exist to
Replace the position of code, so that it may based on the location lookup to its corresponding class file, and then any portion in the class file known
Code needs are divided to be replaced.
S206 replaces code to be replaced using replacement code.
For example, when modification instruction information instruction needs to modify the 15-30 line code in class file in X-File, by 15-
The payment logic of 30 line codes is modified, then X-File is directly being searched from the class file that hard disk is got, and according to modification
Indicate the code of the 15-30 row indicated in the new payment logic Modification X-File in information.
Modified code is loaded into memory by S207;And modified code is run in memory.
After to code revision in memory, the code saved in class file is exactly the code used required for test, into
And be loaded into memory, and run modified code in memory, realize the purpose of test application program.
S208 is non-testing environments in response to current environment, the code got from hard disk is loaded into memory;And
Code is run in memory.
It is modification test wrapper since modification instruction information is for existing for test environment, that is, modify instruction information instruction
The code used in border does not need to modify to code if it is non-testing environments existing and modifying instruction information yet, and
It is directly to be loaded into memory code, and run the code in memory.
For the embodiment of the present disclosure after getting modification instruction information and code, whether detection current environment is test environment,
And the code got from hard disk is just modified when being to test environment, and modified code is loaded into memory, inside
The modified code for test can be run in depositing.
The embodiment of the present disclosure be modify during code is loaded into memory from hard disk to code, rather than
Code is directly modified in hard disk, therefore even if having modified code in test environment, will not be saved on hard disk, is being incited somebody to action in this way
When code on hard disk uploads to distal end library or production environment, upload is also source code.This method avoid by test wrapper
Code in border is misinformated to production environment.
The third embodiment of the present disclosure provides a kind of test device, which can be presented in the form of plug-in unit, the device
Structural representation it is as shown in Figure 3, comprising:
First obtains module 10, for obtaining modification instruction information;Second obtains module 20, obtains 10 coupling of module with first
It closes, for obtaining code from hard disk;Detection module 30, with second acquisition module 20 couple, for detect current environment whether be
Test environment;First execution module 40, couples with detection module 30, for being test environment in response to current environment, according to repairing
Change instruction information and modifies the code got from hard disk;Modified code is loaded into memory;And it transports in memory
The modified code of row;Second execution module 50, couples with detection module 30, for being non-test ring in response to current environment
The code got from hard disk is loaded into memory by border;And code is run in memory.
After developer has developed code, code can be put on local hard drive, from local hard after modifying if necessary
It examines and seizes and takes.Tester is needed to carry out later period test after the completion of code development, whether the test running function of code is normal, this
Whether a little functions can have certain problems, for example, whether test payment can normally execute, and to user couple after the completion of payment
The payment result answered.
In order to allow tester is available to arrive code to be tested, code development personnel can will need tester to test
Code upload in the library of distal end, tester can by code to be tested from the locally downloading hard disk in distal end library, because
The various functions of needing to test the corresponding application program of code for test process, due to being test environment, so not needing true
Operation in positive production environment, but modify corresponding code and realize and effect identical in production environment, the tool of code
Holding in vivo will change.
The embodiment of the present disclosure, can be when getting modification instruction information it is confirmed that needing to modify code, such as when realizing
Fruit does not get modification instruction information and does not need modification code then, it is of course also possible to be that can centainly get the modification to refer to
Show information, the modification indicated in information or non-modification information are indicated by the modification to be confirmed whether to need to modify code.Usually
In the case of, tester tests code if necessary, and majority of case requires modification code, so the modification of the present embodiment
Indicate that information can be got in the case where needing to modify code.
Above-mentioned modification instruction information can be used as a testing conditions, that is, just detect when getting modification instruction information current
Whether the performing environment of code is test environment, if not getting modification instruction information, illustrates that code does not need to modify,
Then directly the code in hard disk is downloaded in memory and is run.
Above-mentioned first obtains module, is specifically used for: detection configuration file;Configuration file is parsed, modifies instruction letter to obtain
Breath, wherein modification instruction information includes at least: the position of code to be replaced and replacement code.The embodiment of the present disclosure realize when,
Modification instruction information is determined by setting configuration file, and then indicates whether the code for needing to modify.It is literary when there is configuration
In the case where part, so that it may be parsed to configuration file, to know the content in configuration file, it is generally the case that configuration text
Position and the replacement code of code to be replaced can be recorded in part, and then can be by from configuration during subsequent replacement code
The modification got in file indicates information to modify code.
When whether determine current environment is test environment, above-mentioned detection module may include: acquiring unit, for obtaining
The environmental information of current environment;And obtain the specific environment information of test environment;Comparing unit, for comparing current environment
Environmental information and test environment specific environment information;First determination unit, for the environmental information in response to current environment
It is identical as the test specific environment information of environment, determine current environment for test environment;Second determination unit, in response to working as
The environmental information of preceding environment is different from the test specific environment information of environment, determines that current environment is non-testing environments.
If two environmental informations are identical, the current environment that can determine that code executes is exactly to test environment.Than
Compared with during, environmental information may include a variety of, such as IP address, MAC Address, environmental variance etc.;For accurate detection
Whether the environmental information of current code performing environment is identical as the test specific environment information of environment, can be believed with the environment of multiple types
Breath is used in conjunction with.
For example, the performing environment MAC Address of current code is 07-16-76-00-02-XX, IP address 192.168.0.X,
Presumptive test environment MAC Address is 07-16-76-00-02-XX, IP address 192.168.0.X, then either MAC Address is still
IP address, two environmental informations are all identical, then can determine that the performing environment of current code is exactly to test environment.
It is above-mentioned it is stated that the present embodiment modification instruction information be that can be obtained in the case where needing to modify code
It arrives, therefore, can indicate any partial code needed to modify in the modification instruction information of the embodiment of the present disclosure.Above-mentioned first executes
Module specifically can be used for: code to be replaced is being determined from the code got in hard disk according to the position of code to be replaced;
Code to be replaced is replaced using replacement code.
For example, when modification instruction information instruction needs to modify the 15-30 line code in class file in X-File, by 15-
The payment logic of 30 line codes is modified, then X-File is directly being searched from the class file that hard disk is got, and according to modification
Indicate the code of the 15-30 row indicated in the new payment logic Modification X-File in information.
After to code revision in memory, the code saved in class file is exactly the code used required for test, into
And be loaded into memory, and run modified code in memory, realize the purpose of test application program.
For the embodiment of the present disclosure after getting modification instruction information and code, whether detection current environment is test environment,
And the code got from hard disk is just modified when being to test environment, and modified code is loaded into memory, inside
The modified code for test can be run in depositing.
The embodiment of the present disclosure be modify during code is loaded into memory from hard disk to code, rather than
Code is directly modified in hard disk, therefore even if having modified code in test environment, will not be saved on hard disk, is being incited somebody to action in this way
When code on hard disk uploads to distal end library or production environment, upload is also source code.This method avoid by test wrapper
Code in border is misinformated to production environment.
The fourth embodiment of the present disclosure provides a kind of storage medium, which is computer-readable medium, is stored with
Computer program realizes the method that disclosure any embodiment provides when the computer program is executed by processor, including as follows
Step S11 to S15:
S11 obtains modification instruction information;
S12 obtains code from hard disk;
Whether S13, detection current environment are test environment;
S14 is test environment in response to current environment, modifies the generation got from hard disk according to modification instruction information
Code;Modified code is loaded into memory;And modified code is run in memory;
S15 is non-testing environments in response to current environment, the code got from hard disk is loaded into memory;And
Code is run in memory.
Computer program is executed by processor whether detection current environment is when testing the step of environment, specifically by processor
It executes following steps: obtaining the environmental information of current environment;Obtain the specific environment information of test environment;Compare current environment
The specific environment information of environmental information and test environment;The specific environment of environmental information and test environment in response to current environment
Information is identical, determines current environment for test environment;The specific environment of environmental information and test environment in response to current environment
Information is different, determines that current environment is non-testing environments.Wherein, environmental information is including at least following one: IP address, MAC
Location, environmental variance.
When computer program is executed by processor the step for obtaining modification instruction information, it is specifically executed by processor following step
It is rapid: detection configuration file;Configuration file is parsed, modifies instruction information to obtain, wherein modification instruction information includes at least: to
Replace position and the replacement code of code.
Computer program is executed by processor the step of modifying the code got from hard disk according to modification instruction information
When, it is specifically executed by processor following steps: being determined from the code got in hard disk according to the position of code to be replaced
Code to be replaced;Code to be replaced is replaced using replacement code.
For the embodiment of the present disclosure after getting modification instruction information and code, whether detection current environment is test environment,
And the code got from hard disk is just modified when being to test environment, and modified code is loaded into memory, inside
The modified code for test can be run in depositing, if not test environment, then be loaded directly into code into memory and
Code is run in memory.
The embodiment of the present disclosure be modify during code is loaded into memory from hard disk to code, rather than
Code is directly modified in hard disk, therefore even if having modified code in test environment, will not be saved on hard disk, is being incited somebody to action in this way
When code on hard disk uploads to distal end library or production environment, upload is also source code.This method avoid by test wrapper
Code in border is misinformated to production environment.
The fifth embodiment of the present disclosure provides a kind of electronic equipment, and the structural schematic diagram of the electronic equipment can be such as Fig. 4 institute
Show, includes at least memory 901 and processor 902, be stored with computer program on memory 901, processor 902 is deposited in execution
The method that disclosure any embodiment provides is realized when computer program on reservoir 901.Illustratively, electronic equipment computer
Program step following S21 to S25:
S21 obtains modification instruction information;
S22 obtains code from hard disk;
Whether S23, detection current environment are test environment;
S24 is test environment in response to current environment, modifies the generation got from hard disk according to modification instruction information
Code;Modified code is loaded into memory;And modified code is run in memory;
S25 is non-testing environments in response to current environment, the code got from hard disk is loaded into memory;And
Code is run in memory.
Processor is when whether the detection current environment stored on executing memory is to test the computer program of environment, tool
Body executes following computer program: obtaining the environmental information of current environment;Obtain the specific environment information of test environment;Compare and works as
The environmental information of preceding environment and the specific environment information of test environment;In response to the environmental information and test environment of current environment
Specific environment information is identical, determines current environment for test environment;In response to the environmental information and test environment of current environment
Specific environment information is different, determines that current environment is non-testing environments.Wherein, environmental information is including at least following one: IP
Location, MAC Address, environmental variance.
Processor specifically executes as follows in the computer program of the acquisition modification instruction information stored on executing memory
Computer program: detection configuration file;Configuration file is parsed, modifies instruction information to obtain, wherein modification instruction information is at least
It include: position and the replacement code of code to be replaced.
The code got from hard disk according to modification instruction information modification that processor stores on executing memory
When computer program, following computer program is specifically executed: according to the position of code to be replaced in the generation got from hard disk
Code to be replaced is determined in code;Code to be replaced is replaced using replacement code.
For the embodiment of the present disclosure after getting modification instruction information and code, whether detection current environment is test environment,
And the code got from hard disk is just modified when being to test environment, and modified code is loaded into memory, inside
The modified code for test can be run in depositing, if not test environment, then be loaded directly into code into memory and
Code is run in memory.
The embodiment of the present disclosure be modify during code is loaded into memory from hard disk to code, rather than
Code is directly modified in hard disk, therefore even if having modified code in test environment, will not be saved on hard disk, is being incited somebody to action in this way
When code on hard disk uploads to distal end library or production environment, upload is also source code.This method avoid by test wrapper
Code in border is misinformated to production environment.
Below with reference to Fig. 5, it illustrates the structures for the electronic equipment another kind for being suitable for being used to realize the embodiment of the present disclosure to show
It is intended to.Terminal device in the embodiment of the present disclosure can include but is not limited to such as mobile phone, laptop, digital broadcasting
Receiver, PDA (personal digital assistant), PAD (tablet computer), PMP (portable media player), car-mounted terminal (such as
Vehicle mounted guidance terminal) etc. mobile terminal and such as number TV, desktop computer etc. fixed terminal.Shown in Fig. 5
Electronic equipment is only an example, should not function to the embodiment of the present disclosure and use scope bring any restrictions.
As shown in figure 5, electronic equipment 600 may include processing unit (such as central processing unit, graphics processor etc.)
601, random access can be loaded into according to the program being stored in read-only memory (ROM) 602 or from storage device 606
Program in memory (RAM) 603 and execute various movements appropriate and processing.In RAM 603, it is also stored with electronic equipment
Various programs and data needed for 600 operations.Processing unit 601, ROM 602 and RAM 603 pass through the phase each other of bus 604
Even.Input/output (I/O) interface 605 is also connected to bus 604.
In general, following device can connect to I/O interface 605: including such as touch screen, touch tablet, keyboard, mouse, taking the photograph
As the input unit 606 of head, microphone, accelerometer, gyroscope etc.;Including such as liquid crystal display (LCD), loudspeaker, vibration
The output device 607 of dynamic device etc.;Storage device 606 including such as tape, hard disk etc.;And communication device 609.Communication device
609, which can permit electronic equipment 600, is wirelessly or non-wirelessly communicated with other equipment to exchange data.Although Fig. 5 shows tool
There is the electronic equipment 600 of various devices, it should be understood that being not required for implementing or having all devices shown.It can be with
Alternatively implement or have more or fewer devices.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on non-transient storage media
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communication device 609, or from storage device 606
It is mounted, or is mounted from ROM 602.When the computer program is executed by processing unit 601, the embodiment of the present disclosure is executed
Method in the above-mentioned function that limits.
In some embodiments, client, server can use such as HTTP (HyperText Transfer
Protocol, hypertext transfer protocol) etc the network protocols of any currently known or following research and development communicated, and can
To be interconnected with the digital data communications (for example, communication network) of arbitrary form or medium.The example of communication network includes local area network
(LAN), wide area network (WAN), Internet (for example, internet) and ad-hoc network (for example, ad hoc ad-hoc network), with
And the network of any currently known or following research and development.
Above-mentioned storage medium can be included in above-mentioned electronic equipment;It is also possible to individualism, and without supplying
In the electronic equipment.
Above-mentioned storage medium carries one or more program, when said one or multiple programs are by the electronic equipment
When execution, so that the electronic equipment: obtaining at least two internet protocol addresses;Send to Node evaluation equipment includes at least two
The Node evaluation of internet protocol address is requested, wherein Node evaluation equipment is chosen internet from least two internet protocol addresses
Protocol address simultaneously returns;The internet protocol address that receiving node valuator device returns;Wherein, acquired internet protocol address refers to
Show the fringe node in content distributing network.
Alternatively, above-mentioned storage medium carries one or more program, when said one or multiple programs are by the electricity
When sub- equipment executes, so that the electronic equipment: receiving the Node evaluation including at least two internet protocol addresses and request;From at least
In two internet protocol addresses, internet protocol address is chosen;Return to the internet protocol address selected;Wherein, the net received
Internet protocol address indicates the fringe node in content distributing network.
The calculating of the operation for executing the disclosure can be write with one or more programming languages or combinations thereof
Machine program code, above procedure design language include but is not limited to object oriented program language-such as Java,
Smalltalk, C++ further include conventional procedural programming language-such as " C " language or similar program design language
Speech.Program code can be executed fully on the user computer, partly be executed on the user computer, as an independence
Software package execute, part on the user computer part execute on the remote computer or completely in remote computer or
It is executed on server.In situations involving remote computers, remote computer can pass through the network of any kind --- packet
It includes local area network (LAN) or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as benefit
It is connected with ISP by internet).
It should be noted that the above-mentioned storage medium of the disclosure can be computer-readable signal media or computer can
Read storage medium either the two any combination.Computer readable storage medium for example can be --- but it is unlimited
In system, device or the device of --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or any above combination.It calculates
The more specific example of machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, portable of one or more conducting wires
Formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable programmable read only memory
(EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device or
The above-mentioned any appropriate combination of person.In the disclosure, computer readable storage medium can be it is any include or storage program
Tangible medium, which can be commanded execution system, device or device use or in connection.And in this public affairs
In opening, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, wherein
Carry computer-readable program code.The data-signal of this propagation can take various forms, including but not limited to electric
Magnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer-readable storage
Any storage medium other than medium, the computer-readable signal media can be sent, propagated or transmitted for being held by instruction
Row system, device or device use or program in connection.The program code for including on storage medium can be used
Any medium transmission appropriate, including but not limited to: electric wire, optical cable, RF (radio frequency) etc. or above-mentioned any appropriate group
It closes.
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the disclosure, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in unit involved in the embodiment of the present disclosure can be realized by way of software, can also be by hard
The mode of part is realized.Wherein, the title of unit does not constitute the restriction to the unit itself under certain conditions.
Function described herein can be executed at least partly by one or more hardware logic components.Example
Such as, without limitation, the hardware logic component for the exemplary type that can be used include: field programmable gate array (FPGA), specially
With integrated circuit (ASIC), Application Specific Standard Product (ASSP), system on chip (SOC), complex programmable logic equipment (CPLD) etc.
Deng.
In the context of the disclosure, machine readable media can be tangible medium, may include or is stored for
The program that instruction execution system, device or equipment are used or is used in combination with instruction execution system, device or equipment.Machine can
Reading medium can be machine-readable signal medium or machine-readable storage medium.Machine readable media can include but is not limited to electricity
Son, magnetic, optical, electromagnetism, infrared or semiconductor system, device or equipment or above content any conjunction
Suitable combination.The more specific example of machine readable storage medium will include the electrical connection of line based on one or more, portable meter
Calculation machine disk, hard disk, random access memory (RAM), read-only memory (ROM), Erasable Programmable Read Only Memory EPROM (EPROM
Or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage facilities or
Any appropriate combination of above content.
Above description is only the preferred embodiment of the disclosure and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that the open scope involved in the disclosure, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from design disclosed above, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed in the disclosure
Can technical characteristic replaced mutually and the technical solution that is formed.
Although this is not construed as requiring these operations with institute in addition, depicting each operation using certain order
The certain order that shows executes in sequential order to execute.Under certain environment, multitask and parallel processing may be advantageous
's.Similarly, although containing several specific implementation details in being discussed above, these are not construed as to this public affairs
The limitation for the range opened.Certain features described in the context of individual embodiment can also be realized in combination single real
It applies in example.On the contrary, the various features described in the context of single embodiment can also be individually or with any suitable
The mode of sub-portfolio is realized in various embodiments.
Although having used specific to this theme of the language description of structure feature and/or method logical action, answer
When understanding that theme defined in the appended claims is not necessarily limited to special characteristic described above or movement.On on the contrary,
Special characteristic described in face and movement are only to realize the exemplary forms of claims.
The multiple embodiments of the disclosure are described in detail above, but the present disclosure is not limited to these specific embodiments,
Those skilled in the art can make a variety of variants and modifications embodiments on the basis of the disclosure is conceived, these modifications and repair
Change should all fall into the disclosure it is claimed within the scope of.
Claims (10)
1. a kind of test method characterized by comprising
Obtain modification instruction information;
Code is obtained from hard disk;
Whether detection current environment is test environment;
It is the test environment in response to the current environment, is got from hard disk according to the modification instruction information modification
Code;Modified code is loaded into memory;And the modified code is run in the memory;
It is non-testing environments in response to the current environment, the code got from hard disk is loaded into memory;And institute
It states and runs the code in memory.
2. the method as described in claim 1, which is characterized in that whether the detection current environment is test environment, comprising:
Obtain the environmental information of the current environment;
Obtain the specific environment information of the test environment;
Compare the environmental information of the current environment and the specific environment information of the test environment;
It is identical as the test specific environment information of environment in response to the environmental information of the current environment, it determines described current
Environment is the test environment;
It is different from the test specific environment information of environment in response to the environmental information of the current environment, it determines described current
Environment is non-testing environments.
3. according to the method described in claim 2, it is characterized in that, the environmental information is including at least following one: IP address,
MAC Address, environmental variance.
4. method as claimed in any one of claims 1-3, which is characterized in that the acquisition modification instruction information, comprising:
Detect configuration file;
The configuration file is parsed, modifies instruction information to obtain, wherein the modification instruction information includes at least: to be replaced
The position of code and replacement code.
5. method as claimed in claim 4, which is characterized in that described to indicate that information modification is obtained from hard disk according to the modification
The code got, comprising:
Code to be replaced is being determined from the code got in hard disk according to the position of the code to be replaced;
The code to be replaced is replaced using the replacement code.
6. a kind of test device characterized by comprising
First obtains module, for obtaining modification instruction information;
Second obtains module, for obtaining code from hard disk;
Detection module, for detecting whether current environment is test environment;
First execution module indicates that information is repaired according to the modification for being the test environment in response to the current environment
Change the code got from hard disk;Modified code is loaded into memory;And in the memory after operation modification
The code;
Second execution module loads the code got from hard disk for being non-testing environments in response to the current environment
Into memory;And the code is run in the memory.
7. device as claimed in claim 6, which is characterized in that the detection module, comprising:
Acquiring unit, for obtaining the environmental information of the current environment;And obtain the specific environment letter of the test environment
Breath;
Comparing unit, for the environmental information of the current environment and the specific environment information of the test environment;
First determination unit, the specific environment information for environmental information and the test environment in response to the current environment
It is identical, determine that the current environment is the test environment;
Second determination unit, the specific environment information for environmental information and the test environment in response to the current environment
Difference determines that the current environment is non-testing environments.
8. device as claimed in claims 6 or 7, which is characterized in that
Described first obtains module, is specifically used for: detection configuration file;The configuration file is parsed, modifies instruction letter to obtain
Breath, wherein the modification instruction information includes at least: the position of code to be replaced and replacement code.
9. a kind of storage medium, is stored with computer program, which is characterized in that the computer program is performed realization right
It is required that method described in any one of 1 to 5.
10. a kind of electronic equipment includes at least memory, processor, is stored with computer program, feature on the memory
It is, the processor is realized described in any one of claims 1 to 5 when executing the computer program on the memory
Method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910695533.9A CN110489341B (en) | 2019-07-30 | 2019-07-30 | Test method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910695533.9A CN110489341B (en) | 2019-07-30 | 2019-07-30 | Test method and device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110489341A true CN110489341A (en) | 2019-11-22 |
CN110489341B CN110489341B (en) | 2023-08-11 |
Family
ID=68548694
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910695533.9A Active CN110489341B (en) | 2019-07-30 | 2019-07-30 | Test method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110489341B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6490721B1 (en) * | 1998-07-14 | 2002-12-03 | Oc Systems Incorporated | Software debugging method and apparatus |
US7610523B1 (en) * | 2006-02-09 | 2009-10-27 | Sun Microsystems, Inc. | Method and template for physical-memory allocation for implementing an in-system memory test |
CN106201878A (en) * | 2016-07-08 | 2016-12-07 | 百度在线网络技术(北京)有限公司 | The execution method and apparatus of test program |
CN107305528A (en) * | 2016-04-25 | 2017-10-31 | 北京京东尚科信息技术有限公司 | Application testing method and device |
CN109032927A (en) * | 2018-06-26 | 2018-12-18 | 腾讯科技(深圳)有限公司 | A kind of bug excavation method and device |
-
2019
- 2019-07-30 CN CN201910695533.9A patent/CN110489341B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6490721B1 (en) * | 1998-07-14 | 2002-12-03 | Oc Systems Incorporated | Software debugging method and apparatus |
US7610523B1 (en) * | 2006-02-09 | 2009-10-27 | Sun Microsystems, Inc. | Method and template for physical-memory allocation for implementing an in-system memory test |
CN107305528A (en) * | 2016-04-25 | 2017-10-31 | 北京京东尚科信息技术有限公司 | Application testing method and device |
CN106201878A (en) * | 2016-07-08 | 2016-12-07 | 百度在线网络技术(北京)有限公司 | The execution method and apparatus of test program |
CN109032927A (en) * | 2018-06-26 | 2018-12-18 | 腾讯科技(深圳)有限公司 | A kind of bug excavation method and device |
Also Published As
Publication number | Publication date |
---|---|
CN110489341B (en) | 2023-08-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109375918A (en) | Interface rendering method, device, electronic equipment and the storage medium of small routine | |
CN108614774A (en) | Automated testing method and device | |
CN110275723A (en) | Obtain method, apparatus, electronic equipment and the readable medium of resource | |
CN109871388A (en) | Data cache method, device, whole electronic equipment and storage medium | |
CN108494860A (en) | WEB accesses system, WEB access methods and device for client | |
CN110413913A (en) | A kind of page furbishing method, device, terminal and storage medium | |
CN110109840A (en) | Code audit method, audit device and the medium compared based on version number | |
CN110209315A (en) | The display methods of character, device, electronic equipment and storage medium in user interface | |
CN110471738A (en) | Method for switching theme, device, electronic equipment and the storage medium of application program | |
CN109447635A (en) | Information storage means and device for block chain | |
CN109684188A (en) | Test method and device | |
CN109254914A (en) | Software development kit test method, system, computer installation and readable storage medium storing program for executing | |
CN110362488A (en) | A kind of page test method, device, electronic equipment and storage medium | |
CN109684589A (en) | Processing method, device and the computer storage medium of the comment data of client | |
CN109446092A (en) | The method, apparatus and electronic equipment be identified to user interface UI element | |
CN110221857A (en) | The problem of application program restorative procedure, device, electronic equipment and storage medium | |
CN107102950A (en) | A kind of applied program testing method and device | |
CN110275736A (en) | Obtain operation data method, apparatus, equipment and the readable medium of application program | |
CN110119386A (en) | Data processing method, data processing equipment, medium and calculating equipment | |
CN110377273A (en) | A kind of method, apparatus of data processing, medium and electronic equipment | |
CN110489621A (en) | A kind of method, apparatus, medium and the electronic equipment of dynamic adjustment routing | |
CN110489165A (en) | Obtain method, apparatus, medium and the equipment of call stack stack frame command offsets | |
CN110378660A (en) | Stock processing method, apparatus, electronic equipment and computer readable storage medium | |
CN109491908A (en) | Page detection method, apparatus, electronic equipment and storage medium | |
CN110489326A (en) | HTTPAPI adjustment method device, medium and equipment based on IDS |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |