CN111352838A - Package file generation method, package file generation device and electronic equipment - Google Patents

Package file generation method, package file generation device and electronic equipment Download PDF

Info

Publication number
CN111352838A
CN111352838A CN202010127414.6A CN202010127414A CN111352838A CN 111352838 A CN111352838 A CN 111352838A CN 202010127414 A CN202010127414 A CN 202010127414A CN 111352838 A CN111352838 A CN 111352838A
Authority
CN
China
Prior art keywords
file
script file
field
preset
generating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010127414.6A
Other languages
Chinese (zh)
Inventor
李国文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202010127414.6A priority Critical patent/CN111352838A/en
Publication of CN111352838A publication Critical patent/CN111352838A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a package file generation method, a package file generation device, an electronic device and a computer readable storage medium, comprising: acquiring an original script file related to a method to be tested; screening each field in the original script file based on preset screening conditions to obtain a target field, wherein the screening conditions comprise: matching with preset key fields; shielding a target field in the original script file to obtain a new script file, wherein the new script file does not contain the target field; and generating a target package file based on the new script file, wherein the target package file is used for realizing the test of test data, and the test data comprises data meeting preset preconditions and data not meeting the preconditions. By the scheme, the situation that the abnormal information is frequently returned due to incorrect input test data in the test process can be reduced, the test cost is saved, and the flexibility in the test process is improved.

Description

