CN111414309A - Automatic test method of application program, computer equipment and storage medium - Google Patents

Automatic test method of application program, computer equipment and storage medium Download PDF

Info

Publication number
CN111414309A
CN111414309A CN202010227941.4A CN202010227941A CN111414309A CN 111414309 A CN111414309 A CN 111414309A CN 202010227941 A CN202010227941 A CN 202010227941A CN 111414309 A CN111414309 A CN 111414309A
Authority
CN
China
Prior art keywords
tested
screen
application object
preset
main screen
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
CN202010227941.4A
Other languages
Chinese (zh)
Other versions
CN111414309B (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.)
Wuhan United Imaging Healthcare Co Ltd
Original Assignee
Wuhan United Imaging Healthcare Co 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 Wuhan United Imaging Healthcare Co Ltd filed Critical Wuhan United Imaging Healthcare Co Ltd
Priority to CN202010227941.4A priority Critical patent/CN111414309B/en
Publication of CN111414309A publication Critical patent/CN111414309A/en
Application granted granted Critical
Publication of CN111414309B publication Critical patent/CN111414309B/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
    • 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

A method, computer device and storage medium for automated testing of an application program, the method comprising: responding to a test starting instruction, and acquiring a test case corresponding to the application program; analyzing the test case, and identifying the operation to be tested corresponding to the test case and the target application object identification corresponding to the operation to be tested; when the target application object identifier represents a main screen, calling a first preset automatic testing method to simulate an operation to be tested on the main screen; when the target application object identifier represents the auxiliary screen, calling a second preset automatic testing method to simulate the operation to be tested in the auxiliary screen; and acquiring an execution result of simulating the execution of the operation to be tested, and generating a test result of the application program based on the execution result, wherein the main screen and the auxiliary screen are associated with each other. The method calls different automatic testing methods for the main screen and the auxiliary screen respectively to realize the simulation of user operation, the simulation operations in the two screens are not affected mutually, and the automatic testing of the application programs on the multiple screens can be realized.

Description

Automatic test method of application program, computer equipment and storage medium
Technical Field
The present application relates to the field of internet technologies, and in particular, to an automated testing method for an application program, a computer device, and a storage medium.
Background
The automated testing generally refers to the automation of software testing, in which a system or an application program is run under a preset condition, and a running result is evaluated, and the preset condition includes a normal condition and an abnormal condition.
For a client accessing an application in a browser mode, there are currently existing UI (User Interface) automated tests, and there are test methods such as selenium. Although the existing automatic test method can realize automatic test on software, the test method is usually used for testing a single screen, and the existing automatic test method cannot complete automatic test on a use scene involving a plurality of screens and having main and auxiliary screens not under the same iframe.
Disclosure of Invention
Therefore, it is necessary to provide an automated testing method, a computer device, and a storage medium for an application program applicable to multiple screens, in order to solve the above technical problem that the automated testing of multiple screen scenes cannot be completed.
A method for automated testing of an application, the method comprising:
responding to a test starting instruction, and acquiring a test case corresponding to the application program;
analyzing the test case, and identifying the operation to be tested corresponding to the test case and the target application object identification corresponding to the operation to be tested;
when the target application object identifier represents a main screen, calling a first preset automatic testing method to simulate the operation to be tested on the main screen;
when the target application object identifier represents an auxiliary screen, calling a second preset automatic testing method to simulate the operation to be tested in the auxiliary screen;
and acquiring an execution result of simulating the execution of the operation to be tested, and generating a test result of the application program based on the execution result, wherein the main screen and the auxiliary screen are associated with each other.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the above method when executing the computer program.
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 above-mentioned method.
When a test starting instruction is detected, acquiring a preset test case corresponding to the application program, determining to-be-tested operation and a corresponding target application object identifier according to the analytic test case, calling a first preset automatic test method to simulate the to-be-tested operation in the main screen when the target application object identifier represents the main screen, and calling a second preset automatic test method to simulate the to-be-tested operation in the auxiliary screen when the target application object represents the auxiliary screen; and after the execution result simulating the operation to be tested is obtained, generating a test result of the application program based on the execution result. In the method, different automatic testing methods are respectively called for the operation of the main screen and the auxiliary screen to realize the simulation of user operation in the main screen and the auxiliary screen in the automatic test of the application programs applied to the multiple screens, the execution result of the simulation of the user operation is obtained, the test result of the application programs is generated according to the execution result, the simulation operations in the two screens are not influenced by each other, and therefore the automatic test of the application programs on the multiple screens can be realized.
Drawings
FIG. 1 is a diagram of an application environment for a method for automated testing of an application in one embodiment;
FIG. 2 is a flow diagram that illustrates a methodology for automated testing of applications in one embodiment;
FIG. 3 is a flowchart illustrating simulation of an operation to be tested in a home screen by calling a default home screen simulation function of a selenium when the operation to be tested is an operation in the home screen in one embodiment;
FIG. 4 is a flowchart illustrating an embodiment of invoking a predefined home screen simulation operation program of a selenium to simulate an operation to be tested in a browser page corresponding to a test case in a home screen;
FIG. 5 is a flowchart illustrating a method for automated testing of an application in accordance with an exemplary embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The automatic testing method of the application program provided by the application program can be applied to the application environment shown in fig. 1 in some embodiments. In this embodiment, a plurality of terminals (a plurality of screens) are referred to, and the terminal 110 and the terminal 120 are represented, and both the terminal 110 and the terminal 120 communicate with the server 130 through a network. In some embodiments, the server 130, when detecting the test start instruction, obtains a preset test case corresponding to the application program, determines an operation to be tested and a corresponding target application object identifier according to the parsed test case, calls a first preset automatic test method to simulate the operation to be tested in the main screen when the target application object identifier represents the main screen, and calls a second preset automatic test method to simulate the operation to be tested in the auxiliary screen when the target application object represents the auxiliary screen; after an execution result simulating the operation to be tested is obtained, a test result of the application program is generated based on the execution result; wherein, the main screen and the sub screen correspond to the terminal 110 and the terminal 120, respectively; in other embodiments, there may be more than one primary screen and secondary screen. The terminals 110 and 120 may be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 130 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, an automated testing method for an application program is provided, which is described by taking the method as an example for being applied to the server in fig. 1, and includes steps S210 to S250.
Step S210, responding to the test start instruction, and obtaining a test case corresponding to the application program.
The test starting instruction is used for indicating to start the automatic test, and an application program needing to be automatically tested is specified in the test starting instruction, and specifically, the test starting instruction can carry an application program identifier; in one embodiment, the test starting instruction further specifies an identifier of a preset use case; in one embodiment, the test initiation instructions are instructions initiated by a tester.
The Test Case (Test Case) refers to the description of a Test task for a specific application program, and embodies Test schemes, methods, techniques and strategies. The contents of the test object, the test environment, the input data, the test steps, the expected results, the test scripts and the like are included, and finally, a document is formed. It is simply considered that a test case is a set of test inputs, execution conditions, and expected results tailored for a particular purpose to verify whether a particular application's requirements are met. In one embodiment, the test cases set the test steps and sequence to be executed.
In one embodiment, when a test starting instruction is detected, a corresponding test case is obtained according to the test starting instruction; in another embodiment, the test case is preset, and when the test start instruction is detected, the test case corresponding to the application program is acquired.
In one embodiment, the application may be an application for remote diagnosis, which may display a diagnosis report in a main screen and view an image in a sub-screen, and which involves a plurality of screen switching operations during use; meanwhile, applications are accessed in a browser-based form in the home screen.
Step S220, analyzing the test case, and identifying the operation to be tested corresponding to the test case and the target application object identification corresponding to the operation to be tested.
One test case may include one or more operations; analyzing the test case to obtain the next operation to be executed in the test case, which is recorded as the operation to be tested in this embodiment; in one embodiment, the operation to be tested may be, for example, a double-click check list. In this embodiment, the application object refers to a control that is set in an interface when an application program runs, and an application object identifier corresponding to an operation to be tested represents a unique identifier of the control (application object) corresponding to the operation to be tested, which is denoted as an identifier of a target application object in this embodiment; taking the operation to be tested as a double-click check list as an example, the target application object identifier corresponding to the operation to be tested represents the control corresponding to the check list.
In step S230, when the target application object identifier represents the main screen, a first preset automated testing method is invoked to simulate an operation to be tested on the main screen.
The automatic testing method for the application program in the embodiment is applied to the application program of the multi-screen, so that the operation corresponding to the operation to be tested of the test case needs to be determined; in the embodiment, the screen where the operation to be tested is located is determined according to the target application object identification, so that the operation to be tested needs to be simulated at a position in the screen.
When the position where the operation to be tested is located is identified as a main screen according to the target application object, simulating the operation to be tested in the main screen by calling a first preset automatic testing method; in one embodiment, the first preset automatic test method can be set according to actual conditions and is used for realizing automatic test of the application program in the main screen. In one embodiment, for an application scenario where the application is accessed through a browser in the home screen, the operation to be tested can be simulated in the home screen by the method in selenium.
Step S240, when the target application object identifier represents the auxiliary screen, calling a second preset automatic test method to simulate the operation to be tested in the auxiliary screen.
When the position of the operation to be tested is identified as the auxiliary screen according to the target application object, simulating the operation to be tested in the auxiliary screen by calling a second preset automatic testing method; in one embodiment, the second preset automatic test method can be set according to actual conditions and is used for realizing automatic test of the application program in the secondary screen. In one embodiment, the operation to be tested is simulated by calling the file obtained by the AutoIt recording.
Furthermore, after the second preset automatic test method is called to simulate the operation to be tested in the secondary screen, a third preset automatic test method can be obtained according to the first preset automatic test method and the second preset automatic test method, and the third preset automatic test method is called to simulate the operation to be tested in the main screen.
In one embodiment, the first preset automatic test method is a selenium test method, the second preset automatic test method is an AutoIt recording test, and the third preset automatic test method is an automatic test method including the selenium test method and the AutoIt recording test.
And step S250, when all steps to be tested in the test case are simulated, obtaining an execution result of simulating the execution of the operation to be tested, and generating a test result of the application program based on the execution result, wherein the main screen and the auxiliary screen are associated with each other.
After simulating the operation to be tested in the main screen or the sub-screen, acquiring a response result of the application program, which is recorded as an execution result of the operation to be tested in this embodiment; for example, in one embodiment, the operation to be tested is a double-click check list, and after the double-click check list is simulated in the main screen, the corresponding image will be automatically opened in the auxiliary screen according to the logic of the application program; therefore, after simulating the double-click check list in the main screen, if the execution result is that the corresponding image is detected to be automatically opened in the auxiliary screen, the application program is normal; after simulating the double-click check list in the main screen, if the corresponding image is not detected in the sub-screen as a result of the execution, it indicates that an abnormality may occur in the application program.
In one embodiment, when the test case includes multiple steps, after simulating one operation to be tested, returning to the step of identifying the step to be executed and the target application object identifier corresponding to the step to be executed, sequentially executing all the steps to be executed in the test case, and obtaining the execution result of the steps to be executed.
Further, determining a test result of the application program according to an execution result of the simulated operation to be tested; in one embodiment, one test case comprises a plurality of operations to be tested, and after one operation to be tested is simulated, the step of analyzing the test case to identify the operation to be tested corresponding to the test case and the target application object identifier corresponding to the operation to be tested is returned; and after all the steps to be executed are completed, acquiring the execution result of each step to be executed, and determining the test result of the application program according to the execution result of each step to be executed.
In one embodiment, the test results of the application include: the method comprises the steps of identifying a mark corresponding to a test case, an internet protocol address corresponding to the test case, the execution time of the test case and the execution result of an operation to be tested.
According to the automatic testing method of the application program, when a test starting instruction is detected, a preset test case corresponding to the application program is obtained, an operation to be tested and a corresponding target application object identifier are determined according to the analysis test case, when the target application object identifier represents a main screen, a first preset automatic testing method is called to simulate the operation to be tested in the main screen, and when the target application object represents an auxiliary screen, a second preset automatic testing method is called to simulate the operation to be tested in an auxiliary screen; and after the execution result simulating the operation to be tested is obtained, generating a test result of the application program based on the execution result. In the method, different automatic testing methods are respectively called for the operation of the main screen and the auxiliary screen to realize the simulation of user operation in the main screen and the auxiliary screen in the automatic test of the application programs applied to the multiple screens, the execution result of the simulation of the user operation is obtained, the test result of the application programs is generated according to the execution result, the simulation operations in the two screens are not influenced by each other, and therefore the automatic test of the application programs on the multiple screens can be realized.
Further, in one embodiment, when the target application object identifier characterizes the home screen, invoking the first preset automated testing method to simulate the operation to be tested on the home screen comprises: and when the target application object identifier represents the main screen, calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the main screen.
Wherein, the selenium is a tool for testing the Web application program; the Selenium test runs directly in the browser, just as a real user is operating; the main functions of this tool from Selenium include: testing compatibility with browsers: it is tested whether the application can work compatibly on different browsers and operating systems. The test system functions include creating regression test verification application functions and user requirements; test scripts of different languages such as Net, Java, Perl and the like are supported to automatically record actions and automatically generate; in one embodiment, the Selenium implements the locating operation on the elements in the page through the Selenium webdriver.
When the representation is represented in the main screen according to the target application object identifier, the representation needs to simulate the operation to be tested in the main screen, and a preset main screen simulation operation program is called to simulate the corresponding operation to be tested in the main screen.
Further, in one embodiment, as shown in fig. 3, when the operation to be tested is an operation in the home screen, simulating the operation to be tested in the home screen by calling the preset home screen simulation operation program of selenium includes steps S310 to S330.
Step S310, when the target application object identification represents the main screen, a browser starting event in the main screen is intercepted.
In one embodiment, the browser launching event in the home screen corresponds to an operation of launching a browser in the home screen, indicating that the browser in the home screen has been launched when the operation of launching the browser in the home screen is intercepted, and indicating that the browser in the home screen has not been launched if the operation of launching the browser in the home screen is not intercepted. In another embodiment, the browser launching event corresponds to detecting that there is an opened browser interface in the main screen, indicating that the browser launching event of the main screen is intercepted when detecting that there is an opened browser interface in the main screen, and indicating that the browser launching event is not intercepted when detecting that there is no opened browser interface in the main screen. In other embodiments, the browser launch event in the home screen is set to other events as well.
Step S320, when the browser starting event is not monitored, calling a selenium webdriver to start the browser of the main screen to obtain the browser page corresponding to the test case.
When the browser starting event is not intercepted in the main screen, the browser is not started in the current main screen, so that the browser needs to be started in the main screen firstly, specifically, the browser in the main screen can be started by calling a selenium webdriver program in the selenium, and a browser interface to be tested corresponding to the test case of the application program is obtained.
The Selenium Webdriver (also called Selenium2, Selenium3) and Selenium RC (Selenium 1) provide various language call interface libraries for web automation of web pages; specifically, the SeleniumWebdriver drives the browser by driving of various browsers (web driver).
Step S330, calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the browser page corresponding to the test case in the main screen.
After a browser of a main screen is started and a browser interface corresponding to a test case is obtained, simulating operation to be tested in the main screen according to preset main screen simulation operation corresponding to the step to be tested; wherein the default home screen simulation operation is a program in the selenium.
In one embodiment, as shown in fig. 4, invoking the preset home screen simulation operation program of selenium to simulate the operation to be tested in the browser page corresponding to the test case in the home screen includes steps S410 and S420.
Step S410, positioning the position of the target application object corresponding to the target application object identifier in the browser page corresponding to the test case in the home screen.
And obtaining the target application object identifier according to the test case, after the browser is started in the home screen to open the browser page corresponding to the test case, positioning the position of the target application object corresponding to the target application object identifier in the browser page, and recording the position as the position of the target application object.
In one embodiment, positioning the target application object in the browser page corresponding to the test case in the home screen to identify the position of the corresponding target application object comprises: calling an element identification obtaining method in the selenium to obtain the corresponding relation between the application object identification and the application object position in the browser page corresponding to the test case in the main screen; and searching the position of the target application object corresponding to the target application object identifier according to the corresponding relation between the application object identifier and the application object position in the browser page corresponding to the test case in the main screen.
After a browser of a home screen is started and a browser interface corresponding to a test case is obtained, a serial number, a name and the like of each application object in the browser interface can be obtained by calling a related method, in this embodiment, the serial number and the name of the application object in a browser page are marked as application object identifiers, and further, the positions of each application object in the browser page are obtained, and the corresponding relation between each application program object identifier and each position is obtained; and searching the position of a target application object corresponding to the target application object identifier in the browser page according to the corresponding relation between the application program object identifiers and the positions of the browser page.
In a specific embodiment, the method for acquiring the Element (application object) identifier may specifically be an Element serial number acquisition method (get Element Id) or an Element Name acquisition method (get Element Name).
Step S420, based on the position of the target application object, calling a preset main screen simulation operation program corresponding to the operation to be tested in the selenium, and simulating the operation to be tested.
And calling a preset main screen simulation operation program corresponding to the operation to be tested in the selenium to execute at the position of the target application object, so as to finish the step of simulating the operation to be tested.
In one embodiment, the operation to be tested includes performing input, click operation, and the like on an element, and in a specific embodiment, the input and click operation of the application object (element) can be realized by using an element input method (element. send _ keys), an element click method (element. click), and the like.
In another embodiment, when the target application object identifier represents the secondary screen, invoking a second preset automated testing method to simulate an operation to be tested in the secondary screen comprises: when the target application object identifier represents the auxiliary screen, calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested to simulate the operation to be tested in the auxiliary screen; the preset auxiliary screen simulation operation file is generated by recording user operation corresponding to the operation to be tested on the auxiliary screen through AutoIt.
Among them, AutoIt is used in Windows GUI (graphical user interface) for automation. It uses the combination of simulating keyboard key, mouse movement and window/control to realize the automation task; common functions of AutoIt include: running Windows and Dos programs, simulating keystroke actions (supporting most keyboard layouts), simulating mouse movements and click actions, moving Windows, resizing and other operations, interacting directly with the "controls" of Windows (setting/retrieving text, moving, closing, etc.), matching clipboards to cut/paste text operations, operating registries, etc.; in one embodiment, AutoIt locates elements in a page by capturing the coordinates of the screen.
In this embodiment, it is described that when the target application object indicates that an operation to be tested needs to be executed on the secondary screen, a preset secondary screen simulation operation file is called to simulate the operation to be tested in the secondary screen. In one embodiment, the second preset automated testing method uses a simulation operation file recorded by calling the AutoIt. In one embodiment, the preset auxiliary screen simulation operation file needing to be called is determined according to the step to be tested.
In one embodiment, the preset sub-screen simulation operation file is an exe file recorded by AutoIt, and when the preset sub-screen simulation operation file is called, the preset sub-screen simulation operation file corresponding to the operation to be tested is called to be played.
Furthermore, the simulation operation file recorded by the AutoIt carries the coordinate position of the screen corresponding to the simulated operation, the position of the simulated operation of the simulation operation file in the screen is positioned by capturing the coordinate in the screen, and the effect of simulating the operation to be tested in the screen by replaying the corresponding simulation operation file is achieved.
According to the method, the operation to be tested is simulated in the main screen and the auxiliary screen, after the execution result is obtained, if other steps to be tested are included in the test case, the next step to be tested is determined, the position (the main screen or the auxiliary screen) corresponding to the next step to be tested is determined, the next step to be tested is further simulated in the screen, and switching between the main screen and the auxiliary screen can be achieved.
In an embodiment, as shown in fig. 5, the method for automatically testing the application program includes the following steps:
various operation steps are recorded in the auxiliary screen by utilizing AutoIt in advance, and an exe executable file is generated.
When a test starting instruction is detected, obtaining a test case corresponding to an application program; and analyzing the test case to obtain a step to be tested.
When the browser starting event is not monitored in the main screen, the browser driver is started by the main screen sender; and manual operation can be simulated through the browser driver, and each element in the browser interface is positioned.
When the operation to be tested is determined to be 'double-click on a main screen check list' according to the test case, positioning a position corresponding to a 'check list' control in a browser page, calling a preset simulation operation program (such as clicking), and simulating double-click operation at the position of the positioned 'check list' control; whether a corresponding check list image is opened on the auxiliary screen or not is detected, and the execution result of the operation to be tested of the 'double-click check list on the main screen' is obtained.
And returning to the step of obtaining the operation to be tested, judging the main screen and the auxiliary screen of the obtained operation to be tested, calling an exe file generated by the Autoit corresponding to the operation X to perform operation playback when the operation to be tested is determined to be 'operation X is executed on the auxiliary screen' according to the test case, and correspondingly simulating the operation to be tested in the auxiliary screen.
Returning to the step of determining the operation to be tested, sequentially determining whether each step in the test case corresponds to a main screen or an auxiliary screen, calling a corresponding simulation program to simulate the operation to be tested on the main screen through a browser driver when the operation is on the main screen, and calling a corresponding exe file to play back in the auxiliary screen when the operation corresponds to the auxiliary screen; simulating the operation to be tested and then obtaining an execution result of the operation to be tested; and if the operation to be tested of the secondary screen is finished, returning to the main screen, and directly operating the driver again. And when all the steps in the test case are executed, generating an automatic test result of the application program according to the execution result of each step.
In the method, simulation operation of recording the EXE script by calling the AutoIt in the secondary screen does not influence realization of simulation operation by the browser driver in the main screen, so that the main screen and the secondary screen can be switched at will in automatic test of the application program, and automatic test of the application program related to multiple screens is realized.
It should be understood that although the various steps in the flow charts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, an apparatus for automated testing of an application is provided, comprising: obtain module, analysis module, main screen operation simulation module, vice screen operation simulation module and test result generation module, wherein:
the acquisition module is used for responding to the test starting instruction and acquiring a test case corresponding to the application program;
the analysis module is used for analyzing the test case and identifying the operation to be tested corresponding to the test case and the target application object identification corresponding to the operation to be tested;
the main screen operation simulation module is used for calling a first preset automatic test method to simulate the operation to be tested on the main screen when the target application object identifier represents the main screen;
the auxiliary screen operation simulation module is used for calling a second preset automatic test method to simulate the operation to be tested in the auxiliary screen when the target application object identifier represents the auxiliary screen;
and the test result generation module is used for acquiring an execution result of simulating the execution of the operation to be tested and generating a test result of the application program based on the execution result, wherein the main screen and the auxiliary screen are associated with each other.
When a test starting instruction is detected, acquiring a preset test case corresponding to the application program, determining to-be-tested operation and a corresponding target application object identifier according to the analytic test case, calling a first preset automatic test method to simulate the to-be-tested operation in the main screen when the target application object identifier represents the main screen, and calling a second preset automatic test method to simulate the to-be-tested operation in the auxiliary screen when the target application object represents the auxiliary screen; and after the execution result simulating the operation to be tested is obtained, generating a test result of the application program based on the execution result. In the method, different automatic testing methods are respectively called for the operation of the main screen and the auxiliary screen to realize the simulation of user operation in the main screen and the auxiliary screen in the automatic test of the application programs applied to the multiple screens, the execution result of the simulation of the user operation is obtained, the test result of the application programs is generated according to the execution result, the simulation operations in the two screens are not influenced by each other, and therefore the automatic test of the application programs on the multiple screens can be realized.
For the specific definition of the automated testing device for the application program, reference may be made to the above definition of the automated testing method for the application program, and details are not described herein again. The modules in the automatic testing device of the application program can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data such as test cases. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method for automated testing of an application.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
responding to a test starting instruction, and acquiring a test case corresponding to the application program;
analyzing the test case, and identifying the operation to be tested corresponding to the test case and the target application object identification corresponding to the operation to be tested;
when the target application object identifier represents a main screen, calling a first preset automatic testing method to simulate an operation to be tested on the main screen;
when the target application object identifier represents the auxiliary screen, calling a second preset automatic testing method to simulate the operation to be tested in the auxiliary screen;
and when all steps to be tested in the test case are simulated, obtaining an execution result of simulating the execution of the operation to be tested, and generating a test result of the application program based on the execution result, wherein the main screen and the auxiliary screen are associated with each other.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the target application object identifier represents a main screen, calling a first preset automatic testing method to simulate an operation to be tested on the main screen comprises the following steps:
and when the target application object identifier represents the main screen, calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the main screen.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the operation to be tested is the operation in the main screen, simulating the operation to be tested in the main screen by calling a preset main screen simulation operation program of the selenium comprises the following steps:
intercepting a browser starting event in a main screen when the target application object identifier represents the main screen;
when the browser starting event is not monitored, calling a selenium webdriver to start the browser of the main screen to obtain a browser page corresponding to the test case;
and calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the browser page corresponding to the test case in the main screen.
In one embodiment, the processor, when executing the computer program, further performs the steps of: calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in a browser page corresponding to the test case in the main screen, wherein the simulation operation comprises the following steps:
positioning the position of a target application object corresponding to the target application object identifier in a browser page corresponding to the test case in the main screen;
and calling a preset main screen simulation operation program corresponding to the operation to be tested in the selenium based on the position of the target application object, and simulating the operation to be tested.
In one embodiment, the processor, when executing the computer program, further performs the steps of: the positioning of the position of the target application object corresponding to the target application object identification in the browser page corresponding to the test case in the main screen comprises the following steps:
calling an element identification obtaining method in the selenium to obtain the corresponding relation between the application object identification and the application object position in the browser page corresponding to the test case in the main screen;
and searching the position of the target application object corresponding to the target application object identifier according to the corresponding relation between the application object identifier and the application object position in the browser page corresponding to the test case in the main screen.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the target application object identifier represents the auxiliary screen, calling a second preset automatic testing method to simulate the operation to be tested in the auxiliary screen comprises the following steps:
when the target application object identifier represents the auxiliary screen, calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested to simulate the operation to be tested in the auxiliary screen; the preset auxiliary screen simulation operation file is generated by recording user operation corresponding to the operation to be tested on the auxiliary screen through AutoIt.
In one embodiment, the processor, when executing the computer program, further performs the steps of: calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested to simulate the operation to be tested in the auxiliary screen, wherein the step of calling the preset auxiliary screen simulation operation file corresponding to the operation to be tested comprises the following steps:
and calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested for playing.
In one embodiment, the processor, when executing the computer program, further performs the steps of: the test results of the application include: the method comprises the steps of identifying a mark corresponding to a test case, an internet protocol address corresponding to the test case, the execution time of the test case and the execution result of an operation to be tested.
In another embodiment, the present application further provides a computer readable storage medium having a computer program stored thereon, the computer program when executed by a processor implementing the steps of:
responding to a test starting instruction, and acquiring a test case corresponding to the application program;
analyzing the test case, and identifying the operation to be tested corresponding to the test case and the target application object identification corresponding to the operation to be tested;
when the target application object identifier represents a main screen, calling a first preset automatic testing method to simulate an operation to be tested on the main screen;
when the target application object identifier represents the auxiliary screen, calling a second preset automatic testing method to simulate the operation to be tested in the auxiliary screen;
and when all steps to be tested in the test case are simulated, obtaining an execution result of simulating the execution of the operation to be tested, and generating a test result of the application program based on the execution result, wherein the main screen and the auxiliary screen are associated with each other.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the target application object identifier represents a main screen, calling a first preset automatic testing method to simulate an operation to be tested on the main screen comprises the following steps:
and when the target application object identifier represents the main screen, calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the main screen.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the operation to be tested is the operation in the main screen, simulating the operation to be tested in the main screen by calling a preset main screen simulation operation program of the selenium comprises the following steps:
intercepting a browser starting event in a main screen when the target application object identifier represents the main screen;
when the browser starting event is not monitored, calling a selenium webdriver to start the browser of the main screen to obtain a browser page corresponding to the test case;
and calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the browser page corresponding to the test case in the main screen.
In one embodiment, the computer program when executed by the processor further performs the steps of: calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in a browser page corresponding to the test case in the main screen, wherein the simulation operation comprises the following steps:
positioning the position of a target application object corresponding to the target application object identifier in a browser page corresponding to the test case in the main screen;
and calling a preset main screen simulation operation program corresponding to the operation to be tested in the selenium based on the position of the target application object, and simulating the operation to be tested.
In one embodiment, the computer program when executed by the processor further performs the steps of: the positioning of the position of the target application object corresponding to the target application object identification in the browser page corresponding to the test case in the main screen comprises the following steps:
calling an element identification obtaining method in the selenium to obtain the corresponding relation between the application object identification and the application object position in the browser page corresponding to the test case in the main screen;
and searching the position of the target application object corresponding to the target application object identifier according to the corresponding relation between the application object identifier and the application object position in the browser page corresponding to the test case in the main screen.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the target application object identifier represents the auxiliary screen, calling a second preset automatic testing method to simulate the operation to be tested in the auxiliary screen comprises the following steps:
when the target application object identifier represents the auxiliary screen, calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested to simulate the operation to be tested in the auxiliary screen; the preset auxiliary screen simulation operation file is generated by recording user operation corresponding to the operation to be tested on the auxiliary screen through AutoIt.
In one embodiment, the computer program when executed by the processor further performs the steps of: calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested to simulate the operation to be tested in the auxiliary screen, wherein the step of calling the preset auxiliary screen simulation operation file corresponding to the operation to be tested comprises the following steps:
and calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested for playing.
In one embodiment, the computer program when executed by the processor further performs the steps of: the test results of the application include: the method comprises the steps of identifying a mark corresponding to a test case, an internet protocol address corresponding to the test case, the execution time of the test case and the execution result of an operation to be tested.
It will be understood by those of ordinary skill in the art that all or a portion of the processes of the methods of the embodiments described above may be implemented by a computer program that may be stored on a non-volatile computer-readable storage medium, which when executed, may include the processes of the embodiments of the methods described above, wherein any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for automated testing of an application, the method comprising:
responding to a test starting instruction, and acquiring a test case corresponding to the application program;
analyzing the test case, and identifying the operation to be tested corresponding to the test case and the target application object identification corresponding to the operation to be tested;
when the target application object identifier represents a main screen, calling a first preset automatic testing method to simulate the operation to be tested on the main screen;
when the target application object identifier represents an auxiliary screen, calling a second preset automatic testing method to simulate the operation to be tested in the auxiliary screen;
and when all the steps to be tested in the test case are simulated, obtaining an execution result of simulating the operation to be tested, and generating a test result of the application program based on the execution result, wherein the main screen and the auxiliary screen are associated with each other.
2. The method of claim 1, wherein invoking a first preset automated testing method to simulate the operation to be tested on the home screen when the target application object identification characterizes the home screen comprises:
and calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the main screen when the target application object identifier represents the main screen.
3. The method of claim 2, wherein invoking a preset home screen simulation function of selenium to simulate the operation to be tested in the home screen when the target application object identification characterizes a home screen comprises:
when the target application object identification represents a main screen, intercepting a browser starting event in the main screen;
when the browser starting event is not monitored, calling a selenium webdriver to start the browser of the main screen to obtain a browser page corresponding to the test case;
and calling a preset main screen simulation operation program of the selenium to simulate the operation to be tested in the browser page corresponding to the test case in the main screen.
4. The method of claim 3, wherein the invoking of the preset home screen simulation operation program of the selenium simulates the operation to be tested in the browser page corresponding to the test case in the home screen comprises:
positioning the position of a target application object corresponding to the target application object identification in a browser page corresponding to the test case in the main screen;
and calling a preset main screen simulation operation program corresponding to the operation to be tested in the selenium based on the position of the target application object, and simulating the operation to be tested.
5. The method of claim 4, wherein locating the position of the target application object in the browser page corresponding to the test case in the home screen that identifies the corresponding target application object comprises:
calling an element identification obtaining method in the selenium to obtain the corresponding relation between the application object identification and the application object position in the browser page corresponding to the test case in the main screen;
and searching the position of the target application object corresponding to the target application object identifier according to the corresponding relation between the application object identifier and the application object position in the browser page corresponding to the test case in the main screen.
6. The method of claim 1, wherein when the target application object identifier characterizes a secondary screen, invoking a second preset automated testing method to simulate the operation to be tested in the secondary screen comprises:
when the target application object identifier represents an auxiliary screen, calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested to simulate the operation to be tested in the auxiliary screen; the preset auxiliary screen simulation operation file is generated by recording user operation corresponding to the operation to be tested on the auxiliary screen through AutoIt.
7. The method of claim 6, wherein the calling a preset sub-screen simulation operation file corresponding to the operation to be tested to simulate the operation to be tested in the sub-screen comprises:
and calling a preset auxiliary screen simulation operation file corresponding to the operation to be tested for playing.
8. The method of any one of claims 1 to 7, wherein when the target application object identifier represents a secondary screen, after invoking a second preset automated testing method to simulate the operation to be tested in the secondary screen, further comprising:
calling a third preset automatic testing method to simulate the operation to be tested in the main screen;
the third preset automatic test method is obtained according to the first preset automatic test method and the second preset automatic test method.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 8.
10. 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 method of any one of claims 1 to 8.
CN202010227941.4A 2020-03-27 2020-03-27 Automatic test method of application program, computer equipment and storage medium Active CN111414309B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010227941.4A CN111414309B (en) 2020-03-27 2020-03-27 Automatic test method of application program, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010227941.4A CN111414309B (en) 2020-03-27 2020-03-27 Automatic test method of application program, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111414309A true CN111414309A (en) 2020-07-14
CN111414309B CN111414309B (en) 2022-03-01

