CN110941563A - Automatic script testing method and device - Google Patents

Automatic script testing method and device Download PDF

Info

Publication number
CN110941563A
CN110941563A CN201911421455.XA CN201911421455A CN110941563A CN 110941563 A CN110941563 A CN 110941563A CN 201911421455 A CN201911421455 A CN 201911421455A CN 110941563 A CN110941563 A CN 110941563A
Authority
CN
China
Prior art keywords
interface
message
target system
test
excel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911421455.XA
Other languages
Chinese (zh)
Other versions
CN110941563B (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.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201911421455.XA priority Critical patent/CN110941563B/en
Priority claimed from CN201911421455.XA external-priority patent/CN110941563B/en
Publication of CN110941563A publication Critical patent/CN110941563A/en
Application granted granted Critical
Publication of CN110941563B publication Critical patent/CN110941563B/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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Abstract

The embodiment of the application provides an automatic script testing method and device, and the method comprises the following steps: respectively converting excel messages for testing each test case into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one; respectively calling the interfaces of each target system based on the interface transaction codes corresponding to the messages sent by each interface so as to enable each target system to respectively carry out automatic script test; and comparing the test output message of each target system with the case expected result corresponding to the excel message respectively, and obtaining the automatic script test result of each target system according to the comparison result. The script test system can effectively realize automatic script test, and the test process does not need a baffle, does not need a system communication downstream system, does not require testers to have coding capacity, and then can effectively improve the efficiency and the degree of automation of script test.

Description

Automatic script testing method and device
Technical Field
The application relates to the technical field of data testing, in particular to an automatic script testing method and device.
Background
In the stage of iterative testing, most systems have no baffles, and due to the factors such as versions, environments, code problems and the like among the systems, the iterative testing is easily not executed according to a plan, although some systems have baffles, testers are still required to have certain coding capacity, and meanwhile, the testing efficiency is low.
At present, automatic script testing of a system can be realized through tools such as RF, Jmeter and the like, however, the testing modes all depend on a baffle, and a tester is required to have certain coding capability, so that the learning cost is high, and the testing efficiency is low.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides an automatic script testing method and device, which can effectively realize automatic script testing, do not need a baffle plate in the testing process, do not need a system to be communicated with a downstream system, and do not need testers to have coding capacity, so that the efficiency and the automation degree of the script testing can be effectively improved.
In order to solve the technical problem, the application provides the following technical scheme:
in a first aspect, the present application provides an automated script testing method, including:
respectively converting excel messages for testing each test case into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one;
respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to enable the target systems to respectively carry out automatic script testing;
and comparing the test output message of each target system with the case expected result corresponding to the excel message, and obtaining the automatic script test result of each target system according to the comparison result.
Further, before the step of converting the excel message for testing each test case into an interface corresponding to each target system and sending the message, the method further comprises the following steps:
receiving an excel message by using a preset visual interface;
the excel message is used for storing interface transaction codes, protocols, case numbers, public message headers and uploading fields in each interface document.
Further, the step of respectively converting the excel messages for testing each test case into the interface uploading messages corresponding to each target system includes:
reading the interface uploading message by using an xlrd module in a preset Python programming mode and carrying out line-by-line processing on the interface uploading message;
and respectively splicing the interface uploading messages processed line by line into the interface uploading messages corresponding to each target system.
Further, the correspondingly calling the interfaces of the target systems respectively based on the interface transaction codes corresponding to the messages sent by the interfaces respectively to enable the target systems to perform the automated script test respectively includes:
based on interface transaction codes and different protocols corresponding to the messages sent by the interfaces, the interfaces of the target systems are respectively and correspondingly called by using different preset programming modes so that the target systems respectively carry out automatic script testing;
wherein, the programming mode comprises the following steps: python programming mode for realizing http and socket protocols and Java programming mode for realizing dubbo protocols.
Further, the comparing the test output message of each target system with the case expected result corresponding to the excel message, and obtaining the automatic script test result of each target system according to the comparison result includes:
obtaining a corresponding case expected result according to a case corresponding to each line of message in the excel message, and obtaining a log file of each target system through a configured log file path and an interface transaction code and reading a test output message;
intercepting the content of the corresponding target key field in the test output message of each target system;
and comparing the target key field content corresponding to each target system with the expected case result respectively, and obtaining the automatic script test result of each target system according to the comparison result.
Further, still include:
and storing the automatic script test result of each target system, and/or outputting the automatic script test result of each target system to a test result column of the excel case by importing an xlwt module.
In a second aspect, the present application provides an automated script testing apparatus, comprising:
the message conversion module is used for respectively converting excel messages used for testing each test case into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one;
the interface calling module is used for respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to respectively carry out the automatic script test on the target systems;
and the verification module is used for comparing the test output message of each target system with the case expected result corresponding to the excel message and obtaining the automatic script test result of each target system according to the comparison result.
Further, still include:
the excel message generation module is used for receiving an excel message by applying a preset visual interface;
the excel message is used for storing interface transaction codes, protocols, case numbers, public message headers and uploading fields in each interface document.
Further, the message conversion module includes:
the message reading unit is used for reading the interface message by using an xlrd module in a preset Python programming mode and carrying out line-by-line processing on the interface message;
and the message splicing unit is used for splicing the interface messages processed line by line into interface messages corresponding to each target system respectively.
Further, the interface calling module comprises:
the automatic calling interface unit is used for correspondingly calling the interfaces of the target systems respectively by applying different preset programming modes based on the interface transaction codes and different protocols respectively corresponding to the messages sent by the interfaces so as to ensure that the target systems respectively carry out automatic script testing;
wherein, the programming mode comprises the following steps: python programming mode for realizing http and socket protocols and Java programming mode for realizing dubbo protocols.
Further, the verification module includes:
the system comprises a case expected result generating unit and a test output message capturing unit, wherein the case expected result generating unit is used for obtaining a corresponding case expected result according to a case corresponding to each line of message in the excel message, and the test output message capturing unit is used for obtaining a log file of each target system through a configured log file path and an interface transaction code and reading a test output message;
a key field intercepting unit, configured to intercept respective corresponding target key field contents in a test output packet of each target system;
and the comparison unit is used for comparing the target key field content corresponding to each target system with the case expected result respectively and obtaining the automatic script test result of each target system according to the comparison result.
Further, still include:
and the test result storage module is used for storing the automatic script test result of each target system, and/or the test result output module is used for outputting the automatic script test result of each target system to the test result column of the excel case by importing the automatic script test result into the xlwt module.
In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the automated script testing method when executing the program.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the automated script testing method.
According to the technical scheme, the automatic script testing method and the automatic script testing device provided by the application have the advantages that excel messages for testing each testing case are respectively converted into interface sending messages corresponding to each target system, wherein the interface sending messages respectively correspond to the message format types of the interface protocols of each target system one by one; respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to enable the target systems to respectively carry out automatic script testing; the test output messages of the target systems are respectively compared with case expected results corresponding to the excel messages, and automatic script test results of the target systems are obtained according to the comparison results, so that automatic script test can be effectively realized, a baffle plate is not needed in the test process, the system is not needed to be communicated with a downstream system, the testing personnel is not required to have coding capacity, the testing personnel only need to send the messages upwards, then a tool is clicked, the iterative test is automatically completed, the script test efficiency and the automation degree can be effectively improved, and the accuracy and the reliability of the script test process are effectively guaranteed.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart illustrating an automated script testing method in an embodiment of the present application.
Fig. 2 is a flowchart illustrating an automated script testing method including step 010 according to an embodiment of the present application.
Fig. 3 is a flowchart illustrating a step 100 in an automated script testing method according to an embodiment of the present application.
Fig. 4 is a flowchart illustrating a step 300 in an automated script testing method according to an embodiment of the present application.
Fig. 5 is a flowchart illustrating an automated script testing method comprising steps 400 and 500 according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of an automated script testing apparatus in an embodiment of the present application.
Fig. 7 is a schematic structural diagram of an automated script testing apparatus including an excel message generation module in the embodiment of the present application.
Fig. 8 is a schematic structural diagram of a message conversion module in the automated script testing apparatus in the embodiment of the present application.
Fig. 9 is a schematic structural diagram of an authentication module in an automated script testing apparatus in an embodiment of the present application.
Fig. 10 is a schematic structural diagram of an automated script testing apparatus including a test result storage module and a test result output module in the embodiment of the present application.
Fig. 11 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Aiming at the problems that the existing testing mode depends on a baffle and a tester is required to have certain coding capacity, the testing of a testing case can be considered by calling an interface, however, the interfaces such as a dubbo protocol and a socket protocol can not be called by a certain programming language, and the testing is premised on the condition that all systems can be communicated or the baffle is used, for example: when the interface is called, the value of a certain field is sent to be 1, after the interface is called, the system performs logic processing, and the value of the field is changed into 2 and then is output to a downstream system; there are many methods and tools for automated testing, such as RF and Jmeter, which can automatically set up the interface, but do not support multi-protocol interfaces, and rely on barriers or have to communicate between systems. The two points are the biggest pain points of the current automated test, and the application just solves the two pain points.
In order to solve the above problems, the present application provides an automated script testing method, an automated script testing apparatus, an electronic device, and a computer-readable storage medium, where an excel message for testing each test case is converted into an interface upload message corresponding to each target system, respectively, where the interface upload message corresponds to a message format type of an interface protocol of each target system one to one; respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to enable the target systems to respectively carry out automatic script testing; and comparing the test output message of each target system with the case expected result corresponding to the excel message respectively, and obtaining the automatic script test result of each target system according to the comparison result. And by storing the upload message directly in excel, two benefits are achieved: first flexibility is better, this excel file all can be used to many different environment, the second threshold is lower, do not require the tester to possess database operation ability, that is to say, this application can effectively realize automatic script test, and the testing process need not the baffle, need not system UNICOM low reaches system, also do not require the tester to possess the encoding ability, the tester only needs to send the message on, then the clicking tool, accomplish the iterative test automatically, and then can effectively improve the efficiency and the degree of automation of script test, and effectively guarantee script test process's accuracy and reliability.
In one or more embodiments of the present application, a protocol refers to: the convention that two parties must comply with when communicating between systems. Such as how to establish a connection, how to identify each other, etc.
In one or more embodiments of the present application, RF refers to: the full name of the Robot Framework is a function automation testing Framework written by python.
In one or more embodiments of the present application, a meter refers to: a Java-based stress testing tool developed by the Apache organization.
In one or more embodiments of the present application, Python refers to: a cross-platform computer programming language. Is an object-oriented dynamic type language. Java is also a door-to-object programming language.
In order to effectively realize automatic script testing, and the testing process does not need a baffle, does not need a system to communicate with a downstream system, and does not require a tester to have coding capability, and further, the efficiency and the degree of automation of the script testing can be effectively improved, the application provides an embodiment of an automatic script testing method, and referring to fig. 1, the automatic script testing method specifically includes the following contents:
step 100: the excel messages used for testing each test case are respectively converted into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one.
It is understood that the tester writes cases, expected results, and reported messages in excel; the method and the device convert excel uploading messages into message formats of systems, automatically call system interfaces through a Python and java compiling tool, and then automatically compare whether output messages are consistent with expected results.
Step 200: and respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to ensure that the target systems respectively carry out automatic script testing.
Step 300: and comparing the test output message of each target system with the case expected result corresponding to the excel message, and obtaining the automatic script test result of each target system according to the comparison result.
That is to say, according to the automated script testing method provided by the embodiment of the application, only the tester needs to send the excel message according to the interface document, and the automated iterative testing of the product can be completed.
In order to effectively improve the application reliability of the excel message and further improve the accuracy and reliability of the automated script test, in an embodiment of the automated script test method of the present application, referring to fig. 2, the following contents are further specifically included before step 100 in the automated script test method:
step 010: and receiving the excel message by using a preset visual interface.
The excel message is used for storing interface transaction codes, protocols, case numbers, public message headers and uploading fields in each interface document.
Specifically, the first column of excel defines the interface transaction code, the second column defines the protocol, the third column defines the case number, the fourth column defines the common header, and each subsequent column defines each upload field of each interface document.
And Python realizes a visual interface and provides excel messages and case paths for the input of testers.
In order to effectively improve the application reliability of the interface message, so as to further improve the accuracy and reliability of the automated script test, in an embodiment of the automated script test method of the present application, referring to fig. 3, step 100 in the automated script test method specifically includes the following contents:
step 101: and reading the interface uploading message by using an xlrd module in a preset Python programming mode and carrying out line-by-line processing on the interface uploading message.
It can be understood that the xlrd module in Python is a functional module for reading excel table data, and supports the excel tables in xlsx and xls formats.
Step 102: and respectively splicing the interface uploading messages processed line by line into the interface uploading messages corresponding to each target system.
Specifically, the Python imports an xlrd library, reads excel messages and processes the excel messages line by line, and the messages are respectively spliced into message formats suitable for the interface protocol through a judgment protocol, such as socket format messages and http format messages.
In order to effectively improve the automation degree of the automated script test and further improve the efficiency of the automated script test, in an embodiment of the automated script test method of the present application, step 200 of the automated script test method specifically includes the following contents:
based on interface transaction codes and different protocols corresponding to the messages sent by the interfaces, the interfaces of the target systems are respectively and correspondingly called by using different preset programming modes so that the target systems respectively carry out automatic script testing; wherein, the programming mode comprises the following steps: python programming mode for realizing http and socket protocols and Java programming mode for realizing dubbo protocols.
That is, the system interface can be called according to different system access protocols (http, https, socket, dubbo).
Specifically, the system service information may be obtained through the configuration file, and then the system service where the interface is located and the protocol may be determined, where different protocols use different programming languages to implement interface invocation, for example: the dubbo protocol adopts Java to realize interface calling, the socket protocol adopts Python to realize interface calling, finally, the spliced uploading message is obtained, and the interface corresponding to the system is called according to the interface transaction code.
In order to effectively improve the reliability and the automation degree of the automatic script test result, so as to further improve the efficiency and the reliability of the automatic script test, in an embodiment of the automatic script test method of the present application, referring to fig. 4, step 300 in the automatic script test method specifically includes the following contents:
step 301: obtaining a corresponding case expected result according to a case corresponding to each line of message in the excel message, and step 302: and acquiring the log file of each target system through the configured log file path and the interface transaction code and reading the test output message.
Step 303: and intercepting the corresponding target key field content in the test output message of each target system.
Step 304: and comparing the target key field content corresponding to each target system with the expected case result respectively, and obtaining the automatic script test result of each target system according to the comparison result.
Specifically, each line of message in the excel message corresponds to one case, and expected results of the cases are obtained; and capturing an output message of the adjusted system, intercepting the key field content in the output message, comparing the key field content with the expected result of the corresponding case, judging the test result, if the test result is correct, the result of the updated case is YES, and if the test result is incorrect, the result of the updated case is NO.
In order to further improve the intelligent degree and reliability of the automated script test, in an embodiment of the automated script test method of the present application, at least one of step 400 and step 500 may be further specifically executed after step 300 in the automated script test method, referring to fig. 5, taking the example of sequentially executing step 400 and step 500, which specifically includes the following contents:
step 400: and storing the automatic script test result of each target system.
Step 500: and leading the automatic script test result of each target system into an xlwt module to realize a test result list output to the excel case.
To further explain the present solution, the present application further provides a specific application example of an automated script testing method, where the automated script testing method specifically includes the following contents:
s1: and converting the excel message into an interface uploading message format by utilizing Python.
①, excel defines interface transaction codes in the first column, protocols in the second column, case numbers in the third column, common headers in the fourth column, and upload fields in each interface document in each subsequent column.
②, Python realizes a visual interface and provides excel messages and case paths for the input of testers.
③, importing Python into an xlrd library, reading excel messages, processing line by line, and respectively splicing the messages into message formats suitable for the interface protocol, such as socket format messages and http format messages, by judging the protocol.
S2: and calling corresponding interfaces of each system according to the transaction codes by using Python and JAVA codes.
①, obtaining system service information through configuration files.
② the system service where the connection interface is located.
③, judging the protocol, and realizing interface calling by adopting different programming languages for different protocols, for example, the dubbo protocol adopts Java to realize interface calling, and the socket protocol adopts Python to realize interface calling.
④, acquiring the spliced message, and calling the corresponding interface of the system according to the interface transaction code.
S3: and automatically comparing the output message of the capturing system with an expected result, and recording the comparison result.
①, each line of message in the excel message corresponds to a case, and the expected result of the case is obtained.
②, capturing the output message of the system.
③ the key field contents in the intercepted output message are compared with the expected results for the corresponding case.
④, judging the test result, if it is correct, the result of updating case is YES, if it is incorrect, the result of updating case is NO.
That is to say, the automated script testing method provided by the application example of the application is a method for realizing automated testing of background products based on python and java, and is characterized in that when a program is started, a message file is read and converted into a format, the converted message is uploaded, a system interface is called, after the interface is successfully called, the interface is grabbed to output the message, the message is automatically compared with an expected result in a case, and the comparison result is recorded in the case; through applying Python, JAVA to call the different protocol interface of each system, can effectively realize automatic script test, and the test procedure need not the baffle, need not system UNICOM low reaches system, also do not require the tester to possess the encoding ability, the tester only needs to send the message, then the point tool, accomplish the iterative test automatically, and then can effectively improve the efficiency and the degree of automation of script test, and effectively guarantee script test procedure's accuracy and reliability, its use threshold is low, efficient and extensive use.
In terms of software, in order to effectively implement automated script testing, and the testing process does not need a baffle, does not need a system to communicate with a downstream system, and does not require a tester to have encoding capability, and further, the efficiency and the degree of automation of the script testing can be effectively improved, the present application provides an embodiment of an automated script testing apparatus for implementing all or part of the contents of the automated script testing method, and the automated script testing apparatus specifically includes the following contents, referring to fig. 6:
the message conversion module 10 is configured to convert the excel messages used for testing each test case into interface upload messages corresponding to each target system, where the interface upload messages correspond to the message format types of the interface protocols of each target system one to one.
And the interface calling module 20 is configured to respectively and correspondingly call the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces, so that the target systems respectively perform the automated script test.
And the verification module 30 is configured to compare the test output message of each target system with the case expected result corresponding to the excel message, and obtain an automated script test result of each target system according to the comparison result.
Specifically, the message conversion module is mainly used for converting an excel message into a system message format (such as a fusion format); the interface calling module is mainly used for calling a system interface according to the transaction code and the report; the verification module is mainly used for capturing the system output message, automatically comparing with an expected result and recording the comparison result.
In order to effectively improve the application reliability of the excel message and further improve the accuracy and reliability of the automated script test, in an embodiment of the automated script test apparatus of the present application, referring to fig. 7, the automated script test apparatus further includes the following contents:
the excel message generation module 01 is used for receiving an excel message by applying a preset visual interface;
the excel message is used for storing interface transaction codes, protocols, case numbers, public message headers and uploading fields in each interface document.
In order to effectively improve the application reliability of the messages sent on the interface, so as to further improve the accuracy and reliability of the automated script test, in an embodiment of the automated script test apparatus of the present application, referring to fig. 8, a message conversion module 10 in the automated script test apparatus specifically includes the following contents:
and the message reading unit 11 is configured to read the interface upload message by using an xlrd module in a preset Python programming mode and perform line-by-line processing on the interface upload message.
And a message splicing unit 12, configured to splice the interface upload messages processed line by line into interface upload messages corresponding to each target system respectively.
In order to effectively improve the automation degree of the automated script test and further improve the efficiency of the automated script test, in an embodiment of the automated script test apparatus of the present application, the interface calling module 20 in the automated script test apparatus specifically includes the following contents:
the automatic calling interface unit is used for correspondingly calling the interfaces of the target systems respectively by applying different preset programming modes based on the interface transaction codes and different protocols respectively corresponding to the messages sent by the interfaces so as to ensure that the target systems respectively carry out automatic script testing; wherein, the programming mode comprises the following steps: python programming mode for realizing http and socket protocols and Java programming mode for realizing dubbo protocols.
In order to effectively improve the reliability and the automation degree of the automatic script test result, so as to further improve the efficiency and the reliability of the automatic script test, in an embodiment of the automatic script test apparatus of the present application, referring to fig. 9, a verification module 30 in the automatic script test apparatus specifically includes the following contents:
a case expected result generating unit 31 for obtaining a corresponding case expected result according to a case corresponding to each line of message in the excel message, and a test output message capturing unit 32 for obtaining a log file of each target system through a configured log file path and an interface transaction code and reading the test output message.
And a key field intercepting unit 33, configured to intercept respective corresponding target key field contents in the test output packet of each target system.
And the comparison unit 34 is configured to compare the target key field content corresponding to each target system with the case expected result, and obtain an automated script test result of each target system according to the comparison result.
In order to further improve the intelligent degree and reliability of the automated script test, in an embodiment of the automated script test method of the present application, the automated script test apparatus may further specifically include at least one of a test result storage module 40 and a test result output module 50, referring to fig. 10, taking an example in which the test result storage module 40 and the test result output module 50 are included at the same time, which specifically includes the following contents:
and the test result storage module 40 is used for storing the automatic script test result of each target system.
And the test result output module 50 is used for outputting the automatic script test result of each target system to the test result column of the excel case by importing the test result into the xlwt module.
In order to effectively implement automatic script testing, and a test process does not need a baffle, does not need a system to be communicated with a downstream system, and does not require a tester to have coding capability, and further, the efficiency and the degree of automation of the script testing can be effectively improved, the application provides an embodiment of an electronic device for implementing all or part of contents in the automatic script testing method, and the electronic device specifically includes the following contents:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between the electronic equipment and relevant equipment such as each target system, the user terminal, a relevant database and the like; the electronic device may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the electronic device may refer to the embodiment of the automated script testing method in the embodiment and the embodiment of the automated script testing apparatus, which are incorporated herein by reference, and repeated details are not repeated here.
Fig. 11 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 11, the electronic device 9600 can include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this FIG. 11 is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In an embodiment, automated script test functionality may be integrated into the central processor 9100. The central processor 9100 may be configured to control as follows:
step 100: the excel messages used for testing each test case are respectively converted into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one.
Step 200: and respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to ensure that the target systems respectively carry out automatic script testing.
Step 300: and comparing the test output message of each target system with the case expected result corresponding to the excel message, and obtaining the automatic script test result of each target system according to the comparison result.
According to the description, the electronic equipment provided by the embodiment of the application can effectively realize automatic script testing, a baffle plate is not needed in the testing process, the system is not needed to be communicated with a downstream system, the testing personnel is not required to have coding capacity, the testing personnel only need to send messages, then a tool is clicked, iterative testing is automatically completed, the efficiency and the automation degree of the script testing can be effectively improved, and the accuracy and the reliability of the script testing process are effectively guaranteed.
In another embodiment, the automated script testing apparatus may be configured separately from the central processor 9100, for example, the automated script testing apparatus may be configured as a chip connected to the central processor 9100, and the automated script testing function may be implemented by the control of the central processor.
As shown in fig. 11, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 also does not necessarily include all of the components shown in fig. 11; in addition, the electronic device 9600 may further include components not shown in fig. 11, which may be referred to in the prior art.
As shown in fig. 11, a central processor 9100, sometimes referred to as a controller or operational control, can include a microprocessor or other processor device and/or logic device, which central processor 9100 receives input and controls the operation of the various components of the electronic device 9600.
The memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to realize information storage or processing, or the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. Power supply 9170 is used to provide power to electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 9140 can be a solid state memory, e.g., Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 9140 could also be some other type of device. Memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 being used for storing application programs and function programs or for executing a flow of operations of the electronic device 9600 by the central processor 9100.
The memory 9140 can also include a data store 9143, the data store 9143 being used to store data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, contact book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby implementing ordinary telecommunications functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100, thereby enabling recording locally through the microphone 9132 and enabling locally stored sounds to be played through the speaker 9131.
Embodiments of the present application further provide a computer-readable storage medium capable of implementing all steps in the automated script testing method in the foregoing embodiments, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all steps of the automated script testing method in the foregoing embodiments, where the execution subject is a server or a client, for example, when the processor executes the computer program, the processor implements the following steps:
step 100: the excel messages used for testing each test case are respectively converted into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one.
Step 200: and respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to ensure that the target systems respectively carry out automatic script testing.
Step 300: and comparing the test output message of each target system with the case expected result corresponding to the excel message, and obtaining the automatic script test result of each target system according to the comparison result.
From the above description, it can be known that the computer-readable storage medium provided in the embodiment of the present application can effectively implement automated script testing, and the testing process does not need a baffle, does not need a system to communicate with a downstream system, and does not require a tester to have coding capability, and the tester only needs to send a message, and then clicks a tool to automatically complete an iterative test, thereby effectively improving efficiency and automation degree of script testing, and effectively ensuring accuracy and reliability of the script testing process.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (14)

1. An automated script testing method, comprising:
respectively converting excel messages for testing each test case into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one;
respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to enable the target systems to respectively carry out automatic script testing;
and comparing the test output message of each target system with the case expected result corresponding to the excel message, and obtaining the automatic script test result of each target system according to the comparison result.
2. The automated script testing method of claim 1, wherein before the step of converting the excel message for testing each test case into an interface upload message corresponding to each target system, the method further comprises:
receiving an excel message by using a preset visual interface;
the excel message is used for storing interface transaction codes, protocols, case numbers, public message headers and uploading fields in each interface document.
3. The automated script testing method of claim 1, wherein the converting excel messages for testing each test case into interface upload messages corresponding to each target system respectively comprises:
reading the interface uploading message by using an xlrd module in a preset Python programming mode and carrying out line-by-line processing on the interface uploading message;
and respectively splicing the interface uploading messages processed line by line into the interface uploading messages corresponding to each target system.
4. The automated script testing method of claim 1, wherein the step of calling the interface of each target system respectively and correspondingly based on the interface transaction code corresponding to the message sent by each interface to enable each target system to perform the automated script testing respectively comprises:
based on interface transaction codes and different protocols corresponding to the messages sent by the interfaces, the interfaces of the target systems are respectively and correspondingly called by using different preset programming modes so that the target systems respectively carry out automatic script testing;
wherein, the programming mode comprises the following steps: python programming mode for realizing http and socket protocols and Java programming mode for realizing dubbo protocols.
5. The automated script testing method according to claim 1, wherein the comparing the test output message of each target system with the case expected result corresponding to the excel message, and obtaining the automated script testing result of each target system according to the comparison result comprises:
obtaining a corresponding case expected result according to a case corresponding to each line of message in the excel message, and obtaining a log file of each target system through a configured log file path and an interface transaction code and reading a test output message;
intercepting the content of the corresponding target key field in the test output message of each target system;
and comparing the target key field content corresponding to each target system with the expected case result respectively, and obtaining the automatic script test result of each target system according to the comparison result.
6. The automated script testing method of claim 1, further comprising:
and storing the automatic script test result of each target system, and/or outputting the automatic script test result of each target system to a test result column of the excel case by importing an xlwt module.
7. An automated script testing apparatus, comprising:
the message conversion module is used for respectively converting excel messages used for testing each test case into interface uploading messages corresponding to each target system, wherein the interface uploading messages respectively correspond to the message format types of the interface protocols of each target system one by one;
the interface calling module is used for respectively and correspondingly calling the interfaces of the target systems based on the interface transaction codes corresponding to the messages sent by the interfaces so as to respectively carry out the automatic script test on the target systems;
and the verification module is used for comparing the test output message of each target system with the case expected result corresponding to the excel message and obtaining the automatic script test result of each target system according to the comparison result.
8. The automated script testing apparatus of claim 7, further comprising:
the excel message generation module is used for receiving an excel message by applying a preset visual interface;
the excel message is used for storing interface transaction codes, protocols, case numbers, public message headers and uploading fields in each interface document.
9. The automated script testing apparatus of claim 7, wherein the message conversion module comprises:
the message reading unit is used for reading the interface message by using an xlrd module in a preset Python programming mode and carrying out line-by-line processing on the interface message;
and the message splicing unit is used for splicing the interface messages processed line by line into interface messages corresponding to each target system respectively.
10. The automated script testing apparatus of claim 7, wherein the interface call module comprises:
the automatic calling interface unit is used for correspondingly calling the interfaces of the target systems respectively by applying different preset programming modes based on the interface transaction codes and different protocols respectively corresponding to the messages sent by the interfaces so as to ensure that the target systems respectively carry out automatic script testing;
wherein, the programming mode comprises the following steps: python programming mode for realizing http and socket protocols and Java programming mode for realizing dubbo protocols.
11. The automated script testing apparatus of claim 7, wherein the verification module comprises:
the system comprises a case expected result generating unit and a test output message capturing unit, wherein the case expected result generating unit is used for obtaining a corresponding case expected result according to a case corresponding to each line of message in the excel message, and the test output message capturing unit is used for obtaining a log file of each target system through a configured log file path and an interface transaction code and reading a test output message;
a key field intercepting unit, configured to intercept respective corresponding target key field contents in a test output packet of each target system;
and the comparison unit is used for comparing the target key field content corresponding to each target system with the case expected result respectively and obtaining the automatic script test result of each target system according to the comparison result.
12. The automated script testing apparatus of claim 7, further comprising:
and the test result storage module is used for storing the automatic script test result of each target system, and/or the test result output module is used for outputting the automatic script test result of each target system to the test result column of the excel case by importing the automatic script test result into the xlwt module.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the automated script testing method of any one of claims 1 to 6 are implemented when the program is executed by the processor.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the automated script testing method of any one of claims 1 to 6.
CN201911421455.XA 2019-12-31 Automatic script testing method and device Active CN110941563B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911421455.XA CN110941563B (en) 2019-12-31 Automatic script testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911421455.XA CN110941563B (en) 2019-12-31 Automatic script testing method and device

Publications (2)

Publication Number Publication Date
CN110941563A true CN110941563A (en) 2020-03-31
CN110941563B CN110941563B (en) 2024-04-16

Family

ID=

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111627171A (en) * 2020-04-28 2020-09-04 深圳壹账通智能科技有限公司 Test message conversion method, device, equipment and medium of ATMP system
CN112052170A (en) * 2020-09-03 2020-12-08 中国银行股份有限公司 Automatic detection method and device, storage medium and electronic equipment
CN112099472A (en) * 2020-09-03 2020-12-18 通号城市轨道交通技术有限公司 Automatic testing method and device, electronic equipment and storage medium
CN112328474A (en) * 2020-10-28 2021-02-05 太仓市同维电子有限公司 Method for remotely issuing parameters to Robot Framework based on Web Socket
CN112597053A (en) * 2020-12-30 2021-04-02 中国工商银行股份有限公司 User interface automatic testing method and device with safety control

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105528294A (en) * 2015-12-29 2016-04-27 广东金赋信息科技有限公司 Method and system for automatically generating interface testing case
WO2016180237A1 (en) * 2015-07-27 2016-11-17 中兴通讯股份有限公司 Northbound interface test apparatus and test method for northbound interface
CN107656874A (en) * 2017-11-07 2018-02-02 中国银行股份有限公司 A kind of interface test method, device, simulation baffle plate and system
CN110297774A (en) * 2019-07-02 2019-10-01 四川长虹电器股份有限公司 A kind of automatic interface testing method based on python

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016180237A1 (en) * 2015-07-27 2016-11-17 中兴通讯股份有限公司 Northbound interface test apparatus and test method for northbound interface
CN105528294A (en) * 2015-12-29 2016-04-27 广东金赋信息科技有限公司 Method and system for automatically generating interface testing case
CN107656874A (en) * 2017-11-07 2018-02-02 中国银行股份有限公司 A kind of interface test method, device, simulation baffle plate and system
CN110297774A (en) * 2019-07-02 2019-10-01 四川长虹电器股份有限公司 A kind of automatic interface testing method based on python

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111627171A (en) * 2020-04-28 2020-09-04 深圳壹账通智能科技有限公司 Test message conversion method, device, equipment and medium of ATMP system
CN112052170A (en) * 2020-09-03 2020-12-08 中国银行股份有限公司 Automatic detection method and device, storage medium and electronic equipment
CN112099472A (en) * 2020-09-03 2020-12-18 通号城市轨道交通技术有限公司 Automatic testing method and device, electronic equipment and storage medium
CN112328474A (en) * 2020-10-28 2021-02-05 太仓市同维电子有限公司 Method for remotely issuing parameters to Robot Framework based on Web Socket
CN112597053A (en) * 2020-12-30 2021-04-02 中国工商银行股份有限公司 User interface automatic testing method and device with safety control

Similar Documents

Publication Publication Date Title
US11360737B2 (en) Method and apparatus for providing speech service
CN109582655B (en) Method and device for positioning system log and computer readable storage medium
CN112615753B (en) Link abnormity tracking method, first node, second node and link
CN111367988A (en) Data import method and device
CN103455413A (en) Method, device and system for interaction scenario test data processing of communication terminals
CN103200022B (en) A kind of data download abnormality eliminating method, equipment and system
CN111782546A (en) Automatic interface testing method and device based on machine learning
CN110543428B (en) Application system testing method and device
CN112905460B (en) Device and method for simulating three-party receipt by automatic interface test
CN110399305B (en) BTT module testing method and device
CN112422485B (en) Communication method and device of transmission control protocol
CN111324480B (en) Large-scale host transaction fault positioning system and method
CN110941563B (en) Automatic script testing method and device
CN110941563A (en) Automatic script testing method and device
CN113438083B (en) Signature adding and checking method and device based on interface automatic test
CN113438251A (en) Protocol conversion method, device and system
CN112866268B (en) Message processing method and system
CN111859041B (en) Data reporting method and device
CN114416597A (en) Test case record generation method and device
CN113515447A (en) System automation test method and device
CN113079056A (en) Terminal protocol consistency test method and device
CN114070902B (en) Message processing method and device based on DELPHI
CN113342447B (en) Page generation method, device, equipment and storage medium based on Flutter
CN115390848A (en) Method and device for converting and transmitting Chinese data with different code systems between systems
CN113760683B (en) Log acquisition method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant