Program testing method, device and equipment, medium and product
The program testing method simplifies the testing process by recording user interactions to generate test scripts, addressing the complexity of existing solutions and making testing more accessible for non-professional testers.
Patent Information
- Application Number
- CN202411286271.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-20
AI Technical Summary
Existing application testing solutions using WinAppDriver require the installation of third-party software and enabling developer mode, which can be complex and cause testing issues, limiting accessibility for non-professional testers.
A program testing method that displays a test interaction window in response to a user's operation, records user interactions to generate a test script, and tests the program without requiring third-party software or developer mode, simplifying the testing process and reducing the technical barrier.
Enables convenient and efficient program testing for users without professional coding skills by directly recording user operations to generate test scripts, eliminating the need for third-party software and developer mode, thus simplifying the testing process and improving accessibility.
Smart Images

Figure CN119166523A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of testing technology, and in particular to a program testing method, device, equipment, medium and product. Background Art
[0002] When an application is undergoing iterative development, each version release requires functional verification of historical functions and verification of the accuracy of processing results. Among them, WinAppDriver is the main tool for automated testing of Windows applications. Most of the simulation tests that need to be performed can be completed through WinAppDriver.
[0003] In the related art, the application testing solution based on WinAppDriver requires the installation of third-party software to locate the position of elements, and the use threshold of the third-party software is high, which makes the testing of the application too complicated; and the application testing solution in the prior art requires turning on the developer mode on the computer, but some computers will have exceptions when the developer mode is turned on, which makes the tester unable to test the application normally. Summary of the invention
[0004] The present disclosure provides a program testing method, apparatus, device, medium and product.
[0005] According to a first aspect of the present disclosure, a program testing method is provided, the method comprising:
[0006] In response to the calling operation of the window, a test interaction window is displayed in the display interface of the program to be tested;
[0007] In response to a user triggering an operation on a recording button in the test interaction window, obtaining operation information of the user on the program to be tested;
[0008] A test script of the program to be tested is generated based on the operation information, and the program to be tested is tested based on the test script.
[0009] Further, the generating a test script of the program to be tested based on the operation information includes:
[0010] Generate an initial test script for the program to be tested based on the operation information;
[0011] Detecting script breakpoint information input by the user in the test interaction form;
[0012] A test breakpoint is set for the initial test script based on the script breakpoint information to obtain the test script.
[0013] Furthermore, the method further comprises:
[0014] Before detecting the calling operation of the form, determining an interactive script and a form file of the interactive script; wherein the interactive script and the form file are used to generate the test interactive form;
[0015] Compiling the interactive script and the form file to obtain an executable file;
[0016] The executable file is embedded in the program package of the program to be tested.
[0017] Furthermore, determining the interactive script includes:
[0018] Determine an interactive script based on the test requirements of the program to be tested; wherein the test requirements include at least one of the following: requirements for obtaining internal and external operation information of the program to be tested, requirements for obtaining operation information of a database of the program to be tested, requirements for condition determination, and requirements for result output.
[0019] Further, the generating a test script of the program to be tested based on the operation information includes:
[0020] Determine control information of a target control in the program to be tested based on the operation information; wherein the control information includes at least one of the following: name information of the target control, location information of the target control, and parameters of the target control;
[0021] A test script for the program to be tested is generated based on the control information.
[0022] Further, the generating a test script of the program to be tested based on the control information includes:
[0023] In response to an instruction by the user to edit the control information, acquiring editing information of the control information by the user;
[0024] updating the control information based on the edit information;
[0025] The test script is generated based on the updated control information.
[0026] Further, the testing the program to be tested based on the test script includes:
[0027] In response to a selection operation on a test script in the test interaction window, determining one or more target test scripts from among all the test scripts;
[0028] The program to be tested is subjected to batch simulation testing through the one or more target test scripts.
[0029] According to a second aspect of the present disclosure, a program testing device is provided, the device comprising:
[0030] A first response module, used for displaying a test interaction window in the display interface of the program to be tested in response to a calling operation of the window;
[0031] A second response module, configured to obtain operation information of the user on the program to be tested in response to a trigger operation of the user on the recording button in the test interaction window;
[0032] A generating module is used to generate a test script of the program to be tested based on the operation information, and to test the program to be tested based on the test script.
[0033] According to a third aspect of the present disclosure, an electronic device is provided, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the method described above is implemented.
[0034] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above method of the present disclosure is implemented.
[0035] According to a fifth aspect of the present disclosure, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the method of the present disclosure is implemented.
[0036] A program testing method, apparatus, device, medium and product are provided by the embodiments of the present disclosure. In the embodiments of the present application, first, in response to a window calling operation, a test interaction window is displayed in the display interface of the program to be tested; then, in response to a user triggering operation of a recording button in the test interaction window, the user's operation information on the program to be tested is obtained; finally, a test script of the program to be tested is generated based on the operation information, and the program to be tested is tested based on the test script.
[0037] From the above description, it can be seen that the electronic device can display the test interaction window in the display interface of the program to be tested in response to the user's window calling operation, and then obtain the user's operation information on the program to be tested in response to the user's triggering operation of the recording button in the test interaction window. The operation information of the program to be tested is directly obtained by recording the user's operation in the test interaction window, which is equivalent to a built-in debugging environment. There is no need to install third-party software to locate the position of elements in the program to be tested, and there is no need to turn on the developer mode on the computer, which simplifies the testing process and improves the convenience of the program testing method. After obtaining the user's operation information on the program to be tested, a test script for the program to be tested can be generated based on the operation information, and the program to be tested can be tested based on the test script, which greatly reduces the threshold for users to test the program, so that users who are not professional code personnel can also perform program testing, further improving the convenience of the program testing method. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0039] Figure 1 A flowchart of a program testing method provided for an exemplary embodiment of the present disclosure;
[0040] Figure 2 A schematic diagram of a test interaction window provided for an exemplary embodiment of the present disclosure;
[0041] Figure 3 A schematic diagram of a test interaction window provided for another exemplary embodiment of the present disclosure;
[0042] Figure 4 A schematic diagram of a test interaction window provided for another exemplary embodiment of the present disclosure;
[0043] Figure 5 A flowchart of a program testing method provided for another exemplary embodiment of the present disclosure;
[0044] Figure 6 A schematic diagram of a test interaction window provided for another exemplary embodiment of the present disclosure;
[0045] Figure 7 A flowchart of a program testing method provided for another exemplary embodiment of the present disclosure;
[0046] Figure 8A schematic diagram of an interactive script and a form file of the interactive script provided by an exemplary embodiment of the present disclosure;
[0047] Fig. 9 A flowchart of a program testing method provided for another exemplary embodiment of the present disclosure;
[0048] Fig.10 A schematic diagram of a test interaction window provided for another exemplary embodiment of the present disclosure;
[0049] Fig.11 A schematic block diagram of functional modules of a program testing device provided for an exemplary embodiment of the present disclosure;
[0050] Fig.12 A structural block diagram of an electronic device provided for an exemplary embodiment of the present disclosure;
[0051] Fig.13 A structural block diagram of a computer system provided for an exemplary embodiment of the present disclosure;
[0052] Fig.14 A structural block diagram of a computer program product provided for an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0053] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0054] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0055] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0056] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0057] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0058] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0059] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0060] As an optional but non-limiting implementation, in response to receiving an active request from the user, the method of sending a prompt message to the user may be, for example, a pop-up window, in which the prompt message may be presented in text. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device. It is understandable that the above notification and the process of obtaining user authorization are only illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0061] In one embodiment, Figure 1 As shown, a program testing method is provided, comprising the following steps:
[0062] Step 101, in response to a window calling operation, displaying a test interaction window in a display interface of a program to be tested.
[0063] Here, when the user needs to perform a program test, the electronic device can display a test interaction window in the display interface of the program to be tested in response to the user's calling operation on the window.
[0064] In a possible embodiment, when a user needs to perform a program test, the electronic device displays a test interaction window in the display interface of the program to be tested in response to the user's call operation on the window, such as Figure 2 As shown, Figure 2The schematic diagram of the test interaction window is exemplarily shown, and the test interaction window can be called by the user through a preset shortcut key. Exemplarily, the preset shortcut key can be "F9", or it can also be other shortcut keys, which are not specifically limited in the present disclosure.
[0065] After opening the program to be tested, the test interactive window can be called out in the program to be tested by triggering the "F9" key on the keyboard. The test interactive window is embedded in the display interface of the program to be tested, for example, Figure 2 As shown. It should be noted that the calling method of the test interaction window can also be other ways, which are not limited here, subject to what can be implemented. The called test interaction window contains multiple options, which are determined by the interaction script and the form file of the interaction script that generate the test interaction window, among which the interaction script and the form file of the interaction script, the interaction script can be a user-defined script.
[0066] Step 102, in response to the user triggering the recording button in the test interaction window, obtaining the user's operation information on the program to be tested.
[0067] After the electronic device displays the test interaction window in the display interface of the program to be tested in response to the user's calling operation on the window, it can respond to the user's triggering operation on the recording button in the test interaction window, and then perform the recording operation to obtain the user's operation information on the program to be tested during the recording process.
[0068] In a possible embodiment, after the electronic device displays a test interaction window in the display interface of the program to be tested in response to the user's calling operation on the window, it obtains the user's operation information on the program to be tested in response to the user's triggering operation on the recording button in the test interaction window.
[0069] For example, Figure 3 As shown, Figure 3 Another test interaction window diagram is shown as an example. When the user clicks "Start Listening" in the test interaction window, it is determined that the trigger operation of the recording button in the test interaction window is detected, that is, "Start Listening" is the recording button. After that, the user can perform the required operations in the program to be tested, and the electronic device will obtain the user's operation information on the program to be tested. The user's operation information will be recorded and displayed in the "Operation Record" of the test interaction window, where the "15:56:49" on the left side of the "Operation Record" page records the user's operation time, and the "Main→Main: Main" on the right side records the user's operation information of the program to be tested, such as the specific operation content.
[0070] Step 103: Generate a test script for the program to be tested based on the operation information, and test the program to be tested based on the test script.
[0071] After the electronic device obtains the user's operation information on the program to be tested in response to the user triggering the recording button in the test interaction window, it can generate a test script for the program to be tested based on the operation information and test the program to be tested based on the test script.
[0072] In a possible embodiment, generating a test script of the program to be tested based on the operation information includes the following steps:
[0073] Determine control information of a target control in the program to be tested based on the operation information;
[0074] A test script for the program to be tested is generated based on the control information.
[0075] Specifically, the electronic device responds to the user's triggering operation on the recording button in the test interaction window, obtains the user's operation information on the program to be tested, and determines the control information of the target control in the program to be tested based on the operation information, wherein the control information includes at least one of the following: name information of the target control, location information of the target control, and parameters of the target control.
[0076] For example, Figure 4 As shown, Figure 4 Another test interactive window diagram is shown exemplarily, where, exemplarily, "FloatConsole" is the location information of the target control, "comboBox12" is the name information of the target control, and "4G" is the parameter of the target control. After determining the control information of the target control in the program to be tested, a test script of the program to be tested can be generated based on the control information.
[0077] Here, a script template of the test script may be obtained, and then the control information may be processed according to the script template to obtain a test script of the program to be tested.
[0078] In a possible embodiment, generating a test script of the program to be tested based on the control information includes the following steps:
[0079] In response to a user's instruction to edit the control information, obtaining the user's editing information of the control information;
[0080] updating control information based on the edit information;
[0081] Generate a test script based on the updated control information.
[0082] In the embodiment of the present disclosure, after the control information of the target control in the program to be tested is determined based on the operation information, the editing information of the control information by the user can be obtained in response to the editing instruction of the control information by the user. Figure 4As shown, the user can edit the control information in the test interaction window. In the embodiment of the present disclosure, after obtaining the control information, the user is supported to edit the control information, wherein the editing includes at least one of modification, deletion, replacement, and addition.
[0083] Exemplarily, the user can copy and paste the current control information, and the electronic device obtains the control information copied by the user as editing information; the user can also complete the required parameters according to the requirements of the test script. For example, the parameters of the target control named "comboBox12" need to be completed, and the user can add the parameter "5G" to the parameters of "comboBox12" as required, and the electronic device obtains the parameters of the target control completed by the user as editing information.
[0084] It should be noted that the electronic device may also obtain the user's editing information of the control information in other forms, such as changing the name information of the target control, the location information of the target control, and the parameters of the target control in the control information, which are not limited here. After obtaining the user's editing information of the control information, the control information may be updated based on the editing information, and a test script may be generated based on the updated control information. After the test script is generated, the test script may be executed to test the program to be tested.
[0085] A program testing method, apparatus, device, medium and product are provided by the embodiments of the present disclosure. In the embodiments of the present application, first, in response to a window calling operation, a test interaction window is displayed in the display interface of the program to be tested; then, in response to a user triggering operation of a recording button in the test interaction window, the user's operation information on the program to be tested is obtained; finally, a test script of the program to be tested is generated based on the operation information, and the program to be tested is tested based on the test script.
[0086] From the above description, it can be seen that the electronic device can display the test interaction window in the display interface of the program to be tested in response to the user's window calling operation, and then obtain the user's operation information on the program to be tested in response to the user's triggering operation of the recording button in the test interaction window. The operation information of the program to be tested is directly obtained by recording the user's operation in the test interaction window, which is equivalent to a built-in debugging environment. There is no need to install third-party software to locate the position of elements in the program to be tested, and there is no need to turn on the developer mode on the computer, which simplifies the testing process and improves the convenience of the program testing method. After obtaining the user's operation information on the program to be tested, a test script for the program to be tested can be generated based on the operation information, and the program to be tested can be tested based on the test script, which greatly reduces the threshold for users to test the program, so that users who are not professional code personnel can also perform program testing, further improving the convenience of the program testing method.
[0087] In one embodiment, Figure 5 As shown, step 103 generates a test script for the program to be tested based on the operation information, and further includes the following steps:
[0088] Step 501: Generate an initial test script for the program to be tested based on the operation information.
[0089] In a possible embodiment, after obtaining the user's operation information on the program to be tested, an initial test script of the program to be tested may be generated in a test interaction window based on the operation information.
[0090] For example, Figure 6 As shown, Figure 6 Another test interaction window schematic diagram is exemplarily shown, in which the initial test script of the program to be tested and the line number sequence of the initial test script control information are displayed.
[0091] Here, the initial test script can be understood as a test script without script breakpoint information.
[0092] Step 502: Detect script breakpoint information input by the user in the test interaction window.
[0093] In a possible embodiment, after the initial test script of the program to be tested is generated based on the operation information, the script breakpoint information input by the user in the test interaction form may be detected.
[0094] For example, Figure 6 As shown, the test interaction window includes a breakpoint input box and an option to save the script. The user can enter the breakpoint information in the breakpoint input box according to actual needs. For example, the user enters "1" at "Breakpoint 1" and enters "17" at "Breakpoint 2" in the breakpoint input box, which means that the user needs the control information of breakpoints 1 to 17 as a test script.
[0095] Step 503: Set a test breakpoint for the initial test script based on the script breakpoint information to obtain a test script.
[0096] In a possible embodiment, after the electronic device detects the script breakpoint information input by the user in the test interaction form, it sets a test breakpoint for the initial test script based on the script breakpoint information to obtain the test script.
[0097] For example, Figure 6As shown, the user enters "1" at "Breakpoint 1" in the breakpoint input box, enters "17" at "Breakpoint 2", and clicks "Save Script". The electronic device sets the test breakpoints of the initial test script to "Breakpoint 1" and "Breakpoint 17" according to the breakpoint information, and obtains a test script with breakpoints 1-17. After obtaining the test script, the user can click "Start Test" to run the test script to test the program to be tested.
[0098] In this embodiment, first, the electronic device generates an initial test script of the program to be tested based on the operation information, then the electronic device detects the script breakpoint information input by the user in the test interaction window, and finally, the electronic device sets a test breakpoint for the initial test script based on the script breakpoint information to obtain the test script. As can be seen from the above description, the user can interact with the test interaction window, determine the test script through the breakpoint information of the custom script, and perform test verification of the script in sections, thereby improving the flexibility and reliability of the program testing method.
[0099] In one embodiment, Figure 7 As shown, a program testing method is also provided, comprising the following steps:
[0100] Step 701, before detecting the calling operation of the form, determine the interactive script and the form file of the interactive script.
[0101] Here, before detecting the calling operation of the form, the electronic device determines the interaction script and the form file of the interaction script, wherein the interaction script and the form file are used to generate a test interaction form.
[0102] In a possible embodiment, determining the interaction script includes the following steps:
[0103] Determine the interaction script based on the test requirements of the program to be tested;
[0104] Specifically, the electronic device determines the interactive script based on the test requirements of the program to be tested, wherein the test requirements include at least one of the following: the requirements for obtaining internal operation information and external operation information of the program to be tested, the requirements for obtaining operation information of the database of the program to be tested, the requirements for condition determination, and the requirements for result output, such as Figure 8 As shown, Figure 8 The interactive script and the form file diagram of the interactive script are shown exemplarily. The interactive script CustomCommand.cs is in C# language. The interactive script CustomCommand.cs can obtain the internal operation information of the program to be tested, mainly simulating the user's click operation, including: menu, form, button, various options, right-click operation, and its instructions and corresponding functions are shown in the following table:
[0105]
[0106]
[0107] The interactive script CustomCommand.cs can obtain external operation information of the program to be tested, including copy and delete operations of specified folders, copy and delete operations of files, determination of whether a file exists, and comparison of file contents. Its instructions and corresponding functions are shown in the following table:
[0108] instruction Function CopyFolder Copy Directory CopyFile Copying Files MoveFolder Deleting a Directory MoveFile Deleting files IsFileExist Does the file exist? FileCompare Compare two file streams to see if they are consistent
[0109] The interactive script CustomCommand.cs can obtain the operation information of the database of the program to be tested, including the existence determination of the database and library tables, and the query operation of the library tables. Its instructions and corresponding functions are shown in the following table:
[0110] instruction Function DataBaseQuery Query the number of database entries StatisticData Statistics query returns array QueryTableName Check if the table name exists in the database
[0111] The interactive script CustomCommand.cs can realize the condition determination requirements and result output, including the determination of the execution results of the above operations and the output of the external commissioning response window. Its instructions and corresponding functions are shown in the following table:
[0112]
[0113] It should be noted that the interactive script can be customized by the user, and the content of the specific interactive script is not limited here. In the remaining projects to be tested by the test program, the user does not need to redevelop a new interactive script, and the user can directly introduce a public script as an interactive script. And if the user has a new interactive operation requirement for the interactive script, it can also continuously iterate and improve the interactive script. For example, in the C# language, the user can introduce the two namespaces of System.Reflection and System.Runtime.InteropServices in the interactive script, wherein System.Reflection provides the ability to check and operate object type information at runtime, including obtaining the properties, methods and constructors of the type, and dynamically creating and using objects; and System.Runtime.Interop Services supports the interoperability between managed code and unmanaged code, so that the interactive script can call native resources and application programming interfaces (Application Programming Interface, API). Through the classes and features in these namespaces, a customized simplified script convention can be defined, and the expected operation can be achieved through the interface form built into the program. This method simplifies the process of internally calling test controls, and the user does not need to have a deep understanding of the complex structure of the application.
[0114] Step 702, compile the interactive script and the form file to obtain an executable file.
[0115] In a possible embodiment, after the electronic device determines the interaction script and the form file of the interaction script, it compiles the interaction script and the form file to obtain an executable file. Exemplarily, the interaction script is CustomCommand.cs, and the electronic device compiles the interaction script CustomCommand.cs and its corresponding form file, and then obtains the executable file.
[0116] Step 703: embed the executable file in the program package of the program to be tested.
[0117] In a possible embodiment, the electronic device compiles the interactive script and the form file to obtain an executable file, and then embeds the executable file in the program package of the program to be tested. The executable file is used to generate a test interactive form. In this way, when the user enters the program to be tested, the electronic device can respond to the user's call operation on the form and display the test interactive form in the display interface of the program to be tested.
[0118] In this embodiment, first, the electronic device determines the interactive script and the form file of the interactive script before detecting the calling operation of the form, then the electronic device compiles the interactive script and the form file to obtain an executable file, and finally, the electronic device embeds the executable file in the program package of the program to be tested, and the executable file is used to generate the test interactive form. From the above description, it can be seen that the interactive script can be customized by the user, and can be continuously iterated and improved, which improves the flexibility of the program testing method; and the interactive script can realize the acquisition of internal operation information and external operation information of the program to be tested, the acquisition of operation information of the database of the program to be tested, the condition determination requirements and the result output, which greatly reduces the complexity of the script and further improves the convenience of the program testing method.
[0119] In one embodiment, Fig. 9 As shown, step 103 tests the program to be tested based on the test script, and also includes the following steps:
[0120] Step 901, in response to a selection operation on a test script in a test interaction window, one or more target test scripts are determined from among all test scripts.
[0121] Here, after the electronic device generates a test script for the program to be tested based on the operation information, the electronic device determines one or more target test scripts from all the test scripts in response to the user's selection operation on the test script in the test interaction window.
[0122] In a possible embodiment, after the electronic device generates a test script for the program to be tested based on the operation information, the electronic device determines one or more target test scripts from all the test scripts in response to the user's selection operation of the test script in the test interaction form, such as Fig.10 As shown, Fig.10 Another test interaction window diagram is shown as an example. The "Directory" option of the "Script Settings" of the test interaction window includes multiple test scripts. It should be noted that the test interaction window displays the script names of multiple test scripts, which is the name given to the test script when the user saves the test script. The user can view the specific content of the test script by clicking on the test script. The user checks the required test script from multiple test scripts. After the user checks the test script, the electronic device responds to the user's check operation on the test script in the test interaction window and determines the target test script from all test scripts.
[0123] Step 902: Perform batch simulation tests on the programs to be tested using one or more target test scripts.
[0124] Here, the electronic device responds to the selection operation of the test script in the test interaction form, determines one or more target test scripts among all the test scripts, and then performs batch simulation tests on the program to be tested through the one or more target test scripts.
[0125] In a possible embodiment, the electronic device responds to the selection operation of the test script in the test interaction form, determines one or more target test scripts among all the test scripts, and then performs batch simulation test on the program to be tested through the one or more target test scripts. For example, Fig.10 As shown, after the user selects the test script, he clicks "Start Test", and the electronic device performs batch simulation tests on the program to be tested according to the target test script selected by the user.
[0126] In this embodiment, first, the electronic device determines one or more target test scripts in all test scripts in response to the selection operation of the test script in the test interaction form, and then the electronic device performs batch simulation tests on the program to be tested through the one or more target test scripts. From the above description, it can be seen that the user can determine the target test script to make the electronic device perform batch simulation tests on the program to be tested, which liberates human labor and improves the efficiency and flexibility of the program testing method; and compared with manual repetitive testing, the batch simulation test of the program to be tested by the electronic device has high accuracy, which improves the reliability of the program testing method.
[0127] In the case of dividing each functional module according to each function, an embodiment of the present disclosure provides a program testing device, which may be a server or a chip applied to a server. Fig.11 A schematic block diagram of the functional modules of a program testing device provided by an exemplary embodiment of the present disclosure. Fig.11 As shown, the program test device includes:
[0128] The first response module 1101 is used to display a test interaction window in the display interface of the program to be tested in response to the calling operation of the window;
[0129] The second response module 1102 is used to obtain the user's operation information on the program to be tested in response to the user's triggering operation on the recording button in the test interaction window;
[0130] The generating module 1103 is used to generate a test script of the program to be tested based on the operation information, and test the program to be tested based on the test script.
[0131] In one embodiment, the generating module 1103 includes:
[0132] A first generating unit, configured to generate an initial test script of the program to be tested based on the operation information;
[0133] A detection unit, used for detecting script breakpoint information input by the user in the test interaction form;
[0134] The first acquisition unit is used to set a test breakpoint for the initial test script based on the script breakpoint information to obtain the test script.
[0135] In one embodiment, the apparatus further comprises:
[0136] A determination module, used for determining an interactive script and a form file of the interactive script before detecting a calling operation of the form; wherein the interactive script and the form file are used to generate the test interactive form;
[0137] A compiling module, used for compiling the interactive script and the form file to obtain an executable file;
[0138] The embedding module is used to embed the executable file in the program package of the program to be tested.
[0139] In one embodiment, the determining module includes:
[0140] The first determination unit is used to determine the interactive script based on the test requirements of the program to be tested; wherein the test requirements include at least one of the following: the requirement for obtaining internal operation information and external operation information of the program to be tested, the requirement for obtaining operation information of the database of the program to be tested, the condition judgment requirement and the result output requirement.
[0141] In one embodiment, the generating module 1103 includes:
[0142] A second determining unit is used to determine control information of a target control in the program to be tested based on the operation information; wherein the control information includes at least one of the following: name information of the target control, location information of the target control, and parameters of the target control;
[0143] The second generating unit is used to generate a test script of the program to be tested based on the control information.
[0144] In one embodiment, the generating module 1103 includes:
[0145] A second acquiring unit, configured to acquire, in response to an editing instruction of the control information by the user, editing information of the control information by the user;
[0146] an updating unit, configured to update the control information based on the editing information;
[0147] The third generating unit is used to generate the test script based on the updated control information.
[0148] In one embodiment, the apparatus further comprises:
[0149] A third response module, configured to determine one or more target test scripts from among all the test scripts in response to a selection operation on a test script in the test interaction form;
[0150] The batch test module is used to perform batch simulation tests on the program to be tested through the one or more target test scripts.
[0151] An embodiment of the present disclosure also provides an electronic device, comprising: at least one processor; and a memory for storing instructions executable by the at least one processor; wherein the at least one processor is configured to execute the instructions to implement the above method disclosed in the embodiment of the present disclosure.
[0152] Fig.12 The structure diagram of an electronic device provided by an exemplary embodiment of the present disclosure is shown in FIG. Fig.12 As shown, the electronic device 1200 includes at least one processor 1201 and a memory 1202 coupled to the processor 1201 , and the processor 1201 can execute corresponding steps in the above method disclosed in the embodiment of the present disclosure.
[0153] The processor 1201 may also be referred to as a central processing unit (CPU), which may be an integrated circuit chip having signal processing capabilities. Each step in the method disclosed in the embodiment of the present disclosure may be completed by an integrated logic circuit of hardware in the processor 1201 or by instructions in the form of software. The processor 1201 may be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a memory 1202, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, or other mature storage media in the art. The processor 1201 reads the information in the memory 1202 and completes the steps of the method in combination with its hardware.
[0154] In addition, when various operations / processes according to the present disclosure are implemented by software and / or firmware, they can be transmitted from a storage medium or a network to a computer system having a dedicated hardware structure, such as Fig.13 The computer system 1300 shown is installed with the programs constituting the software. When the various programs are installed, the computer system can perform various functions, including the functions described above. Fig.13 A structural block diagram of a computer system provided for an exemplary embodiment of the present disclosure.
[0155] Computer system 1300 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0156] like Fig.13 As shown, the computer system 1300 includes a computing unit 1301, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1302 or a computer program loaded from a storage unit 1308 to a random access memory (RAM) 1303. In the RAM 1303, various programs and data required for the operation of the computer system 1300 can also be stored. The computing unit 1301, the ROM 1302, and the RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0157] A plurality of components in the computer system 1300 are connected to the I / O interface 1305, including: an input unit 1306, an output unit 1307, a storage unit 1308, and a communication unit 1309. The input unit 1306 may be any type of device capable of inputting information to the computer system 1300, and the input unit 1306 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 1307 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1308 may include, but is not limited to, a disk, an optical disk. The communication unit 1309 allows the computer system 1300 to exchange information / data with other devices over a network such as the Internet, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0158] The computing unit 1301 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1301 performs the various methods and processes described above. For example, in some embodiments, the above methods disclosed in the embodiments of the present disclosure may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1308. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1200 via the ROM 1302 and / or the communication unit 1309. In some embodiments, the computing unit 1301 may be configured to perform the above methods disclosed in the embodiments of the present disclosure in any other appropriate manner (e.g., by means of firmware).
[0159] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the above method disclosed in the embodiment of the present disclosure.
[0160] The computer-readable storage medium in the disclosed embodiments may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. The computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specifically, the computer-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0161] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0162] Fig.14 A computer program product is provided for an exemplary embodiment of the present disclosure. The computer program product 1400 includes a computer program 1401. When the computer program 1401 is executed by a processor, the method disclosed in the embodiment of the present disclosure is implemented.
[0163] In embodiments of the present disclosure, computer program codes for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer.
[0164] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0165] The modules, components or units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the names of the modules, components or units do not, in some cases, limit the modules, components or units themselves.
[0166] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0167] The above descriptions are only some embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, a technical solution formed by replacing the above features with the technical features with similar functions disclosed in the present disclosure (but not limited to).
[0168] Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present disclosure. It should be understood by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.
Claims
1. A program testing method, It is characterized in that include: In response to the calling operation of the window, a test interaction window is displayed in the display interface of the program to be tested; In response to a user triggering an operation on a recording button in the test interaction window, obtaining operation information of the user on the program to be tested; A test script of the program to be tested is generated based on the operation information, and the program to be tested is tested based on the test script.
2. The program testing method according to claim 1, It is characterized in that The step of generating a test script for the program to be tested based on the operation information includes: Generate an initial test script for the program to be tested based on the operation information; Detecting script breakpoint information input by the user in the test interaction form; A test breakpoint is set for the initial test script based on the script breakpoint information to obtain the test script.
3. The program testing method according to claim 1, It is characterized in that The method further comprises: Before detecting the calling operation of the form, determining an interactive script and a form file of the interactive script; wherein the interactive script and the form file are used to generate the test interactive form; Compiling the interactive script and the form file to obtain an executable file; The executable file is embedded in the program package of the program to be tested.
4. The program testing method according to claim 3, It is characterized in that The step of determining the interactive script includes: Determine an interactive script based on the test requirements of the program to be tested; wherein the test requirements include at least one of the following: requirements for obtaining internal and external operation information of the program to be tested, requirements for obtaining operation information of a database of the program to be tested, requirements for condition determination, and requirements for result output.
5. The program testing method according to claim 1, It is characterized in that The step of generating a test script for the program to be tested based on the operation information includes: Determine control information of a target control in the program to be tested based on the operation information; wherein the control information includes at least one of the following: name information of the target control, location information of the target control, and parameters of the target control; A test script for the program to be tested is generated based on the control information.
6. The program testing method according to claim 5, It is characterized in that The step of generating a test script for the program to be tested based on the control information includes: In response to an instruction by the user to edit the control information, acquiring editing information of the control information by the user; updating the control information based on the edit information; The test script is generated based on the updated control information.
7. The program testing method according to claim 1, It is characterized in that The testing of the program to be tested based on the test script includes: In response to a selection operation on a test script in the test interaction window, determining one or more target test scripts from among all the test scripts; The program to be tested is subjected to batch simulation testing through the one or more target test scripts.
8. A program testing device, It is characterized in that include: A first response module, used for displaying a test interaction window in the display interface of the program to be tested in response to a calling operation of the window; A second response module, configured to obtain operation information of the user on the program to be tested in response to a trigger operation of the user on the recording button in the test interaction window; A generating module is used to generate a test script of the program to be tested based on the operation information, and to test the program to be tested based on the test script.
9. An electronic device, It is characterized in that include: at least one processor; a memory for storing the at least one processor-executable instruction; The at least one processor is configured to execute the instructions to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 7.
11. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Test data acquisition method and device, electronic equipment and storage medium
CN111506496A
Regression testing method and device, computer system and computer readable storage medium
CN112799940A
Test script recording method and device, electronic equipment and storage medium
CN115543814A
Recording method and playback method of test script
CN116150026A
Interactive interface test method and device, electronic equipment and storage medium
CN116225943A
