CN116680174A - Test case operation method, device, electronic equipment, medium and program product - Google Patents

Test case operation method, device, electronic equipment, medium and program product Download PDF

Info

Publication number
CN116680174A
CN116680174A CN202310620171.3A CN202310620171A CN116680174A CN 116680174 A CN116680174 A CN 116680174A CN 202310620171 A CN202310620171 A CN 202310620171A CN 116680174 A CN116680174 A CN 116680174A
Authority
CN
China
Prior art keywords
case
test
page
information
test page
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
CN202310620171.3A
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.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology 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 Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202310620171.3A priority Critical patent/CN116680174A/en
Publication of CN116680174A publication Critical patent/CN116680174A/en
Pending legal-status Critical Current

Links

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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the disclosure discloses a test case operation method, a device, an electronic device, a medium and a program product. One embodiment of the method comprises the following steps: responding to the received case test page link information, and carrying out page interception processing on a case test page corresponding to the case test page link information to obtain a case test page screenshot; carrying out image recognition processing on the case test page screenshot to obtain a case test page module information set and an event information set to be bound; generating test case information according to the case test page module information set and the event information set to be bound; and operating the test case characterized by the test case information to obtain a test case operation result. The implementation mode is related to the test case, and the speed and the efficiency of interface test can be improved.

Description