Family

ID=71491487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010227941.4A Active CN111414309B (en) 2020-03-27 2020-03-27 Automatic test method of application program, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111414309B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113688043A (en) * 2021-08-25 2021-11-23 北京三快在线科技有限公司 Application program testing method, device, server, iOS device and medium
WO2023225801A1 (en) * 2022-05-23 2023-11-30 北京小米移动软件有限公司 Automated testing method and apparatus for application

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101557437A (en) * 2009-05-12 2009-10-14 厦门敏讯信息技术股份有限公司 Automatic testing method of mobile phone software and device thereof
CN101729160A (en) * 2008-10-30 2010-06-09 中兴通讯股份有限公司 Method for generating test information for automatic test system of mobile phone software
CN103729158A (en) * 2012-10-10 2014-04-16 三星电子株式会社 Multi-display apparatus and method of controlling display thereof
CN104809057A (en) * 2014-01-29 2015-07-29 株式会社Sji Application test system, application test method and storage medium
US20150347284A1 (en) * 2014-05-27 2015-12-03 International Business Machines Corporation Screenshot validation testing
CN105453033A (en) * 2013-05-02 2016-03-30 亚马逊技术股份有限公司 Program testing service
CN106095226A (en) * 2016-06-01 2016-11-09 广州三星通信技术研究有限公司 The method and apparatus of application program is run in electric terminal
CN107193735A (en) * 2017-05-17 2017-09-22 武汉联影医疗科技有限公司 Method for testing software and system
CN107220170A (en) * 2016-03-22 2017-09-29 阿里巴巴集团控股有限公司 A kind of method of testing, device and electronic equipment
US20190079856A1 (en) * 2014-04-08 2019-03-14 Turnkey Solutions Corp. Software test automation system and method

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101729160A (en) * 2008-10-30 2010-06-09 中兴通讯股份有限公司 Method for generating test information for automatic test system of mobile phone software
CN101557437A (en) * 2009-05-12 2009-10-14 厦门敏讯信息技术股份有限公司 Automatic testing method of mobile phone software and device thereof
CN103729158A (en) * 2012-10-10 2014-04-16 三星电子株式会社 Multi-display apparatus and method of controlling display thereof
CN105453033A (en) * 2013-05-02 2016-03-30 亚马逊技术股份有限公司 Program testing service
CN104809057A (en) * 2014-01-29 2015-07-29 株式会社Sji Application test system, application test method and storage medium
US20190079856A1 (en) * 2014-04-08 2019-03-14 Turnkey Solutions Corp. Software test automation system and method
US20150347284A1 (en) * 2014-05-27 2015-12-03 International Business Machines Corporation Screenshot validation testing
CN107220170A (en) * 2016-03-22 2017-09-29 阿里巴巴集团控股有限公司 A kind of method of testing, device and electronic equipment
CN106095226A (en) * 2016-06-01 2016-11-09 广州三星通信技术研究有限公司 The method and apparatus of application program is run in electric terminal
CN107193735A (en) * 2017-05-17 2017-09-22 武汉联影医疗科技有限公司 Method for testing software and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ARNAB ROY CHOWDHURY: "How To Test A Multiscreen Behaviour Of An Application", 《HTTPS://WWW.LAMBDATEST.COM/BLOG/HOW-TO-TEST-A-MULTISCREEN-BEHAVIOUR-OF-AN-APPLICATION/》 *
知平软件: "Android自动化测试在多种屏幕下的注意事项", 《HTTPS://WWW.CNBLOGS.COM/VOWEI/ARCHIVE/2012/10/03/2710824.HTML》 *
郝雪琪: "基于Android的播控终端系统的设计与实现", 《中国优秀硕士学位论文全文数据库 (信息科技辑)》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113688043A (en) * 2021-08-25 2021-11-23 北京三快在线科技有限公司 Application program testing method, device, server, iOS device and medium
WO2023225801A1 (en) * 2022-05-23 2023-11-30 北京小米移动软件有限公司 Automated testing method and apparatus for application

