CN111240992A - Test method and device, storage medium and electronic equipment - Google Patents

Test method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN111240992A
CN111240992A CN202010065012.8A CN202010065012A CN111240992A CN 111240992 A CN111240992 A CN 111240992A CN 202010065012 A CN202010065012 A CN 202010065012A CN 111240992 A CN111240992 A CN 111240992A
Authority
CN
China
Prior art keywords
test
trigger
data
queue
test result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010065012.8A
Other languages
Chinese (zh)
Other versions
CN111240992B (en
Inventor
石伍昱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202010065012.8A priority Critical patent/CN111240992B/en
Publication of CN111240992A publication Critical patent/CN111240992A/en
Application granted granted Critical
Publication of CN111240992B publication Critical patent/CN111240992B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • 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
    • 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

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)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The disclosure provides a testing method and device, electronic equipment and a computer readable storage medium, and relates to the technical field of automatic testing. The test method comprises the following steps: initializing a test unit queue and a test result queue, wherein the test unit queue comprises a plurality of test units, testing corresponding triggers in each test unit, and the test result queue is used for storing test results of the test units; extracting the test unit from the test unit queue, and deploying environment data required by testing the corresponding trigger; when the environment data is deployed successfully, executing the action of the trigger and collecting data; and comparing the acquired data with expected data to obtain the test result and storing the test result in the test result queue. The method and the device can shorten the test period, simplify the test environment and solve the problem that the test result is difficult to judge.

Description