Package file generation method, package file generation device and electronic equipment
Technical Field
The present application belongs to the field of data processing technologies, and in particular, to a package file generation method, a package file generation apparatus, an electronic device, and a computer-readable storage medium.
Background
Currently, many enterprise-enabled platforms require a database call to be made, and during the database call, a plurality of different methods need to be run to implement different functions. These methods may be set with a number of preconditions before being called or executed. When testing each function of the platform, each method can be normally executed only after the precondition is satisfied; otherwise, a situation that the corresponding method cannot be called or executed due to the fact that the precondition is not satisfied may occur, so that the platform is abnormal or returns directly, and the subsequent flow cannot be executed. This requires that the verifier prepare a large amount of correct verification data in the early stage to verify the methods in the platform, which is costly.
Disclosure of Invention
In view of this, the present application provides a package file generation method, a package file generation apparatus, an electronic device, and a computer-readable storage medium, which can save test cost and improve flexibility in a test process.
A first aspect of the present application provides a package file generation method, including:
acquiring an original script file related to a method to be tested;
screening each field in the original script file based on preset screening conditions to obtain a target field, wherein the screening conditions comprise: the preset key field is matched with a preset key field and used for indicating that the content returned by the returned statement is abnormal content;
shielding a target field in the original script file to obtain a new script file, wherein the new script file does not contain the target field;
and generating an object package file based on the new script file, wherein the object package file is used for realizing the test of test data, and the test data comprises data meeting preset preconditions and data not meeting the preconditions.
A second aspect of the present application provides a package file generating apparatus, including:
the acquisition unit is used for acquiring an original script file related to a method to be tested;
and the screening unit is used for screening each field in the original script file based on preset screening conditions to obtain a target field, wherein the screening conditions comprise: the preset key field is matched with a preset key field and used for indicating that the content returned by the returned statement is abnormal content;
the shielding unit is used for shielding the target field in the original script file to obtain a new script file, wherein the new script file does not contain the target field;
and the generating unit is used for generating an object package file based on the new script file, wherein the object package file is used for realizing the test of test data, and the test data comprises data meeting preset preconditions and data not meeting the preconditions.
A third aspect of the present application provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method according to the first aspect when executing the computer program.
A fourth aspect of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first aspect as described above.
A fifth aspect of the application provides a computer program product comprising a computer program which, when executed by one or more processors, performs the steps of the method as described in the first aspect above.
As can be seen from the above, in the present application, an original script file related to a method to be tested is first obtained, and then each field in the original script file is screened based on a preset screening condition to obtain a target field, where the screening condition includes: and matching with a preset key field, shielding a target field in the original script file to obtain a new script file, wherein the new script file does not contain the target field, and finally generating a target package file based on the new script file, wherein the target package file is used for realizing the test of test data, and the test data comprises data meeting a preset precondition and data not meeting the precondition. By the scheme, the situation that the abnormal information is frequently returned due to incorrect input test data in the test process can be reduced, the test cost is saved, and the flexibility in the test process is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flow chart illustrating an implementation of a package file generation method according to an embodiment of the present application;
fig. 2 is a block diagram of a package file generation apparatus according to an embodiment of the present application;
fig. 3 is a schematic diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
Currently, most of the core algorithms, important business processes, important interfaces and data timing acquisition of platforms employed by many enterprises are implemented based on the respective methods stored in the database. Most of the methods are simply called by front-end pages, some are called regularly, and others are packaged into interfaces to be provided for other platforms or platforms to call. After the methods are operated, the results are usually displayed on a front-end page, some methods are directly dropped in the background to wait for being used by other methods, and other methods are displayed in the returned results when other platforms call. However, no matter how the calling or the result displaying is realized, the methods are complex preconditions before being called and executed, and the corresponding methods can be normally executed only after the preconditions are met; if the precondition is not satisfied, the corresponding method cannot be normally executed, and the program directly throws an exception or returns, so that the subsequent function or process cannot be executed. Therefore, in the process of testing the methods, the test data needs to be prepared manually in advance, and the test data needs to meet one or more preconditions, so that all the methods to be tested can be called and executed. If the precondition has a requirement for mutual exclusion of data, a plurality of pieces of test data are required to be prepared to respectively verify different scenes and methods; if the preconditions are very large, a large batch of test data needs to be prepared for the respective tests, which results in a very large resource overhead spent on the data preparation. Based on this, the embodiment of the present application provides a package file generation method, a package file generation apparatus, and an electronic device, which can regenerate a new script file without changing core service logic and algorithms of these methods, where the new script file is executed in a database to generate a new package file, and a tester directly calls the new package file in the database during smoking or testing, so that only one piece of data is needed to cover all functions of test and verification, and there is no need to worry that the execution is exited because the data does not meet a certain precondition or preconditions. In order to explain the technical solution of the present application, the following description will be given by way of specific examples.
Example one
In the embodiment of the present application, the main execution subject of the flow is an electronic device such as a server or a personal computer. Fig. 1 shows a flowchart of an implementation of a package file generation method according to an embodiment of the present application, which is detailed as follows:
step 101, obtaining an original script file related to a method to be tested;
in the embodiment of the present application, one or more methods in the platform may be first designated by a tester as a method to be tested. After the method to be tested is determined, the original script file related to the method to be tested needs to be further acquired. Specifically, each method in the platform is generally stored in a preset database, and therefore, a start address and an end address of the method to be tested in a data dictionary table (dba _ source) in the database may be obtained first, and then the original script file may be obtained by extracting codes from the start address to the end address based on the start address and the end address, that is, the original script file may be obtained by extracting codes from the start address to the end address, where the start address refers to a start line number start _ num and the end address refers to an end line number end _ num. Further, the packet header and the packet body name associated with the original script file under the correct system user name may be searched in the data dictionary table, where the correct system user refers to an owner of the packet header and the packet body associated with the original script file, that is, a user actually performing the call.
102, screening each field in the original script file based on preset screening conditions to obtain a target field;
in the embodiment of the application, a user may set a filtering condition in the electronic device in advance, and the electronic device may immediately filter each field in the original script file based on the filtering condition to obtain a target field. Specifically, the screening conditions include: the method comprises the steps of matching with a preset key field, wherein the preset key field is used for indicating that the content returned by a return statement is abnormal content; that is, the fields not matching the preset key fields are screened out, and the fields matching the preset key fields are retained, then the step 102 can be represented as:
a1, acquiring and analyzing a preset configuration file to obtain a key field;
in this embodiment of the present application, the electronic device may store a configuration file in advance, and the configuration file is generated based on the original package file. Based on this, the electronic device may first obtain and parse the configuration file to obtain the key fields configured in the configuration file. Optionally, in addition to the key fields, the configuration file may also be configured with the following data: the method comprises the following steps of starting sql of the header name of the original package file, ending sql of the header name of the original package file, starting sql of the body name of the original package file, ending of the body name of the original package file, starting sql of the name of the method to be tested, ending of the name of the method to be tested and the name of the target package file. Optionally, the generating process of the configuration file may be to first obtain a source code of an original package file, then traverse the source code to obtain all methods called by the source code, then obtain a return statement in each method, and finally generate the configuration file according to the obtained return statement in each method, where the return statement refers to a return statement given in a method. Further, in order to select key fields more specifically and avoid the configuration file from being too bloated, the returned statements in each method may be obtained and then analyzed, specifically, whether the content returned by each returned statement is preset abnormal content or not is detected, that is, whether each returned statement throws out the abnormality or whether the program exits execution or other situations are detected, if yes, the content returned by the returned statement is considered to be abnormal content, and if not, the content returned by the returned statement is considered to be non-abnormal content; after analyzing each return statement, determining the return statement of which the returned content is the abnormal content as a key field, and generating the configuration file based on each determined key field.
A2, matching each field contained in the original script file with the key field;
in the embodiment of the present application, the code in the original script file is traversed, and each field included in the original script file is respectively matched with each key field. Specifically, only if two fields are identical will two fields be confirmed as matching.
And A3, determining the fields successfully matched with the key fields as target fields.
In the embodiment of the application, when a field successfully matched with any key field is found in the original script file, the field is confirmed as a target field. It should be noted that, considering that there are a plurality of key fields, there may be a plurality of target fields determined in this step, and the number of the key fields and the target fields is not limited herein.
Step 103, shielding the target field in the original script file to obtain a new script file;
in this embodiment of the present application, after the target field in the original script file is screened out, the target field is further subjected to a shielding process, where the shielding process may be to delete the target field, or may also be to replace the target field. Specifically, if the target field is masked by the replacement operation, the step 103 may be represented as: and replacing the target field in the original script file with a preset log writing field to obtain a new script file, wherein the log writing field performs corresponding log writing operation after being executed. The preset log writing field is actually a call log writing method, that is, when the target field is encountered, the target field is replaced by a log writing method through a replacement operation, and when the program runs to the original target field, the log writing operation is executed. It should be noted that the information written by the log write operation is not limited herein, and for example, the exception information thrown by the original target field (i.e. the exception content returned by the original target field) may be written into the log file. Of course, for the fields that cannot be successfully matched with the target fields in the original script file, the shielding operation is not needed, and the fields are directly reserved. After all the target fields in the original script file are shielded, the obtained script file is the new script file. Wherein, the new script file does not contain the target field. Optionally, the log write field or other fields for replacing the target field may also be configured into the configuration file, which is not limited herein. Further, the generated new script file may be stored in the database for the test user to call, which is not limited herein.
And 104, generating an object package file based on the new script file.
In this embodiment of the present application, after obtaining a new script file, an object package file may be further generated based on the new script file, where the object package file is used to implement a test on test data, and the test data includes data that satisfies a preset precondition and data that does not satisfy the precondition. Specifically, considering that a new script file is usually stored in a database, and the access right of the database and the execution right of the test operation are usually only opened to a tester, the database may be called by a test user, and the new script file is executed based on the configuration file, so as to generate a new packet header and a new packet body under the test user, that is, generate a target packet file, where the test user specifically refers to an account corresponding to the tester. When the method in the target package file is called, the field which throws or returns the abnormal content is shielded, so that the method can be directly executed without exiting no matter whether the input test data meets the precondition or not. When the input test data meets the precondition, the corresponding data processing operation can be normally executed; when the input test data does not meet the precondition, the abnormal information can be output to the log, and the condition of forced quitting can not occur.
Therefore, by the scheme, keywords which are possibly thrown out of abnormal contents in the platform are shielded, all the methods to be tested can be tested in a covering mode only by less test data, the method of the platform can be guaranteed to be normally called, and the input test data can be checked which precondition is met and which precondition is not met through the log file, so that not only can the generated target package file be normally called, but also the situation that the input test data is forcibly quitted from execution due to the fact that the input test data does not meet one or more precondition is avoided, and a reference basis is provided for the whole test scheme or thought.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example two
A second embodiment of the present application provides a package file generating apparatus, where the package file generating apparatus may be integrated in an electronic device, and as shown in fig. 2, a package file generating apparatus 200 in the second embodiment of the present application includes:
an obtaining unit 201, configured to obtain an original script file related to a method to be tested;
a screening unit 202, configured to screen each field in the original script file based on a preset screening condition to obtain a target field, where the screening condition includes: the preset key field is matched with a preset key field and used for indicating that the content returned by the returned statement is abnormal content;
a shielding unit 203, configured to shield a target field in the original script file to obtain a new script file, where the new script file does not include the target field;
a generating unit 204, configured to generate an object package file based on the new script file, where the object package file is used to implement a test on test data, and the test data includes data that satisfies a preset precondition and data that does not satisfy the precondition.
Optionally, the obtaining unit 201 includes:
the address acquisition subunit is used for acquiring a starting address and an ending address of the method to be tested in a preset database;
and the data extraction subunit is used for extracting the original script file from the database based on the starting address and the ending address.
Optionally, the screening unit 202 includes:
the file analysis subunit is used for acquiring and analyzing a preset configuration file to obtain a key field;
a field matching subunit, configured to match each field included in the original script file with the key field;
and the field determining subunit is used for determining the fields successfully matched with the key fields as target fields.
Optionally, the package file generating device further includes:
a storage unit, configured to store the new script file in the database;
accordingly, the generating unit 204 is specifically configured to invoke the new script file in the database by a test user, and execute the new script file based on the configuration file, so as to generate an object package file under the test user.
Optionally, the package file generating apparatus 200 further includes:
the source code acquisition unit is used for acquiring a source code of the original package file;
the source code traversing unit is used for traversing the source code to obtain all methods called by the source code;
a return statement acquisition unit for acquiring return statements in each method;
and the configuration file generating unit is used for generating the configuration file according to the return statements in the acquired methods.
Optionally, the configuration file generating unit includes:
the abnormal content detection subunit is used for detecting whether the content returned by each returned statement is preset abnormal content or not;
a key field determining subunit, configured to determine a return statement that the returned content is the abnormal content as a key field;
and generating the configuration file based on the determined key fields.
Optionally, the shielding unit 203 is specifically configured to replace a target field in the original script file with a preset log writing field to obtain a new script file, where the log writing field performs a corresponding log writing operation after being executed.
Therefore, by the scheme, keywords which are possibly thrown out of abnormal contents in the platform are shielded, all the methods to be tested can be tested in a covering mode only by less test data, the method of the platform can be guaranteed to be normally called, and the input test data can be checked which precondition is met and which precondition is not met through the log file, so that not only can the generated target package file be normally called, but also the situation that the input test data is forcibly quitted from execution due to the fact that the input test data does not meet one or more precondition is avoided, and a reference basis is provided for the whole test scheme or thought.
EXAMPLE III
Referring to fig. 3, an electronic device 3 in the embodiment of the present application includes: a memory 301, one or more processors 302 (only one shown in fig. 3), and a computer program stored on the memory 301 and executable on the processors. Wherein: the memory 301 is used for storing software programs and modules, and the processor 302 executes various functional applications and data processing by running the software programs and units stored in the memory 301, so as to acquire resources corresponding to the preset events. Specifically, the processor 302 realizes the following steps by running the above-mentioned computer program stored in the memory 301:
acquiring an original script file related to a method to be tested;
screening each field in the original script file based on preset screening conditions to obtain a target field, wherein the screening conditions comprise: the preset key field is matched with a preset key field and used for indicating that the content returned by the returned statement is abnormal content;
shielding a target field in the original script file to obtain a new script file, wherein the new script file does not contain the target field;
and generating an object package file based on the new script file, wherein the object package file is used for realizing the test of test data, and the test data comprises data meeting preset preconditions and data not meeting the preconditions.
Assuming that the above is the first possible implementation manner, in a second possible implementation manner provided on the basis of the first possible implementation manner, the acquiring an original script file related to a method to be tested includes:
acquiring a starting address and an ending address of the method to be tested in a preset database;
and extracting the original script file from the database based on the starting address and the ending address.
In a third possible implementation manner provided based on the second possible implementation manner, the filtering, based on a preset filtering condition, each field in the original script file to obtain a target field includes:
acquiring and analyzing a preset configuration file to obtain a key field;
matching each field contained in the original script file with the key field;
and determining the fields successfully matched with the key fields as target fields.
In a fourth possible implementation provided on the basis of the third possible implementation, the processor 302 further implements the following steps when executing the computer program stored in the memory 301:
storing the new script file in the database;
correspondingly, the generating of the object package file based on the new script file includes:
and calling the new script file in the database by a test user, and executing the new script file based on the configuration file to generate an object package file under the test user.
In a fifth possible implementation manner provided on the basis of the third possible implementation manner, the processor 302 implements the following steps when executing the computer program stored in the memory 301:
acquiring a source code of an original package file;
traversing the source code to obtain all methods called by the source code;
acquiring return statements in each method;
and generating the configuration file according to the return statements in the acquired methods.
In a sixth possible embodiment based on the fifth possible embodiment, the generating the configuration file according to the return statement in each acquired method includes:
detecting whether the content returned by each returned statement is preset abnormal content or not;
determining a return statement of which the returned content is the abnormal content as a key field;
and generating the configuration file based on the determined key fields.
In a seventh possible embodiment based on the first possible embodiment, the generating the configuration file according to the return statement in each of the acquired methods includes:
and replacing the target field in the original script file with a preset log writing field to obtain a new script file, wherein the log writing field performs corresponding log writing operation after being executed.
It should be understood that, in the embodiment of the present Application, the Processor 302 may be a Central Processing Unit (CPU), and the Processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Memory 301 may include both read-only memory and random access memory and provides instructions and data to processor 302. Some or all of memory 301 may also include non-volatile random access memory. For example, the memory 301 may also store device type information.
Therefore, by the scheme, keywords which are possibly thrown out of abnormal contents in the platform are shielded, all the methods to be tested can be tested in a covering mode only by less test data, the method of the platform can be guaranteed to be normally called, and the input test data can be checked which precondition is met and which precondition is not met through the log file, so that not only can the generated target package file be normally called, but also the situation that the input test data is forcibly quitted from execution due to the fact that the input test data does not meet one or more precondition is avoided, and a reference basis is provided for the whole test scheme or thought.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of external device software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the above-described modules or units is only one logical functional division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated unit may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, all or part of the flow in the method of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the above-described computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer readable Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable storage medium may contain other contents which can be appropriately increased or decreased according to the requirements of the legislation and the patent practice in the jurisdiction, for example, in some jurisdictions, the computer readable storage medium does not include an electrical carrier signal and a telecommunication signal according to the legislation and the patent practice.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A package file generation method is characterized by comprising the following steps:
acquiring an original script file related to a method to be tested;
screening each field in the original script file based on preset screening conditions to obtain a target field, wherein the screening conditions comprise: the preset key field is matched with a preset key field and used for indicating that the content returned by the returned statement is abnormal content;
shielding a target field in the original script file to obtain a new script file, wherein the new script file does not contain the target field;
and generating an object package file based on the new script file, wherein the object package file is used for realizing the test of test data, and the test data comprises data meeting preset preconditions and data not meeting the preconditions.
2. The package file generating method of claim 1, wherein said obtaining an original script file related to a method to be tested comprises:
acquiring a starting address and an ending address of the method to be tested in a preset database;
and extracting the original script file from the database based on the starting address and the ending address.
3. The package file generation method of claim 2, wherein the screening each field in the original script file based on a preset screening condition to obtain a target field comprises:
acquiring and analyzing a preset configuration file to obtain a key field;
matching each field contained in the original script file with the key field;
and determining the fields successfully matched with the key fields as target fields.
4. The package file generating method according to claim 3, wherein after the target field in the original script file is masked to obtain a new script file, the package file generating method further comprises:
storing the new script file in the database;
correspondingly, the generating of the object package file based on the new script file comprises:
and calling the new script file in the database through a test user, and executing the new script file based on the configuration file so as to generate a target package file under the test user.
5. The package file generating method according to claim 3, wherein the package file generating method further comprises:
acquiring a source code of an original package file;
traversing the source code to obtain all methods called by the source code;
acquiring return statements in each method;
and generating the configuration file according to the obtained return statements in each method.
6. The package file generation method according to claim 5, wherein the generating the configuration file according to the obtained return statement in each method includes:
detecting whether the content returned by each returned statement is preset abnormal content or not;
determining a return statement of which the returned content is the abnormal content as a key field;
and generating the configuration file based on the determined key fields.
7. The method for generating a package file according to claim 1, wherein the step of masking the object field in the original script file to obtain a new script file comprises:
and replacing the target field in the original script file with a preset log writing field to obtain a new script file, wherein the log writing field performs corresponding log writing operation after being executed.
8. A package file generating apparatus, characterized by comprising:
the acquisition unit is used for acquiring an original script file related to a method to be tested;
and the screening unit is used for screening each field in the original script file based on preset screening conditions to obtain a target field, wherein the screening conditions comprise: the preset key field is matched with a preset key field and used for indicating that the content returned by the returned statement is abnormal content;
the shielding unit is used for shielding the target field in the original script file to obtain a new script file, wherein the new script file does not contain the target field;
and the generating unit is used for generating an object package file based on the new script file, wherein the object package file is used for realizing the test of test data, and the test data comprises data meeting preset preconditions and data not meeting the preconditions.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202010127414.6A 2020-02-28 2020-02-28 Package file generation method, package file generation device and electronic equipment Pending CN111352838A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010127414.6A CN111352838A (en) 2020-02-28 2020-02-28 Package file generation method, package file generation device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010127414.6A CN111352838A (en) 2020-02-28 2020-02-28 Package file generation method, package file generation device and electronic equipment

