CN109828903B - Automatic testing method and device, computer device and storage medium - Google Patents

Automatic testing method and device, computer device and storage medium Download PDF

Info

Publication number
CN109828903B
CN109828903B CN201811537199.6A CN201811537199A CN109828903B CN 109828903 B CN109828903 B CN 109828903B CN 201811537199 A CN201811537199 A CN 201811537199A CN 109828903 B CN109828903 B CN 109828903B
Authority
CN
China
Prior art keywords
interface
tested
test
background
parameters
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
CN201811537199.6A
Other languages
Chinese (zh)
Other versions
CN109828903A (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 Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201811537199.6A priority Critical patent/CN109828903B/en
Publication of CN109828903A publication Critical patent/CN109828903A/en
Application granted granted Critical
Publication of CN109828903B publication Critical patent/CN109828903B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides an automatic testing method, which comprises the following steps: executing UI automation test on the tested application program; calling a corresponding background interface according to preset operation in the UI automation test, inputting input parameters to the background interface, and acquiring return parameters; obtaining system log information in real time, screening out parameters transmitted to a third party interface when the background interface calls the third party interface, and comparing the parameters transmitted to the third party interface by the background interface and the parameters of the platform interface, which are input and returned, with preset parameter information so as to output the system log information and an interface test result; when the preset operation executed on the elements to be tested comprises database connection, testing and verifying the database; and generating a test report. The invention also provides an automatic testing device, a computer device and a storage medium. The automatic test in the invention not only stays at the UI verification level, but also can cover the service logic of the server, thereby improving the test quality.

Description

Automatic testing method and device, computer device and storage medium
Technical Field
The invention relates to the technical field of testing, in particular to an automatic testing method and device, electronic equipment and a computer readable storage medium.
Background
With the continuous development of software technology, software systems are more and more huge, and the functions of software are more and more complex, so that the software testing difficulty is increased. Compared with the internet products, the testing difficulty of the internet financial products is particularly high, because the internet financial products relate to monetary transactions, security is more emphasized, and for safety consideration, complex core business logic is implemented in a background, and the page logic of the client is relatively simple. However, currently, most testers only pay attention to the UI in the UI automation test under the influence of the layering theory, the actual background logic coverage and the database verification of the whole process are less, the pure UI inspection only covers a few test cases, and the test quality cannot be well guaranteed for internet financial products. In addition, the stability of the UI automation test is general, the input cost is high, the output effect is poor, and in addition, the script maintenance cost which is frequently high in the later period is added, so that the UI automation test technology falls down in the spirit stage increasingly in the industry, and is difficult to popularize and fall to the ground in various companies.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an automatic testing method and apparatus, an electronic device, and a computer-readable storage medium, which can improve testing efficiency and testing quality.
A first aspect of the present application provides an automated testing method applied to a computer apparatus, the method including:
when a test operation instruction is received, positioning an element to be tested in a user interface of an application program to be tested, generating a corresponding test instruction according to the element to be tested, executing the test instruction to execute preset operation on the element to be tested so as to perform UI (user interface) automatic test on the user interface, and outputting a user interface verification result;
calling a corresponding background interface according to the preset operation executed by the test instruction on the element to be tested, inputting a parameter to the background interface, and acquiring a return parameter of the background interface, wherein the parameter is input when the test instruction is executed to execute a parameter input operation in the page element to be tested;
obtaining system log information in real time, screening out parameters which are transmitted to a third party interface by a background interface when the background interface calls the third party interface from the system log information, comparing the parameters which are transmitted to the third party interface by the screened background interface with the parameters of the platform interface, and the parameters of the platform interface, which are entered and returned, with preset parameter information, judging whether the parameters of the background interface, which are entered and returned and the parameters transmitted to the third party interface by the background interface are consistent with the preset parameter information, and outputting the system log information and an interface test result according to the judgment result;
when the preset operation executed on the elements to be tested comprises database connection, acquiring information related to the elements to be tested in the database, and comparing the acquired information related to the elements to be tested in the database with an expected result to verify the database and output a database verification result; and
and generating a test report, wherein the test report comprises the user interface verification result, the interface test result, the system log information and the database verification result.
A second aspect of the present application provides an automated testing apparatus, comprising:
the UI automatic test module is used for positioning an element to be tested in a user interface of the tested application program, generating a corresponding test instruction according to the element to be tested, executing the test instruction to execute preset operation on the element to be tested so as to perform UI automatic test on the user interface, and outputting a user interface verification result;
the interface testing module is used for calling a corresponding background interface according to the preset operation executed on the element to be tested, inputting a parameter to the background interface and acquiring a return parameter of the background interface, wherein the parameter is input when the test instruction is executed to execute a parameter input operation in the page element to be tested;
the interface testing module is used for comparing the parameters transmitted to the third-party interface by the screened background interface and the parameters transmitted to the third-party interface by the background interface with preset parameter information, judging whether the parameters transmitted to the third-party interface by the background interface and the parameters transmitted to the third-party interface by the background interface are consistent with the preset parameter information or not, and outputting the log information and an interface testing result according to a judgment result;
the system comprises a UI automation test module, a database verification module and a database verification module, wherein the UI automation test module is used for acquiring information related to elements to be tested in the database when test operation executed on the elements to be tested by the UI automation test module comprises database connection, and comparing the acquired information related to the elements to be tested in the database with an expected result so as to test and verify the database and output a database verification result; and
and the test report generating module is used for generating a test report, wherein the test report comprises the user interface verification result, the interface test result, the system log information and the database verification result.
A third aspect of the application provides a computer apparatus comprising a processor for implementing the automated testing method as described above when executing a computer program stored in a memory.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements an automated testing method as previously described.
The automatic test method provided by the invention is used for carrying out UI automatic test, replaces the traditional manual test, reduces the test cost and improves the test efficiency. On the other hand, the automatic test in the invention not only stays at the UI verification level, but also can cover the service logic of the server, including the verification of the interface parameters and the data verification of the connection database, thereby improving the test quality.
Drawings
Fig. 1 is a schematic diagram of an application environment architecture of an automated testing method according to an embodiment of the present invention.
Fig. 2 is a flowchart of an automated testing method according to a second embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an automated testing apparatus according to a third embodiment of the present invention.
Fig. 4 is a schematic diagram of a computer device according to a fourth embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a detailed description of the present invention will be given below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth to provide a thorough understanding of the present invention, and the described embodiments are merely a subset of the embodiments of the present invention, rather than a complete embodiment. 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 invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
Example one
Fig. 1 is a schematic diagram of an application environment architecture of an automated testing method according to an embodiment of the present invention.
The automated testing method of the invention is applied in an environment comprising a computer device 1 and at least one terminal device 2, wherein the computer device 1 and the at least one terminal device 2 are connected in communication through a network. In this embodiment, the computer device 1 may be a server or a personal computer, wherein the server may be a single server, a server cluster or a cloud server.
The terminal device 2 is, but not limited to, an electronic device such as a server, a smart phone, a tablet computer, a laptop portable computer, a desktop computer, etc.
In one embodiment, the computer device 1 and the at least one terminal device 2 may establish communication connection through a wired (e.g., USB (Universal Serial Bus) or Wireless) manner, the Wireless manner may be any type of conventional Wireless communication, such as Radio, Wireless Fidelity (WIFI), cellular, satellite, broadcast, etc. the Wireless communication technology may include, but is not limited to, Global System for Mobile Communications (GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), wideband Code Division Multiple Access (W-CDMA), CDMA2000, IMT Single Carrier (IMT Single Carrier), Enhanced Data rate GSM Evolution (Enhanced Data Rates for GSM Evolution), Long Term Evolution (Long-Term Evolution), LTE), LTE advanced Long Term Evolution (LTE), TD-LTE, High Performance Radio Local Area Network (High Performance Radio Local Area Network, High LAN), High Performance Radio Wide Area Network (High Performance Radio Wide Area Network, High WAN), Local Multipoint Distribution Service (LMDS), Worldwide Interoperability for Microwave Access (WiMAX), ZigBee protocol (ZigBee), Bluetooth, Orthogonal Frequency Division Multiplexing (Flash-Orthogonal Frequency Division Multiplexing, Flash-OFDM), High Capacity Spatial Division Multiplexing (HC-SDMA), Universal Mobile Telecommunications System (Universal Mobile Telecommunications System, UMTS), UMTS TDD, HSPA +), Time Division Synchronous Code Division Multiple Access (TD-SCDMA), Evolution-Data Optimized (EV-DO), Digital Enhanced Cordless Telecommunications (DECT), and others.
For the computer device 1 that needs to be automatically tested, the automatic testing function provided by the method of the present invention may be directly integrated on the computer device 1, or a client for implementing the method of the present invention may be installed. For another example, the method provided by the present invention may also be run on a device such as a server in the form of a Software Development Kit (SDK), an interface of an automated testing function is provided in the form of an SDK, and the computer device 1 or other devices may implement processing of an abnormal application through the provided interface.
Example two
Fig. 2 is a flowchart illustrating an automated testing method according to a second embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
Step S1, when receiving a test operation instruction, positioning an element to be tested in a user interface of the tested application program, generating a corresponding test instruction according to the element to be tested, executing the test instruction to execute preset operation on the element to be tested so as to perform UI automatic test on the user interface, and outputting a user interface verification result.
The application to be tested can be installed in different electronic devices, which may include, but are not limited to, a terminal device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like. The UI automatic test is divided into an Android (Android), an IOS (input/output system) environment and a UI automatic test in a browser according to different terminal systems.
In one embodiment, the method for automatically testing the UI of the user interface of the application to be tested may include the following steps:
1) analyzing the user interface of the tested application program, and acquiring the elements to be tested in the user interface of the tested application program and the positioning data of the elements to be tested.
In one embodiment, after a testing device provided with an automatic testing framework is connected with an electronic device provided with an application program to be tested, when the automatic testing framework receives the automatic testing instruction, a uiautomatoviewer tool in the electronic device provided with the application program to be tested obtains elements to be tested in a UI in the application program to be tested and positioning data of the elements to be tested. Among them, uiaumatoroviwer is a tool carried by android SDK. And through a screen capture and XML layout file analysis mode, a control information viewing service is provided for a user.
The elements to be tested may include, but are not limited to, a login page, a start page, an application launch page, etc., and in-page buttons, text entry boxes, drop-down boxes, single/check box elements, hyperlinks, text, pictures, audio, animation, video, etc.
The positioning data of the page element may be, but is not limited to, id, name, class name, xpath, and hierarchical Style Sheets (CSSs) of the page element. The positioning data corresponding to each page element is defined when the program of the client side is written. The obtaining of the positioning data corresponding to the page element may include at least one of an id, a name, a class name, an xpath, and a CSS of the page element.
2) And generating an automatic test instruction according to the acquired to-be-tested elements and the positioning data of the to-be-tested elements, wherein the automatic test instruction comprises test operation executed on the to-be-tested elements.
3) And executing the test instruction, and controlling the elements to be tested in the tested user interface to traverse and execute corresponding operations.
4) And obtaining an execution result fed back by the tested user interface and comparing the execution result with an expected result, wherein if the comparison result is consistent, the UI test is passed, and if the comparison result is inconsistent, the UI test is not passed.
The execution result may include data of an execution state after the application program to be tested completes execution of the test instruction and a user interface image of an execution result after the test case completes execution. For example, when the application under test is instant messaging software, and the page element included in the user interface under test is a "register" button, after the test instruction for clicking the register button is executed, if the registration is successful, the execution state data is a successful registration, and the user interface image is an interface image of the successful registration, and then the execution state data and the interface image are compared with the expected result.
Step S2, calling a corresponding background interface according to the preset operation executed by the test instruction on the element to be tested, inputting a parameter to the background interface, and obtaining a return parameter of the background interface, where the parameter is input when a parameter input operation is executed in the page element to be tested by executing the test instruction.
The interface test is to judge whether the interface meets or meets the corresponding requirements of functionality and safety by testing the corresponding reference information of the input reference under different conditions. For example, when the user registration interface is tested in step S1, after the operations of locating the user name input box, clicking the user name input box and inputting the user name, locating the password input box, clicking the password input box and inputting the password, re-locating the registration button and clicking the registration button are completed by executing the test instruction, a background user registration interface is invoked according to the above operations in step S2, the user name and the password input in step S1 are used as input parameters to be input into the user registration interface, and the interface return parameters are obtained.
Step S3, system log information is obtained in real time, parameters transmitted to a third party interface by a background interface when the background interface calls the third party interface are screened out from the system log information, the parameters transmitted to the third party interface by the screened background interface and the parameters of the platform interface, which are entered and returned, are compared with preset parameter information, whether the parameters of the background interface, which are entered and returned and the parameters transmitted to the third party interface by the background interface are consistent with the preset parameter information or not is judged, and the system log information and an interface test result are output according to the judgment result.
In an embodiment of the present invention, step S3 specifically includes:
1) executing a preset script for capturing system log information, and capturing the system log information from a server;
2) searching and positioning the access parameter and the return parameter of the interface and the interface parameter transmitted to the third-party background interface by the interface from the system log information according to the keyword set by the user;
3) comparing the screened interface input parameters, the screened return parameters and the parameters transmitted to the third-party background interface by the interface with preset parameter information respectively;
the preset parameter information is stored in a preset storage position in a Json (JavaScript Object Notation) character string format.
Preferably, the interface parameter Value exists in the form of a Key Value pair (Key/Value pair), and the unique Value (Value) corresponding to the Key Value pair can be determined through the Key (Key), where Key in the Key Value pair is the name of the interface parameter, and the corresponding Value is the parameter Value corresponding to the name of the interface parameter.
4) If the interface parameter input and the return parameter and the interface parameter transmitted to the third-party background interface by the interface are consistent with the corresponding preset parameters, the test is passed;
5) and if the interface parameter input and the return parameter and the interface parameter transmitted to the third-party background interface by the interface are inconsistent with the corresponding preset parameter, the test is not passed.
S4, when the preset operation executed on the elements to be tested includes database connection, obtaining information related to the elements to be tested in the database, and comparing the obtained information related to the elements to be tested in the database with an expected result, so as to test and verify the database and output a database verification result.
And when the information in the acquired database is consistent with the expected result, determining that the database test verification is passed, and if the information in the acquired database is not consistent with the expected result, determining that the database test verification is not passed.
The test verification of the database may include the following: a modification operation of the data item; an add operation of a data item; deleting the data item; the data table is full; the data table is deleted empty; deleting the record in the empty table; concurrent operation of data tables, etc.
S5, generating a test report, wherein the test report comprises the user interface verification result, the interface test result, the log information and the database verification result.
Preferably, the automated testing method supports Jenkins continuous integration. Jenkins is an open source software project, is a continuous integration tool developed based on Java, is used for monitoring continuous and repeated work, and aims to provide an open and easy-to-use software platform to enable continuous integration of software.
Preferably, the test report may be displayed in a user interface of the test platform, and may also be exported in a file with a format of PDF, WORD, Excel, or the like.
Preferably, the automated testing method may further include:
and sending the test report to a preset person in a preset mode.
The preset mode can be mails, short messages and the like, the preset personnel can be related personnel such as a test manager, a tester, a developer and the like, and the contact mode of the preset personnel can be stored in the storage device in advance.
EXAMPLE III
Please refer to fig. 3, which is a block diagram of an automatic testing apparatus according to a preferred embodiment of the present invention.
In some embodiments, the automated test equipment 10 runs in a computer device. The automatic test device 10 may include a plurality of functional modules composed of program code segments. Program code for various program segments in the automated test equipment 10 may be stored in a memory of a computer device and executed by the at least one processor to implement automated test functions.
In this embodiment, the automatic test device 10 may be divided into a plurality of functional modules according to the functions performed by the automatic test device. Referring to fig. 3, the functional modules may include: the system comprises a UI automation testing module 101, an interface testing module 102, a log information obtaining module 103, a database verification module 104 and a test report generating module 105. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory. In the present embodiment, the functions of the modules will be described in detail in the following embodiments.
The UI automation test module 101 is configured to locate an element to be tested in a user interface of a tested application program, generate a corresponding test instruction according to the element to be tested, execute the test instruction to execute a preset operation on the element to be tested to perform UI automation test on the user interface, and output a user interface verification result.
In an embodiment, the UI automation test module 101 may perform UI automation test on the user interface of the application to be tested, including the following steps:
1) analyzing the user interface of the tested application program, and acquiring the elements to be tested in the user interface of the tested application program and the positioning data of the elements to be tested.
In one embodiment, after a testing device provided with an automatic testing framework is connected with an electronic device provided with an application program to be tested, when the automatic testing framework receives the automatic testing instruction, a uiautomatoviewer tool in the electronic device provided with the application program to be tested obtains elements to be tested in a UI in the application program to be tested and positioning data of the elements to be tested. Among them, uiaumatoroviwer is a tool carried by android SDK. And through a screen capture and XML layout file analysis mode, a control information viewing service is provided for a user.
The elements to be tested may include, but are not limited to, a login page, a start page, an application launch page, etc., and in-page buttons, text entry boxes, drop-down boxes, single/check box elements, hyperlinks, text, pictures, audio, animation, video, etc.
The positioning data of the page element may be, but is not limited to, id, name, class name, xpath, and hierarchical Style Sheets (CSSs) of the page element. The positioning data corresponding to each page element is defined when the program of the client side is written. The obtaining of the positioning data corresponding to the page element may include at least one of an id, a name, a class name, an xpath, and a CSS of the page element.
2) And generating an automatic test instruction according to the acquired to-be-tested elements and the positioning data of the to-be-tested elements, wherein the automatic test instruction comprises test operation executed on the to-be-tested elements.
3) And executing the automatic test instruction, and controlling the elements to be tested in the tested user interface to traverse and execute corresponding operations.
4) And obtaining an execution result fed back by the tested user interface and comparing the execution result with an expected result, wherein if the comparison result is consistent, the UI test is passed, and if the comparison result is inconsistent, the UI test is not passed.
The execution result may include data of an execution state after the application program to be tested completes execution of the test instruction and a user interface image of an execution result after the test case completes execution. For example, when the application under test is instant messaging software, and the page element included in the user interface under test is a "register" button, after the test instruction for clicking the register button is executed, if the registration is successful, the execution state data is a successful registration, and the user interface image is an interface image of the successful registration, and then the execution state data and the interface image are compared with the expected result.
The interface testing module 102 is configured to invoke a corresponding background interface according to the preset operation executed by the UI automation testing module 101 on the element to be tested by the testing instruction, input an entry parameter to the background interface, and acquire a return parameter of the background interface, where the entry parameter is a parameter input when the testing instruction is executed to execute a parameter input operation in the page element to be tested.
The interface test is to judge whether the interface meets or meets the corresponding requirements of functionality and safety by testing the corresponding reference information of the input reference under different conditions. For example, when the UI automation test module 101 tests the user registration interface, after the operations of positioning the user name input box, clicking the user name input box and inputting the user name, positioning the password input box, clicking the password input box and inputting the password, repositioning the registration button and clicking the registration button are completed by executing the test instruction, the interface test module 102 invokes the user registration interface of the background according to the operations, inputs the user name and the password input by the UI automation test module 101 as input parameters into the user registration interface, and obtains the interface return parameters.
The log information obtaining module 103 is configured to obtain system log information in real time, screen out parameters that the background interface transmits to a third party interface when the background interface calls the third party interface from the system log information, compare the parameters that the screened background interface transmits to the third party interface and the parameters that the platform interface enters and returns with preset parameter information, determine whether the parameters that the background interface enters and returns and the parameters that the background interface transmits to the third party interface are consistent with the preset parameter information, and output the log information and an interface test result according to the determination result.
In an embodiment of the present invention, the step of acquiring the system log information by the log information acquiring module 103 includes: executing a preset script for capturing system log information, and capturing the system log information from a server; and searching and positioning the access parameter and the return parameter of the interface and the interface parameter transmitted to the third-party background interface by the interface from the system log information according to the keywords set by the user.
The interface test module 102 compares the screened interface input parameters, the screened interface return parameters and the parameters transmitted to the third-party background interface by the interface with preset parameters respectively; if the interface parameter input and the return parameter and the interface parameter transmitted to the third-party background interface by the interface are consistent with the corresponding preset parameters, the test is passed; and if the interface parameter input and the return parameter and the interface parameter transmitted to the third-party background interface by the interface are inconsistent with the corresponding preset parameter, the test is not passed.
The preset parameters are stored in a preset storage position in a Json (JavaScript Object Notation) character string format.
Preferably, the interface parameter Value exists in the form of a Key Value pair (Key/Value pair), and the unique Value (Value) corresponding to the Key Value pair can be determined through the Key (Key), where Key in the Key Value pair is the name of the interface parameter, and the corresponding Value is the parameter Value corresponding to the name of the interface parameter.
The database verification module 104 is configured to, when the UI automation test module 101 performs a test operation on an element to be tested, including connection to a database, obtain information related to the element to be tested in the database, and compare the obtained information in the database with an expected result, so as to perform a test verification on the database and output a database verification result.
And when the information in the acquired database is consistent with the expected result, determining that the database test verification is passed, and if the information in the acquired database is not consistent with the expected result, determining that the database test verification is not passed.
The test verification of the database may include the following: a modification operation of the data item; an add operation of a data item; deleting the data item; the data table is full; the data table is deleted empty; deleting the record in the empty table; concurrent operation of data tables, etc.
The test report generating module 105 is configured to generate a test report, where the test report includes the user interface verification result, the interface test result, the log information, and the database verification result.
Preferably, the test method also supports Jenkins continuous integration. Jenkins is an open source software project, is a continuous integration tool developed based on Java, is used for monitoring continuous and repeated work, and aims to provide an open and easy-to-use software platform to enable continuous integration of software.
Preferably, the test report may be displayed in a user interface of the test platform, and may also be exported in a file with a format of PDF, WORD, Excel, or the like.
Preferably, the test method may further include:
and sending the test report to a preset person in a preset mode.
The preset mode can be mails, short messages and the like, the preset personnel can be related personnel such as a test manager, a tester, a developer and the like, and the contact mode of the preset personnel can be stored in the storage device in advance.
The automatic test method provided by the invention is used for carrying out UI automatic test, replaces the traditional manual test, reduces the test cost and improves the test efficiency. On the other hand, the UI automatic test in the invention not only stays at the UI verification level, but also can cover the service logic of the server, including the verification of the interface parameters and the data verification of the connection database, thereby improving the test quality.
Example four
FIG. 4 is a diagram of a computer device according to a preferred embodiment of the present invention.
The computer device 1 comprises a memory 20, a processor 30 and a computer program 40, such as an automated test program, stored in the memory 20 and executable on the processor 30. The processor 30, when executing the computer program 40, implements the steps of the above-described automated testing method embodiments, such as the steps S1-S5 shown in fig. 2. Alternatively, the processor 30, when executing the computer program 40, implements the functions of the modules/units in the above-mentioned embodiment of the automatic testing device, such as the module 101 and 105 in fig. 3.
Illustratively, the computer program 40 may be partitioned into one or more modules/units that are stored in the memory 20 and executed by the processor 30 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, the instruction segments describing the execution process of the computer program 40 in the computer apparatus 1. For example, the computer program 40 may be divided into a UI automation test module 101, an interface test module 102, a log information acquisition module 103, a database verification module 104, and a test report generation module 105 in fig. 3. See the third embodiment for the specific functions of each module.
The computer device 1 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. It will be appreciated by a person skilled in the art that the schematic diagram is merely an example of the computer apparatus 1, and does not constitute a limitation of the computer apparatus 1, and may comprise more or less components than those shown, or some components may be combined, or different components, for example, the computer apparatus 1 may further comprise an input and output device, a network access device, a bus, etc.
The Processor 30 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor 30 may be any conventional processor or the like, the processor 30 being the control center of the computer device 1, various interfaces and lines connecting the various parts of the overall computer device 1.
The memory 20 may be used for storing the computer program 40 and/or the module/unit, and the processor 30 implements various functions of the computer device 1 by running or executing the computer program and/or the module/unit stored in the memory 20 and calling data stored in the memory 20. The memory 20 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 by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the computer apparatus 1, and the like. In addition, the memory 20 may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The modules/units integrated with the computer device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and which, when executed by a processor, may implement the steps of the above-described embodiments of the method. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
In the embodiments provided in the present invention, it should be understood that the disclosed computer apparatus and method can be implemented in other ways. For example, the above-described embodiments of the computer apparatus are merely illustrative, and for example, the division of the units is only one logical function division, and there may be other divisions when the actual implementation is performed.
In addition, functional units in the embodiments of the present invention may be integrated into the same processing unit, or each unit may exist alone physically, or two or more units are integrated into the same unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. The units or computer means recited in the computer means claims may also be implemented by the same unit or computer means, either in software or in hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (8)

1. An automated testing method applied to a computer device, the method comprising:
when a test operation instruction is received, locating an element to be tested in a user interface of an application program to be tested, generating a corresponding test instruction according to the element to be tested, executing the test instruction to execute preset operation on the element to be tested so as to perform UI automatic test on the user interface, and outputting a user interface verification result, wherein the UI automatic test on the user interface comprises the following steps: analyzing the application program user interface to be tested, and acquiring elements to be tested in the application program user interface to be tested and positioning data of the elements to be tested; generating an automatic test instruction according to the acquired to-be-tested elements and the positioning data of the to-be-tested elements, wherein the automatic test instruction comprises test operation executed on the to-be-tested elements; executing the test instruction, and controlling elements to be tested in the tested user interface to traverse and execute corresponding operations; obtaining an execution result fed back by the tested user interface and comparing the execution result with an expected result, if the comparison result is consistent, the UI test is passed, and if the comparison result is inconsistent, the UI test is not passed;
calling a corresponding background interface according to the preset operation executed by the test instruction on the element to be tested, inputting a parameter to the background interface, and acquiring a return parameter of the background interface, wherein the parameter is input when the test instruction is executed to execute a parameter input operation in the page element to be tested;
the method comprises the steps of obtaining system log information in real time, screening out parameters which are transmitted to a third-party interface by a background interface when the background interface calls the third-party interface from the system log information, comparing the parameters which are transmitted to the third-party interface by the screened background interface and parameters which are transmitted to the third-party interface by a platform interface with preset parameter information, judging whether the parameters which are transmitted to the third-party interface by the background interface and the parameters which are transmitted to the third-party interface by the background interface are consistent with the preset parameter information, and outputting the system log information and an interface test result according to a judgment result, wherein the parameters which are obtained in real time and transmitted to the third-party interface by the background interface when the third-party interface is called by the background interface screened from the system log information comprise the following steps: executing a preset script for capturing system log information, and capturing the system log information; searching and positioning the parameters of the background interface, such as the access parameter and the return parameter, and the parameters transmitted to the third-party background interface by the background interface from the system log information according to preset keywords;
when the preset operation executed by the test instruction on the element to be tested comprises database connection, acquiring information related to the element to be tested in the database, and comparing the acquired information related to the element to be tested in the database with an expected result to verify the database and output a database verification result; and
and generating a test report, wherein the test report comprises the user interface verification result, the interface test result, the system log information and the database verification result.
2. The automated testing method of claim 1, wherein the test validation of the database comprises: a modification operation of the data item; an add operation of a data item; deleting the data item; the data table is full; the data table is deleted empty; deleting the record in the empty table; concurrent operation of the data tables.
3. The automated testing method of claim 1, wherein the automated testing method supports Jenkins continued integration.
4. The automated testing method of claim 1, further comprising: and sending the test report to a preset person in a preset mode.
5. The automated testing method of claim 1, wherein the predetermined parameter information is stored in a predetermined storage location in a format of a Json string.
6. An automated testing apparatus, comprising:
the UI automation test module is used for positioning an element to be tested in a user interface of an application program to be tested, generating a corresponding test instruction according to the element to be tested, executing the test instruction to execute preset operation on the element to be tested so as to perform UI automation test on the user interface, and outputting a user interface verification result, wherein the UI automation test on the user interface comprises the following steps: analyzing the application program user interface to be tested, and acquiring elements to be tested in the application program user interface to be tested and positioning data of the elements to be tested; generating an automatic test instruction according to the acquired to-be-tested elements and the positioning data of the to-be-tested elements, wherein the automatic test instruction comprises test operation executed on the to-be-tested elements; executing the test instruction, and controlling elements to be tested in the tested user interface to traverse and execute corresponding operations; obtaining an execution result fed back by the tested user interface and comparing the execution result with an expected result, if the comparison result is consistent, the UI test is passed, and if the comparison result is inconsistent, the UI test is not passed;
the interface testing module is used for calling a corresponding background interface according to the preset operation executed on the element to be tested, inputting a parameter to the background interface and acquiring a return parameter of the background interface, wherein the parameter is input when the test instruction is executed to execute a parameter input operation in the page element to be tested;
a log information acquisition module for acquiring system log information in real time, and screening out parameters transmitted to a third-party interface by the background interface when the background interface calls the third-party interface from the system log information, the interface testing module compares the parameters transmitted to the third-party interface by the screened background interface and the parameters transmitted to the third-party interface by the background interface with preset parameter information, judges whether the parameters transmitted to the third-party interface by the background interface and the parameters transmitted to the third-party interface by the background interface are consistent with the preset parameter information or not, and outputs the log information and an interface testing result according to the judgment result, the method for acquiring the system log information in real time and the parameters, which are transmitted to the third-party interface by the background interface when the background interface calls the third-party interface, are screened from the system log information comprises the following steps: executing a preset script for capturing system log information, and capturing the system log information; searching and positioning the parameters of the background interface, such as the access parameter and the return parameter, and the parameters transmitted to the third-party background interface by the background interface from the system log information according to preset keywords;
the database verification module is used for acquiring information related to the elements to be tested in the database when preset operation executed on the elements to be tested by the test instruction comprises database connection, comparing the acquired information related to the elements to be tested in the database with an expected result, and performing test verification on the database and outputting a database verification result; and
and the test report generating module is used for generating a test report, wherein the test report comprises the user interface verification result, the interface test result, the system log information and the database verification result.
7. A computer device, characterized by: the computer arrangement comprises a processor for implementing the automated testing method of any one of claims 1-5 when executing a computer program stored in a memory.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program, when executed by a processor, implements an automated testing method according to any one of claims 1-5.
CN201811537199.6A 2018-12-14 2018-12-14 Automatic testing method and device, computer device and storage medium Active CN109828903B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811537199.6A CN109828903B (en) 2018-12-14 2018-12-14 Automatic testing method and device, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811537199.6A CN109828903B (en) 2018-12-14 2018-12-14 Automatic testing method and device, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN109828903A CN109828903A (en) 2019-05-31
CN109828903B true CN109828903B (en) 2022-03-08