Test method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of automated testing technologies, and in particular, to a testing method, a testing apparatus, an electronic device, and a computer-readable storage medium.
Background
A trigger is a method provided to programmers and data analysts to ensure data integrity, and generally includes three parts, events, conditions, and actions. The workflow of the trigger may be as follows: when an event of a trigger is triggered, if the current trigger parameter meets the triggering condition, the action in the trigger is executed.
The application of triggers is very wide, for example, as the most basic logic unit in a general game copy, various triggers can be used together to realize the logic processing function in the game copy. In addition, in the application of the trigger, the test work of the trigger is inevitably involved. At the present stage, most of the testing work adopts a manual testing method, a large amount of human resources and working time are consumed, and meanwhile, the problems of complex and changeable testing environment, large testing workload, long testing period, difficulty in judging testing results and the like exist.
Therefore, it is desirable to provide a testing method that can simplify the testing environment, shorten the testing period, and reduce the manpower and time consumption.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
An object of the embodiments of the present disclosure is to provide a testing method, a testing apparatus, an electronic device, and a computer-readable storage medium, so as to solve the problems that a lot of human resources and working time are required to be consumed, a testing environment is complex and changeable, a testing workload is large, a testing period is long, and a testing result is difficult to determine in a process of testing a trigger.
According to a first aspect of the present disclosure, there is provided a test method comprising:
initializing a test unit queue and a test result queue, wherein the test unit queue comprises a plurality of test units, testing corresponding triggers in each test unit, and the test result queue is used for storing test results of the test units;
extracting the test unit from the test unit queue, and deploying environment data required by testing the corresponding trigger;
when the environment data is deployed successfully, executing the action of the trigger and collecting data;
and comparing the acquired data with expected data to obtain the test result and storing the test result in the test result queue.
In an exemplary embodiment of the present disclosure, the test unit includes a timer;
the environmental data required by the trigger corresponding to the deployment test includes:
and executing the deployment operation on the environment data until the time recorded by the timer is equal to the environment deployment time, wherein the environment deployment time is the time required for deploying the data.
In an exemplary embodiment of the present disclosure, the method further comprises:
setting a time threshold;
and when the time recorded by the timer exceeds the time threshold, stopping the deployment of the environment data, and setting the test result as test failure.
In an exemplary embodiment of the present disclosure, the test unit includes a timer;
the executing the action of the trigger and collecting data includes:
executing the action of the trigger and starting timing at the same time;
and when the time recorded by the timer reaches a preset time interval, acquiring data obtained by executing the action of the trigger, wherein the preset time interval is the shortest time interval from the execution of the action of the trigger to the acquisition of the data.
In an exemplary embodiment of the present disclosure, the performing the action of the trigger and collecting data includes:
and when a first test result of one first test unit meets the trigger information of a second test unit, executing the action of the trigger corresponding to the second test unit and collecting data, wherein the trigger information comprises the condition and the event of the trigger.
In an exemplary embodiment of the disclosure, the comparing the collected data with expected data to obtain the test result and storing the test result in the test result queue includes:
when the collected data is consistent with the expected data, setting the test result of the trigger to be passed and storing the test result in the test result queue;
and when the collected data is inconsistent or not completely consistent with the expected data, setting the test result of the trigger as test failure, and storing the test result and the collected data in the test result queue.
In an exemplary embodiment of the present disclosure, the method further comprises:
extracting the test unit at the head of the test unit queue, and testing the corresponding trigger in the test unit;
and storing the obtained test result to the tail of the test result queue, and deleting the test unit in the test unit queue until the queue length of the test unit queue is zero.
According to a second aspect of the present disclosure, there is provided a test apparatus comprising:
the device comprises an initialization module, a test unit queue and a test result queue, wherein the test unit queue comprises a plurality of test units, corresponding triggers are tested in the test units, and the test result queue is used for storing test results of the test units;
the deployment module is used for extracting the test unit from the test unit queue and deploying environment data required by testing the corresponding trigger;
the test module is used for executing the action of the trigger and collecting data when the environment data is deployed successfully;
and the comparison module is used for comparing the acquired data with expected data to obtain the test result and storing the test result in the test result queue.
According to a third aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any one of the above via execution of the executable instructions.
According to a fourth aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any one of the above.
Exemplary embodiments of the present disclosure may have some or all of the following benefits:
in the testing method provided by the disclosed example embodiment, first, a testing unit queue and a testing result queue are initialized, wherein the testing unit queue comprises a plurality of testing units, each testing unit corresponds to a trigger, the triggers are tested in the testing units, and the testing result queue is used for storing the testing results of the testing units; after the initialization of the test unit queue and the test result queue is completed, extracting the test unit from the test unit queue, and deploying environment data required by testing a corresponding trigger; and when the environment data is successfully deployed, executing the action of the trigger and acquiring data, and comparing the acquired data with expected data to obtain a test result and storing the test result in a test result queue. On one hand, in the testing method provided by the exemplary embodiment of the present disclosure, the testing of the trigger action is completed by deploying the environment data required by the trigger corresponding to the testing unit, that is, enabling the environment data to satisfy the event and the condition of the trigger executing the corresponding action, thereby simplifying the testing environment and improving the testing efficiency. In another aspect, the method compares the collected test data to expected data to obtain a test result. The problem that the test result is difficult to judge can be solved through the digitalized test result and the automatic judging process, and compared with a judging method based on manual experience, the accuracy of the obtained test result is higher, and the test quality and the efficiency of the trigger are improved. Meanwhile, the testing process is automatic, so that compared with a manual testing method, the number of testers is reduced, the testing period is shortened, the labor cost and the time cost are saved, and the problem that the testing environment is complex and various due to division of labor during testing can be solved by using a uniform testing environment.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
FIG. 1 is a diagram illustrating an exemplary system architecture to which a testing method and apparatus of embodiments of the present disclosure may be applied;
FIG. 2 illustrates a schematic structural diagram of a computer system suitable for use with the electronic device used to implement embodiments of the present disclosure;
FIG. 3 schematically illustrates a flow diagram of a testing method according to one embodiment of the present disclosure;
FIG. 4 schematically illustrates a test flow composition framework diagram of a test method for a particular application scenario according to the present disclosure;
FIG. 5 schematically illustrates a test flow diagram of a test unit in a test method according to a specific application scenario of the present disclosure;
FIG. 6 is a general test flow diagram schematically illustrating a test method according to a specific application scenario of the present disclosure;
FIG. 7 schematically shows a block diagram of a testing device according to one embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Fig. 1 is a schematic diagram illustrating a system architecture of an exemplary application environment to which a testing method and apparatus according to an embodiment of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include one or more of 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 terminal devices 101, 102, 103 may be various electronic devices having a display screen, including but not limited to desktop computers, portable computers, smart phones, tablet computers, and the like. 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. For example, server 105 may be a server cluster comprised of multiple servers, or the like.
The testing method provided by the embodiment of the present disclosure may be executed by the terminal devices 101, 102, and 103, and correspondingly, the testing apparatus may also be disposed in the terminal devices 101, 102, and 103. The testing method provided by the embodiment of the present disclosure may also be executed by the terminal devices 101, 102, and 103 and the server 105 together, and accordingly, the testing apparatus may be disposed in the terminal devices 101, 102, and 103 and the server 105. In addition, the testing method provided by the embodiment of the present disclosure may also be executed by the server 105, and accordingly, the testing apparatus may be disposed in the server 105, which is not particularly limited in the exemplary embodiment.
For example, in the present exemplary embodiment, at the start of a test, the server 105 initializes the test cell queue and the test result queue so as to test a corresponding trigger in a plurality of test cells of the test cell queue, and stores the test result of each test cell in the test result queue. After the initialization is completed, the plurality of mobile terminal devices 101, 102, and 103 extract the test unit from the test unit queue, and deploy the environmental data required for testing the trigger corresponding to the test unit. And when the environment data is deployed successfully, executing the action corresponding to the trigger, acquiring the data, comparing the acquired data with expected data to obtain a test result, and storing the test result in a test result queue.
FIG. 2 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present disclosure.
It should be noted that the computer system 200 of the electronic device shown in fig. 2 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments of the present disclosure.
As shown in fig. 2, the computer system 200 includes a Central Processing Unit (CPU)201 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)202 or a program loaded from a storage section 208 into a Random Access Memory (RAM) 203. In the RAM 203, various programs and data necessary for system operation are also stored. The CPU201, ROM 202, and RAM 203 are connected to each other via a bus 204. An input/output (I/O) interface 205 is also connected to bus 204.
The following components are connected to the I/O interface 205: an input portion 206 including a keyboard, a mouse, and the like; an output section 207 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 208 including a hard disk and the like; and a communication section 209 including a network interface card such as a LAN card, a modem, or the like. The communication section 209 performs communication processing via a network such as the internet. A drive 210 is also connected to the I/O interface 205 as needed. A removable medium 211 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 210 as necessary, so that a computer program read out therefrom is mounted into the storage section 208 as necessary.
A trigger is a method provided to programmers and data analysts to ensure data integrity, and generally includes three parts, events, conditions, and actions. The workflow of the trigger may be as follows: when an event of a trigger is triggered and the current parameter satisfies the trigger condition, the action in the trigger is executed.
The application of triggers is very wide, for example, as the most basic logic unit in a general game copy, various triggers can be used together to realize the logic processing function in the game copy. In addition, in the application of the trigger, the test work of the trigger is inevitably involved.
In order to achieve the above-mentioned test work on the flip-flop, the inventors have tentatively proposed the following two schemes:
the main idea of the first method is as follows: and distributing the test tasks to a plurality of testers, testing one or more triggers by each tester in respective test environment, and finally summarizing the test results of all the testers.
The main idea of the second method is: and testing all the triggers in sequence by the same tester in the same testing environment, and recording the testing result by taking the testing sequence as the basis.
However, the two methods have the following problems through practical verification: first, in the first method, the number of testers required for the test process is large, which results in high labor cost. Moreover, the test environment of each tester is not uniform, which causes the problem of complicated and variable test environment. Although the second method only needs one tester, which saves the labor cost, the whole testing process is completed by one tester, which needs a lot of working time, so that the testing period is longer, and the time cost is increased. In addition, because both methods adopt a manual test mode to manually perform a test process, whether the test result passes or fails needs to be judged according to the observation result and experience of a tester, but the test results of part of triggers are difficult to obtain a clear conclusion through observation, and the test results obtained based on manual judgment also have the problem of inaccuracy.
In order to solve the problems of complex and changeable test environment, long test period, high test cost, difficult judgment of test results and the like in the method, in the present exemplary embodiment, the inventor further provides a new technical solution, and the following describes the technical solution of the embodiment of the present disclosure in detail:
the present example embodiment first provides a test method. The test method may be applied to one or more of the terminal devices 101, 102, and 103, the server 105, and the terminal devices 101, 102, and 103 and the server 105. Referring to fig. 3, the testing method specifically includes the following steps:
step S310: initializing a test unit queue and a test result queue, wherein the test unit queue comprises a plurality of test units, testing corresponding triggers in each test unit, and the test result queue is used for storing test results of the test units;
step S320: extracting the test unit from the test unit queue, and deploying environment data required by testing the corresponding trigger;
step S330: when the environment data is deployed successfully, executing the action of the trigger and collecting data;
step S340: and comparing the acquired data with expected data to obtain the test result and storing the test result in the test result queue.
In the testing method provided by the exemplary embodiment, on one hand, the testing of the trigger action is completed by deploying the environment data required by the trigger corresponding to the testing unit, that is, enabling the environment data to meet the event and the condition of the trigger executing the corresponding action, so that the testing environment is simplified, and the testing efficiency is improved. In another aspect, the method compares the collected test data to expected data to obtain a test result. The problem that the test result is difficult to judge can be solved through the digitalized test result and the automatic judging process, and compared with a judging method based on manual experience, the accuracy of the obtained test result is higher, and the test quality and the efficiency of the trigger are improved. Meanwhile, the testing process is automatic, so that compared with a manual testing method, the number of testers is reduced, the testing period is shortened, the labor cost and the time cost are saved, and the problem that the testing environment is complex and various due to division of labor during testing can be solved by using a uniform testing environment.
Next, in another embodiment, the above steps are explained in more detail.
In step S310, a test unit queue and a test result queue are initialized, where the test unit queue includes a plurality of test units, a corresponding trigger is tested in each of the test units, and the test result queue is used to store test results of the test units.
In the present exemplary embodiment, first, a test unit queue and a test result queue are initialized, and a trigger to be tested is stored in the test unit queue, where the test unit queue is composed of a plurality of test units, and each test unit corresponds to one trigger, that is, the test operation of the corresponding trigger is completed in each test unit. And after the test is finished, storing the obtained test result in a test result queue.
The test method provided by the present exemplary embodiment can be applied to a test process of a trigger. The trigger consists of three parts of events, conditions and actions, and the work flow of the trigger is as follows: when the event of a trigger is triggered, if the current trigger parameter meets the triggering condition, the action in the trigger is executed, and the process indicates that the trigger is triggered once. In the testing method of the present disclosure, for example, the trigger may be applied in the field of games, for example, as the most basic logic unit in the game copy, and constitutes a logic processing function in the game copy. Thus, the testing process in the game development process also tests the trigger forming the game copy. It should be noted that the above scenario is only an exemplary illustration and is not limiting, and the application of the test method to the triggers applied to other fields also belongs to the protection scope of the present exemplary embodiment.
In the above-mentioned process of testing the corresponding trigger in the test unit, for example, the test unit may be composed of three parts, i.e., a start switch, a test process and a test result. The starting switch is the trigger information of the trigger and is composed of conditions and events, namely, in the test method, the conditions and the events of the trigger can be simplified into one switch, so that the effect of simplifying the test environment is achieved. The test flow comprises a test object and a rule unit, wherein the test object is the action of the trigger to be tested, and the rule unit is used for judging and obtaining a test result. It should be noted that the above definition of the test unit is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
Preferably, in this exemplary embodiment, the test cell queue is initialized to a queue with the number of test cells being the number of flip-flops to be tested, and the test result queue is initialized to an empty queue. Accordingly, the test procedure may be: firstly, taking out a test unit at the head of a test unit queue, executing a test flow of a corresponding trigger in the test unit, and adding an obtained test result to the tail of the test result queue after obtaining a test result; and then deleting the head of the test unit queue, judging the length of the test unit queue, and if the queue length is 0, ending the test flow. If the queue length is larger than 0, continuously taking out the head test unit of the test unit queue to test the trigger; and repeating the steps until the queue length of the test unit is 0, and finishing the automatic test process. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
In step S320, the test unit is extracted from the test unit queue, and environment data required for testing the corresponding trigger is deployed.
In the present exemplary embodiment, after the initialization of the test cell queue and the test result queue is completed, the test cell is obtained from the test cell queue according to a certain rule. For example, as described in step S310, when the test unit queue is not empty, each test unit may be sequentially obtained from the test unit queue, or a plurality of test units may be obtained simultaneously, which is not particularly limited in this exemplary embodiment.
In the test method provided in this exemplary embodiment, after the test unit is extracted, in order to test the trigger in the test unit, environment data required by a test environment in which the trigger is deployed is also required. The environment data is trigger information for triggering the action of the trigger corresponding to the test unit. That is, when testing, a test environment needs to be deployed to ensure that the actions of the trigger are successfully triggered. The above is a deployment process of the environment data, for example, as follows: setting a timer in the test unit for recording the time for deploying the environmental data; after the timer is initialized, the deployment operation of the environment data is executed until the time recorded by the timer is equal to the environment deployment time, wherein the environment deployment time is the time required for deploying the environment data.
Preferably, in the process of deploying the environment data, a time threshold may be preset, and when the time recorded by the timer exceeds the time threshold, the deployment of the environment data is stopped, and the test result is set as test failure. By the method, the situation that when the environmental data of one test unit is unsuccessfully deployed, too long time is consumed in the test unit can be avoided, so that the test time can be saved, and the test efficiency can be improved. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
In step S330, when the environmental data is successfully deployed, the action of the trigger is executed and data is collected.
In the present exemplary embodiment, after the environment data is successfully deployed, the successfully deployed environment data is transferred to the trigger, and at this time, the trigger information of the trigger is satisfied, and the start switch in the test unit is turned on, and the action of the trigger is executed and the data is collected. The data is the data generated by executing the action of the trigger, and the method for collecting the data can be realized by the following processes, for example: setting a timer in the test unit for recording the time for waiting for data acquisition; initializing the timer, executing the action of the trigger and starting timing at the same time; and when the time recorded by the timer reaches a preset time interval, acquiring data obtained by executing the action of the trigger, wherein the preset time interval is the shortest time interval from the execution of the action of the trigger to the acquisition of the data. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
In addition, in this exemplary embodiment, the first test result of one first test unit may be used as the trigger information of the trigger corresponding to another second test unit, and when the first test result satisfies the trigger information of the second test unit, the action of the trigger corresponding to the second test unit is executed and data is collected. In the situation, the test result of one test unit is used as the starting switch of the other test unit, and the whole process can be automatically executed only by manually opening the starting switch of the first test unit, so that the effects of saving the labor cost, shortening the test period and improving the test efficiency can be achieved. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
In step S340, the collected data is compared with the expected data to obtain the test result, and the test result is stored in the test result queue.
In the present exemplary embodiment, after the data generated by executing the trigger action is collected through the processes in steps S310 to S330, the collected data is compared with the expected data to obtain a test result, and the obtained test result is stored in the test result queue. The specific implementation of the process may be as follows, for example: comparing the acquired data with expected data, and setting the test result of the trigger to pass the test and storing the test result in the test result queue when the acquired data is consistent with the expected data; and when the collected data is inconsistent or not completely consistent with the expected data, setting the test result of the trigger as test failure.
Preferably, when the test result is judged to be not passed, the test result is stored in the test result queue, and the acquired data is also stored in the test result queue, so that the data is used for analyzing the reason of the test failure. In addition, the problem that the test result is difficult to judge can be solved through the digitalized test result and the automatic judging process, and compared with a judging method based on manual experience, the accuracy of the obtained test result is higher, and the test quality and the efficiency of the trigger are improved.
It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
Next, the test method in the present exemplary embodiment is further described with reference to specific scenarios shown in fig. 4 to 6.
In the testing method provided in this specific application scenario, a schematic diagram of a composition framework of an automated testing process for a trigger is shown in fig. 4, and is composed of a testing unit queue 410 and a testing result queue 420. The test unit queue is formed by arranging a plurality of test units in sequence. Each test unit comprises a starting switch, a test flow and a test result. The start switch is a switch for controlling whether the test unit starts a test procedure. The test flow comprises a test object and a rule unit. The test object is the action of the trigger in the specific application scenario. The rule unit comprises environment data, a timer and expected data and is used for judging and obtaining a test result. The result unit queue is used for storing the test result data of each test unit.
In this specific application scenario, a test flow corresponding to a trigger is performed in each test unit, and the test flow in a single test unit is shown in fig. 5, which specifically includes the following steps:
in step S510, the test flow is started.
In this specific application scenario, the start switch is a switch that controls whether the test unit starts the test process, and is in a closed state before the test starts, and the start switch may be manually turned on, or turned on by the test result of other test units. When the starting switch of one test unit is turned on, the test unit can complete the complete test process from the start of the test until the test result is obtained.
The mode of controlling the test process by using the starting switch can automatically execute the whole process, thereby achieving the effects of saving the labor cost, shortening the test period and improving the test efficiency.
In step S520, the environment data is deployed.
In this specific application scenario, for a trigger action, the environment data is data required for the trigger action to be successfully executed. That is, the test environment is made to satisfy the conditions and events of the trigger. What is done in this step is deployment work for the environment data.
In step S530, the deployment time of the environmental data is timed by the timer.
In this specific application scenario, whether the environment data deployment is completed is judged by the timer in the rule unit, which is specifically implemented as follows: initializing the timer, recording the time for deploying the environmental data by using the timer, and when the time recorded by the timer is less than the deployment time of the environmental data, jumping to step S520 until the time recorded by the timer is equal to the deployment time of the environment, wherein the deployment time of the environment is the time required for deploying the environmental data.
In the process of deploying the environment data, a time threshold value can be preset, and when the time recorded by the timer exceeds the time threshold value, deployment of the environment data is stopped, and the test result is set as test failure. By the method, the situation that when the environmental data of one test unit is unsuccessfully deployed, too long time is consumed in the test unit can be avoided, so that the test time can be saved, and the test efficiency can be improved.
In step S540, the environment data deployment is completed.
In this specific application scenario, when the time recorded by the timer reaches the deployment time of the environmental data, the deployment of the environmental data is completed, and the deployed environmental data is transmitted to the trigger.
In step S550, the trigger operation is executed.
In the specific application scenario, when the environmental data is successfully deployed, the trigger information of the trigger is satisfied, and the test flow starts to execute the action of the trigger.
In step S560, the trigger performs an action.
In step S570, the time of data acquisition is counted using a timer.
In this specific application scenario, the timer may be further configured to record time used for waiting to acquire data, where the data acquisition is specifically implemented as follows: initializing the timer, executing the action of the trigger, starting timing at the same time, and jumping to step S560 when the waiting time recorded in the timer does not reach the preset time interval; when the time recorded by the timer reaches a preset time interval, the step S580 is skipped, wherein the preset time interval is the shortest time interval from the execution of the action of the trigger to the collection of the data.
In step S580, data obtained by the trigger executing the action is collected.
In step S590, the collected data is compared with expected data,
in the specific application scenario, the expected data is stored in the rule unit and is data corresponding to the acquired data one by one, and whether the execution of the trigger action meets the expectation of the test or not can be obtained by comparing the expected data with the acquired data. When the comparison result of the expected data and the acquired data is completely consistent, skipping to the step S591; when the comparison result is not consistent or not consistent completely, the process proceeds to step S592.
In step S591, a result flag that passes the test is returned.
In step S592, a result flag of failing the test is returned.
In addition, the testing method provided in this specific application scenario may sequentially execute the testing process shown in fig. 5 on each testing unit by initializing one testing unit queue and one testing result queue, where the specific process is shown in fig. 6, and includes the following steps:
in step S610, the test unit at the head of the test unit queue is extracted.
In step S620, the extracted test unit is executed in accordance with the flow in steps S510 to S592.
In step S630, the test result obtained by executing the test unit in step S591 or step S592 is returned.
In step S640, the test result returned by the test unit is added to the tail of the test result queue, and when the test result fails, the returned collected data is also stored in the test result queue.
In step S650, deleting the test unit at the head of the test unit queue, performing length judgment on the test unit queue, and when the queue length is 0, jumping to step S660; when the queue length is greater than 0, the process goes to step S610.
In step S660, the automatic test flow ends.
In the testing method provided in the specific application scenario, on one hand, the testing of the trigger action is completed by deploying the environmental data required by the trigger corresponding to the testing unit, that is, enabling the environmental data to meet the event and the condition of the trigger executing the corresponding action, thereby simplifying the testing environment and improving the testing efficiency. In another aspect, the method compares the collected test data to expected data to obtain a test result. The problem that the test result is difficult to judge can be solved through the digitalized test result and the automatic judging process, and compared with a judging method based on manual experience, the accuracy of the obtained test result is higher, and the test quality and the efficiency of the trigger are improved. Meanwhile, the testing process is automatic, so that compared with a manual testing method, the number of testers is reduced, the testing period is shortened, the labor cost and the time cost are saved, and the problem that the testing environment is complex and various due to division of labor during testing can be solved by using a uniform testing environment.
It should be noted that although the various steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that these steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Further, in the present exemplary embodiment, a test apparatus is also provided. The testing device can be applied to terminal equipment, a server, and both the terminal equipment and the server. Referring to fig. 7, the test apparatus 700 may include an initialization module 710, a deployment module 720, a test module 730, and a comparison module 740. Wherein:
the initialization module 710 may be configured to initialize a test unit queue and a test result queue, where the test unit queue includes a plurality of test units, a corresponding trigger is tested in each test unit, and the test result queue is used to store test results of the test units;
the deployment module 720 may be configured to extract the test unit from the test unit queue, and deploy the environment data required for testing the corresponding trigger;
the testing module 730 may be configured to execute the action of the trigger and collect data when the environmental data is successfully deployed;
the comparison module 740 may be configured to compare the collected data with expected data to obtain the test result, and store the test result in the test result queue.
The specific details of each module or unit in the testing apparatus have been described in detail in the corresponding testing method, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method as described in the embodiments below. For example, the electronic device may implement the steps shown in fig. 3 to 6, and the like.
It should be noted that the computer readable media shown in the present disclosure may be computer readable signal media or computer readable storage media or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 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 contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method of testing, comprising:
initializing a test unit queue and a test result queue, wherein the test unit queue comprises a plurality of test units, testing corresponding triggers in each test unit, and the test result queue is used for storing test results of the test units;
extracting the test unit from the test unit queue, and deploying environment data required by testing the corresponding trigger;
when the environment data is deployed successfully, executing the action of the trigger and collecting data;
and comparing the acquired data with expected data to obtain the test result and storing the test result in the test result queue.
2. The method of claim 1, wherein the test unit comprises a timer;
the environmental data required by the trigger corresponding to the deployment test includes:
and executing the deployment operation on the environment data until the time recorded by the timer is equal to the environment deployment time, wherein the environment deployment time is the time required for deploying the data.
3. The method of testing of claim 2, further comprising:
setting a time threshold;
and when the time recorded by the timer exceeds the time threshold, stopping the deployment of the environment data, and setting the test result as test failure.
4. The method of claim 1, wherein the test unit comprises a timer;
the executing the action of the trigger and collecting data includes:
executing the action of the trigger and starting timing at the same time;
and when the time recorded by the timer reaches a preset time interval, acquiring data obtained by executing the action of the trigger, wherein the preset time interval is the shortest time interval from the execution of the action of the trigger to the acquisition of the data.
5. The method of claim 1, wherein the performing the action of the trigger and collecting data comprises:
and when a first test result of one first test unit meets the trigger information of a second test unit, executing the action of the trigger corresponding to the second test unit and collecting data, wherein the trigger information comprises the condition and the event of the trigger.
6. The method of claim 4, wherein comparing the collected data with expected data to obtain the test result and storing the test result in the test result queue comprises:
when the collected data is consistent with the expected data, setting the test result of the trigger to be passed and storing the test result in the test result queue;
and when the collected data is inconsistent or not completely consistent with the expected data, setting the test result of the trigger as test failure, and storing the test result and the collected data in the test result queue.
7. The method of testing of claim 1, further comprising:
extracting the test unit at the head of the test unit queue, and testing the corresponding trigger in the test unit;
and storing the obtained test result to the tail of the test result queue, and deleting the test unit in the test unit queue until the queue length of the test unit queue is zero.
8. A test apparatus, comprising:
the device comprises an initialization module, a test unit queue and a test result queue, wherein the test unit queue comprises a plurality of test units, corresponding triggers are tested in the test units, and the test result queue is used for storing test results of the test units;
the deployment module is used for extracting the test unit from the test unit queue and deploying environment data required by testing the corresponding trigger;
the test module is used for executing the action of the trigger and collecting data when the environment data is deployed successfully;
and the comparison module is used for comparing the acquired data with expected data to obtain the test result and storing the test result in the test result queue.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. An electronic device, comprising:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-7 via execution of the executable instructions.
CN202010065012.8A 2020-01-20 2020-01-20 Test method and device, storage medium and electronic equipment Active CN111240992B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010065012.8A CN111240992B (en) 2020-01-20 2020-01-20 Test method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010065012.8A CN111240992B (en) 2020-01-20 2020-01-20 Test method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111240992A true CN111240992A (en) 2020-06-05
CN111240992B CN111240992B (en) 2023-04-25