Publications (1)

Publication Number Publication Date
CN111352838A true CN111352838A (en) 2020-06-30

Family

ID=71195808

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010127414.6A Pending CN111352838A (en) 2020-02-28 2020-02-28 Package file generation method, package file generation device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111352838A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612664A (en) * 2020-12-24 2021-04-06 百度在线网络技术(北京)有限公司 Electronic equipment testing method and device, electronic equipment and storage medium
WO2023241592A1 (en) * 2022-06-14 2023-12-21 中兴通讯股份有限公司 Page loading method and device, storage medium, and electronic device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612664A (en) * 2020-12-24 2021-04-06 百度在线网络技术(北京)有限公司 Electronic equipment testing method and device, electronic equipment and storage medium
CN112612664B (en) * 2020-12-24 2024-04-02 百度在线网络技术(北京)有限公司 Electronic equipment testing method and device, electronic equipment and storage medium
WO2023241592A1 (en) * 2022-06-14 2023-12-21 中兴通讯股份有限公司 Page loading method and device, storage medium, and electronic device

Similar Documents

Publication Publication Date Title
CN108459962B (en) Code normalization detection method and device, terminal equipment and storage medium
CN108415830B (en) Method and device for generating software test case
CN110941528B (en) Log buried point setting method, device and system based on fault
CN114546738B (en) Universal test method, system, terminal and storage medium for server
CN109918296B (en) Software automation test method and device
US11237943B2 (en) Generating inputs for computer-program testing
CN111352838A (en) Package file generation method, package file generation device and electronic equipment
CN110554938A (en) BIOS (basic input output System) testing method, system, terminal and storage medium based on script set
CN110704303B (en) Method and device for acquiring test coverage information
CN110188083B (en) Interface information mining method and device
CN112084108A (en) Test script generation method and device and related components
CN114979100B (en) Cloud resource inspection method and related device
CN113806231B (en) Code coverage rate analysis method, device, equipment and medium
US9489284B2 (en) Debugging method and computer program product
CN114282221A (en) Injection vulnerability detection method, system, terminal and storage medium
CN113486359A (en) Software vulnerability detection method and device, electronic device and storage medium
CN107291618B (en) Application storage method and device and terminal equipment
CN112527265A (en) Method for automatically injecting logs and computer equipment
CN111444057A (en) Page performance data acquisition method and device and computing equipment
US11042634B2 (en) Determining information leakage of computer-readable programs
US20220197945A1 (en) Computer-implemented method for analyzing a transaction log
CN114780952A (en) Method, system and storage medium for detecting sensitive application calling scene
CN118295930A (en) Automatic test processing method, device, equipment, storage medium and product
CN116069657A (en) Regression testing method, regression testing device, regression testing equipment, storage medium and regression testing product
CN111723001A (en) Method and device for generating PHP code coverage rate report

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