CN113468049A - Test method, device, equipment and medium based on configurable interface - Google Patents

Test method, device, equipment and medium based on configurable interface Download PDF

Info

Publication number
CN113468049A
CN113468049A CN202110724909.1A CN202110724909A CN113468049A CN 113468049 A CN113468049 A CN 113468049A CN 202110724909 A CN202110724909 A CN 202110724909A CN 113468049 A CN113468049 A CN 113468049A
Authority
CN
China
Prior art keywords
interface
target
file
social security
tested
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110724909.1A
Other languages
Chinese (zh)
Other versions
CN113468049B (en
Inventor
刘琼
褚红丹
刘献美
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Pension Insurance Corp
Original Assignee
Ping An Pension Insurance Corp
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 Pension Insurance Corp filed Critical Ping An Pension Insurance Corp
Priority to CN202110724909.1A priority Critical patent/CN113468049B/en
Publication of CN113468049A publication Critical patent/CN113468049A/en
Application granted granted Critical
Publication of CN113468049B publication Critical patent/CN113468049B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/26Government or public services
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the field of testing, and provides a testing method, a testing device, testing equipment and testing media based on a configurable interface, which can specifically simulate user operation aiming at different interface versions so as to perform specific testing subsequently, automatically verify whether the sending state of data sent through the interface and the message sending result are wrong or not, perform specific automatic testing according to different interface versions so as to ensure that a file can be correctly transmitted to a target social security server and generate a testing report of an interface to be tested, automatically simulate manual operation through a pre-compiled script, reduce time consumed by manual testing, effectively save time cost, simultaneously dock a plurality of social security servers, improve the universality of testing, perform specific testing according to different interface versions, and further optimize the testing effect. In addition, the invention also relates to a block chain technology, and the simulation operation script can be stored in the block chain node.

Description

Test method, device, equipment and medium based on configurable interface
Technical Field
The present invention relates to the field of test technologies, and in particular, to a test method, device, apparatus, and medium based on a configurable interface.
Background
At present, the career annuity system is connected with a national social security supervision system, 33 social security are totally arranged in the country, and the same social security comprises interfaces of different versions. The multiple social security monitoring systems are connected in a butt joint mode at the same time, and the requirement for on-line production needs to be rapidly met. The two versions total 31 interfaces, all interfaces of 33 social security need to be regressed and tested on the same day, the traffic is heavy, and the difficulty of testing and data checking is increased.
In the prior art, when interface regression testing is performed, the interfaces of each social security need to be tested respectively, a large number of repeated codes need to be written in the testing process, and the testing efficiency is seriously influenced.
Disclosure of Invention
In view of the above, it is necessary to provide a testing method, device, equipment and medium based on a configurable interface, which can automatically simulate manual operation through a pre-programmed script, reduce time consumed by manual testing, effectively save time cost, and simultaneously interface multiple social security servers, improve test universality, perform targeted testing according to different interface versions, and further optimize test effect.
A testing method based on a configurable interface comprises the following steps:
acquiring a pre-written simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, and each social security server corresponds to one social security code;
responding to a test instruction, and acquiring an interface to be tested and a target social security server according to the test instruction;
determining the interface version of the interface to be tested and determining a target social security code of the target social security server;
calling a target script from the simulation operation script according to the interface version of the interface to be tested;
determining the target social security code as an entry parameter of the target script, and executing the target script;
when the target script is detected to be executed completely, connecting to a configuration database, acquiring a data sending state record from the configuration database, sending a message result, and downloading a target file uploaded to the target social security server;
verifying the data sending state record and the message sending result to obtain a first verification result;
verifying the target file according to the interface version of the interface to be tested to obtain a second verification result;
and generating a test report of the interface to be tested according to the first verification result and the second verification result.
According to a preferred embodiment of the present invention, the acquiring the interface to be tested and the target social security server according to the test instruction includes:
analyzing the test instruction to obtain information carried by the test instruction;
acquiring a first label and a second label which are configured in advance, wherein the first label corresponds to an interface identification code, and the second label corresponds to a server identification code;
establishing a first regular expression according to the first label, and establishing a second regular expression according to the second label;
traversing information carried by the test instruction by using the first regular expression, determining the traversed information matched with the first regular expression as an interface identification code of the interface to be tested, and determining the interface to be tested according to the interface identification code of the interface to be tested;
traversing the information carried by the test instruction by using the second regular expression, determining the traversed information matched with the second regular expression as the server identification code of the target social security server, and determining the target social security server according to the server identification code of the target social security server.
According to a preferred embodiment of the present invention, the determining the interface version of the interface to be tested includes:
when the uploaded data is an accessory and the accessory is compressed without encryption processing, determining that the interface to be tested is a first version; or
When the uploaded data is a text and the text is compressed and then needs to be encrypted, determining that the interface to be tested is a second version; or
And when the uploaded data is a message, determining that the interface to be tested is a third version.
According to a preferred embodiment of the present invention, the executing the target script includes:
when the interface to be tested is the first version, uploading a target attachment, compressing the target attachment, uploading the compressed target attachment to the target social security server according to a preset frequency, and sending a file ready notice in a short-connection socket communication mode; or
When the interface to be tested is the second version, receiving data sent by an upstream server, acquiring target data selected from the data sent by the upstream server, compressing the target data, encrypting the compressed target data, packaging the data obtained after encryption as packaged data, uploading the packaged data to the target social security server, and sending a file ready notice; or
And when the interface to be tested is the third version, sending a target message to the target social security server.
According to the preferred embodiment of the present invention, the verifying the data transmission status record and the message transmission result includes:
when the data sending state record shows that the sending is successful, determining that the data sending state of the data sent through the interface to be tested passes the verification, or when the data sending state record shows that the sending is failed, determining that the data sending state of the data sent through the interface to be tested does not pass the verification;
acquiring a pre-configured interface specification corresponding to the target social security server, and determining whether the field length and the file naming format of the message in the message sending result are consistent with the interface specification; acquiring a mandatory field from the message result according to the interface specification, and detecting whether the mandatory field is a null field; acquiring service data corresponding to the target social security server, acquiring a service field from the message result, and detecting whether the service data is matched with the service field; when the field length, the file naming format and the interface specification are consistent, the mandatory field is not a null field, and the service data is matched with the service field, determining that the message sending result passes verification; or when the field length, the file naming format and the interface specification are not consistent, and/or the mandatory field is a null field, and/or the service data is not matched with the service field, determining that the message sending result is not verified.
According to a preferred embodiment of the present invention, said verifying the target file according to the interface version of the interface to be tested comprises:
when the interface to be tested is the first version, decompressing the target file to obtain a decompressed file, obtaining the file size and the file name of the decompressed file, comparing whether the file size of the decompressed file is consistent with the file size of the target file or not, and comparing whether the file name of the decompressed file is consistent with the file name of the target file or not, when the file size of the decompressed file is consistent with the file size of the target file and the file name of the decompressed file is consistent with the file name of the target file, determining that the target file passes verification, or when the file size of the decompressed file is not consistent with the file size of the target file and/or the file name of the decompressed file is not consistent with the file name of the target file, determining that the target file does not pass verification;
when the interface to be tested is the second version, acquiring a file naming rule corresponding to the target social security server, and verifying whether the file name of the target file conforms to the file naming rule corresponding to the target social security server; decompressing the target file to obtain a decompressed file, decrypting the decompressed file to obtain a decrypted text, comparing the decrypted text with the target file line by line, and determining consistency between the decrypted text and the target file, when the file name of the target file conforms to a file naming rule corresponding to the target social security server and the decrypted text is consistent with the target file, determining that the target file passes verification, or when the file name of the target file does not conform to the file naming rule corresponding to the target social security server and/or the decrypted text is inconsistent with the target file, determining that the target file does not pass verification;
and when the interface to be tested is the third version, the target file is not verified.
According to a preferred embodiment of the invention, the method further comprises:
when a newly added interface is detected, determining the interface version of the newly added interface, and writing a script corresponding to the newly added interface into the simulation operation script according to the interface version;
and when a new social security server is detected, adding the social security code and the service data of the new social security server in the simulation operation script.
A configurable interface based test device, the configurable interface based test device comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a pre-written simulation operation script, the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, and each social security server corresponds to one social security code;
the acquisition unit is also used for responding to a test instruction and acquiring an interface to be tested and a target social security server according to the test instruction;
the determining unit is used for determining the interface version of the interface to be tested and determining a target social security code of the target social security server;
the calling unit is used for calling a target script from the simulation operation script according to the interface version of the interface to be tested;
the execution unit is used for determining the target social security code as the entry of the target script and executing the target script;
the downloading unit is used for connecting to a configuration database when the target script is detected to be executed completely, acquiring a data sending state record from the configuration database, sending a message result, and downloading a target file uploaded to the target social security server;
the verification unit is used for verifying the data sending state record and the message sending result to obtain a first verification result;
the verification unit is further used for verifying the target file according to the interface version of the interface to be tested to obtain a second verification result;
and the generating unit is used for generating a test report of the interface to be tested according to the first verification result and the second verification result.
A computer device, the computer device comprising:
a memory storing at least one instruction; and
a processor executing instructions stored in the memory to implement the configurable interface based test method.
A computer-readable storage medium having stored therein at least one instruction for execution by a processor in a computer device to implement the configurable interface based testing method.
According to the technical scheme, the method can acquire the pre-programmed simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, each social security server corresponds to one social security code, the fully automatic simulation of the manual operation of a user is realized, the labor cost is effectively reduced, the artificial operation error is avoided, the execution efficiency is improved, the interface to be tested and the target social security server are acquired according to the test instruction in response to the test instruction, the required data are acquired based on the label and the regular expression, and due to the uniqueness of the label, the data acquisition efficiency is improved, the accuracy of the acquired data is ensured, and the interface version of the interface to be tested is determined, determining a target social security code of the target social security server, calling a target script from the simulation operation script according to the interface version of the interface to be tested, determining the target social security code as the reference of the target script, executing the target script, and performing targeted simulation user operation aiming at different interface versions so as to perform targeted test subsequently, when the target script is detected to be executed completely, connecting to a configuration database, obtaining a data sending state record and a message sending result from the configuration database, downloading a target file uploaded to the target social security server, verifying the data sending state record and the message sending result to obtain a first verification result, automatically verifying whether the sending state of data sent through the interface and the message sending result are wrong or not, and verifying the target file according to the interface version of the interface to be tested, and obtaining a second verification result, performing targeted automatic testing according to different interface versions to ensure that the file can be correctly transmitted to the target social security server, generating a test report of the interface to be tested according to the first verification result and the second verification result, automatically simulating manual operation through a pre-programmed script, reducing time consumed by manual testing, effectively saving time cost, simultaneously docking a plurality of social security servers, improving the universality of testing, performing targeted testing according to different interface versions, and further optimizing the testing effect.
Drawings
FIG. 1 is a flow chart of a testing method based on configurable interface according to a preferred embodiment of the present invention.
FIG. 2 is a functional block diagram of a test apparatus based on configurable interface according to a preferred embodiment of the present invention.
FIG. 3 is a schematic structural diagram of a computer device according to a preferred embodiment of the testing method based on configurable interface of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of a testing method based on configurable interface according to a preferred embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The testing method based on the configurable interface is applied to one or more computer devices, where the computer devices are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and hardware thereof includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive web Television (IPTV), an intelligent wearable device, and the like.
The computer device may also include a network device and/or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network servers.
The Network in which the computer device is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
S10, obtaining a pre-written simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, and each social security server corresponds to one social security code.
In this embodiment, the simulation operation script may be a Jmeter script, and is written and uploaded in advance by a developer or a tester.
Through practice, the Jmeter script is quick and accurate, the success rate is high, and the success rate can basically reach 100%.
Through the embodiment, the full-automatic simulation of the manual operation of the user can be realized, the labor cost is effectively reduced, the artificial operation error is avoided, and the execution efficiency is improved.
Specifically, the simulation operation script is used for simulating a user manual full-flow operation, such as: uploading files, clicking to submit, confirming to take effect, clicking to send and the like.
In the embodiment, one social security server can be uniquely represented by the social security code.
In this embodiment, each interface is interfaced with the social security server to realize data exchange with the social security server.
And S11, responding to the test instruction, and acquiring the interface to be tested and the target social security server according to the test instruction.
In this embodiment, the test instruction may be triggered by a tester according to a test requirement, or may be configured to be triggered periodically, for example, triggered at 9 am on 1 day per month, which is not limited by the present invention.
In at least one embodiment of the present invention, the acquiring the interface to be tested and the target social security server according to the test instruction includes:
analyzing the test instruction to obtain information carried by the test instruction;
acquiring a first label and a second label which are configured in advance, wherein the first label corresponds to an interface identification code, and the second label corresponds to a server identification code;
establishing a first regular expression according to the first label, and establishing a second regular expression according to the second label;
traversing information carried by the test instruction by using the first regular expression, determining the traversed information matched with the first regular expression as an interface identification code of the interface to be tested, and determining the interface to be tested according to the interface identification code of the interface to be tested;
traversing the information carried by the test instruction by using the second regular expression, determining the traversed information matched with the second regular expression as the server identification code of the target social security server, and determining the target social security server according to the server identification code of the target social security server.
The first tag and the second tag can be configured in a user-defined mode.
For example: the first tag may be configured as an InterfaceID and the second tag may be configured as a ServerID.
Further, the first regular expression established according to the first tag may be an interface id (), and the second regular expression established according to the second tag may be a server id ().
Further, traversing information carried by the test instruction by using the first regular expression InterfaceID (), determining the traversed information matched with the first regular expression InterfaceID () as an interface identification code of the interface to be tested, and further determining the interface with the interface identification code of the interface to be tested as the interface to be tested. Traversing information carried by the test instruction by using the second regular expression ServerID (), determining the traversed information matched with the second regular expression ServerID () as the server identification code of the target social security server, and further determining the server with the server identification code of the target social security server as the target social security server.
Through the embodiment, the required data can be acquired based on the labels and the regular expressions, and due to the uniqueness of the labels, the data acquisition efficiency is improved, and meanwhile, the accuracy of the acquired data is guaranteed.
S12, determining the interface version of the interface to be tested and determining the target social security code of the target social security server.
It should be noted that, in this embodiment, different testing methods are adopted for different interface versions, so that the interface version of the interface to be tested needs to be determined.
In at least one embodiment of the present invention, the determining the interface version of the interface to be tested comprises:
when the uploaded data is an accessory and the accessory is compressed without encryption processing, determining that the interface to be tested is a first version; or
When the uploaded data is a text and the text is compressed and then needs to be encrypted, determining that the interface to be tested is a second version; or
And when the uploaded data is a message, determining that the interface to be tested is a third version.
Specifically, the first version may include a report class version, the second version may include a data class version, and the third version may include a pure packet class version.
In at least one embodiment of the invention, each social security server corresponds to one social security code, so that the embodiment determines the target social security code of the target social security server, so as to execute the simulation operation script according to the target social security code subsequently to simulate the manual operation of the user.
And S13, calling a target script from the simulation operation script according to the interface version of the interface to be tested.
It will be appreciated that the state of data interaction differs for each version and, therefore, the simulation operational script that is executed differs.
Because the simulation operation script corresponds to at least one interface version, the present embodiment invokes a target script from the simulation operation script according to the interface version of the interface to be tested, so as to perform a targeted test on different interface versions in the following.
S14, determining the target social security code as the entry of the target script, and executing the target script.
Specifically, the executing the target script includes:
when the interface to be tested is the first version, uploading a target attachment, compressing the target attachment, uploading the compressed target attachment to the target social security server according to a preset frequency, and sending a file ready notice in a short-connection socket communication mode; or
When the interface to be tested is the second version, receiving data sent by an upstream server, acquiring target data selected from the data sent by the upstream server, compressing the target data, encrypting the compressed target data, packaging the data obtained after encryption as packaged data, uploading the packaged data to the target social security server, and sending a file ready notice; or
And when the interface to be tested is the third version, sending a target message to the target social security server.
For example: the interfaces mainly adopted in the market at present comprise 31 interfaces and are connected with 33 social security servers, wherein 13 interfaces mainly transmit data in an accessory form and are determined as the first version; the 18 interfaces mainly transmit data in the form of text data, and are determined as the second version; in special cases, some interfaces may send messages directly, and without attachments or other text data, may be determined to be the third version.
Through the implementation mode, the user operation can be simulated in a targeted mode according to different interface versions, so that a targeted test can be performed subsequently.
And S15, when the target script is detected to be executed completely, connecting to a configuration database, acquiring data sending state records from the configuration database, sending message results, and downloading a target file uploaded to the target social security server.
In this embodiment, the configuration database stores data related to script operation, such as an operation record, a record of the data transmission status, the message sending result, a file uploaded to a social security server, and the like.
Wherein the target file may include annuity data and the like.
S16, verifying the data sending state record and the message sending result to obtain a first verification result.
In at least one embodiment of the present invention, the verifying the data transmission status record and the message sending result includes:
when the data sending state record shows that the sending is successful, determining that the data sending state of the data sent through the interface to be tested passes the verification, or when the data sending state record shows that the sending is failed, determining that the data sending state of the data sent through the interface to be tested does not pass the verification;
acquiring a pre-configured interface specification corresponding to the target social security server, and determining whether the field length and the file naming format of the message in the message sending result are consistent with the interface specification; acquiring a mandatory field from the message result according to the interface specification, and detecting whether the mandatory field is a null field; acquiring service data corresponding to the target social security server, acquiring a service field from the message result, and detecting whether the service data is matched with the service field; when the field length, the file naming format and the interface specification are consistent, the mandatory field is not a null field, and the service data is matched with the service field, determining that the message sending result passes verification; or when the field length, the file naming format and the interface specification are not consistent, and/or the mandatory field is a null field, and/or the service data is not matched with the service field, determining that the message sending result is not verified.
Further, all the verification results above are integrated to obtain the first verification result.
The service data may include a province name and the like corresponding to the target social security server, and may be configured specifically according to actual requirements.
By the embodiment, whether the sending state of the data sent by the interface and the message sending result are wrong or not can be automatically verified.
And S17, verifying the target file according to the interface version of the interface to be tested to obtain a second verification result.
Specifically, the verifying the target file according to the interface version of the interface to be tested includes:
when the interface to be tested is the first version, decompressing the target file to obtain a decompressed file, obtaining the file size and the file name of the decompressed file, comparing whether the file size of the decompressed file is consistent with the file size of the target file or not, and comparing whether the file name of the decompressed file is consistent with the file name of the target file or not, when the file size of the decompressed file is consistent with the file size of the target file and the file name of the decompressed file is consistent with the file name of the target file, determining that the target file passes verification, or when the file size of the decompressed file is not consistent with the file size of the target file and/or the file name of the decompressed file is not consistent with the file name of the target file, determining that the target file does not pass verification;
when the interface to be tested is the second version, acquiring a file naming rule corresponding to the target social security server, and verifying whether the file name of the target file conforms to the file naming rule corresponding to the target social security server; decompressing the target file to obtain a decompressed file, decrypting the decompressed file to obtain a decrypted text, comparing the decrypted text with the target file line by line, and determining consistency between the decrypted text and the target file, when the file name of the target file conforms to a file naming rule corresponding to the target social security server and the decrypted text is consistent with the target file, determining that the target file passes verification, or when the file name of the target file does not conform to the file naming rule corresponding to the target social security server and/or the decrypted text is inconsistent with the target file, determining that the target file does not pass verification;
and when the interface to be tested is the third version, the target file is not verified.
It can be understood that, since the first version performs data interaction in the form of an attachment, it is mainly verified whether the size and file name of the corresponding target file are consistent with the originally uploaded version; since the second version transmits data in the form of text data (for example, data interaction is performed by text data in a txt format), besides the naming rule of the file name verification, the actual content of the target file can be compared with the originally uploaded file one by one to determine whether the file is uploaded to the server of the other side, that is, whether the file of the target social security server is consistent with the original version, so that the situations of missing transmission or data errors in the file transmission process are avoided; since the third version only sends a message to the target social security server without attaching other data, the previous verification of the data sending state record and the message sending result are sufficient, and no attached other file needs to be verified, that is, the target file is not verified.
Through the embodiment, targeted automatic testing can be performed according to different interface versions, so that files can be correctly transmitted to the target social security server.
And S18, generating a test report of the interface to be tested according to the first verification result and the second verification result.
In this embodiment, the first verification result and the second verification result are combined to generate a test report of the interface to be tested.
According to the embodiment, manual operation is automatically simulated through the pre-written script, time consumed by manual testing is reduced, time cost is effectively saved, meanwhile, the multiple social security servers are connected in a butt joint mode, testing universality is improved, targeted testing is conducted according to different interface versions, and testing effect is further optimized.
In this embodiment, after the test report of the interface to be tested is generated, the test report of the interface to be tested may be sent to terminal devices of related personnel, such as testers and developers, so as to assist in performing timely optimization and timely handling when there is an abnormality.
In at least one embodiment of the invention, the method further comprises:
when a newly added interface is detected, determining the interface version of the newly added interface, and writing a script corresponding to the newly added interface into the simulation operation script according to the interface version;
and when a new social security server is detected, adding the social security code and the service data of the new social security server in the simulation operation script.
In the embodiment, when a new interface or social security server is provided, a corresponding set of scripts does not need to be rewritten to execute an independent test until the corresponding set of scripts is newly added on the original basis, and the expandability of the test is improved.
It should be noted that, in order to further improve the security of the data and avoid malicious tampering of the data, the simulation operation script may be stored in the blockchain node.
According to the technical scheme, the method can acquire the pre-programmed simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, each social security server corresponds to one social security code, the fully automatic simulation of the manual operation of a user is realized, the labor cost is effectively reduced, the artificial operation error is avoided, the execution efficiency is improved, the interface to be tested and the target social security server are acquired according to the test instruction in response to the test instruction, the required data are acquired based on the label and the regular expression, and due to the uniqueness of the label, the data acquisition efficiency is improved, the accuracy of the acquired data is ensured, and the interface version of the interface to be tested is determined, determining a target social security code of the target social security server, calling a target script from the simulation operation script according to the interface version of the interface to be tested, determining the target social security code as the reference of the target script, executing the target script, and performing targeted simulation user operation aiming at different interface versions so as to perform targeted test subsequently, when the target script is detected to be executed completely, connecting to a configuration database, obtaining a data sending state record and a message sending result from the configuration database, downloading a target file uploaded to the target social security server, verifying the data sending state record and the message sending result to obtain a first verification result, automatically verifying whether the sending state of data sent through the interface and the message sending result are wrong or not, and verifying the target file according to the interface version of the interface to be tested, and obtaining a second verification result, performing targeted automatic testing according to different interface versions to ensure that the file can be correctly transmitted to the target social security server, generating a test report of the interface to be tested according to the first verification result and the second verification result, automatically simulating manual operation through a pre-programmed script, reducing time consumed by manual testing, effectively saving time cost, simultaneously docking a plurality of social security servers, improving the universality of testing, performing targeted testing according to different interface versions, and further optimizing the testing effect.
FIG. 2 is a functional block diagram of a test apparatus based on configurable interface according to a preferred embodiment of the present invention. The configurable interface based test device 11 comprises an acquisition unit 110, a determination unit 111, a calling unit 112, an execution unit 113, a downloading unit 114, a verification unit 115 and a generation unit 116. The module/unit referred to in the present invention refers to a series of computer program segments that can be executed by the processor 13 and that can perform a fixed function, and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
The obtaining unit 110 obtains a pre-written simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, and each social security server corresponds to one social security code.
In this embodiment, the simulation operation script may be a Jmeter script, and is written and uploaded in advance by a developer or a tester.
Through practice, the Jmeter script is quick and accurate, the success rate is high, and the success rate can basically reach 100%.
Through the embodiment, the full-automatic simulation of the manual operation of the user can be realized, the labor cost is effectively reduced, the artificial operation error is avoided, and the execution efficiency is improved.
Specifically, the simulation operation script is used for simulating a user manual full-flow operation, such as: uploading files, clicking to submit, confirming to take effect, clicking to send and the like.
In the embodiment, one social security server can be uniquely represented by the social security code.
In this embodiment, each interface is interfaced with the social security server to realize data exchange with the social security server.
In response to the test instruction, the obtaining unit 110 obtains the interface to be tested and the target social security server according to the test instruction.
In this embodiment, the test instruction may be triggered by a tester according to a test requirement, or may be configured to be triggered periodically, for example, triggered at 9 am on 1 day per month, which is not limited by the present invention.
In at least one embodiment of the present invention, the obtaining unit 110, according to the test instruction, obtains the interface to be tested and the target social security server includes:
analyzing the test instruction to obtain information carried by the test instruction;
acquiring a first label and a second label which are configured in advance, wherein the first label corresponds to an interface identification code, and the second label corresponds to a server identification code;
establishing a first regular expression according to the first label, and establishing a second regular expression according to the second label;
traversing information carried by the test instruction by using the first regular expression, determining the traversed information matched with the first regular expression as an interface identification code of the interface to be tested, and determining the interface to be tested according to the interface identification code of the interface to be tested;
traversing the information carried by the test instruction by using the second regular expression, determining the traversed information matched with the second regular expression as the server identification code of the target social security server, and determining the target social security server according to the server identification code of the target social security server.
The first tag and the second tag can be configured in a user-defined mode.
For example: the first tag may be configured as an InterfaceID and the second tag may be configured as a ServerID.
Further, the first regular expression established according to the first tag may be an interface id (), and the second regular expression established according to the second tag may be a server id ().
Further, traversing information carried by the test instruction by using the first regular expression InterfaceID (), determining the traversed information matched with the first regular expression InterfaceID () as an interface identification code of the interface to be tested, and further determining the interface with the interface identification code of the interface to be tested as the interface to be tested. Traversing information carried by the test instruction by using the second regular expression ServerID (), determining the traversed information matched with the second regular expression ServerID () as the server identification code of the target social security server, and further determining the server with the server identification code of the target social security server as the target social security server.
Through the embodiment, the required data can be acquired based on the labels and the regular expressions, and due to the uniqueness of the labels, the data acquisition efficiency is improved, and meanwhile, the accuracy of the acquired data is guaranteed.
The determining unit 111 determines the interface version of the interface to be tested and determines the target social security code of the target social security server.
It should be noted that, in this embodiment, different testing methods are adopted for different interface versions, so that the interface version of the interface to be tested needs to be determined.
In at least one embodiment of the present invention, the determining unit 111 determines the interface version of the interface to be tested includes:
when the uploaded data is an accessory and the accessory is compressed without encryption processing, determining that the interface to be tested is a first version; or
When the uploaded data is a text and the text is compressed and then needs to be encrypted, determining that the interface to be tested is a second version; or
And when the uploaded data is a message, determining that the interface to be tested is a third version.
Specifically, the first version may include a report class version, the second version may include a data class version, and the third version may include a pure packet class version.
In at least one embodiment of the invention, each social security server corresponds to one social security code, so that the embodiment determines the target social security code of the target social security server, so as to execute the simulation operation script according to the target social security code subsequently to simulate the manual operation of the user.
The invoking unit 112 invokes a target script from the simulation operation script according to the interface version of the interface to be tested.
It will be appreciated that the state of data interaction differs for each version and, therefore, the simulation operational script that is executed differs.
Because the simulation operation script corresponds to at least one interface version, the present embodiment invokes a target script from the simulation operation script according to the interface version of the interface to be tested, so as to perform a targeted test on different interface versions in the following.
The execution unit 113 determines the target social security code as an entry of the target script, and executes the target script.
Specifically, the executing unit 113 executing the target script includes:
when the interface to be tested is the first version, uploading a target attachment, compressing the target attachment, uploading the compressed target attachment to the target social security server according to a preset frequency, and sending a file ready notice in a short-connection socket communication mode; or
When the interface to be tested is the second version, receiving data sent by an upstream server, acquiring target data selected from the data sent by the upstream server, compressing the target data, encrypting the compressed target data, packaging the data obtained after encryption as packaged data, uploading the packaged data to the target social security server, and sending a file ready notice; or
And when the interface to be tested is the third version, sending a target message to the target social security server.
For example: the interfaces mainly adopted in the market at present comprise 31 interfaces and are connected with 33 social security servers, wherein 13 interfaces mainly transmit data in an accessory form and are determined as the first version; the 18 interfaces mainly transmit data in the form of text data, and are determined as the second version; in special cases, some interfaces may send messages directly, and without attachments or other text data, may be determined to be the third version.
Through the implementation mode, the user operation can be simulated in a targeted mode according to different interface versions, so that a targeted test can be performed subsequently.
When the target script is detected to be executed completely, the downloading unit 114 connects to the configuration database, obtains the data sending state record from the configuration database, sends the message result, and downloads the target file uploaded to the target social security server.
In this embodiment, the configuration database stores data related to script operation, such as an operation record, a record of the data transmission status, the message sending result, a file uploaded to a social security server, and the like.
Wherein the target file may include annuity data and the like.
The verification unit 115 verifies the data transmission status record and the message transmission result to obtain a first verification result.
In at least one embodiment of the present invention, the verifying unit 115 verifies the data sending status record and the message sending result, including:
when the data sending state record shows that the sending is successful, determining that the data sending state of the data sent through the interface to be tested passes the verification, or when the data sending state record shows that the sending is failed, determining that the data sending state of the data sent through the interface to be tested does not pass the verification;
acquiring a pre-configured interface specification corresponding to the target social security server, and determining whether the field length and the file naming format of the message in the message sending result are consistent with the interface specification; acquiring a mandatory field from the message result according to the interface specification, and detecting whether the mandatory field is a null field; acquiring service data corresponding to the target social security server, acquiring a service field from the message result, and detecting whether the service data is matched with the service field; when the field length, the file naming format and the interface specification are consistent, the mandatory field is not a null field, and the service data is matched with the service field, determining that the message sending result passes verification; or when the field length, the file naming format and the interface specification are not consistent, and/or the mandatory field is a null field, and/or the service data is not matched with the service field, determining that the message sending result is not verified.
Further, all the verification results above are integrated to obtain the first verification result.
The service data may include a province name and the like corresponding to the target social security server, and may be configured specifically according to actual requirements.
By the embodiment, whether the sending state of the data sent by the interface and the message sending result are wrong or not can be automatically verified.
The verification unit 115 verifies the target file according to the interface version of the interface to be tested, and obtains a second verification result.
Specifically, the verifying unit 115 verifies the target file according to the interface version of the interface to be tested includes:
when the interface to be tested is the first version, decompressing the target file to obtain a decompressed file, obtaining the file size and the file name of the decompressed file, comparing whether the file size of the decompressed file is consistent with the file size of the target file or not, and comparing whether the file name of the decompressed file is consistent with the file name of the target file or not, when the file size of the decompressed file is consistent with the file size of the target file and the file name of the decompressed file is consistent with the file name of the target file, determining that the target file passes verification, or when the file size of the decompressed file is not consistent with the file size of the target file and/or the file name of the decompressed file is not consistent with the file name of the target file, determining that the target file does not pass verification;
when the interface to be tested is the second version, acquiring a file naming rule corresponding to the target social security server, and verifying whether the file name of the target file conforms to the file naming rule corresponding to the target social security server; decompressing the target file to obtain a decompressed file, decrypting the decompressed file to obtain a decrypted text, comparing the decrypted text with the target file line by line, and determining consistency between the decrypted text and the target file, when the file name of the target file conforms to a file naming rule corresponding to the target social security server and the decrypted text is consistent with the target file, determining that the target file passes verification, or when the file name of the target file does not conform to the file naming rule corresponding to the target social security server and/or the decrypted text is inconsistent with the target file, determining that the target file does not pass verification;
and when the interface to be tested is the third version, the target file is not verified.
It can be understood that, since the first version performs data interaction in the form of an attachment, it is mainly verified whether the size and file name of the corresponding target file are consistent with the originally uploaded version; since the second version transmits data in the form of text data (for example, data interaction is performed by text data in a txt format), besides the naming rule of the file name verification, the actual content of the target file can be compared with the originally uploaded file one by one to determine whether the file is uploaded to the server of the other side, that is, whether the file of the target social security server is consistent with the original version, so that the situations of missing transmission or data errors in the file transmission process are avoided; since the third version only sends a message to the target social security server without attaching other data, the previous verification of the data sending state record and the message sending result are sufficient, and no attached other file needs to be verified, that is, the target file is not verified.
Through the embodiment, targeted automatic testing can be performed according to different interface versions, so that files can be correctly transmitted to the target social security server.
The generating unit 116 generates a test report of the interface to be tested according to the first verification result and the second verification result.
In this embodiment, the first verification result and the second verification result are combined to generate a test report of the interface to be tested.
According to the embodiment, manual operation is automatically simulated through the pre-written script, time consumed by manual testing is reduced, time cost is effectively saved, meanwhile, the multiple social security servers are connected in a butt joint mode, testing universality is improved, targeted testing is conducted according to different interface versions, and testing effect is further optimized.
In this embodiment, after the test report of the interface to be tested is generated, the test report of the interface to be tested may be sent to terminal devices of related personnel, such as testers and developers, so as to assist in performing timely optimization and timely handling when there is an abnormality.
In at least one embodiment of the present invention, when a newly added interface is detected, an interface version of the newly added interface is determined, and a script corresponding to the newly added interface is written in the simulation operation script according to the interface version;
and when a new social security server is detected, adding the social security code and the service data of the new social security server in the simulation operation script.
In the embodiment, when a new interface or social security server is provided, a corresponding set of scripts does not need to be rewritten to execute an independent test until the corresponding set of scripts is newly added on the original basis, and the expandability of the test is improved.
It should be noted that, in order to further improve the security of the data and avoid malicious tampering of the data, the simulation operation script may be stored in the blockchain node.
According to the technical scheme, the method can acquire the pre-programmed simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, each social security server corresponds to one social security code, the fully automatic simulation of the manual operation of a user is realized, the labor cost is effectively reduced, the artificial operation error is avoided, the execution efficiency is improved, the interface to be tested and the target social security server are acquired according to the test instruction in response to the test instruction, the required data are acquired based on the label and the regular expression, and due to the uniqueness of the label, the data acquisition efficiency is improved, the accuracy of the acquired data is ensured, and the interface version of the interface to be tested is determined, determining a target social security code of the target social security server, calling a target script from the simulation operation script according to the interface version of the interface to be tested, determining the target social security code as the reference of the target script, executing the target script, and performing targeted simulation user operation aiming at different interface versions so as to perform targeted test subsequently, when the target script is detected to be executed completely, connecting to a configuration database, obtaining a data sending state record and a message sending result from the configuration database, downloading a target file uploaded to the target social security server, verifying the data sending state record and the message sending result to obtain a first verification result, automatically verifying whether the sending state of data sent through the interface and the message sending result are wrong or not, and verifying the target file according to the interface version of the interface to be tested, and obtaining a second verification result, performing targeted automatic testing according to different interface versions to ensure that the file can be correctly transmitted to the target social security server, generating a test report of the interface to be tested according to the first verification result and the second verification result, automatically simulating manual operation through a pre-programmed script, reducing time consumed by manual testing, effectively saving time cost, simultaneously docking a plurality of social security servers, improving the universality of testing, performing targeted testing according to different interface versions, and further optimizing the testing effect.
Fig. 3 is a schematic structural diagram of a computer device according to a preferred embodiment of the testing method based on configurable interface of the present invention.
The computer device 1 may comprise a memory 12, a processor 13 and a bus, and may further comprise a computer program, such as a test program based on a configurable interface, stored in the memory 12 and executable on the processor 13.
It will be understood by those skilled in the art that the schematic diagram is merely an example of the computer device 1, and does not constitute a limitation to the computer device 1, the computer device 1 may have a bus-type structure or a star-shaped structure, the computer device 1 may further include more or less other hardware or software than those shown, or different component arrangements, for example, the computer device 1 may further include an input and output device, a network access device, etc.
It should be noted that the computer device 1 is only an example, and other electronic products that are currently available or may come into existence in the future, such as electronic products that can be adapted to the present invention, should also be included in the scope of the present invention, and are included herein by reference.
The memory 12 includes at least one type of readable storage medium, which includes flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 12 may in some embodiments be an internal storage unit of the computer device 1, for example a removable hard disk of the computer device 1. The memory 12 may also be an external storage device of the computer device 1 in other embodiments, such as a plug-in removable hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the computer device 1. Further, the memory 12 may also include both an internal storage unit and an external storage device of the computer device 1. The memory 12 may be used not only to store application software installed in the computer device 1 and various types of data, such as codes of configurable interface based test programs, etc., but also to temporarily store data that has been output or is to be output.
The processor 13 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 13 is a Control Unit (Control Unit) of the computer device 1, connects various components of the entire computer device 1 by using various interfaces and lines, and executes various functions and processes data of the computer device 1 by running or executing programs or modules (e.g., executing configurable interface based test programs, etc.) stored in the memory 12 and calling data stored in the memory 12.
The processor 13 executes the operating system of the computer device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in each of the above embodiments of the configurable interface based test method, such as the steps shown in fig. 1.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 12 and executed by the processor 13 to accomplish the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing certain functions, which are used to describe the execution of the computer program in the computer device 1. For example, the computer program may be divided into an acquisition unit 110, a determination unit 111, a call unit 112, an execution unit 113, a download unit 114, a verification unit 115, a generation unit 116.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a computer device, or a network device) or a processor (processor) to execute parts of the configurable interface based test method according to the embodiments of the present invention.
The integrated modules/units of the computer device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), random-access Memory, or the like.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one line is shown in FIG. 3, but this does not mean only one bus or one type of bus. The bus is arranged to enable connection communication between the memory 12 and at least one processor 13 or the like.
Although not shown, the computer device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 13 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The computer device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the computer device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the computer device 1 and other computer devices.
Optionally, the computer device 1 may further comprise a user interface, which may be a Display (Display), an input unit, such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the computer device 1 and for displaying a visualized user interface.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
Fig. 3 shows only the computer device 1 with the components 12-13, and it will be understood by a person skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the computer device 1 and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
With reference to fig. 1, the memory 12 of the computer device 1 stores a plurality of instructions to implement a configurable interface based test method, and the processor 13 can execute the plurality of instructions to implement:
acquiring a pre-written simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, and each social security server corresponds to one social security code;
responding to a test instruction, and acquiring an interface to be tested and a target social security server according to the test instruction;
determining the interface version of the interface to be tested and determining a target social security code of the target social security server;
calling a target script from the simulation operation script according to the interface version of the interface to be tested;
determining the target social security code as an entry parameter of the target script, and executing the target script;
when the target script is detected to be executed completely, connecting to a configuration database, acquiring a data sending state record from the configuration database, sending a message result, and downloading a target file uploaded to the target social security server;
verifying the data sending state record and the message sending result to obtain a first verification result;
verifying the target file according to the interface version of the interface to be tested to obtain a second verification result;
and generating a test report of the interface to be tested according to the first verification result and the second verification result.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the instruction, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the present invention may also be implemented by one unit or means through software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A testing method based on a configurable interface is characterized in that the testing method based on the configurable interface comprises the following steps:
acquiring a pre-written simulation operation script, wherein the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, and each social security server corresponds to one social security code;
responding to a test instruction, and acquiring an interface to be tested and a target social security server according to the test instruction;
determining the interface version of the interface to be tested and determining a target social security code of the target social security server;
calling a target script from the simulation operation script according to the interface version of the interface to be tested;
determining the target social security code as an entry parameter of the target script, and executing the target script;
when the target script is detected to be executed completely, connecting to a configuration database, acquiring a data sending state record from the configuration database, sending a message result, and downloading a target file uploaded to the target social security server;
verifying the data sending state record and the message sending result to obtain a first verification result;
verifying the target file according to the interface version of the interface to be tested to obtain a second verification result;
and generating a test report of the interface to be tested according to the first verification result and the second verification result.
2. The configurable interface based test method of claim 1, wherein the obtaining the interface to be tested and the target social security server according to the test instruction comprises:
analyzing the test instruction to obtain information carried by the test instruction;
acquiring a first label and a second label which are configured in advance, wherein the first label corresponds to an interface identification code, and the second label corresponds to a server identification code;
establishing a first regular expression according to the first label, and establishing a second regular expression according to the second label;
traversing information carried by the test instruction by using the first regular expression, determining the traversed information matched with the first regular expression as an interface identification code of the interface to be tested, and determining the interface to be tested according to the interface identification code of the interface to be tested;
traversing the information carried by the test instruction by using the second regular expression, determining the traversed information matched with the second regular expression as the server identification code of the target social security server, and determining the target social security server according to the server identification code of the target social security server.
3. The configurable interface based testing method of claim 1, wherein said determining an interface version of the interface to be tested comprises:
when the uploaded data is an accessory and the accessory is compressed without encryption processing, determining that the interface to be tested is a first version; or
When the uploaded data is a text and the text is compressed and then needs to be encrypted, determining that the interface to be tested is a second version; or
And when the uploaded data is a message, determining that the interface to be tested is a third version.
4. The configurable interface based test method of claim 3, wherein the executing the object script comprises:
when the interface to be tested is the first version, uploading a target attachment, compressing the target attachment, uploading the compressed target attachment to the target social security server according to a preset frequency, and sending a file ready notice in a short-connection socket communication mode; or
When the interface to be tested is the second version, receiving data sent by an upstream server, acquiring target data selected from the data sent by the upstream server, compressing the target data, encrypting the compressed target data, packaging the data obtained after encryption as packaged data, uploading the packaged data to the target social security server, and sending a file ready notice; or
And when the interface to be tested is the third version, sending a target message to the target social security server.
5. The configurable interface based test method of claim 1, wherein the verifying the data transmission status record and the message sending result comprises:
when the data sending state record shows that the sending is successful, determining that the data sending state of the data sent through the interface to be tested passes the verification, or when the data sending state record shows that the sending is failed, determining that the data sending state of the data sent through the interface to be tested does not pass the verification;
acquiring a pre-configured interface specification corresponding to the target social security server, and determining whether the field length and the file naming format of the message in the message sending result are consistent with the interface specification; acquiring a mandatory field from the message result according to the interface specification, and detecting whether the mandatory field is a null field; acquiring service data corresponding to the target social security server, acquiring a service field from the message result, and detecting whether the service data is matched with the service field; when the field length, the file naming format and the interface specification are consistent, the mandatory field is not a null field, and the service data is matched with the service field, determining that the message sending result passes verification; or when the field length, the file naming format and the interface specification are not consistent, and/or the mandatory field is a null field, and/or the service data is not matched with the service field, determining that the message sending result is not verified.
6. The configurable interface based testing method of claim 3, wherein said validating the target file according to the interface version of the interface to be tested comprises:
when the interface to be tested is the first version, decompressing the target file to obtain a decompressed file, obtaining the file size and the file name of the decompressed file, comparing whether the file size of the decompressed file is consistent with the file size of the target file or not, and comparing whether the file name of the decompressed file is consistent with the file name of the target file or not, when the file size of the decompressed file is consistent with the file size of the target file and the file name of the decompressed file is consistent with the file name of the target file, determining that the target file passes verification, or when the file size of the decompressed file is not consistent with the file size of the target file and/or the file name of the decompressed file is not consistent with the file name of the target file, determining that the target file does not pass verification;
when the interface to be tested is the second version, acquiring a file naming rule corresponding to the target social security server, and verifying whether the file name of the target file conforms to the file naming rule corresponding to the target social security server; decompressing the target file to obtain a decompressed file, decrypting the decompressed file to obtain a decrypted text, comparing the decrypted text with the target file line by line, and determining consistency between the decrypted text and the target file, when the file name of the target file conforms to a file naming rule corresponding to the target social security server and the decrypted text is consistent with the target file, determining that the target file passes verification, or when the file name of the target file does not conform to the file naming rule corresponding to the target social security server and/or the decrypted text is inconsistent with the target file, determining that the target file does not pass verification;
and when the interface to be tested is the third version, the target file is not verified.
7. The configurable interface based testing method of claim 1, wherein the method further comprises:
when a newly added interface is detected, determining the interface version of the newly added interface, and writing a script corresponding to the newly added interface into the simulation operation script according to the interface version;
and when a new social security server is detected, adding the social security code and the service data of the new social security server in the simulation operation script.
8. A configurable interface based test device, the configurable interface based test device comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a pre-written simulation operation script, the simulation operation script corresponds to at least one interface version, each interface version corresponds to at least one interface, each interface corresponds to at least one social security server, and each social security server corresponds to one social security code;
the acquisition unit is also used for responding to a test instruction and acquiring an interface to be tested and a target social security server according to the test instruction;
the determining unit is used for determining the interface version of the interface to be tested and determining a target social security code of the target social security server;
the calling unit is used for calling a target script from the simulation operation script according to the interface version of the interface to be tested;
the execution unit is used for determining the target social security code as the entry of the target script and executing the target script;
the downloading unit is used for connecting to a configuration database when the target script is detected to be executed completely, acquiring a data sending state record from the configuration database, sending a message result, and downloading a target file uploaded to the target social security server;
the verification unit is used for verifying the data sending state record and the message sending result to obtain a first verification result;
the verification unit is further used for verifying the target file according to the interface version of the interface to be tested to obtain a second verification result;
and the generating unit is used for generating a test report of the interface to be tested according to the first verification result and the second verification result.
9. A computer device, characterized in that the computer device comprises:
a memory storing at least one instruction; and
a processor executing instructions stored in the memory to implement the configurable interface based test method of any of claims 1 to 7.
10. A computer-readable storage medium characterized by: the computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in a computer device to implement the configurable interface based test method according to any one of claims 1 to 7.
CN202110724909.1A 2021-06-29 2021-06-29 Configurable interface-based test method, device, equipment and medium Active CN113468049B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110724909.1A CN113468049B (en) 2021-06-29 2021-06-29 Configurable interface-based test method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110724909.1A CN113468049B (en) 2021-06-29 2021-06-29 Configurable interface-based test method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN113468049A true CN113468049A (en) 2021-10-01
CN113468049B CN113468049B (en) 2023-07-04