Family

ID=70869259

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010065012.8A Active CN111240992B (en) 2020-01-20 2020-01-20 Test method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111240992B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI823042B (en) * 2020-12-30 2023-11-21 新唐科技股份有限公司 Testing device and operation method thereof

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160147646A1 (en) * 2014-11-21 2016-05-26 Wipro Limited Method and system for executing automated tests in an integrated test environment
CN108108297A (en) * 2016-11-25 2018-06-01 腾讯科技(深圳)有限公司 The method and apparatus of automatic test
CN110347484A (en) * 2019-06-27 2019-10-18 上海麦克风文化传媒有限公司 A kind of working method that software translating deployment is efficiently tested in the process

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160147646A1 (en) * 2014-11-21 2016-05-26 Wipro Limited Method and system for executing automated tests in an integrated test environment
CN108108297A (en) * 2016-11-25 2018-06-01 腾讯科技(深圳)有限公司 The method and apparatus of automatic test
CN110347484A (en) * 2019-06-27 2019-10-18 上海麦克风文化传媒有限公司 A kind of working method that software translating deployment is efficiently tested in the process

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI823042B (en) * 2020-12-30 2023-11-21 新唐科技股份有限公司 Testing device and operation method thereof

Also Published As

Publication number Publication date
CN111240992B (en) 2023-04-25