Also Published As

Publication number Publication date
CN111414309B (en) 2022-03-01

Similar Documents

Publication Publication Date Title
CN106844217B (en) Method and device for embedding point of applied control and readable storage medium
US9342237B2 (en) Automated testing of gesture-based applications
CN111061526B (en) Automatic test method, device, computer equipment and storage medium
US20190227917A1 (en) Adaptive system for mobile device testing
CN111124919A (en) User interface testing method, device, equipment and storage medium
US11237948B2 (en) Rendering engine component abstraction system
CN110032519A (en) Cloud function adjustment method, device, computer equipment and storage medium
CN110610089B (en) User behavior simulation method and device and computer equipment
CN106126424A (en) A kind of visual automated testing method of script, device and mobile terminal
RU2611961C2 (en) Method and system of regression testing of web page functionality, machine-readable data storage media
CN111414309B (en) Automatic test method of application program, computer equipment and storage medium
CN104899132A (en) Application software test method, apparatus and system
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN116166525A (en) Method and device for generating test script
CN107102937B (en) User interface testing method and device
CN110232018A (en) Interface test method, device, computer equipment
CN108984380A (en) A kind of server test method, device and medium based on linux system
CN116719736A (en) Test case generation method and device for testing software interface
US20220147437A1 (en) Automated testing of mobile devices using visual analysis
CN113986768A (en) Application stability testing method, device, equipment and medium
RU2729210C1 (en) Electronic devices software testing system
CN110806981B (en) Application program testing method, device, equipment and storage medium
US10545858B2 (en) Method for testing a graphical interface and corresponding test system
CN113342629A (en) Operation track restoration method and device, computer equipment and storage medium
CN115982018B (en) UI test method, system, computer device and storage medium based on OCR

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
CP02 Change in the address of a patent holder

Address after: 430206 Lianying medical headquarters base, No. 99, gaokeyuan Road, Donghu high tech Development Zone, Wuhan, Hubei Province

Patentee after: WUHAN UNITED IMAGING HEALTHCARE Co.,Ltd.

Address before: No. 818, Gaoxin Avenue, Donghu high tech Development Zone, Wuhan, Hubei 430206

Patentee before: WUHAN UNITED IMAGING HEALTHCARE Co.,Ltd.

CP02 Change in the address of a patent holder