Family

ID=77873588

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110724909.1A Active CN113468049B (en) 2021-06-29 2021-06-29 Configurable interface-based test method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN113468049B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113973055A (en) * 2021-12-08 2022-01-25 北京安博通科技股份有限公司 Network equipment configuration method and system based on local USB flash disk
CN115174197A (en) * 2022-07-01 2022-10-11 阿里云计算有限公司 Webshell file detection method and system, electronic device and computer storage medium
CN116049035A (en) * 2022-12-27 2023-05-02 合芯科技有限公司 Verification and debugging realization method for cache consistency
CN116991786A (en) * 2023-06-26 2023-11-03 深圳市晶存科技有限公司 Test board data transmission method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0594888A1 (en) * 1992-10-30 1994-05-04 International Business Machines Corporation Method and apparatus for computer software testing
US5915083A (en) * 1997-02-28 1999-06-22 Vlsi Technology, Inc. Smart debug interface circuit for efficiently for debugging a software application for a programmable digital processor device
WO2019091217A1 (en) * 2017-11-10 2019-05-16 华为技术有限公司 Script debugging method and device, and computer storage medium
US20200090056A1 (en) * 2018-09-19 2020-03-19 Tata Consultancy Services Limited Systems and methods for real time configurable recommendation using user data
CN111949537A (en) * 2020-08-14 2020-11-17 北京锐安科技有限公司 Interface test method, device, equipment and medium
CN112395202A (en) * 2020-11-26 2021-02-23 苏宁云计算有限公司 Interface automation test method and device, computer equipment and storage medium
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0594888A1 (en) * 1992-10-30 1994-05-04 International Business Machines Corporation Method and apparatus for computer software testing
US5915083A (en) * 1997-02-28 1999-06-22 Vlsi Technology, Inc. Smart debug interface circuit for efficiently for debugging a software application for a programmable digital processor device
WO2019091217A1 (en) * 2017-11-10 2019-05-16 华为技术有限公司 Script debugging method and device, and computer storage medium
US20200090056A1 (en) * 2018-09-19 2020-03-19 Tata Consultancy Services Limited Systems and methods for real time configurable recommendation using user data
CN111949537A (en) * 2020-08-14 2020-11-17 北京锐安科技有限公司 Interface test method, device, equipment and medium
CN112395202A (en) * 2020-11-26 2021-02-23 苏宁云计算有限公司 Interface automation test method and device, computer equipment and storage medium
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113973055A (en) * 2021-12-08 2022-01-25 北京安博通科技股份有限公司 Network equipment configuration method and system based on local USB flash disk
CN113973055B (en) * 2021-12-08 2022-03-25 北京安博通科技股份有限公司 Network equipment configuration method and system based on local USB flash disk
CN115174197A (en) * 2022-07-01 2022-10-11 阿里云计算有限公司 Webshell file detection method and system, electronic device and computer storage medium
CN115174197B (en) * 2022-07-01 2024-03-29 阿里云计算有限公司 Webshell file detection method, system, electronic equipment and computer storage medium
CN116049035A (en) * 2022-12-27 2023-05-02 合芯科技有限公司 Verification and debugging realization method for cache consistency
CN116049035B (en) * 2022-12-27 2024-02-09 合芯科技有限公司 Verification and debugging realization method for cache consistency
CN116991786A (en) * 2023-06-26 2023-11-03 深圳市晶存科技有限公司 Test board data transmission method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113468049B (en) 2023-07-04