Similar Documents

Publication Publication Date Title
CN106294120B (en) Method, apparatus and computer program product for testing code
US10120783B2 (en) Determining test case efficiency
CN112882930B (en) Automatic test method and device, storage medium and electronic equipment
CN112631919A (en) Comparison test method and device, computer equipment and storage medium
CN114003451A (en) Interface test method, device, system and medium
CN109669865A (en) Performance test methods, device, electronic equipment and readable storage medium storing program for executing
CN106528429A (en) UI testing method and device
CN111240992B (en) Test method and device, storage medium and electronic equipment
CN108959078A (en) A kind of end Windows automatic software test method and system
CN115668895A (en) Resource configuration determining method and device of cloud service system
CN116841898A (en) Test case and test script generation method, device, system and medium
CN116702668A (en) Regression testing method and device, electronic equipment and storage medium
US10769334B2 (en) Intelligent fail recognition
CN116149978A (en) Service interface testing method and device, electronic equipment and storage medium
Průcha Aspect optimalization of robotic process automation
CN111258912B (en) Page testing method, device, terminal and storage medium
CN115576821B (en) Verification method and device, electronic equipment and storage medium
CN109240909A (en) A kind of data file verification method based on registration center
CN114253867B (en) Automatic testing method, device and system based on neural network model
CN114968791A (en) Detection method and device
CN109062810B (en) Application program testing method and device, electronic equipment and storage medium
CN113656268A (en) Performance test method and device of business service, electronic equipment and storage medium
CN116340174A (en) Graphic page testing method, training method and device
Pennala Cloud-based testing of 4G base station software
CN115408266A (en) Software testing method, system and storage medium

Legal Events

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