CN113468050A - Canvas-based testing method and device, computer equipment and storage medium - Google Patents

Canvas-based testing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113468050A
CN113468050A CN202110733854.0A CN202110733854A CN113468050A CN 113468050 A CN113468050 A CN 113468050A CN 202110733854 A CN202110733854 A CN 202110733854A CN 113468050 A CN113468050 A CN 113468050A
Authority
CN
China
Prior art keywords
script
canvas
test
result
tested
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110733854.0A
Other languages
Chinese (zh)
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.)
Hangzhou Qunhe Information Technology Co Ltd
Original Assignee
Hangzhou Qunhe Information Technology 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 Hangzhou Qunhe Information Technology Co Ltd filed Critical Hangzhou Qunhe Information Technology Co Ltd
Priority to CN202110733854.0A priority Critical patent/CN113468050A/en
Publication of CN113468050A publication Critical patent/CN113468050A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a canvas-based testing method, a canvas-based testing device, computer equipment and a storage medium, which relate to the technical field of computer application, wherein the method comprises the steps of recording a to-be-tested script of user operation information from the canvas, and realizing the playback of the to-be-tested script, so that regression testing is not required to be carried out on all codes before code submission and during integrated testing each time, and a large amount of manpower and time are saved; the method comprises the steps of performing deserialization processing on a script to be tested to obtain a test script, obtaining an operation result of the test script, comparing the operation result with an expected result of user operation information to output a test result, namely reconstructing an object of the script to be tested and executing the test, so that the local test of the canvas can be realized, the operation problem of locating the canvas does not need to be searched in a large number of codes, the test efficiency is effectively improved, and the robustness of the codes is further improved.

Description