Similar Documents

Publication Publication Date Title
CN113468049B (en) Configurable interface-based test method, device, equipment and medium
CN112015663B (en) Test data recording method, device, equipment and medium
CN112653760B (en) Cross-server file transmission method and device, electronic equipment and storage medium
CN112506779A (en) Software interface testing method and device, electronic equipment and storage medium
CN112506559A (en) Gray scale publishing method and device based on gateway, electronic equipment and storage medium
CN114519084A (en) Block chain-based medical data inspection method, device, equipment and medium
CN114116400A (en) Application exception handling method, device, equipment and medium based on log printing
CN112579452A (en) Software automation test method, device, equipment and storage medium
CN114036068A (en) Update detection method, device, equipment and storage medium based on privacy security
CN115002062A (en) Message processing method, device, equipment and readable storage medium
CN114185588A (en) Incremental package generation method, device, equipment and storage medium
CN114399397A (en) Renewal tracking method, device, equipment and medium
CN114185502A (en) Log printing method, device, equipment and medium based on production line environment
CN113392090A (en) Data verification method, device, equipment and medium based on database migration
CN113051171A (en) Interface test method, device, equipment and storage medium
CN114124835A (en) Interface-based data transmission method, device, equipment and medium
CN113419718A (en) Data transmission method, device, equipment and medium
CN113240351A (en) Business data consistency checking method and device, electronic equipment and medium
CN112667244A (en) Data verification method and device, electronic equipment and computer readable storage medium
CN115964307B (en) Automatic test method, device, equipment and medium for transaction data
CN113360398B (en) Hybrid application program testing method, device, equipment and medium
CN116225971B (en) Transaction interface compatibility detection method, device, equipment and medium
CN114818656B (en) Binary file analysis method, device, equipment and medium based on gray scale upgrading
CN113626533B (en) Ultraviolet power detection method and device and electronic equipment
CN114138378A (en) Non-invasive current-limiting fusing method, device, equipment and medium

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