Family

ID=66858886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811537199.6A Active CN109828903B (en) 2018-12-14 2018-12-14 Automatic testing method and device, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN109828903B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532169A (en) * 2019-07-08 2019-12-03 平安科技(深圳)有限公司 Interface testing case generation method, device, computer equipment and storage medium
CN110704304B (en) * 2019-09-06 2022-09-27 平安普惠企业管理有限公司 Application program testing method and device, storage medium and server
CN110764999A (en) * 2019-09-06 2020-02-07 深圳壹账通智能科技有限公司 Automatic testing method and device, computer device and storage medium
CN110716878B (en) * 2019-10-11 2023-09-26 赛诺贝斯(北京)营销技术股份有限公司 Automatic interface testing method, device and system
CN112711525B (en) * 2019-10-25 2023-12-26 中国移动通信集团浙江有限公司 Collaborative testing method and device for UI test and interface test and computing equipment
CN110851309B (en) * 2019-10-31 2024-03-19 广东安可云科技有限公司 Integrated verification system and method
CN110908909B (en) * 2019-11-21 2023-09-22 望海康信(北京)科技股份公司 Automatic test method, device, storage medium and equipment
CN113515439B (en) * 2020-04-10 2023-09-29 中国电信股份有限公司 Method and device for testing security of background interface data access
CN111581100B (en) * 2020-05-11 2023-05-30 北京首汽智行科技有限公司 Background management system testing method
CN112181412A (en) * 2020-09-27 2021-01-05 的卢技术有限公司 Ui element positioning method, system, electronic equipment and storage medium
CN112612695B (en) * 2020-12-17 2023-09-15 广东数远科技有限公司 RPA-based functional test environment verification method, device, equipment and medium
CN112597051A (en) * 2020-12-30 2021-04-02 北京华胜天成科技股份有限公司 Method and device for obtaining test result, electronic equipment and storage medium
CN112732576A (en) * 2021-01-08 2021-04-30 网易(杭州)网络有限公司 Automatic testing method, device and equipment based on user interface
CN113377671A (en) * 2021-06-29 2021-09-10 山东派盟网络科技有限公司 Group control method, device and equipment
CN114443477A (en) * 2022-01-14 2022-05-06 苏州浪潮智能科技有限公司 Password security configuration testing method, system, terminal and storage medium
CN115357501B (en) * 2022-08-24 2024-04-05 中国人民解放军32039部队 Automatic testing method and system for aerospace measurement and control software
CN117149820A (en) * 2023-09-25 2023-12-01 湖南长银五八消费金融股份有限公司 Borrowing operation detection method, device, equipment and storage medium
CN117171056B (en) * 2023-11-02 2024-01-09 绿城科技产业服务集团有限公司 Test method and device based on automatic interface

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101377759A (en) * 2008-08-26 2009-03-04 中国工商银行股份有限公司 Automatic interface test system
EP2386953A1 (en) * 2010-05-14 2011-11-16 Sap Ag Systems and methods for generating reusable test components out of remote application programming interface
CN107368420A (en) * 2017-07-27 2017-11-21 万帮充电设备有限公司 API method of testings, device and electronic equipment
CN108399119A (en) * 2017-02-06 2018-08-14 腾讯科技(深圳)有限公司 Browse serves kernel engine data processing, automatic test method and apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930262B (en) * 2016-03-02 2018-04-20 平安科技(深圳)有限公司 Application program user interface automated testing method and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101377759A (en) * 2008-08-26 2009-03-04 中国工商银行股份有限公司 Automatic interface test system
EP2386953A1 (en) * 2010-05-14 2011-11-16 Sap Ag Systems and methods for generating reusable test components out of remote application programming interface
CN108399119A (en) * 2017-02-06 2018-08-14 腾讯科技(深圳)有限公司 Browse serves kernel engine data processing, automatic test method and apparatus
CN107368420A (en) * 2017-07-27 2017-11-21 万帮充电设备有限公司 API method of testings, device and electronic equipment