Canvas-based testing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer application technologies, and in particular, to a canvas-based testing method and apparatus, a computer device, and a storage medium.
Background
As a piece of Canvas-based Web end software, since it often involves many operations and editing states, especially three-dimensional software, the amount and complexity of code is often much higher than that of a general Web end page. Because the automatic test can effectively improve the code robustness, the programmer can conveniently and quickly find problems, the development efficiency is improved, the program quality is improved, and the like, the automatic test is often used for the test and operation and maintenance of the system.
However, most of the automatic front-end tests are implemented based on searching and comparing Dom (Document Object Model) or explicit input and output data. For example, the automated test may be a commonly used interaction page based on a Dom node or a function with explicit input and output, but for a Canvas, there is no testable structure inside, the Canvas is a single Dom, and most of the automation at the front end needs to be based on clicks among different DOMs, so that the automated test cannot be realized for the page of the Canvas. Under the background that a mature automatic regression testing framework does not exist, developers develop new functions each time with huge recession risks, sometimes the new functions cannot be found in time, a large amount of time is wasted to investigate the causes of the recession, and the testing efficiency is greatly influenced.
Disclosure of Invention
The embodiment of the application aims to provide a canvas-based testing method to solve the problem of low testing efficiency.
In order to solve the above technical problem, an embodiment of the present application provides a canvas-based testing method, including the following steps:
recording a script to be tested of the user operation information from the canvas;
performing deserialization processing on the script to be tested to obtain a test script;
acquiring an operation result of the test script;
and comparing the operation result with an expected result of the user operation information to output a test result.
Further, the script to be tested for recording the user operation information from the canvas comprises:
acquiring user operation information from a canvas;
classifying the operation information to obtain an initial script, wherein the initial script comprises a command and an event;
and carrying out serialization processing on the initial script to obtain the script to be tested.
Further, after the operation information is classified to obtain the initial script, the canvas-based testing method further includes:
and determining a selection set identifier corresponding to the operation information according to the command and the event, wherein the selection set identifier is used for indicating the selector.
Further, the expected result includes an expected result of the selector corresponding to the selection set identifier, and the comparing the running result with the expected result of the user operation information to output the test result includes:
running a command or event in the test script;
if the operation result is not wrong, comparing the operation result with the expected result of the selector;
and if the comparison result is consistent and the to-be-tested script is not played back, continuing to execute the reverse-order testing process of the to-be-tested script.
Further, the canvas-based testing method further comprises:
and if the running result is in error or the comparison result is inconsistent, determining that the current test script fails to test.
Further, an embodiment of the present application provides a canvas-based testing apparatus, including:
the recording module is used for recording a script to be tested of the user operation information from the canvas;
the anti-sequence module is used for performing anti-sequence processing on the script to be tested to obtain a test script;
the acquisition module is used for acquiring the running result of the test script;
and the test module is used for comparing the operation result with an expected result of the user operation information so as to output a test result.
Further, the recording module includes:
the acquisition unit is used for acquiring user operation information from the canvas;
the classification unit is used for classifying the operation information to obtain an initial script, wherein the initial script comprises a command and an event;
and the serialization unit is used for carrying out serialization processing on the initial script so as to obtain the script to be tested.
Further, the canvas-based testing apparatus further comprises:
and the selector module is used for determining a selection set identifier corresponding to the operation information according to the command and the event, wherein the selection set identifier is used for indicating the selector.
Further, the test module includes:
the running unit is used for running the command or the event in the test script;
the comparison unit is used for comparing the operation result with the expected result of the selector if the operation result has no error;
and the execution unit is used for continuing to execute the reverse-order test process of the script to be tested if the comparison result is consistent and the playback of the script to be tested is not finished.
Further, the canvas-based testing apparatus further comprises:
and the test failure module is used for determining that the test of the current test script fails if the running result is in error or the comparison result is inconsistent.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the canvas-based testing method when executing the computer program.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the steps of the canvas-based testing method described above.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
the playback of the script to be tested is realized by recording the script to be tested of the user operation information from the canvas, so that the regression test is not required to be carried out on all the codes before the codes are submitted and during the integrated test every time, thereby saving a large amount of labor and time; the method comprises the steps of performing deserialization processing on a script to be tested to obtain a test script, obtaining an operation result of the test script, comparing the operation result with an expected result of user operation information to output a test result, namely reconstructing an object of the script to be tested and executing the test, so that the local test of the canvas can be realized, the operation problem of positioning the canvas does not need to be searched one by one in a large number of codes, the test efficiency is effectively improved, and the robustness of the codes is further improved.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a schematic diagram of a canvas-based testing system provided herein;
FIG. 3 is a flow diagram of one embodiment of a method for canvas-based testing provided herein
FIG. 4 is a schematic diagram illustrating an embodiment of a canvas-based testing apparatus provided herein;
FIG. 5 is a schematic block diagram of one embodiment of a computer device provided herein.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the canvas-based testing method provided in the embodiment of the present application is generally executed by a server/terminal device, and accordingly, the canvas-based testing apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
In particular, Canvas is like a block of Canvas on which various diagrams, animations, etc. can be drawn in JavaScript (a lightweight, interpreted or just-in-time programming language with function precedence). The new tag added by Canvas in HTML5(HyperText Markup Language 5, a Language description for constructing Web content) can be used to generate images in real time on Web pages, and can manipulate the image content, which is basically a bitmap (bitmap) that can be operated by JavaScript. The Canvas object represents an HTML Canvas element- < Canvas >, which has no behavior of its own, but may define an API (interface) to support scripted client drawing operations. Thus, a Canvas often involves many operations and edit states, especially three-dimensional software, and the amount and complexity of its code is often much higher than that of a typical Web-end Web page. However, the existing automatic test method of interaction pages based on Dom nodes or function functions with definite input and output cannot be used for pages based on Canvas. Under the background that a set of mature automatic regression testing framework does not exist, developers develop new functions each time with huge recession risks, sometimes the new functions cannot be found in time, a large amount of time needs to be wasted to investigate the causes of the recession, and the development efficiency is greatly influenced. For the tester, a lot of time is spent on each online process to manually perform the regression test, and particularly for the software with frequent deployment, the time spent on the regression test is more.
Therefore, in the embodiment of the application, by solving the problem of automatic regression testing of the Canvas-based Web application, an automatic recording function is provided to record and generate the script to be tested, then the script to be tested is read and played back, and the change of the selector, the number of elements and the attribute change in the same actual operation process are compared, namely whether the change state is consistent with the actual change state in the operation process is compared, so that the purpose of automatic testing is achieved, the Web end version is modified in the continuous iteration process, huge manpower resources are not needed to be spent for regression testing every time, problems can be found in time, the flow testing efficiency is improved, the development efficiency is effectively improved, and the code quality is ensured.
With continued reference to FIG. 2, a flow diagram of one embodiment of a canvas-based testing method of the present application is shown. The canvas-based test method comprises the following steps:
s201: and recording the script to be tested of the user operation information from the canvas.
The user operation information includes click/double click/long press in the canvas element, such as mouse click, or trigger operation of a shortcut key, such as operation of quickly selecting a certain element by simultaneously controlling a Ctrl key and a letter "a" key.
Further, the user operation information may be abstracted into a Command (Command) and an Event (Event). In the embodiment of the application, the command refers to a trigger instruction of a user in a canvas, that is, an action instruction, such as a click command, a drag command, a shortcut command, and the like; the event refers to all objects triggered according to the command and corresponding description information, for example, an event that an object pointed by a click command is a mouse click.
Further, the command and the event are subjected to sequence processing, that is, the serialization processing is to convert user operation information into a byte stream which can be stored or transmitted, for example, a JavaScript Object change (JSON) is changed into a data interchange format, and the byte stream stores Object states and description information in the command and the event and serves as a script to be tested, that is, the script to be tested is the script information subjected to the serialization processing, so that the integrity and transferability of the script to be tested are ensured when the script to be tested is transferred and stored, and the subsequent playback and use of the script to be tested are facilitated.
S202: and performing deserialization processing on the script to be tested to obtain the test script.
In the embodiment of the application, command and event in the script to be tested are deserialized, that is, the object of the command or event is deserialized and reconstructed, the byte stream is converted into the original object state and description information, for example, JSON is deserialized into a JavaScript object, and information such as attributes and elements controlled by each event or command in the original canvas is recovered, so that the information is used as the test script.
S203: and acquiring the running result of the test script.
Specifically, an iteration version code of the current Web end is adopted to run the test script so as to output a running result of the test script, wherein the iteration version code is a logic code obtained by modifying and iterating an original code on the Web end, the test script is run through the iteration version code, and then whether the current canvas is changed by the current iteration version code is tested.
S204: and comparing the operation result with an expected result of the user operation information to output a test result.
In the embodiment of the application, the expected result refers to each element, the state information of the attribute and the number of the elements when the canvas runs normally under the condition that the original code of the Web end is not changed. The test result includes whether the operation is error, whether the comparison result is consistent, and the like.
In the embodiment of the application, the to-be-tested script of the user operation information is recorded from the canvas, so that the playback of the to-be-tested script is realized, all codes do not need to be subjected to regression testing before code submission and during integrated testing each time, and a large amount of labor and time are saved; the method comprises the steps of performing deserialization processing on a script to be tested to obtain a test script, obtaining an operation result of the test script, comparing the operation result with an expected result of user operation information to output a test result, namely reconstructing an object of the script to be tested and executing the test, so that the local test of the canvas can be realized, the operation problem of positioning the canvas does not need to be searched one by one in a large number of codes, the test efficiency is effectively improved, and the robustness of the codes is further improved.
Further, the script to be tested for recording the user operation information from the canvas comprises:
acquiring user operation information from a canvas;
classifying the operation information to obtain an initial script, wherein the initial script comprises a command and an event;
and carrying out serialization processing on the initial script to obtain the script to be tested.
Specifically, the user operation information in the canvas is monitored from the terminal device interface, for example, the user clicks a character in a main navigation bar in the canvas through a mouse, a shortcut key is adopted to trigger a login confirmation button or drag a component in the canvas, and the like.
The command includes operation logic of the button, for example, the User operation information is that any UI (User Interface) button is clicked on a web page, or that a shortcut key is pressed, which may be regarded as triggering one or more commands. The event may be a mouse down event, i.e. when the mouse pointer is moved over an element and the mouse button is pressed, or a mouse up event, i.e. when the mouse button is released on an element, or a mouse move event, i.e. when the mouse is moved over an element. The event may also be a keyboard event triggered on the canvas. The commands and events are pre-stored in an operation form, namely the operation form specifies the commands or events pointed to by each user operation information.
Therefore, the corresponding command or event can be found by monitoring the user operation information, that is, the user operation information is converted into the initial script language of the command or event in the operation form, and the initial script language is a dynamic language used for controlling the software application program or can be interpreted or compiled when being called.
In the embodiment of the application, in order to enable the initial script to be repeatedly used in the test process, the initial script needs to be stored in a temporary or persistent storage area in advance. The serialization process is the conversion of the original script into a form that can be stored or transmitted. Therefore, after the user operation information is converted into the initial script, the initial script is serialized to obtain the script to be tested, and the script to be tested is recorded and stored in the temporary or persistent storage area, so that the playback and use of the user operation information can be realized.
Further, after the operation information is classified to obtain the initial script, the canvas-based testing method further includes:
and determining a selection set identifier corresponding to the operation information according to the command and the event, wherein the selection set identifier is used for indicating the selector.
Wherein the selection set identifier is a selector identifier, and the selector may be a CSS (Cascading Style Sheets) selector, such as an intersection selector, a union selector, a descendant selector, a sub-element selector, a pseudo selector, a simple selector, an attribute selector, and the like, and the simple selector includes a class selector and an ID selector.
Class selectors are used to describe the style of a set of tags, and a class selector may be used on multiple tags, e.g., defining the name of a class selector. An attribute value; that is, the class selector must be preceded by a point ".", which is essentially the mark of the class selector, and the name class _ name of the class selector is self-defined, that is, the name of the class selector is essentially the selection set identifier. The well-defined class style is used on the HTML tag through the class attribute, and the format is as follows: the class selector may use the same class selector on multiple HTML tags in the same page.
Further, the use of ID selectors and class selectors is substantially similar, with the ID selector's flag being defined by the beginning of the pound "#". The ID selector can be used in HTML by the ID attribute. An ID selector can only appear once in the same page and is unique. And the class selector can appear in multiple same pages, so that the ID selector is more targeted. Thus, in the same page, the same ID selector is not allowed to appear, but the same class selector is allowed. One ID selector is defined by # and can be expressed as # ID name { attribute: an attribute value; for example, the attribute is the page background color, and the attribute value is pink.
Therefore, according to the selector pointed by the command and the event, the selection set identifier corresponding to the operation information can be determined. The selection set identification indicates that the setting of the current CSS style is implemented by a designated selector. By sorting commands or events according to the selection set identifier, one can quickly determine different instructions or events that the same selector can have on multiple HTML tags in the same page.
Further, the expected result includes an expected result of the selector corresponding to the selection set identifier, and as shown in step S204, comparing the running result with the expected result of the user operation information to output the test result includes:
running a command or event in the test script;
if the operation result is not wrong, comparing the operation result with the expected result of the selector;
and if the comparison result is consistent and the to-be-tested script is not played back, continuing to execute the reverse-order testing process of the to-be-tested script.
In the real-time example of the application, a command or an event of a test script is run in an iterative version code of a current Web end, and the command or the event is obtained by reconstructing a script to be tested through deserialization.
The expected result of the selector is the state information of the selector corresponding to the user operation information when the iterative version code of the Web end is not tested, and the state information of the selector can be the attribute value of the attribute. The reverse order test process is a process of performing reverse serialization on the script to be tested to obtain a test script and testing the test script.
If the program in the operation result has no error, the problem that the iterative version code has no grammar or code form is shown, and whether the state information of the selector presented by the current operation result is consistent with the expected result of the selector or not is further compared. If the current version code is consistent with the iteration version code of the current Web end, the iteration version code of the current Web end is successfully tested, the script to be tested is continuously read, the script to be tested is tested after being subjected to deserialization treatment, and the test is sequentially circulated until the script to be tested is completely read.
Further, referring to fig. 3, fig. 3 is a schematic diagram of a test comparison process in the embodiment of the present application. Judging whether the script to be tested is an instruction or not by reading the pre-recorded script to be tested; if the command is the instruction, performing deserialization processing on the command in the script to be tested, otherwise, performing deserialization processing on the event, namely reconstructing the object of the command or the event through the deserialization processing to be used as the test script; running a command or an event based on the current iteration version code of the Web end; if no program error occurs in the running process, further comparing whether the selector is changed between the current selector and the selector in the last un-iterated version code, for example, when the last selector is operated to sequentially click the object a and the object B, when the current selector is tested, if the object a and/or the object B is not clicked, it is possible that the object a and/or the object B does not exist or the position of the object a and/or the object B is changed, which indicates that the currently executed program is different from the program executed last time, but it is programmatically expected that the test result line is consistent with the last saving, and then determining that no decline occurs; if the selector is changed or the program is reported in error, namely the running result is reported in error or the comparison result is inconsistent, determining that the current test script fails to test, namely the current iteration version code fails to test; if the selector is not changed, further judging whether the script to be tested completes playback; if the playback is not finished, the test process of the scripts to be tested is continuously executed until all the scripts to be tested are read and the test is finished, a new round of integral test on all codes in the current canvas of the Web end is not needed after each test failure, and the scripts to be tested are played back one by one, namely user operation information is played back one by one, so that a large amount of test investigation time is reduced, and the test efficiency is improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures 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 may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 4, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a testing apparatus based on a canvas, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 4, fig. 4 is a schematic structural diagram of an embodiment of a canvas-based testing apparatus provided in the present application, wherein the canvas-based testing apparatus further includes: a recording module 401, an anti-sequence module 402, an obtaining module 403, and a testing module 404. Wherein:
a recording module 401, configured to record a to-be-tested script of user operation information from a canvas;
an deserializing module 402, configured to deserialize the script to be tested to obtain a test script;
an obtaining module 403, configured to obtain an operation result of the test script;
the test module 404 is configured to compare the operation result with an expected result of the user operation information to output a test result.
Further, the recording module 401 includes:
an obtaining unit 4011 configured to obtain user operation information from a canvas;
the classification unit 4012 is configured to classify the operation information to obtain an initial script, where the initial script includes a command and an event;
and the serialization unit 4013 is configured to perform serialization processing on the initial script to obtain a script to be tested.
Further, the canvas-based testing apparatus further comprises:
and a selector module 405, configured to determine, according to the command and the event, a selection set identifier corresponding to the operation information, where the selection set identifier is used to indicate a selector.
Further, the testing module 404 includes:
an execution unit 4041 configured to execute a command or an event in the test script;
a comparing unit 4042, configured to compare the operation result with the expected result of the selector if the operation result has no error;
the execution unit 4043 is configured to continue to execute the reverse order test process of the script to be tested if the comparison result is consistent and the playback of the script to be tested is not finished.
Further, the canvas-based testing apparatus further comprises:
and the test failure module 406 is configured to determine that the test of the current test script fails if the running result is in error or the comparison result is inconsistent.
With respect to the canvas-based testing apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 5, fig. 5 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 5 comprises a memory 51, a processor 52, a network interface 53 communicatively connected to each other via a system bus. It is noted that only a computer device 5 having components 51-53 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 51 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or D canvas-based test memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 51 may be an internal storage unit of the computer device 5, such as a hard disk or a memory of the computer device 5. In other embodiments, the memory 51 may also be an external storage device of the computer device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 5. Of course, the memory 51 may also comprise both an internal storage unit of the computer device 5 and an external storage device thereof. In this embodiment, the memory 51 is generally used for storing an operating system installed in the computer device 5 and various types of application software, such as program codes of a canvas-based test method. Further, the memory 51 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 52 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 52 is typically used to control the overall operation of the computer device 5. In this embodiment, the processor 52 is configured to execute the program code stored in the memory 51 or process data, for example, execute the program code of the canvas-based test method.
The network interface 53 may comprise a wireless network interface or a wired network interface, and the network interface 53 is generally used for establishing communication connections between the computer device 5 and other electronic devices.
The present application further provides another embodiment that provides a computer-readable storage medium having stored thereon a canvas based test program executable by at least one processor to cause the at least one processor to perform the steps of the canvas based test method as described above.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A canvas-based testing method, comprising:
recording a script to be tested of the user operation information from the canvas;
performing deserialization processing on the script to be tested to obtain a test script;
acquiring an operation result of the test script;
and comparing the operation result with an expected result of the user operation information to output a test result.
2. The canvas-based testing method according to claim 1, wherein the recording of the script to be tested of the user operation information from the canvas comprises:
acquiring user operation information from the canvas;
classifying the operation information to obtain an initial script, wherein the initial script comprises a command and an event;
and carrying out serialization processing on the initial script to obtain a script to be tested.
3. The canvas-based testing method of claim 2, wherein after classifying the operational information to obtain an initial script, the method further comprises:
and determining a selection set identifier corresponding to the operation information according to the command and the event, wherein the selection set identifier is used for indicating a selector.
4. The canvas-based testing method of claim 3, wherein the expected result comprises an expected result of a selector corresponding to the selection set identifier, and wherein comparing the running result with the expected result of the user operation information to output a test result comprises:
executing a command or event in the test script;
if the operation result has no error, comparing the operation result with the expected result of the selector;
and if the comparison result is consistent and the to-be-tested script is not played back, continuing to execute the reverse-order testing process of the to-be-tested script.
5. The canvas-based testing method according to any one of claims 1 to 5, further comprising:
and if the running result is in error or the comparison result is inconsistent, determining that the current test script fails to test.
6. A canvas based testing apparatus, comprising:
the recording module is used for recording a script to be tested of the user operation information from the canvas;
the anti-sequence module is used for performing anti-sequence processing on the script to be tested to obtain a test script;
the acquisition module is used for acquiring the running result of the test script;
and the test module is used for comparing the operation result with an expected result of the user operation information so as to output a test result.
7. The canvas-based testing apparatus according to claim 6, wherein the logging module comprises:
the acquisition unit is used for acquiring user operation information from the canvas;
the classification unit is used for classifying the operation information to obtain an initial script, wherein the initial script comprises a command and an event;
and the serialization unit is used for carrying out serialization processing on the initial script so as to obtain the script to be tested.
8. The canvas-based testing apparatus of claim 6, wherein the testing module comprises:
the running unit is used for running the command or the event in the test script;
a comparison unit, configured to compare the operation result with the expected result of the selector if the operation result has no error;
and the execution unit is used for continuing to execute the reverse-order test process of the script to be tested if the comparison result is consistent and the playback of the script to be tested is not finished.
9. A computer device comprising a memory having stored therein a computer program and a processor which, when executed, implements the steps of the canvas based testing method according to any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the canvas-based testing method according to any one of claims 1 to 5.
CN202110733854.0A 2021-06-30 2021-06-30 Canvas-based testing method and device, computer equipment and storage medium Pending CN113468050A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110733854.0A CN113468050A (en) 2021-06-30 2021-06-30 Canvas-based testing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110733854.0A CN113468050A (en) 2021-06-30 2021-06-30 Canvas-based testing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113468050A true CN113468050A (en) 2021-10-01

