CN113468049B - Configurable interface-based test method, device, equipment and medium - Google Patents

Configurable interface-based test method, device, equipment and medium Download PDF

Info

Publication number
CN113468049B
CN113468049B CN202110724909.1A CN202110724909A CN113468049B CN 113468049 B CN113468049 B CN 113468049B CN 202110724909 A CN202110724909 A CN 202110724909A CN 113468049 B CN113468049 B CN 113468049B
Authority
CN
China
Prior art keywords
interface
file
target
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.)
Active
Application number
CN202110724909.1A
Other languages
Chinese (zh)
Other versions
CN113468049A (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/00Information and communication technology [ICT] specially adapted for implementation of business processes of 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Tourism & Hospitality (AREA)
  • Development Economics (AREA)
  • General Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • Educational Administration (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Computer Security & Cryptography (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the field of testing, and provides a testing method, a device, equipment and a medium based on a configurable interface, which can simulate user operation with pertinence for different interface versions for subsequent targeted testing, automatically verify whether the sending state of data sent through the interface and the message sending result are wrong, and perform targeted automatic testing according to different interface versions so as to ensure that files can be correctly transmitted to a target social security server and generate a testing report of an interface to be tested. In addition, the invention also relates to a blockchain technology, and the simulation operation script can be stored in a blockchain node.

Description

Configurable interface-based test method, device, equipment and medium
Technical Field
The present invention relates to the field of testing technologies, and in particular, to a configurable interface-based testing method, apparatus, device, and medium.
Background
Currently, the professional annuity system interfaces with the national social security administration system, a total of 33 social security devices nationally, and the same social security device comprises different version interfaces. And the system is connected with a plurality of social security monitoring systems at the same time, and the test on-line production requirements are required to be completed rapidly. The two versions are 31 interfaces in total, and 33 social security needs to complete all interface regression tests on the same day as the online process, so that the service volume is heavy, and the difficulty of testing and checking data is increased.
In the prior art, when the interface regression test is performed, the interfaces of each social insurance are required to be tested respectively, and a large number of repeated codes are required to be written in the test process, so that the test efficiency is seriously affected.
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-written script, thereby reducing the time consumed by manual testing, effectively saving the time cost, simultaneously interfacing with 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.
A configurable interface-based test method, the configurable interface-based test method comprising:
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 a 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 an interface version of the interface to be tested and determining a target social security code of the target social security server;
according to the interface version of the interface to be tested, a target script is called from the simulation operation script;
determining the target social security code as an entry of the target script, and executing the target script;
when the execution of the target script is detected to be finished, connecting to a configuration database, acquiring a data transmission 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 transmission 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 obtaining 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 a 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 encryption processing is not needed after the accessory is compressed, determining that the interface to be tested is a first version; or alternatively
When the uploaded data is text and encryption processing is needed after the text is compressed, determining that the interface to be tested is a second version; or alternatively
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:
uploading a target accessory when the interface to be tested is the first version, compressing the target accessory, uploading the compressed target accessory 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 alternatively
When the interface to be tested is the second version, receiving data sent by an upstream server, obtaining target data selected from the data sent by the upstream server, compressing the target data, carrying out encryption processing on the compressed target data, packing the data obtained after the encryption processing to be used as packed data, uploading the packed data to the target social security server, and sending a file ready notification; or alternatively
And when the interface to be tested is the third version, sending a target message to the target social security server.
According to a preferred embodiment of the present invention, the verifying the data transmission status record and the sending out the message result includes:
when the data transmission state record shows that the transmission is successful, determining that the data transmission state of the data transmitted through the interface to be tested passes verification, or when the data transmission state record shows that the transmission is failed, determining that the data transmission state of the data transmitted through the interface to be tested does not pass verification;
acquiring a preset interface specification corresponding to the target social security server, and determining whether the field length, the file naming format and the interface specification of the message in the message sending result are consistent; acquiring a necessary field from the message result according to the interface specification, and detecting whether the necessary field is an empty 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 necessary filling field is not an empty 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 inconsistent, and/or the necessary filling field is a null field, and/or the service data and the service field are not matched, determining that the message sending result is not verified.
According to a preferred embodiment of the present invention, the verifying the object 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, comparing whether the file name of the decompressed file is consistent with the file name of the target file, and determining that the target file is not verified 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, or determining that the target file is verified when the file size of the decompressed file is inconsistent with the file size of the target file and/or the file name of the decompressed file is inconsistent with the file name of the target file;
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 accords with 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 row by row, determining the consistency of the decrypted text with the target file, and determining that the target file passes verification when the file name of the target file accords with a file naming rule corresponding to the target social security server and the decrypted text accords with the target file, or determining that the target file does not pass verification when the file name of the target file does not accord with a file naming rule corresponding to the target social security server and/or the decrypted text does not accord with the target file;
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 detecting that a new interface exists, determining an interface version of the new interface, and writing a script corresponding to the new interface into the simulation operation script according to the interface version;
and when the newly added social security server is detected, adding the social security code and the service data of the newly added social security server into the simulation operation script.
A configurable interface-based test device, the configurable interface-based test device comprising:
the system comprises an acquisition unit, a storage unit and a storage 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 further used for responding to the 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 the 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 execution of the target script is detected, acquiring a data transmission 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 transmission state record and the message sending result to obtain a first verification result;
the verification unit is further configured to verify the target file according to the interface version of the interface to be tested, so as 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; a kind of electronic device with high-pressure air-conditioning system
And the processor executes the instructions stored in the memory to realize the test method based on the configurable interface.
A computer-readable storage medium having stored therein at least one instruction that is executed by a processor in a computer device to implement the configurable interface-based test method.
According to the technical scheme, the method can obtain the 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, each social security server corresponds to one social security code, full-automatic simulation of manual operation of a user is realized, labor cost is effectively reduced, human operation errors are avoided, meanwhile, execution efficiency is improved, a test instruction is responded, an interface to be tested and a target social security server are obtained according to the test instruction, required data is obtained based on a label and a regular expression, due to the uniqueness of the label, the accuracy of the obtained data is guaranteed while the data obtaining efficiency is improved, the interface version of the interface to be tested is determined, the target social security code of the target social security server is determined, the target social security code is fetched from the simulation operation script according to the interface of the interface to be tested, the target social security code is determined to be the target script, and a data configuration and a data library is automatically verified by the user, the data is sent to the user interface to the user, the test script is verified to be in a state, the data is automatically sent to the user, the test script is verified to be the state, the data is recorded, the test result is automatically sent, and the test result is recorded, and verifying the target file according to the interface version of the interface to be tested to obtain a second verification result, and carrying out targeted automatic test 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-written script, reducing the time consumed by manual test, effectively saving the time cost, simultaneously interfacing a plurality of social security servers, improving the universality of the test, carrying out targeted test according to different interface versions, and further optimizing the test effect.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of a configurable interface based test method of the present invention.
FIG. 2 is a functional block diagram of a preferred embodiment of a configurable interface based test device of the present invention.
FIG. 3 is a schematic diagram of a computer device implementing a test method based on a configurable interface according to a preferred embodiment 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 test method based on a configurable interface according to a preferred embodiment of the present invention. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
The test method based on the configurable interface is applied to one or more computer devices, wherein the computer device is a device capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and the hardware of the computer device comprises, but is not limited to, a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, an ASIC), a programmable gate array (Field-Programmable Gate Array, an FPGA), a digital processor (Digital Signal Processor, a DSP), an embedded device and the like.
The computer device may be any electronic product that can interact with a user in a human-computer manner, such as a personal computer, tablet computer, smart phone, personal digital assistant (Personal Digital Assistant, PDA), game console, interactive internet protocol television (Internet Protocol Television, IPTV), smart wearable device, etc.
The computer device may also include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network server, a server group composed of a plurality of network servers, or a Cloud based Cloud Computing (Cloud Computing) composed 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 (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 a social security code.
In this embodiment, the simulation operation script may be a Jmeter script, which is written and uploaded in advance by a developer or a tester.
Through practice, the Jmeter script is quick and accurate, and the success rate is high, and can basically reach 100 percent of success rate.
Through the embodiment, the full-automatic simulation of manual operation of a user can be realized, the labor cost is effectively reduced, human operation errors are avoided, and the execution efficiency is improved.
Specifically, the simulation operation script is used for simulating manual full-flow operation of a user, such as: uploading files, click submission, validation, click transmission, and the like.
In this embodiment, one social security server can be uniquely represented by the social security code.
In this embodiment, each interface is in butt joint with the social security server so as to realize data exchange with the social security server.
S11, responding to the test instruction, and acquiring an interface to be tested and a 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 a month, which is not limited by the present invention.
In at least one embodiment of the present invention, the obtaining 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 a 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 self-defined manner.
For example: the first tag may be configured as an interface id and the second tag may be configured as a ServerID.
Further, the first regular expression established according to the first tag may be an interfacial id (), and the second regular expression established according to the second tag may be a ServerID ().
Further, the information carried by the test instruction is traversed by using the first regular expression InterfaceID (), the traversed information matched with the first regular expression InterfaceID () is determined to be the interface identification code of the interface to be tested, and the interface with the interface identification code of the interface to be tested is further determined to be the interface to be tested. Traversing the 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.
According to the embodiment, the required data can be acquired based on the tag and the regular expression, and due to the uniqueness of the tag, the data acquisition efficiency is improved, and meanwhile, the accuracy of the acquired data is ensured.
S12, determining an interface version of the interface to be tested and determining a target social security code of the target social security server.
It should be noted that, in this embodiment, different testing manners are adopted for different interface versions, so that it is necessary to determine the interface version of the interface to be tested.
In at least one 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 encryption processing is not needed after the accessory is compressed, determining that the interface to be tested is a first version; or alternatively
When the uploaded data is text and encryption processing is needed after the text is compressed, determining that the interface to be tested is a second version; or alternatively
And when the uploaded data is a message, determining that the interface to be tested is a third version.
In particular, 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 message class version.
In at least one embodiment of the present invention, each social security server corresponds to one social security code, and thus, the present embodiment determines a 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 a manual operation of a user.
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 data interaction state is different for each version and, therefore, the simulated operation script that is executed is also different.
Because the simulation operation script corresponds to at least one interface version, the embodiment invokes the target script from the simulation operation script according to the interface version of the interface to be tested, so as to perform targeted testing on different interface versions later.
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:
uploading a target accessory when the interface to be tested is the first version, compressing the target accessory, uploading the compressed target accessory 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 alternatively
When the interface to be tested is the second version, receiving data sent by an upstream server, obtaining target data selected from the data sent by the upstream server, compressing the target data, carrying out encryption processing on the compressed target data, packing the data obtained after the encryption processing to be used as packed data, uploading the packed data to the target social security server, and sending a file ready notification; or alternatively
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 in butt joint with 33 social security servers, wherein 13 interfaces mainly transmit data in the form of accessories and are determined to be the first version; the 18 interfaces transmitting data primarily in the form of text data, determined as said second version; in special cases, some interfaces may send messages directly, without attachments or other text data, and may be determined as the third version.
Through the embodiment, the user operation can be simulated in a targeted manner aiming at different interface versions, so that the targeted test can be carried out later.
And S15, when the execution of the target script is detected to be finished, connecting to a configuration database, acquiring a data transmission state record from the configuration database, sending a message result, and downloading a target file uploaded to the target social security server.
In this embodiment, the configuration database stores relevant data of script operation, such as operation records, the data sending status records, the sending message results, files uploaded to the social security server, and the like.
Wherein the target file may include annuity data or the like.
S16, verifying the data transmission 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 sending out the message result includes:
when the data transmission state record shows that the transmission is successful, determining that the data transmission state of the data transmitted through the interface to be tested passes verification, or when the data transmission state record shows that the transmission is failed, determining that the data transmission state of the data transmitted through the interface to be tested does not pass verification;
acquiring a preset interface specification corresponding to the target social security server, and determining whether the field length, the file naming format and the interface specification of the message in the message sending result are consistent; acquiring a necessary field from the message result according to the interface specification, and detecting whether the necessary field is an empty 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 necessary filling field is not an empty 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 inconsistent, and/or the necessary filling field is a null field, and/or the service data and the service field are not matched, determining that the message sending result is not verified.
Further, integrating all the verification results 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 specifically configured according to actual requirements.
By the embodiment, whether the transmission state of the data transmitted through the interface and the message transmission 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, and obtaining 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, comparing whether the file name of the decompressed file is consistent with the file name of the target file, and determining that the target file is not verified 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, or determining that the target file is verified when the file size of the decompressed file is inconsistent with the file size of the target file and/or the file name of the decompressed file is inconsistent with the file name of the target file;
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 accords with 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 row by row, determining the consistency of the decrypted text with the target file, and determining that the target file passes verification when the file name of the target file accords with a file naming rule corresponding to the target social security server and the decrypted text accords with the target file, or determining that the target file does not pass verification when the file name of the target file does not accord with a file naming rule corresponding to the target social security server and/or the decrypted text does not accord with the target file;
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 the file name of the corresponding target file are consistent with those of the originally uploaded version; the second version transmits data in the form of text data (for example, text data in txt format is adopted for data interaction), so that besides the naming rule of the verification file name, the actual content of the target file can be compared with the original uploaded file one by one to determine whether the file uploaded to the opposite server, namely, the file of the target social security server is consistent with the original version, and the condition of missing transmission or data error in the process of file transmission is avoided; because the third version only sends the message to the target social security server without other data, the data sending state record and the message sending result are verified, and the target file is not verified if other files with the message are not required to be verified.
According to the embodiment, targeted automatic testing can be performed according to different interface versions, so that files can be ensured to be correctly transmitted to the target social security server.
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, so as 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, so that the time consumed by manual testing is reduced, the time cost is effectively saved, meanwhile, a plurality of social security servers are in butt joint, the universality of testing is improved, and the testing effect is further optimized by carrying out targeted testing according to different interface versions.
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 also be sent to terminal devices of related personnel, such as testers and developers, so as to assist in timely optimization and timely processing when there is an abnormality.
In at least one embodiment of the invention, the method further comprises:
When detecting that a new interface exists, determining an interface version of the new interface, and writing a script corresponding to the new interface into the simulation operation script according to the interface version;
and when the newly added social security server is detected, adding the social security code and the service data of the newly added social security server into the simulation operation script.
In the embodiment, when a newly added interface or a social security server exists, a set of corresponding scripts does not need to be rewritten to execute independent tests until the new interfaces or social security servers are needed to be added on the original basis, so that the expandability of the tests is improved.
It should be noted that, in order to further improve the security of the data and avoid the data from being tampered maliciously, the simulation operation script may be stored in the blockchain node.
According to the technical scheme, the method can obtain the 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, each social security server corresponds to one social security code, full-automatic simulation of manual operation of a user is realized, labor cost is effectively reduced, human operation errors are avoided, meanwhile, execution efficiency is improved, a test instruction is responded, an interface to be tested and a target social security server are obtained according to the test instruction, required data is obtained based on a label and a regular expression, due to the uniqueness of the label, the accuracy of the obtained data is guaranteed while the data obtaining efficiency is improved, the interface version of the interface to be tested is determined, the target social security code of the target social security server is determined, the target social security code is fetched from the simulation operation script according to the interface of the interface to be tested, the target social security code is determined to be the target script, and a data configuration and a data library is automatically verified by the user, the data is sent to the user interface to the user, the test script is verified to be in a state, the data is automatically sent to the user, the test script is verified to be the state, the data is recorded, the test result is automatically sent, and the test result is recorded, and verifying the target file according to the interface version of the interface to be tested to obtain a second verification result, and carrying out targeted automatic test 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-written script, reducing the time consumed by manual test, effectively saving the time cost, simultaneously interfacing a plurality of social security servers, improving the universality of the test, carrying out targeted test according to different interface versions, and further optimizing the test effect.
FIG. 2 is a functional block diagram of a preferred embodiment of a configurable interface based test device of the present invention. The configurable interface based test device 11 comprises an acquisition unit 110, a determination unit 111, a retrieval unit 112, an execution unit 113, a download 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 capable of being executed by the processor 13 and of performing a fixed function, which are stored in the memory 12. In the present embodiment, the functions of the respective modules/units will be described in detail in the following embodiments.
The obtaining unit 110 obtains a pre-written simulated operation script, where the simulated 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, which is written and uploaded in advance by a developer or a tester.
Through practice, the Jmeter script is quick and accurate, and the success rate is high, and can basically reach 100 percent of success rate.
Through the embodiment, the full-automatic simulation of manual operation of a user can be realized, the labor cost is effectively reduced, human operation errors are avoided, and the execution efficiency is improved.
Specifically, the simulation operation script is used for simulating manual full-flow operation of a user, such as: uploading files, click submission, validation, click transmission, and the like.
In this embodiment, one social security server can be uniquely represented by the social security code.
In this embodiment, each interface is in butt joint with the social security server so as 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 a month, which is not limited by the present invention.
In at least one embodiment of the present invention, the obtaining unit 110 obtains the interface to be tested and the target social security server according to the test instruction, including:
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 a 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 self-defined manner.
For example: the first tag may be configured as an interface id and the second tag may be configured as a ServerID.
Further, the first regular expression established according to the first tag may be an interfacial id (), and the second regular expression established according to the second tag may be a ServerID ().
Further, the information carried by the test instruction is traversed by using the first regular expression InterfaceID (), the traversed information matched with the first regular expression InterfaceID () is determined to be the interface identification code of the interface to be tested, and the interface with the interface identification code of the interface to be tested is further determined to be the interface to be tested. Traversing the 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.
According to the embodiment, the required data can be acquired based on the tag and the regular expression, and due to the uniqueness of the tag, the data acquisition efficiency is improved, and meanwhile, the accuracy of the acquired data is ensured.
The determining unit 111 determines an interface version of the interface to be tested, and determines a target social security code of the target social security server.
It should be noted that, in this embodiment, different testing manners are adopted for different interface versions, so that it is necessary to determine the interface version of the interface to be tested.
In at least one embodiment of the present invention, the determining unit 111 determines an interface version of the interface to be tested includes:
when the uploaded data is an accessory and encryption processing is not needed after the accessory is compressed, determining that the interface to be tested is a first version; or alternatively
When the uploaded data is text and encryption processing is needed after the text is compressed, determining that the interface to be tested is a second version; or alternatively
And when the uploaded data is a message, determining that the interface to be tested is a third version.
In particular, 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 message class version.
In at least one embodiment of the present invention, each social security server corresponds to one social security code, and thus, the present embodiment determines a 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 a manual operation of a user.
The calling unit 112 calls 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 data interaction state is different for each version and, therefore, the simulated operation script that is executed is also different.
Because the simulation operation script corresponds to at least one interface version, the embodiment invokes the target script from the simulation operation script according to the interface version of the interface to be tested, so as to perform targeted testing on different interface versions later.
The execution unit 113 determines the target social security code as an entry of the target script, and executes the target script.
Specifically, the execution unit 113 executes the target script includes:
uploading a target accessory when the interface to be tested is the first version, compressing the target accessory, uploading the compressed target accessory 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 alternatively
When the interface to be tested is the second version, receiving data sent by an upstream server, obtaining target data selected from the data sent by the upstream server, compressing the target data, carrying out encryption processing on the compressed target data, packing the data obtained after the encryption processing to be used as packed data, uploading the packed data to the target social security server, and sending a file ready notification; or alternatively
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 in butt joint with 33 social security servers, wherein 13 interfaces mainly transmit data in the form of accessories and are determined to be the first version; the 18 interfaces transmitting data primarily in the form of text data, determined as said second version; in special cases, some interfaces may send messages directly, without attachments or other text data, and may be determined as the third version.
Through the embodiment, the user operation can be simulated in a targeted manner aiming at different interface versions, so that the targeted test can be carried out later.
When it is detected that the target script is executed, the downloading unit 114 is connected to a configuration database, acquires a data sending status record from the configuration database, sends out a message result, and downloads a target file uploaded to the target social security server.
In this embodiment, the configuration database stores relevant data of script operation, such as operation records, the data sending status records, the sending message results, files uploaded to the social security server, and the like.
Wherein the target file may include annuity data or the like.
The verification unit 115 verifies the data sending status record and the sending message result to obtain a first verification result.
In at least one embodiment of the present invention, the verifying unit 115 verifies the data transmission status record, and the sending out the message result includes:
when the data transmission state record shows that the transmission is successful, determining that the data transmission state of the data transmitted through the interface to be tested passes verification, or when the data transmission state record shows that the transmission is failed, determining that the data transmission state of the data transmitted through the interface to be tested does not pass verification;
acquiring a preset interface specification corresponding to the target social security server, and determining whether the field length, the file naming format and the interface specification of the message in the message sending result are consistent; acquiring a necessary field from the message result according to the interface specification, and detecting whether the necessary field is an empty 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 necessary filling field is not an empty 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 inconsistent, and/or the necessary filling field is a null field, and/or the service data and the service field are not matched, determining that the message sending result is not verified.
Further, integrating all the verification results 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 specifically configured according to actual requirements.
By the embodiment, whether the transmission state of the data transmitted through the interface and the message transmission 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, including:
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, comparing whether the file name of the decompressed file is consistent with the file name of the target file, and determining that the target file is not verified 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, or determining that the target file is verified when the file size of the decompressed file is inconsistent with the file size of the target file and/or the file name of the decompressed file is inconsistent with the file name of the target file;
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 accords with 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 row by row, determining the consistency of the decrypted text with the target file, and determining that the target file passes verification when the file name of the target file accords with a file naming rule corresponding to the target social security server and the decrypted text accords with the target file, or determining that the target file does not pass verification when the file name of the target file does not accord with a file naming rule corresponding to the target social security server and/or the decrypted text does not accord with the target file;
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 the file name of the corresponding target file are consistent with those of the originally uploaded version; the second version transmits data in the form of text data (for example, text data in txt format is adopted for data interaction), so that besides the naming rule of the verification file name, the actual content of the target file can be compared with the original uploaded file one by one to determine whether the file uploaded to the opposite server, namely, the file of the target social security server is consistent with the original version, and the condition of missing transmission or data error in the process of file transmission is avoided; because the third version only sends the message to the target social security server without other data, the data sending state record and the message sending result are verified, and the target file is not verified if other files with the message are not required to be verified.
According to the embodiment, targeted automatic testing can be performed according to different interface versions, so that files can be ensured to 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, so as 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, so that the time consumed by manual testing is reduced, the time cost is effectively saved, meanwhile, a plurality of social security servers are in butt joint, the universality of testing is improved, and the testing effect is further optimized by carrying out targeted testing according to different interface versions.
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 also be sent to terminal devices of related personnel, such as testers and developers, so as to assist in timely optimization and timely processing when there is an abnormality.
In at least one embodiment of the invention, when detecting that a new interface exists, determining an interface version of the new interface, and writing a script corresponding to the new interface into the simulation operation script according to the interface version;
And when the newly added social security server is detected, adding the social security code and the service data of the newly added social security server into the simulation operation script.
In the embodiment, when a newly added interface or a social security server exists, a set of corresponding scripts does not need to be rewritten to execute independent tests until the new interfaces or social security servers are needed to be added on the original basis, so that the expandability of the tests is improved.
It should be noted that, in order to further improve the security of the data and avoid the data from being tampered maliciously, the simulation operation script may be stored in the blockchain node.
According to the technical scheme, the method can obtain the 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, each social security server corresponds to one social security code, full-automatic simulation of manual operation of a user is realized, labor cost is effectively reduced, human operation errors are avoided, meanwhile, execution efficiency is improved, a test instruction is responded, an interface to be tested and a target social security server are obtained according to the test instruction, required data is obtained based on a label and a regular expression, due to the uniqueness of the label, the accuracy of the obtained data is guaranteed while the data obtaining efficiency is improved, the interface version of the interface to be tested is determined, the target social security code of the target social security server is determined, the target social security code is fetched from the simulation operation script according to the interface of the interface to be tested, the target social security code is determined to be the target script, and a data configuration and a data library is automatically verified by the user, the data is sent to the user interface to the user, the test script is verified to be in a state, the data is automatically sent to the user, the test script is verified to be the state, the data is recorded, the test result is automatically sent, and the test result is recorded, and verifying the target file according to the interface version of the interface to be tested to obtain a second verification result, and carrying out targeted automatic test 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-written script, reducing the time consumed by manual test, effectively saving the time cost, simultaneously interfacing a plurality of social security servers, improving the universality of the test, carrying out targeted test according to different interface versions, and further optimizing the test effect.
FIG. 3 is a schematic diagram of a computer device implementing a test method based on a configurable interface according to a preferred embodiment 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 stored in the memory 12 and executable on the processor 13, for example a test program based on a configurable interface.
It will be appreciated 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 of the computer device 1, the computer device 1 may be a bus type structure, a star type structure, the computer device 1 may further comprise more or less other hardware or software than illustrated, or a different arrangement of components, for example, the computer device 1 may further comprise an input-output device, a network access device, etc.
It should be noted that the computer device 1 is only used as an example, and other electronic products that may be present in the present invention or may be present in the future are also included in the scope of the present invention by way of reference.
The memory 12 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 12 may in some embodiments be an internal storage unit of the computer device 1, such as a removable hard disk of the computer device 1. The memory 12 may in other embodiments also be an external storage device of the computer device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are 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 for storing application software installed in the computer device 1 and various types of data, such as code of a test program based on a configurable interface, etc., but also for temporarily storing data that has been output or is to be output.
The processor 13 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, a combination of various control chips, and the like. The processor 13 is a Control Unit (Control Unit) of the computer device 1, connects the respective components of the entire computer device 1 using various interfaces and lines, executes various functions of the computer device 1 and processes data by running or executing programs or modules stored in the memory 12 (for example, executing a test program based on a configurable interface, etc.), and calls data stored in the memory 12.
The processor 13 executes the operating system of the computer device 1 and various types of applications installed. The processor 13 executes the application program to implement the steps of the various configurable interface based test method embodiments described above, such as the steps shown in fig. 1.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing the specified functions, which instruction segments 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 retrieval unit 112, an execution unit 113, a download unit 114, a verification unit 115, a generation unit 116.
The integrated units implemented in the form of software functional modules described above may be stored in a computer readable storage medium. The software functional module is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor (processor) to execute portions of the configurable interface-based test method according to the embodiments of the present invention.
The modules/units integrated in the computer device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on this understanding, the present invention may also be implemented by a computer program for instructing a relevant hardware device to implement all or part of the procedures of the above-mentioned embodiment method, where the computer program may be stored in a computer readable storage medium and the computer program may be executed by a processor to implement the steps of each of the above-mentioned method embodiments.
Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a 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 from the use of blockchain nodes, and the like.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one straight line is shown in fig. 3, but not only one bus or one type of bus. The bus is arranged to enable a connection communication between the memory 12 and at least one processor 13 or the like.
Although not shown, the computer device 1 may further comprise a power source (such as a battery) for powering the various components, preferably the power source may be logically connected to the at least one processor 13 via a power management means, whereby the functions of charge management, discharge management, and power consumption management are achieved by the power management means. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The computer device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described in detail herein.
Further, the computer device 1 may also comprise a network interface, optionally comprising a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the computer device 1 and other computer devices.
The computer device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or 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, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the computer device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
Fig. 3 shows only a computer device 1 with components 12-13, it being understood by those skilled in the art that the structure shown in fig. 3 is not limiting of the computer device 1 and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
In connection with fig. 1, the memory 12 in the computer device 1 stores a plurality of instructions to implement a configurable interface based test method, the processor 13 being executable to implement:
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 a 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 an interface version of the interface to be tested and determining a target social security code of the target social security server;
According to the interface version of the interface to be tested, a target script is called from the simulation operation script;
determining the target social security code as an entry of the target script, and executing the target script;
when the execution of the target script is detected to be finished, connecting to a configuration database, acquiring a data transmission 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 transmission 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 specific implementation method of the above instructions by the processor 13 may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
In the several embodiments provided in the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
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 characteristics 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 evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. The units or means stated in the invention may also be implemented by one unit or means, either by software or hardware. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (7)

1. The test method based on the configurable interface is characterized by comprising the following steps of:
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 a 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 an interface version of the interface to be tested and determining a target social security code of the target social security server;
according to the interface version of the interface to be tested, a target script is called from the simulation operation script;
determining the target social security code as an entry of the target script, and executing the target script;
when the execution of the target script is detected to be finished, connecting to a configuration database, acquiring a data transmission 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 transmission 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;
generating a test report of the interface to be tested according to the first verification result and the second verification result;
the determining the interface version of the interface to be tested includes:
when the uploaded data is an accessory and encryption processing is not needed after the accessory is compressed, determining that the interface to be tested is a first version; or alternatively
When the uploaded data is text and encryption processing is needed after the text is compressed, determining that the interface to be tested is a second version; or alternatively
When the uploaded data is a message, determining that the interface to be tested is a third version;
the executing the target script includes:
uploading a target accessory when the interface to be tested is the first version, compressing the target accessory, uploading the compressed target accessory 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 alternatively
When the interface to be tested is the second version, receiving data sent by an upstream server, obtaining target data selected from the data sent by the upstream server, compressing the target data, carrying out encryption processing on the compressed target data, packing the data obtained after the encryption processing to be used as packed data, uploading the packed data to the target social security server, and sending a file ready notification; or alternatively
When the interface to be tested is the third version, sending a target message to the target social security server;
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, comparing whether the file name of the decompressed file is consistent with the file name of the target file, and determining that the target file is not verified 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, or determining that the target file is verified when the file size of the decompressed file is inconsistent with the file size of the target file and/or the file name of the decompressed file is inconsistent with the file name of the target file;
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 accords with 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 row by row, determining the consistency of the decrypted text with the target file, and determining that the target file passes verification when the file name of the target file accords with a file naming rule corresponding to the target social security server and the decrypted text accords with the target file, or determining that the target file does not pass verification when the file name of the target file does not accord with a file naming rule corresponding to the target social security server and/or the decrypted text does not accord with the target file;
and when the interface to be tested is the third version, the target file is not verified.
2. The configurable interface-based testing method according to claim 1, wherein the obtaining the interface to be tested and the target social security server according to the testing 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 a 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 test method of claim 1, wherein said validating said data transmission status record, said sending out message results comprises:
When the data transmission state record shows that the transmission is successful, determining that the data transmission state of the data transmitted through the interface to be tested passes verification, or when the data transmission state record shows that the transmission is failed, determining that the data transmission state of the data transmitted through the interface to be tested does not pass verification;
acquiring a preset interface specification corresponding to the target social security server, and determining whether the field length, the file naming format and the interface specification of the message in the message sending result are consistent; acquiring a necessary field from the message result according to the interface specification, and detecting whether the necessary field is an empty 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 necessary filling field is not an empty 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 inconsistent, and/or the necessary filling field is a null field, and/or the service data and the service field are not matched, determining that the message sending result is not verified.
4. The configurable interface based test method of claim 1, wherein the method further comprises:
when detecting that a new interface exists, determining an interface version of the new interface, and writing a script corresponding to the new interface into the simulation operation script according to the interface version;
and when the newly added social security server is detected, adding the social security code and the service data of the newly added social security server into the simulation operation script.
5. A configurable interface-based test device, the configurable interface-based test device comprising:
the system comprises an acquisition unit, a storage unit and a storage 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 further used for responding to the 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 the 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 execution of the target script is detected, acquiring a data transmission 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 transmission state record and the message sending result to obtain a first verification result;
the verification unit is further configured to verify the target file according to the interface version of the interface to be tested, so as to obtain a second verification result;
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;
the determining unit determining the interface version of the interface to be tested includes:
when the uploaded data is an accessory and encryption processing is not needed after the accessory is compressed, determining that the interface to be tested is a first version; or alternatively
When the uploaded data is text and encryption processing is needed after the text is compressed, determining that the interface to be tested is a second version; or alternatively
When the uploaded data is a message, determining that the interface to be tested is a third version;
the executing unit executing the target script includes:
uploading a target accessory when the interface to be tested is the first version, compressing the target accessory, uploading the compressed target accessory 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 alternatively
When the interface to be tested is the second version, receiving data sent by an upstream server, obtaining target data selected from the data sent by the upstream server, compressing the target data, carrying out encryption processing on the compressed target data, packing the data obtained after the encryption processing to be used as packed data, uploading the packed data to the target social security server, and sending a file ready notification; or alternatively
When the interface to be tested is the third version, sending a target message to the target social security server;
the verifying unit verifies the target file according to the interface version of the interface to be tested, including:
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, comparing whether the file name of the decompressed file is consistent with the file name of the target file, and determining that the target file is not verified 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, or determining that the target file is verified when the file size of the decompressed file is inconsistent with the file size of the target file and/or the file name of the decompressed file is inconsistent with the file name of the target file;
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 accords with 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 row by row, determining the consistency of the decrypted text with the target file, and determining that the target file passes verification when the file name of the target file accords with a file naming rule corresponding to the target social security server and the decrypted text accords with the target file, or determining that the target file does not pass verification when the file name of the target file does not accord with a file naming rule corresponding to the target social security server and/or the decrypted text does not accord with the target file;
And when the interface to be tested is the third version, the target file is not verified.
6. A computer device, the computer device comprising:
a memory storing at least one instruction; a kind of electronic device with high-pressure air-conditioning system
A processor executing instructions stored in the memory to implement the configurable interface based test method of any one of claims 1 to 4.
7. A computer-readable storage medium, characterized by: the 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 test method of any one of claims 1 to 4.
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 CN113468049A (en) 2021-10-01
CN113468049B true 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)

Families Citing this family (4)

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

Citations (6)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3627399A1 (en) * 2018-09-19 2020-03-25 Tata Consultancy Services Limited Systems and methods for real time configurable recommendation using user data

Patent Citations (6)

* 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
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

Also Published As

Publication number Publication date
CN113468049A (en) 2021-10-01

Similar Documents

Publication Publication Date Title
CN113468049B (en) Configurable interface-based test method, device, equipment and medium
CN112073269B (en) Block chain network testing method, device, server and storage medium
US7536599B2 (en) Methods and systems for validating a system environment
CN112015663B (en) Test data recording method, device, equipment and medium
CN112506779A (en) Software interface testing method and device, electronic equipment and storage medium
CN110058867A (en) The packing of application program mirror image, installation method and computer installation, storage medium
CN112506559A (en) Gray scale publishing method and device based on gateway, electronic equipment and storage medium
CN114185808A (en) Automatic testing method and device, electronic equipment and computer readable storage medium
CN111694582A (en) Application program resource package processing method, device, equipment and readable storage medium
CN111694684A (en) Abnormal construction method and device of storage equipment, electronic equipment and storage medium
CN112579452A (en) Software automation test method, device, equipment and storage medium
CN114185502B (en) Log printing method, device, equipment and medium based on production line environment
CN114036068A (en) Update detection method, device, equipment and storage medium based on privacy security
CN113505079A (en) Application program testing method, device, equipment and medium
CN115002062A (en) Message processing method, device, equipment and readable storage medium
CN114124835A (en) Interface-based data transmission method, device, equipment and medium
CN113051171A (en) Interface test method, device, equipment and storage medium
CN112667244A (en) Data verification method and device, electronic equipment and computer readable storage medium
CN113360398B (en) Hybrid application program testing method, device, equipment and medium
CN115964307B (en) Automatic test method, device, equipment and medium for transaction data
CN110716939B (en) Data management method, electronic device, system and medium
CN118014696B (en) Transaction order preheating method, device, equipment and medium
CN112084114B (en) Method and apparatus for testing interfaces
CN113542387B (en) System release method and device, electronic equipment and storage medium
CN116306591B (en) Flow form generation 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