Test case operation method, device, electronic equipment, medium and program product
Technical Field
Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a test case operation method, apparatus, electronic device, medium, and program product.
Background
When designing a user interface, interface testing is typically performed prior to being online. Interface testing is generally required to test whether the layout of functional modules of a user interface is reasonable, whether the overall style is consistent, whether the placement positions of various controls conform to the use habit of a customer, and further to test the operation convenience of the interface, the simplicity and the understandability of navigation, the availability of page elements and the like. Currently, in performing interface testing, the following methods are generally adopted: the developer builds a complex environment locally and manually writes the test cases in a code mode to perform interface test. The use case and the preamble are written manually.
However, the inventors found that when the interface test is performed in the above manner, there are often the following technical problems:
the developer builds and manually writes in the test case, the operation is complicated, the requirement on the developer is high, the developer is required to be familiar with interface design, the interface test speed is low, and the interface test efficiency is low.
The above information disclosed in this background section is only for enhancement of understanding of the background of the inventive concept and, therefore, may contain information that does not form the prior art that is already known to those of ordinary skill in the art in this country.
Disclosure of Invention
The disclosure is in part intended to introduce concepts in a simplified form that are further described below in the detailed description. The disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose test case running methods, apparatus, electronic devices, computer readable media and program products to solve one or more of the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a test case running method, the method including: responding to the received case test page link information, and carrying out page interception processing on a case test page corresponding to the case test page link information to obtain a case test page screenshot; carrying out image recognition processing on the case test page screenshot to obtain a case test page module information set and an event information set to be bound; generating test case information according to the case test page module information set and the event information set to be bound; and operating the test case characterized by the test case information to obtain a test case operation result.
Optionally, the performing image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set includes: and inputting the case test page screenshot into a case test page identification model to obtain a case test page module information set and a to-be-bound event information set.
Optionally, the case test page identification model includes a case test page division sub-model and a case test module binding sub-model.
Optionally, the case test module binding sub-model is obtained through training by the following steps: obtaining a sample set, wherein a sample in the sample set comprises a sample case test page module and sample binding event information corresponding to the sample case test page module; the following training steps are performed based on the sample set: respectively inputting sample case test page modules of at least one sample in a sample set into an initial neural network to obtain prediction binding event information corresponding to each sample in the at least one sample; comparing the predicted binding event information corresponding to each sample in the at least one sample with the corresponding sample binding event information; determining whether the initial neural network reaches a preset optimization target according to the comparison result; and in response to determining that the initial neural network reaches the optimization target, taking the initial neural network as a use case test page recognition model with the training completed.
Optionally, the step of training the case test module to bind the sub-model further includes: in response to determining that the initial neural network does not meet the optimization objective, adjusting network parameters of the initial neural network, and using unused samples to form a sample set, using the adjusted initial neural network as the initial neural network, again performing the training step.
Optionally, the generating test case information according to the set of the test case page module information and the set of the event information to be bound includes: binding the case test page module information set and the event information set to be bound to obtain binding test case information; generating a test case identifier according to the binding test case information; creating a test case folder according to the test case identifier; and determining the test case information according to the binding test case information and the test case identification.
Optionally, the running test case represented by the test case information obtains a test case running result, including: in response to detecting that the target front-end testing tool is started and the current process is the main process, at least one subprocess is created according to the number of processors included in the current server; opening the case test page link in any one of the at least one subprocess to display a case test page; generating a case test page size set according to the case test page; and for each case test page size in the case test page size set, running the test case information according to the case test page size to obtain a test case running result.
Optionally, the running of the test case information according to the size of the test page of the case to obtain a running result of the test case includes: according to the test case information, carrying out event binding processing on page elements included in the case test page to obtain binding events corresponding to the page elements; executing binding events corresponding to page elements included in the use case test page to obtain event execution results; and carrying out screenshot processing on the event execution result to obtain a screenshot of the event execution result as a test case operation result.
Optionally, the method further comprises: determining whether the case test page links change or not; and responding to the change of the case test page links, and displaying the case test page corresponding to the case test page links before the change.
Optionally, after the generating the test case identifier, the method further includes: creating a test case folder according to the test case identifier; and after the test case represented by the test case information is operated to obtain the test case operation result, the method further comprises the following steps: and storing the test case operation result into the test case folder.
Optionally, the method further comprises: and sending the test case operation result to the associated terminal equipment, so that the terminal equipment displays the test case operation result.
In a second aspect, some embodiments of the present disclosure provide a test case execution apparatus, the apparatus including: the intercepting unit is configured to respond to the received case test page link information and conduct page intercepting processing on the case test page corresponding to the case test page link information to obtain a case test page screenshot; the image recognition unit is configured to perform image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set; the generating unit is configured to generate test case information according to the case test page module information set and the event information set to be bound; the operation unit is configured to operate the test cases represented by the test case information to obtain test case operation results.
Optionally, the image recognition unit is further configured to: and inputting the case test page screenshot into a case test page identification model to obtain a case test page module information set and a to-be-bound event information set.
Optionally, the case test page identification model includes a case test page division sub-model and a case test module binding sub-model.
Optionally, the apparatus further comprises a training unit configured to: the case test module binding sub-model is obtained through training the following steps: obtaining a sample set, wherein a sample in the sample set comprises a sample case test page module and sample binding event information corresponding to the sample case test page module; the following training steps are performed based on the sample set: respectively inputting sample case test page modules of at least one sample in a sample set into an initial neural network to obtain prediction binding event information corresponding to each sample in the at least one sample; comparing the predicted binding event information corresponding to each sample in the at least one sample with the corresponding sample binding event information; determining whether the initial neural network reaches a preset optimization target according to the comparison result; and in response to determining that the initial neural network reaches the optimization target, taking the initial neural network as a use case test page recognition model with the training completed.
Optionally, the training unit is further configured to: in response to determining that the initial neural network does not meet the optimization objective, adjusting network parameters of the initial neural network, and using unused samples to form a sample set, using the adjusted initial neural network as the initial neural network, again performing the training step.
Optionally, the generating unit is further configured to: binding the case test page module information set and the event information set to be bound to obtain binding test case information; generating a test case identifier according to the binding test case information; creating a test case folder according to the test case identifier; and determining the test case information according to the binding test case information and the test case identification.
Optionally, the execution unit is further configured to: in response to detecting that the target front-end testing tool is started and the current process is the main process, at least one subprocess is created according to the number of processors included in the current server; opening the case test page link in any one of the at least one subprocess to display a case test page; generating a case test page size set according to the case test page; and for each case test page size in the case test page size set, running the test case information according to the case test page size to obtain a test case running result.
Optionally, the execution unit is further configured to: according to the test case information, carrying out event binding processing on page elements included in the case test page to obtain binding events corresponding to the page elements; executing binding events corresponding to page elements included in the use case test page to obtain event execution results; and carrying out screenshot processing on the event execution result to obtain a screenshot of the event execution result as a test case operation result.
Optionally, the apparatus further comprises a determining unit and a retracting unit, the determining unit being configured to: determining whether the case test page links change or not; the retract unit is configured to: and responding to the change of the case test page links, and displaying the case test page corresponding to the case test page links before the change.
Optionally, the device further includes a creating unit configured to create a test case folder according to the test case identifier, and a storage unit configured to store the test case operation result into the test case folder.
Optionally, the device further includes a sending unit configured to send the test case operation result to an associated terminal device, so that the terminal device displays the test case operation result.
In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors causes the one or more processors to implement the method described in any of the implementations of the first aspect above.
In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect above.
In a fifth aspect, some embodiments of the present disclosure provide a computer program product comprising a computer program which, when executed by a processor, implements the method described in any of the implementations of the first aspect above.
By the test case operation method of some embodiments of the present disclosure, the speed and efficiency of performing the interface test can be improved. Specifically, the interface test is performed at a slower rate, and the reason for the lower interface test efficiency is that: the developer builds and manually writes in the test case, the operation is complicated, the requirement on the developer is high, the developer is required to be familiar with interface design, the interface test speed is low, and the interface test efficiency is low. Based on this, in the test case operation method of some embodiments of the present disclosure, first, in response to receiving a test case page link, a page interception process is performed on a page corresponding to the test case page link, so as to obtain a screenshot of the test case page. Thus, a screenshot of the page to be tested can be obtained. And then, carrying out image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set. Therefore, the case test page module information set required to be tested in the interface test and the event information to be bound with each case test page module information to be bound can be determined. And secondly, generating test case information according to the case test page module information set and the event information set to be bound. Thus, test case information for performing the interface test can be obtained. And then, running the test case characterized by the test case information to obtain a test case running result. Therefore, the test case running result can be checked again. Because the case test page screenshot is subjected to image recognition processing, a case test page module information set and an event information set to be bound are obtained, and test case information is generated. The method can avoid the situation that a developer with higher standard is required to build and write the test case manually, and realize the automatic generation of the test case, thereby improving the speed and efficiency of interface test.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is an architecture diagram of an exemplary system in which some embodiments of the present disclosure may be applied;
FIG. 2 is a flow chart of some embodiments of a test case run method according to the present disclosure;
FIG. 3 is a flow chart of other embodiments of test case operation methods according to the present disclosure;
FIG. 4 is a schematic structural diagram of some embodiments of a test case execution device according to the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Operations such as collection, storage, use, etc. of personal information (e.g., cookies) of a user involved in the present disclosure, and before performing the corresponding operations, the relevant organization or individual is up to the end to include carrying out personal information security impact assessment, fulfilling informed obligations to the personal information body, obtaining authorized consent of the personal information body in advance, etc.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
FIG. 1 illustrates an exemplary system architecture 100 of a test case execution method or test case execution device to which some embodiments of the present disclosure may be applied.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a web browser application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices having a display screen and supporting page display of a database system, including but not limited to smartphones, tablets, electronic book readers, laptop and desktop computers, and the like. When the terminal devices 101, 102, 103 are software, they can be installed in the above-listed electronic devices. It may be implemented as a plurality of software or software modules, for example, for providing distributed services, or as a single software or software module. The present invention is not particularly limited herein.
The server 105 may be a server providing various services, such as a background web server/background server providing support for web pages/information displayed on the terminal devices 101, 102, 103. The background web server/background server may analyze the received data such as the web page request, and feed back the processing result (e.g., web page data) to the terminal device.
It should be noted that the database operation execution method provided by the embodiment of the present disclosure may be executed by the server 105. Accordingly, the database operation execution means may be provided in the server 105.
With continued reference to FIG. 2, a flow 200 of some embodiments of a test case execution method according to the present disclosure is shown. The test case operation method comprises the following steps:
step 201, in response to receiving the case test page link information, performing a page interception process on the case test page corresponding to the case test page link information to obtain a case test page screenshot.
In some embodiments, an execution body (such as a computing device) of the test case running method may respond to receiving the case test page link information from the front end through a wired connection manner or a wireless connection manner, and perform a page interception process on a case test page corresponding to the case test page link information to obtain a case test page screenshot. The case test page link information may be URL (Uniform Resource Locator ). The use case test page may be a page that may be presented through a URL. In practice, the front end may write the user login information into domains included in the URL in the form of a written cookie, and send the written URL to the execution body. The user login information may be information describing a user account number or a password. In response to receiving the URL, the execution body may perform a page interception process on a page corresponding to the URL through a Cypress technology, to obtain a case test page screenshot. Thus, a screenshot of the page to be tested can be obtained. It should be noted that the wireless connection may include, but is not limited to, 3G/4G connections, wiFi connections, bluetooth connections, wiMAX connections, zigbee connections, UWB (ultra wideband) connections, and other now known or later developed wireless connection means.
And 202, performing image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set.
In some embodiments, the execution body may perform image recognition processing on the case test page screenshot to obtain a set of case test page module information and a set of event information to be bound. The case test page module information in the case test page module information set corresponds to the event information to be bound in the event information to be bound one by one. The case test page module information may be information representing a part of pages in the case test page. The event information to be bound can be information representing an event waiting to be bound with the case test page module information. As an example, the case test page module information may be: the oval module-button, the event information to be bound corresponding to the case test page module information may be: clicking. As yet another example, the case test page module information may be: the text- "input" character, the event information to be bound corresponding to the case test page module information may be: and (5) inputting. As yet another example, the case test page module information may be: the text- "select" character, the event information to be bound corresponding to the case test page module information may be: clicking. In practice, firstly, an image recognition process can be performed on a case test page screenshot by adopting a target detection technology, so as to obtain a case test page module information set. And then, determining the to-be-bound event information corresponding to each case test page module information in the case test page module information set according to a preset page module to-be-bound relation comparison table to obtain the to-be-bound event information set. The comparison table of the to-be-bound relation of the preset page module may be a comparison table for representing a corresponding relation between the information of the case test page module and the to-be-bound event information. Therefore, the case test page module information set required to be tested in the interface test and the event information to be bound with each case test page module information to be bound can be determined.
In some optional implementations of some embodiments, the execution body may input the case test page screenshot to a case test page identification model to obtain a set of case test page module information and a set of event information to be bound. The case test page recognition model may be a neural network model (e.g., CNN model) that is pre-trained and takes a screenshot of a case test page as input and takes a set of information of a case test page module and a set of information of an event to be bound as output. Therefore, the case test page module information set and the event information set to be bound can be obtained through the case test page identification model.
Alternatively, the case test page identification model may include a case test page division sub-model and a case test module binding sub-model. The case test page division sub-model may be a model for a case test page division module. The input of the case test page division sub-model may be a case test page screenshot, and the output may be a case test page module set. In practice, the case test page division sub-model may divide the case test page into a preset number of case test page modules, and delete case test page modules satisfying a preset invalid condition in the preset number of case test page modules, so as to obtain a set of case test page modules for inputting a case test module binding sub-model. The preset invalid condition may be that the color values of the case test page modules are #ffffffff. For example, the preset number may be 16.
Alternatively, the case test module binding sub-model may be trained by:
first, a sample set is obtained. The samples in the sample set comprise a sample case test page module and sample binding event information corresponding to the sample case test page module.
Second, the following training steps are performed based on the sample set:
in the first substep, a sample case test page module of at least one sample in a sample set is respectively input into an initial neural network to obtain predicted binding event information corresponding to each sample in the at least one sample. The initial neural network may be various neural networks, such as a convolutional neural network, a deep neural network, and the like, capable of obtaining predicted binding event information according to the sample use case test page module.
And a second sub-step of comparing the predicted binding event information corresponding to each of the at least one sample with the corresponding sample binding event information.
And a third sub-step of determining whether the initial neural network reaches a preset optimization target according to the comparison result. The optimization target may be that the accuracy of the predicted binding event information generated by the initial neural network is greater than a preset accuracy threshold.
And a fourth sub-step, in response to determining that the initial neural network reaches the optimization target, using the initial neural network as a use case test page recognition model with training completed.
And a fifth sub-step of, in response to determining that the initial neural network has not reached the optimization objective, adjusting network parameters of the initial neural network, and forming a sample set using unused samples, and performing the training step again using the adjusted initial neural network as the initial neural network. As an example, the network parameters of the initial neural network described above may be adjusted using a back propagation algorithm (Back Propgation Algorithm, BP algorithm) and a gradient descent method (e.g., a random small batch gradient descent algorithm).
And 203, generating test case information according to the test case page module information set and the event information set to be bound.
In some embodiments, the execution body may generate test case information according to the set of case test page module information and the set of event information to be bound. In practice, the module information of each case test page and the corresponding event information to be bound can be bound to obtain a module bound event information set, and each module bound event information in the module bound event information set is combined into the test case information. Thus, test case information for performing the interface test can be obtained.
In some optional implementations of some embodiments, first, the execution body may perform binding processing on the set of case test page module information and the set of event information to be bound to obtain binding test case information. In practice, the module information of each case test page and the corresponding event information to be bound can be bound to obtain a module bound event information set, and each module bound event information in the module bound event information set is combined into bound test case information. Then, a test case identification may be generated according to the binding test case information. The test case identifier can uniquely identify the binding test case information. In practice, the function uuid function can be used to generate the test case identification according to the binding test case information. Finally, the test case information can be determined according to the binding test case information and the test case identification. In practice, the binding test case information and the test case identifier may be combined into test case information. Thus, the determined test case information may include a test case identification.
And 204, running the test case characterized by the test case information to obtain a test case running result.
In some embodiments, the execution body may execute the test case represented by the test case information to obtain a test case running result. The test case operation result can be stored in a server in a json mode. Therefore, the test case running result can be checked again.
In some alternative implementations of some embodiments, first, in response to detecting that the target front-end test tool is started, and that the current process is the master process, at least one sub-process may be created based on the number of processors included by the current server. The target front-end testing tool may be a cytopress tool. The number of processors may be the number of CPUs (central processing unit), central processing units. The number of created sub-processes is the same as the number of processors. And secondly, opening the case test page link in any one of the at least one subprocess to display the case test page. Therefore, the main process management and the sub-process multithreading operation test service can be realized. Then, according to the case test page, a set of case test page sizes can be generated. In practice, at least one page size may be determined from the case test page as the case test page size, to obtain a set of case test page sizes. For example, the case test page size may be: 750p, 1080p. And finally, for each case test page size in the case test page size set, running the test case information according to the case test page size to obtain a test case running result. Thus, test cases can be executed for each case test page size.
Optionally, the running of the test case information according to the size of the test page of the case to obtain a running result of the test case includes: firstly, according to the test case information, event binding processing can be performed on page elements included in the case test page, and binding events corresponding to the page elements can be obtained. In practice, event binding processing may be performed on a page element (DOM) included in the use case test page according to the to-be-bound event information recorded in the test case information, so as to obtain a binding event corresponding to the page element. And secondly, binding events corresponding to page elements included in the use case test page can be executed, and an event execution result is obtained. And finally, carrying out screenshot processing on the event execution result to obtain a screenshot of the event execution result as a test case operation result. Thus, the test case operation result can be obtained.
Alternatively, first, it may be determined whether the above-described use case test page links change. And secondly, responding to the change of the case test page links, and displaying the case test page corresponding to the case test page links before the change. Thus, jumps to other URLs can be avoided.
Optionally, after the generating the test case identifier, the method may further include: a test case folder can be created according to the test case identification. In practice, the above test case identification may be used as a folder name to create a folder.
Alternatively, the test case running result may be stored in the test case folder. Therefore, cloud storage of test case operation results can be achieved.
By the test case operation method of some embodiments of the present disclosure, the speed and efficiency of performing the interface test can be improved. Specifically, the interface test is performed at a slower rate, and the reason for the lower interface test efficiency is that: the developer builds and manually writes in the test case, the operation is complicated, the requirement on the developer is high, the developer is required to be familiar with interface design, the interface test speed is low, and the interface test efficiency is low. Based on this, in the test case operation method of some embodiments of the present disclosure, first, in response to receiving a test case page link, a page interception process is performed on a page corresponding to the test case page link, so as to obtain a screenshot of the test case page. Thus, a screenshot of the page to be tested can be obtained. And then, carrying out image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set. Therefore, the case test page module information set required to be tested in the interface test and the event information to be bound with each case test page module information to be bound can be determined. And secondly, generating test case information according to the case test page module information set and the event information set to be bound. Thus, test case information for performing the interface test can be obtained. And then, running the test case characterized by the test case information to obtain a test case running result. Therefore, the test case running result can be checked again. Because the case test page screenshot is subjected to image recognition processing, a case test page module information set and an event information set to be bound are obtained, and test case information is generated. The method can avoid the situation that a developer with higher standard is required to build and write the test case manually, and realize the automatic generation of the test case, thereby improving the speed and efficiency of interface test.
With further reference to FIG. 3, a flow 300 of further embodiments of a test case execution method is shown. The process 300 of the test case operation method includes the following steps:
step 301, in response to receiving the case test page link information, performing a page interception process on the case test page corresponding to the case test page link information to obtain a screenshot of the case test page.
And step 302, performing image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set.
And 303, generating test case information according to the test case page module information set and the event information set to be bound.
And step 304, running the test case characterized by the test case information to obtain a test case running result.
In some embodiments, the specific implementation of steps 301 to 304 and the technical effects thereof may refer to steps 201 to 204 in those embodiments corresponding to fig. 2, and will not be described herein.
Step 305, the test case operation result is sent to the associated terminal equipment, so that the terminal equipment displays the test case operation result.
In some embodiments, the execution body may send the test case running result to an associated terminal device, so that the terminal device displays the test case running result. The above-mentioned associated terminal device may be a terminal device of a developer. Therefore, the test case operation result display with high readability can be provided for the developer.
As can be seen from fig. 3, compared with the description of some embodiments corresponding to fig. 2, the process 300 of the test case operation method in some embodiments corresponding to fig. 3 embodies the step of sending the test case operation result to the associated terminal, so that the terminal expands the display of the test case operation result. Therefore, the scheme described by the embodiments can provide the developer with test case operation result display with higher readability.
With further reference to FIG. 4, as an implementation of the method illustrated in the above figures, the present disclosure provides some embodiments of a test case execution apparatus, which correspond to those method embodiments illustrated in FIG. 2, and which are particularly applicable to various electronic devices.
As shown in fig. 4, the test case running apparatus 400 of some embodiments includes: an interception unit 401, an image recognition unit 402, a generation unit 403, and an operation unit 404. The intercepting unit 401 is configured to respond to receiving the case test page link information, and perform page interception processing on the case test page corresponding to the case test page link information to obtain a case test page screenshot; the image recognition unit 402 is configured to perform image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set; the generating unit 403 is configured to generate test case information according to the above-mentioned case test page module information set and the above-mentioned event information set to be bound; the operation unit 404 is configured to operate the test case represented by the test case information, so as to obtain a test case operation result.
Optionally, the image recognition unit may be further configured to: and inputting the case test page screenshot into a case test page identification model to obtain a case test page module information set and a to-be-bound event information set.
Optionally, the case test page identification model includes a case test page division sub-model and a case test module binding sub-model.
Optionally, the apparatus may further include a training unit configured to: the case test module binding sub-model is obtained through training the following steps: obtaining a sample set, wherein a sample in the sample set comprises a sample case test page module and sample binding event information corresponding to the sample case test page module; the following training steps are performed based on the sample set: respectively inputting sample case test page modules of at least one sample in a sample set into an initial neural network to obtain prediction binding event information corresponding to each sample in the at least one sample; comparing the predicted binding event information corresponding to each sample in the at least one sample with the corresponding sample binding event information; determining whether the initial neural network reaches a preset optimization target according to the comparison result; and in response to determining that the initial neural network reaches the optimization target, taking the initial neural network as a use case test page recognition model with the training completed.
Optionally, the training unit may be further configured to: in response to determining that the initial neural network does not meet the optimization objective, adjusting network parameters of the initial neural network, and using unused samples to form a sample set, using the adjusted initial neural network as the initial neural network, again performing the training step.
Optionally, the generating unit may be further configured to: binding the case test page module information set and the event information set to be bound to obtain binding test case information; generating a test case identifier according to the binding test case information; creating a test case folder according to the test case identifier; and determining the test case information according to the binding test case information and the test case identification.
Optionally, the execution unit may be further configured to: in response to detecting that the target front-end testing tool is started and the current process is the main process, at least one subprocess is created according to the number of processors included in the current server; opening the case test page link in any one of the at least one subprocess to display a case test page; generating a case test page size set according to the case test page; and for each case test page size in the case test page size set, running the test case information according to the case test page size to obtain a test case running result.
Optionally, the execution unit may be further configured to: according to the test case information, carrying out event binding processing on page elements included in the case test page to obtain binding events corresponding to the page elements; executing binding events corresponding to page elements included in the use case test page to obtain event execution results; and carrying out screenshot processing on the event execution result to obtain a screenshot of the event execution result as a test case operation result.
Optionally, the apparatus may further include a determining unit and a retracting unit, the determining unit being configured to: determining whether the case test page links change or not; the retract unit is configured to: and responding to the change of the case test page links, and displaying the case test page corresponding to the case test page links before the change.
Optionally, the device may further include a creating unit configured to create a test case folder according to the test case identifier, and a storage unit configured to store the test case operation result into the test case folder.
Optionally, the apparatus may further include a sending unit configured to send the test case operation result to an associated terminal device, so that the terminal device displays the test case operation result.
It will be appreciated that the elements described in the test case manipulation device 400 correspond to the individual steps of the method described with reference to fig. 2. Thus, the operations, features, and beneficial effects described above with respect to the method are equally applicable to the test case running apparatus 400 and the units included therein, and are not described herein again.
Referring now to FIG. 5, a schematic diagram of an electronic device 500 (e.g., computing device 101 shown in FIG. 1) suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 5 is merely an example and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 5, the electronic device 500 may include a processing means 501 (e.g., a central processor, a graphics processor, etc.) that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 shows an electronic device 500 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 5 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communications device 509, or from the storage device 508, or from the ROM 502. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing device 501.
It should be noted that, the computer readable medium described in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (Hyper Text Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: responding to the received case test page link information, and carrying out page interception processing on a case test page corresponding to the case test page link information to obtain a case test page screenshot; carrying out image recognition processing on the case test page screenshot to obtain a case test page module information set and an event information set to be bound; generating test case information according to the case test page module information set and the event information set to be bound; and operating the test case characterized by the test case information to obtain a test case operation result.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes an intercept unit, an image recognition unit, a generation unit, and an execution unit. The names of the units do not form a limitation on the unit itself in a certain case, for example, the interception unit may also be described as a unit for performing, in response to receiving the case test page link information, page interception processing on the case test page corresponding to the case test page link information to obtain a screenshot of the case test page.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
Some embodiments of the present disclosure also provide a computer program product comprising a computer program which, when executed by a processor, implements any of the test case running methods described above.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.

Claims (14)

1. A test case operation method, comprising:
responding to received case test page link information, and carrying out page interception processing on a case test page corresponding to the case test page link information to obtain a case test page screenshot;
performing image recognition processing on the case test page screenshot to obtain a case test page module information set and an event information set to be bound;
generating test case information according to the case test page module information set and the event information set to be bound;
and operating the test case characterized by the test case information to obtain a test case operation result.
2. The method of claim 1, wherein the performing image recognition processing on the case test page screenshot to obtain a set of case test page module information and a set of event information to be bound, comprises:
and inputting the case test page screenshot into a case test page identification model to obtain a case test page module information set and a to-be-bound event information set.
3. The method of claim 2, wherein the case test page identification model includes a case test page division sub-model and a case test module binding sub-model; and
the case test module binding sub-model is obtained through training the following steps:
obtaining a sample set, wherein a sample in the sample set comprises a sample case test page module and sample binding event information corresponding to the sample case test page module;
the following training steps are performed based on the sample set:
respectively inputting sample case test page modules of at least one sample in a sample set into an initial neural network to obtain prediction binding event information corresponding to each sample in the at least one sample;
comparing predicted binding event information corresponding to each sample of the at least one sample with corresponding sample binding event information;
Determining whether the initial neural network reaches a preset optimization target according to the comparison result;
and in response to determining that the initial neural network reaches the optimization target, taking the initial neural network as a use case test page recognition model with the training completed.
4. The method of claim 3, wherein training the case test module to bind a sub-model further comprises:
in response to determining that the initial neural network does not meet the optimization objective, adjusting network parameters of the initial neural network, and using the unused samples to form a sample set, using the adjusted initial neural network as the initial neural network, again performing the training step.
5. The method of claim 1, wherein the generating test case information according to the set of case test page module information and the set of event information to be bound comprises:
binding the case test page module information set and the event information set to be bound to obtain binding test case information;
generating a test case identifier according to the binding test case information;
and determining the test case information according to the binding test case information and the test case identification.
6. The method of claim 1, wherein the running the test case characterized by the test case information to obtain a test case running result comprises:
in response to detecting that the target front-end testing tool is started and the current process is the main process, at least one subprocess is created according to the number of processors included in the current server;
opening the case test page link in any one of the at least one subprocess to display a case test page;
generating a case test page size set according to the case test page;
and for each case test page size in the case test page size set, running the test case information according to the case test page size to obtain a test case running result.
7. The method of claim 5, wherein the running the test case information according to the test case test page size to obtain a test case running result comprises:
according to the test case information, carrying out event binding processing on page elements included in the case test page to obtain binding events corresponding to the page elements;
executing binding events corresponding to page elements included in the use case test page to obtain event execution results;
And carrying out screenshot processing on the event execution result to obtain a screenshot of the event execution result as a test case operation result.
8. The method of claim 6, wherein the method further comprises:
determining whether the case test page link changes;
and responding to the change of the case test page link, and displaying the case test page corresponding to the case test page link before the change.
9. The method of claim 5, wherein after the generating test case identification, the method further comprises:
creating a test case folder according to the test case identifier;
and after the test case represented by the test case information is operated to obtain a test case operation result, the method further comprises the following steps:
and storing the test case operation result into the test case folder.
10. The method according to one of claims 1-9, wherein the method further comprises:
and sending the test case operation result to the associated terminal equipment, so that the terminal equipment displays the test case operation result.
11. A test case running device comprising:
The intercepting unit is configured to respond to receiving the case test page link information, and carry out page intercepting processing on a case test page corresponding to the case test page link information to obtain a case test page screenshot;
the image recognition unit is configured to perform image recognition processing on the case test page screenshot to obtain a case test page module information set and a to-be-bound event information set;
the generating unit is configured to generate test case information according to the case test page module information set and the event information set to be bound;
and the operation unit is configured to operate the test cases represented by the test case information to obtain test case operation results.
12. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-10.
13. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of claims 1-10.
14. A computer program product comprising a computer program which, when executed by a processor, implements the method of any of claims 1-10.
CN202310620171.3A 2023-05-29 2023-05-29 Test case operation method, device, electronic equipment, medium and program product Pending CN116680174A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310620171.3A CN116680174A (en) 2023-05-29 2023-05-29 Test case operation method, device, electronic equipment, medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310620171.3A CN116680174A (en) 2023-05-29 2023-05-29 Test case operation method, device, electronic equipment, medium and program product

Publications (1)

Publication Number Publication Date
CN116680174A true CN116680174A (en) 2023-09-01

Family

ID=87784717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310620171.3A Pending CN116680174A (en) 2023-05-29 2023-05-29 Test case operation method, device, electronic equipment, medium and program product

Country Status (1)

Country Link
CN (1) CN116680174A (en)

Similar Documents

Publication Publication Date Title
CN111061956B (en) Method and apparatus for generating information
CN111177617A (en) Web direct operation and maintenance method and device based on operation and maintenance management system and electronic equipment
CN111459364B (en) Icon updating method and device and electronic equipment
CN109902446B (en) Method and apparatus for generating information prediction model
CN111596991A (en) Interactive operation execution method and device and electronic equipment
CN113590974A (en) Recommendation page configuration method and device, electronic equipment and computer readable medium
CN110765386A (en) Webpage image monitoring method and device, electronic equipment and readable storage medium
CN111596992B (en) Navigation bar display method and device and electronic equipment
CN116302271A (en) Page display method and device and electronic equipment
CN116680174A (en) Test case operation method, device, electronic equipment, medium and program product
CN111062995B (en) Method, apparatus, electronic device and computer readable medium for generating face image
CN110084298B (en) Method and device for detecting image similarity
CN111767290B (en) Method and apparatus for updating user portraits
CN113296771A (en) Page display method, device, equipment and computer readable medium
CN113486749A (en) Image data collection method, device, electronic equipment and computer readable medium
CN112464039A (en) Data display method and device of tree structure, electronic equipment and medium
CN112434619A (en) Case information extraction method, case information extraction device, case information extraction equipment and computer readable medium
CN112035092A (en) Form processing method, device, equipment and readable medium
CN112311842A (en) Method and device for information interaction
CN111581246A (en) Method, device, electronic equipment and computer readable medium for generating data
CN111538552A (en) Gift panel configuration method and device, readable medium and electronic equipment
CN111309323A (en) Parameter initialization method and device and electronic equipment
CN111767486A (en) Method, device, electronic equipment and computer readable medium for displaying page
CN110795670A (en) Webpage image monitoring method and device, electronic equipment and readable storage medium
CN111787043A (en) Data request method and device

Legal Events

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