Family

ID=77874230

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110733854.0A Pending CN113468050A (en) 2021-06-30 2021-06-30 Canvas-based testing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113468050A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338388A (en) * 2021-12-31 2022-04-12 广东睿江云计算股份有限公司 LXC-based wireless CPE factory configuration method, device, equipment and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620564A (en) * 2008-06-30 2010-01-06 福建升腾资讯有限公司 Method for automatically testing recording playback mode of terminal system
CN103164195A (en) * 2011-12-13 2013-06-19 阿里巴巴集团控股有限公司 Selector presenting method based on browser and device
CN110134600A (en) * 2019-05-09 2019-08-16 北京小米移动软件有限公司 Test script method for recording, device and storage medium
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
CN110908894A (en) * 2019-10-11 2020-03-24 苏宁云计算有限公司 Visual report tool automatic testing method and device based on vuex
CN112711526A (en) * 2019-10-25 2021-04-27 腾讯科技(深圳)有限公司 UI test method, device, equipment and storage medium
CN114398283A (en) * 2022-01-18 2022-04-26 平安健康保险股份有限公司 Automatic testing method and device for user interface, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620564A (en) * 2008-06-30 2010-01-06 福建升腾资讯有限公司 Method for automatically testing recording playback mode of terminal system
CN103164195A (en) * 2011-12-13 2013-06-19 阿里巴巴集团控股有限公司 Selector presenting method based on browser and device
CN110134600A (en) * 2019-05-09 2019-08-16 北京小米移动软件有限公司 Test script method for recording, device and storage medium
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
CN110908894A (en) * 2019-10-11 2020-03-24 苏宁云计算有限公司 Visual report tool automatic testing method and device based on vuex
CN112711526A (en) * 2019-10-25 2021-04-27 腾讯科技(深圳)有限公司 UI test method, device, equipment and storage medium
CN114398283A (en) * 2022-01-18 2022-04-26 平安健康保险股份有限公司 Automatic testing method and device for user interface, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
UFT ONE帮助中心: "画布用户界面(GUI测试)", pages 1, Retrieved from the Internet <URL:https://admhelp.microfocus.com/uft/zh-CN/15.0-15.0.2/UFT_Help/Content/User_Guide/UsingTestFlowPaneGUI.htm> *
李晓鹏: "从零开始学Selenium自动化测试 基于Python视频教学版", 31 January 2021, 机械工业出版社, pages: 89 - 90 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338388A (en) * 2021-12-31 2022-04-12 广东睿江云计算股份有限公司 LXC-based wireless CPE factory configuration method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN108108297B (en) Method and device for automatic testing
CN111552633A (en) Interface abnormal call testing method and device, computer equipment and storage medium
CN104699602A (en) Method for detecting influence and computer
US20220350857A1 (en) Methods and systems for browser extension used to generate relative xpath, absolute xpath and/or css selectors
CN104866416A (en) Method and device for performance analysis of application program
CN111666220B (en) Method and device for generating Web page object test file
CN110659197B (en) Application test case generation method and device and software test system
CN112506757A (en) Automatic test method, system, computer device and medium thereof
CN113505895B (en) Machine learning engine service system, model training method and configuration method
CN111679976A (en) Method and device for searching page object
CN111475237A (en) Menu processing method and device, electronic equipment and storage medium
CN112306594A (en) Rendering method and device based on mobile terminal and storage medium
CN113468050A (en) Canvas-based testing method and device, computer equipment and storage medium
CN110716804A (en) Method and device for automatically deleting useless resources, storage medium and electronic equipment
CN117033249A (en) Test case generation method and device, computer equipment and storage medium
CN112667502A (en) Page testing method, device and medium
CN117234505A (en) Interactive page generation method, device, equipment and storage medium thereof
CN116974929A (en) Automatic test tool construction method, automatic test method and related equipment thereof
CN111475388A (en) Data push test method and device, computer equipment and storage medium
CN115481025A (en) Script recording method and device for automatic test, computer equipment and medium
CN110955813A (en) Data crawling method and device
CN113761402A (en) Link debugging method, device, equipment and storage medium
CN116560819B (en) RPA-based batch automatic operation method, system, equipment and storage medium
CN115061916B (en) Method for automatically generating interface test case and related equipment thereof
CN113268412B (en) Control analysis method, device, equipment and medium for Web system test case recording

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