Also Published As

Publication number Publication date
CN109828903A (en) 2019-05-31

Similar Documents

Publication Publication Date Title
CN109828903B (en) Automatic testing method and device, computer device and storage medium
CN108415832B (en) Interface automation test method, device, equipment and storage medium
US20130117855A1 (en) Apparatus for automatically inspecting security of applications and method thereof
CN107436844B (en) Method and device for generating interface use case aggregate
CN109828905B (en) Automatic test method, device, computer device and storage medium
CN107526676B (en) Cross-system test method and device
US20080172580A1 (en) Collecting and Reporting Code Coverage Data
CN110990274B (en) Data processing method, device and system for generating test cases
CN114328276B (en) Test case generation method and device, and test case display method and device
CN111897724A (en) Automatic testing method and device suitable for cloud platform
CN113268243B (en) Memory prediction method and device, storage medium and electronic equipment
CN113449310A (en) Application program vulnerability detection method, device and equipment
CN109783367B (en) Interface testing method, device, computer device and storage medium
CN114328250A (en) Automatic self-checking method, medium and device for software system
CN112286815A (en) Interface test script generation method and related equipment thereof
CN108021317B (en) Method and device for screen editing
CN112241362A (en) Test method, test device, server and storage medium
CN114238048A (en) Automatic testing method and system for Web front-end performance
CN111865726B (en) Service message testing method, device, computer system and storage medium
CN109324822B (en) PWA (public warning assistant) item detection method, computer-readable storage medium and terminal device
CN109062797B (en) Method and device for generating information
CN112380115A (en) Regression testing method and device, electronic equipment and storage medium
CN112433778A (en) Mobile equipment page display method and device, electronic equipment and storage medium
CN113298538B (en) Customer service data processing method and device
CN115314413B (en) CAN signal testing 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
GR01 Patent grant