[go: up one dir, main page]

CN108572909B - Test case processing method and device and electronic equipment - Google Patents

Test case processing method and device and electronic equipment Download PDF

Info

Publication number
CN108572909B
CN108572909B CN201710140591.6A CN201710140591A CN108572909B CN 108572909 B CN108572909 B CN 108572909B CN 201710140591 A CN201710140591 A CN 201710140591A CN 108572909 B CN108572909 B CN 108572909B
Authority
CN
China
Prior art keywords
test
case
container
test case
execution
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.)
Active
Application number
CN201710140591.6A
Other languages
Chinese (zh)
Other versions
CN108572909A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201710140591.6A priority Critical patent/CN108572909B/en
Publication of CN108572909A publication Critical patent/CN108572909A/en
Application granted granted Critical
Publication of CN108572909B publication Critical patent/CN108572909B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

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 embodiment of the invention provides a method and a device for processing test cases and electronic equipment, wherein the processing method relates to multiple times of execution of multiple test cases running in the same resource environment, and the following processing is included in the process of executing the test cases each time: monitoring a request for opening a first container in a first case test process under a unit framework in the process of executing the test case, wherein the first container is used for loading Bean resources required by the test case; and after the request is monitored, stopping the execution of the test case in a first case test process, and transferring the execution task of the test case to a second case test process outside the Junit framework for execution, wherein the second case test process keeps the first container and the Bean resource after the first container and the Bean resource are loaded for the first time. The scheme of the embodiment of the invention can reduce the time for running the test case and improve the test efficiency.

Description

Test case processing method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a test case, and an electronic device.
Background
Junit is a Java regression testing framework for writing and running repeatable tests, and can realize assertion of expected test results and conveniently organize and run tests. In the conventional process for testing Junit execution cases, it takes 2-3 minutes to initialize a container (such as a Pandora container) and load resources such as Bean (a JAVA Bean, a reusable component written in JAVA language) data required by case operation each time a test case is executed, and the resources are released and the container is closed after the case execution is completed. When the test case is executed again, it takes 2-3 minutes again to reinitialize the container and load the resources.
In the existing test case execution scheme, the time for running a test case code to start a container and loading Bean resources each time is about 2-3 minutes, the actual running time (test of an execution case and result processing) is usually within 5 seconds, a large amount of time for running the test case is basically spent on an initialization environment, and the time cost for running the test case is increased.
Disclosure of Invention
The invention provides a test case processing method and device and electronic equipment, which are used for reducing the time for running a test case and improving the test efficiency.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, a method for processing a test case is provided, where the method involves executing multiple test cases running in the same resource environment multiple times, and in a process of executing the test cases each time, the method includes the following processing:
monitoring a request for opening a first container in a first case test process under a unit framework in the process of executing the test case, wherein the first container is used for loading Bean resources required by the test case;
stopping the execution of the test case in the first case test process after monitoring the request, transferring the execution task of the test case to a second case test process outside the Junit framework for execution,
and after the first container and the Bean resource are loaded for the first time, the second example testing process keeps the first container and the Bean resource.
In a second aspect, a method for processing test cases is provided, where the method involves executing multiple test cases running in the same resource environment multiple times, and in the process of executing the test cases each time, the method includes the following processing:
monitoring a request for opening a first container in a first case test process under a first system framework in the process of executing the test case, wherein the first container is used for loading test environment resources required by the test case;
stopping the execution of the test case in the first case test process after monitoring the request, transferring the execution task of the test case to a second case test process outside the first system frame for execution,
and after the first container and the test environment resources are loaded for the first time, the second example test process keeps the first container and the test environment resources.
In a third aspect, a processing apparatus for multiple times of executing multiple test cases running in a same resource environment is provided, where the processing apparatus includes: the monitoring module and the process control module; in the process of executing the test case each time:
the monitoring module is used for monitoring a request for opening a first container in a first case testing process under a first system framework and in the process of executing the test case, wherein the first container is used for loading test environment resources required by the test case;
the process control module is used for stopping the execution of the test case in the first case test process and transferring the execution task of the test case to a second case test process outside the first system frame for execution after the monitoring module monitors the request,
and after the first container and the test environment resources are loaded for the first time, the second example test process keeps the first container and the test environment resources.
In a fourth aspect, an electronic device is provided, comprising:
a memory for storing a program;
a processor, coupled to the memory, for executing the program for:
monitoring a request for opening a first container in a first case test process under a first system framework in the process of executing the test case, wherein the first container is used for loading test environment resources required by the test case;
stopping the execution of the test case in the first case test process after monitoring the request, transferring the execution task of the test case to a second case test process outside the first system frame for execution,
and after the first container and the test environment resources are loaded for the first time, the second example test process keeps the first container and the test environment resources.
According to the processing method and device for the test case and the electronic equipment, the request for opening the first container in the process of executing the test case in the test process of the first case under the first system frame is monitored; and then after the request is monitored, stopping the execution of the test case in the first case test process, transferring the execution task of the test case to a second case test process outside the first system frame for execution, and controlling the second case test process to keep the first container and the test environment resources after the first container and the test environment resources are loaded for the first time, so that the first container and the test environment resources do not need to be newly opened when the subsequent test case is executed, and the test efficiency is improved.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a logic diagram illustrating the processing of test cases in the prior art;
FIG. 2 is a logic diagram illustrating the processing of test cases according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for processing test cases according to an embodiment of the present invention;
FIG. 4 is a block diagram of a test case processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary 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 limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 is a logic diagram illustrating the processing of test cases under a Junit framework in the prior art. As shown in fig. 1, the existing logic for processing a test case under the unit framework can be described from two sides of an upper application layer and a lower execution layer, which correspond to each other, and the content of the lower layer can be regarded as a specific implementation process of the upper layer content. When the Junit intellij IDE (built-in Junit plug-in) starts running, its corresponding execution layer has already started to request the operating system to open the Java Virtual Machine (JVM) container and load the resources, which are the environments that need to be prepared before the test is performed. The method for executing the test under the unit framework (part of the unit executing code) is divided into two types, one is the unit framework method, and can be regarded as the code executing method of the unit; the other is a method of executing test cases, which is also an improved part of the prior art to which embodiments of the present invention are directed. In fig. 1, the process of executing the test case method is described in combination with the underlying execution layer.
After the method for executing the test case is started at the application layer, the operating system is applied to start a process for the operating process, which is referred to as a first case test process in this embodiment, and the test process can be understood as a process for executing the test case locally based on a Junit framework. A test case comprises a resource loading part and a test process part, wherein the resource loading part is used for requesting to open a first container (such as a Pandora container) required by the currently tested test code and loading Bean resources to the first container, and the test process part is executed after the resource loading is finished. The process of executing the test case method for one time comprises the following steps: opening the first container, loading Bean resources and executing test code are all completed in the first main thread in the first instance of test process. When the test case method is executed, the first main thread is closed, the first case test process is closed accordingly, and the previously opened Pandora container and the loaded Bean resource are closed and released.
The above procedure for executing the test case method is set in junit intellijide, which is difficult or impossible to change, and the operation of junit intellijide opens a process for the execution procedure of each test case, not a thread. Therefore, after the test is completed, the loaded resources are released, and when the test case is executed next time, the first case test process is started again, and the process is executed once in the newly-built first main thread, so that the resources are repeatedly started, and a large amount of time is consumed, which is also a technical problem to be solved in the patent.
The embodiment of the invention changes the prior art that in a method for executing a test case based on a Junit framework, a process needs to be newly started for the process of each test case, and after the test case is executed, the process is closed, so that the loaded Bean resource is released. And through inter-process communication, transferring the task of executing the test case, which is originally completed in the first main thread, to a second main thread in a second example test process outside a Junit framework for execution, and after the second main thread loads the first container and the Bean resource for the first time, keeping the first container and the Bean resource in the second example test process for use by all threads below the second container and the Bean resource, so that the container and the load resource do not need to be repeatedly opened when the test case is executed subsequently, the test time is saved, and the test efficiency is improved.
Fig. 2 is a schematic diagram of processing logic of a test case provided in an embodiment of the present invention, and based on the core idea of the present invention, a service program (hereinafter, the service is referred to as server) is added to an upper application layer and a second example test process is added to a corresponding lower execution layer in an existing logic architecture. The second test process is a process outside the unit framework, is not controlled by the logic code of the unit intellijide, and realizes the operations of starting, closing, maintaining resources and the like of the second test process through the server.
Specifically, in the first example test process, the first main thread usually issues a call request to open the Pandora container first, and then the system opens the Pandora container locally. The method and the device intervene for the operation, namely when a first main thread sends a call request for opening a Pandora container, the request is intercepted, and at the moment, the operation of the main thread is stopped and enters a waiting state. And the intercepted request and the task corresponding to the subsequent test process are all transferred to a second main thread in a second instance test process to be continuously executed. After the second main thread receives a task of executing the test case, a sub-thread is created, then a Pandora container is opened in the sub-thread, Bean resources are loaded in the container, resources are maintained (hold), and a test process is executed after the resources are loaded. After the test case is executed, the sub-thread is closed, the second main thread keeps the starting state all the time, and meanwhile, a test result is returned to the first case test process. After receiving the test result, the first test process can perform preset processing on the test result to make the test result meet the output requirement of the test result under the unit framework, and return the test result to the unit main program, then close the first test process, and end the method for executing the test case this time.
When a new one-time test case is executed, the first case test process and the first main thread are reestablished. And then, still intervening the execution process in the first main thread, transferring the test task to a second example test process, completing the execution by the second main thread, creating a sub-thread again after the second main thread receives the task of executing the test case, and then sequentially executing opening a Pandora container, loading Bean resources and executing the test process in the sub-thread. At this time, because the Pandora container is already opened and the Bean resource is loaded in the second example test process, the sub-thread can skip the process and directly enter the test execution process, so that the time required for opening the container and loading the resource is saved, and the test efficiency is improved.
It should be noted that, although the embodiment of the present invention is described in terms of a processing procedure of a test case under a Junit framework, it should be understood by those skilled in the art that the technical solution of the embodiment of the present invention can be completely applied to a case similar to the processing procedure of the test case under the Junit framework. Therefore, the Junit framework can be abstracted into a first system framework for carrying out case testing, the Pandora container can be abstracted into a first container for loading test environment resources required by test cases, and the Bean resource can be abstracted into the test environment resources. Based on this, the technical idea of the embodiment of the invention can be abstracted to transfer the test process originally executed in the first case test process based on the first system frame to the second case test process outside the first system frame for execution, so as to jump out the limitation of the first system frame, thereby more flexibly and effectively utilizing the test environment resources and improving the test efficiency of the test case.
The technical solution of the present application is further described below by a plurality of embodiments, and for convenience of description, the unit framework is still used as a specific example to be described below, but it should be understood by those skilled in the art that in the description of the following embodiments, the unit framework may be replaced by the first system framework, and the Bean resource may be replaced by the test environment resource.
Example one
Based on the above-mentioned concept of shifting the test process originally executed in the first example test process based on the unit framework to the second example test process other than the unit framework, as shown in fig. 3, it is a flowchart of a method for processing test cases shown in the embodiment of the present invention, and the method for processing test cases involves executing multiple test cases running in the same resource environment for multiple times, and in combination with the content in fig. 2, in the process of executing test cases each time, the method includes the following processing steps:
s310, a request for opening a first container in a first case test process under a Junit framework and in the process of executing a test case is monitored, and the first container is used for loading Bean resources required by the test case.
Specifically, the listener (liener) under the unit framework can listen to the operations executed in the first instance test process in real time, and the operations also include that the first main thread in the first instance test process sends out a request for opening the first container. The first container may be a Pandora container for loading Bean resources required by test cases.
And S320, after the request is monitored, stopping the execution of the test case in the first case test process, and transferring the execution task of the test case to a second case test process outside the Junit framework for execution, wherein the second case test process keeps the first container and the Bean resource after the first container and the Bean resource are loaded for the first time.
Specifically, by extending a Runner (an executor, a component in a Junit frame) of the existing Junit, the test case uses a custom Runner, an agent is set in the custom Runner to intercept a request for opening a first container triggered by a first main thread in the process of executing the test case, and then the intercepted request can be converted into an http service request to access a local service program except the Junit frame through the request, and an execution task of the test case is transferred to a second example test corresponding to the service program except the Junit frame, so that the test task is continuously completed.
When the second instance test process is started and receives the execution task of the first test case transferred by the first instance test process, the second main thread in the second instance test process executes the test case process according to the content of the test case, and keeps the first container and the Bean resources all the time after the first container and the Bean resources are loaded for the first time.
When the second instance testing process is subsequently connected to the execution task of the test case transferred by the first instance testing process again, the testing process is still executed according to the content of the test case, but because the second instance testing process keeps the first container and the Bean resource after the first container and the Bean resource are loaded for the first time, extra time is not needed to be spent for newly opening the container and loading the resource in the subsequent testing task, and the testing efficiency is improved.
Further, in a specific implementation manner of step S320, the following steps are performed to transfer the execution task of the test case to a second case test process outside the unit framework for execution.
Firstly, sending a notification message to a second case testing process, wherein the notification message comprises calling information of a test case;
for example, in the process of intercepting the test case, after a request for opening a first container is triggered by a first main thread, a self-defined Runner may form an http service request according to the request, and send a notification message to a second case testing process in the manner of the http service request, where the notification message includes call information of the test case.
Then, after receiving the notification message, the second instance testing process calls the testing instance according to the calling information and executes the testing instance;
specifically, after receiving the notification message, the second case testing process calls the test cases according to the call information and executes operations in sequence according to the operation steps specified in the test cases.
Furthermore, the test case comprises a resource loading part and a test process part, the second case test process comprises a second main thread, wherein the resource loading part is used for requesting to open the first container and load the Bean resource to the first container,
and in the process of executing the test case in the second case testing process, creating a sub-thread through the second main thread, sequentially executing the resource loading part and the testing process part in the sub-thread, and closing the sub-thread after the execution of the process part to be tested is finished. After the first container and the Bean resource are loaded for the first time, the first container and the Bean resource can be kept in the second example test process and are not closed or released.
And finally, after the test case is executed, the second case test process returns the test result to the first case test process.
For example, the second example testing process may encapsulate the testing result with the expanded Junit runlisterner, and the encapsulated result is returned to the first example testing process by http response.
Further, the first test process is closed after receiving the test result, and the process of executing the test case method is completed.
Specifically, after the test process part is executed in the sub-thread in the second example test process, the test result may be returned to the first main thread of the first example test process, and the first main thread receives the test result and closes the first main thread and the first example test process after the preset processing for the test result is completed.
Wherein, the preset processing aiming at the test result can comprise: the first example test process parses the returned test result and notifies the upper layer junnitintellijide application through RunNotifier.
In the process of implementing the scheme, a Jrebel (a set of JavaEE development tools) hot plug-in deployment mode can be adopted to synchronize the changed codes to the upper-layer application program corresponding to the second-instance test process, and the codes become effective in real time after the codes are changed, so that the optimization of the second-instance test process is facilitated.
In addition, the upper application program corresponding to the second example testing process can be accessed in a remote mode, so that the whole testing process is debugged and accessed.
According to the processing method of the test case provided by the embodiment of the invention, a request for opening a first container in the process of executing the test case in the test process of a first case under a Junit framework is monitored; and then after the request is monitored, stopping the execution of the test case in the first case test process, transferring the execution task of the test case to a second case test process outside a Junit framework for execution, and controlling the second case test process to keep the first container and the Bean resource after the first container and the Bean resource are loaded for the first time, so that the first container and the Bean resource do not need to be newly opened when the subsequent test case is executed, and the test efficiency is improved.
Example two
As shown in fig. 4, a block diagram of a processing apparatus for test cases according to an embodiment of the present invention, where the processing apparatus is configured to execute multiple test cases running in the same resource environment for multiple times, and may be configured to execute the method steps shown in fig. 3, and the processing apparatus includes: a listening module 410 and a process control module 420; wherein:
a monitoring module 410, configured to monitor a request for opening a first container in a first case test process under a unit framework and in a process of executing a test case, where the first container is used to load Bean resources required by the test case;
the process control module 420 is configured to, after the monitoring module 410 monitors the request, terminate execution of the test case in the first case test process, and transfer an execution task of the test case to a second case test process outside the unit framework for execution, where the second case test process keeps the first container and the Bean resource after the first container and the Bean resource are loaded for the first time.
Further, the process control module 420 transfers the execution task of the test case to a second case test process outside the unit framework for execution, which includes:
sending a notification message to a second case testing process, wherein the notification message comprises calling information of a test case;
after receiving the notification message, the second instance testing process calls the testing case according to the calling information and executes the testing case,
and after the test case is executed, returning a test result to the first case test process.
Further, the first example test process is closed after receiving the test result.
Furthermore, the test case comprises a resource loading part and a test process part, the second case test process comprises a second main thread, the resource loading part is used for requesting to open the first container and loading the Bean resource to the first container,
and in the process of executing the test case in the second case testing process, creating a sub-thread through the second main thread, sequentially executing the resource loading part and the testing process part in the sub-thread, closing the sub-thread after the execution of the testing process part is finished, and keeping the first container and the Bean resources after the first container and the Bean resources are loaded by the second main thread for the first time.
Further, the first example test process includes a first main thread, the test case is executed in the first main thread, and after the test process part is executed in the sub-thread, the method further includes: and returning a test result to the first main thread of the first case test process, and closing the first main thread and the first case test process after the first main thread receives the test result and finishes the preset processing aiming at the test result.
According to the processing device of the test case provided by the embodiment of the invention, a request for opening a first container in the process of executing the test case in the test process of a first case under a unit frame is monitored; and then after the request is monitored, stopping the execution of the test case in the first case test process, transferring the execution task of the test case to a second case test process outside a Junit framework for execution, and controlling the second case test process to keep the first container and the Bean resource after the first container and the Bean resource are loaded for the first time, so that the first container and the Bean resource do not need to be newly opened when the subsequent test case is executed, and the test efficiency is improved.
EXAMPLE III
The foregoing describes an overall architecture of a load balancing apparatus for driving limited resources, where the functions of the apparatus can be implemented by an electronic device, as shown in fig. 5, which is a schematic structural diagram of the electronic device according to an embodiment of the present invention, and specifically includes: a memory 510 and a processor 520.
A memory 510 for storing programs.
In addition to the programs described above, the memory 510 may also be configured to store other various data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phonebook data, messages, pictures, videos, and so forth.
The memory 510 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
A processor 520, coupled to the memory 510, for executing programs in the memory 510 for:
monitoring a request for opening a first container in a first example test process under a unit framework in the process of executing a test case, wherein the first container is used for loading Bean resources required by the test case;
stopping the execution of the test case in the first test process after the request is monitored, transferring the execution task of the test case to a second test process outside the Junit framework for execution,
and after the first container and the Bean resource are loaded for the first time, the second instance testing process keeps the first container and the Bean resource.
The above specific processing operations have been described in detail in the foregoing embodiments, and are not described again here.
Further, as shown in fig. 5, the electronic device may further include: communication components 530, power components 540, audio components 550, display 560, and other components. Only some of the components are schematically shown in fig. 5, and it is not meant that the electronic device comprises only the components shown in fig. 5.
The communication component 530 is configured to facilitate wired or wireless communication between the electronic device and other devices. The electronic device may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 530 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 530 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
A power supply component 540 provides power to the various components of the electronic device. The power components 540 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for an electronic device.
The audio component 550 is configured to output and/or input audio signals. For example, the audio assembly 550 includes a Microphone (MIC) configured to receive external audio signals when the electronic device is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 510 or transmitted via the communication component 530. In some embodiments, audio assembly 550 also includes a speaker for outputting audio signals.
The display 560 includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (12)

1. A processing method of a test case is characterized in that the processing method involves executing a plurality of test cases running in the same resource environment for a plurality of times, and in the process of executing the test cases each time, the processing method comprises the following processing:
monitoring a request for opening a first container in a first case test process under a unit framework in the process of executing the test case, wherein the first container is used for loading Bean resources required by the test case;
stopping the execution of the test case in the first case test process after monitoring the request, transferring the execution task of the test case to a second case test process outside the Junit framework for execution,
and after the first container and the Bean resource are loaded for the first time, the second example testing process keeps the first container and the Bean resource.
2. The processing method according to claim 1, wherein said transferring the execution task of the test case to a second case testing process outside the unit framework for execution comprises:
sending a notification message to the second case testing process, wherein the notification message comprises the calling information of the test case;
after receiving the notification message, the second case testing process calls the test case according to the calling information and executes the test case,
and after the test case is executed, returning a test result to the test process of the first case.
3. A processing method of a test case is characterized in that the processing method involves executing a plurality of test cases running in the same resource environment for a plurality of times, and in the process of executing the test cases each time, the processing method comprises the following processing:
monitoring a request for opening a first container in a first case test process under a first system framework in the process of executing the test case, wherein the first container is used for loading test environment resources required by the test case;
stopping the execution of the test case in the first case test process after monitoring the request, transferring the execution task of the test case to a second case test process outside the first system frame for execution,
and after the first container and the test environment resources are loaded for the first time, the second example test process keeps the first container and the test environment resources.
4. The processing method according to claim 3, wherein the transferring the execution task of the test case to a second case testing process outside the first system framework for execution comprises:
sending a notification message to the second case testing process, wherein the notification message comprises the calling information of the test case;
after receiving the notification message, the second case testing process calls the test case according to the calling information and executes the test case,
and after the test case is executed, returning a test result to the test process of the first case.
5. The processing method according to claim 4, wherein the first test case process is closed after receiving the test result.
6. The processing method according to claim 3, wherein the test case comprises a resource loading part and a test procedure part, the second case test procedure comprises a second main thread, the resource loading part is used for requesting to open the first container and load the test environment resources to the first container,
creating a sub-thread through the second main thread in the process of executing the test case in the second case testing process, sequentially executing the resource loading part and the testing process part in the sub-thread, closing the sub-thread after the testing process part is executed,
and after the first container and the test environment resources are loaded for the first time, the second main thread keeps the first container and the test environment resources.
7. The processing method according to claim 6, wherein the first instance test process comprises a first main thread, wherein the test case is executed in the first main thread,
after the testing process part is executed in the sub-thread, the method further comprises the following steps: and returning a test result to a first main thread of the first example test process, wherein the first main thread and the first example test process are closed after the first main thread receives the test result and finishes preset processing aiming at the test result.
8. The process of any one of claims 5 to 7, wherein the first system framework is a Junit framework and the test environment resources are Bean resources.
9. A processing apparatus of a test case, wherein the processing apparatus is configured to execute a plurality of test cases running in a same resource environment multiple times, and the processing apparatus includes: the monitoring module and the process control module; in the process of executing the test case each time:
the monitoring module is used for monitoring a request for opening a first container in a first case testing process under a first system framework and in the process of executing the test case, wherein the first container is used for loading test environment resources required by the test case;
the process control module is used for stopping the execution of the test case in the first case test process and transferring the execution task of the test case to a second case test process outside the first system frame for execution after the monitoring module monitors the request,
and after the first container and the test environment resources are loaded for the first time, the second example test process keeps the first container and the test environment resources.
10. The processing apparatus according to claim 9, wherein the process control module transfers the execution task of the test case to a second case test process outside the first system framework for execution, and includes:
sending a notification message to the second case testing process, wherein the notification message comprises the calling information of the test case;
after receiving the notification message, the second case testing process calls the test case according to the calling information and executes the test case,
and after the test case is executed, returning a test result to the test process of the first case.
11. The processing apparatus as claimed in claim 10, wherein the first test case process is configured to close the first test case process after receiving the test result.
12. An electronic device, comprising:
a memory for storing a program;
a processor, coupled to the memory, for executing the program for:
monitoring a request for opening a first container in a first case test process under a first system framework in the process of executing the test case, wherein the first container is used for loading test environment resources required by the test case;
stopping the execution of the test case in the first case test process after monitoring the request, transferring the execution task of the test case to a second case test process outside the first system frame for execution,
and after the first container and the test environment resources are loaded for the first time, the second example test process keeps the first container and the test environment resources.
CN201710140591.6A 2017-03-10 2017-03-10 Test case processing method and device and electronic equipment Active CN108572909B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710140591.6A CN108572909B (en) 2017-03-10 2017-03-10 Test case processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710140591.6A CN108572909B (en) 2017-03-10 2017-03-10 Test case processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN108572909A CN108572909A (en) 2018-09-25
CN108572909B true CN108572909B (en) 2021-07-16

Family

ID=63578064

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710140591.6A Active CN108572909B (en) 2017-03-10 2017-03-10 Test case processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN108572909B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416740A (en) * 2019-12-26 2021-02-26 上海哔哩哔哩科技有限公司 Method for evaluating validity of test case, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1841336A (en) * 2005-03-31 2006-10-04 联想(北京)有限公司 Computer testing method
CN104317722A (en) * 2014-11-13 2015-01-28 中国建设银行股份有限公司 Unit testing method and device based on Junit
CN105389256A (en) * 2015-11-11 2016-03-09 中国建设银行股份有限公司 Unit testing method and system
CN106055474A (en) * 2016-05-23 2016-10-26 乐视控股(北京)有限公司 Test method and apparatus
CN106294159A (en) * 2016-08-12 2017-01-04 腾讯科技(深圳)有限公司 A kind of method controlling screenshotss and screenshotss control device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9015671B2 (en) * 2006-12-27 2015-04-21 The Mathworks, Inc. Integrating program construction
US8949791B2 (en) * 2009-07-08 2015-02-03 Vmware, Inc. Distributed software testing using cloud computing resources
US9274933B2 (en) * 2012-11-14 2016-03-01 International Business Machines Corporation Pretest setup planning

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1841336A (en) * 2005-03-31 2006-10-04 联想(北京)有限公司 Computer testing method
CN104317722A (en) * 2014-11-13 2015-01-28 中国建设银行股份有限公司 Unit testing method and device based on Junit
CN105389256A (en) * 2015-11-11 2016-03-09 中国建设银行股份有限公司 Unit testing method and system
CN106055474A (en) * 2016-05-23 2016-10-26 乐视控股(北京)有限公司 Test method and apparatus
CN106294159A (en) * 2016-08-12 2017-01-04 腾讯科技(深圳)有限公司 A kind of method controlling screenshotss and screenshotss control device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
If I have multiple JUnit test classes, but they share a large amount of setup, is there a way to resuse some of this setup code?;Seb;《https://stackoverflow.com/questions/31452008/if-i-have-multiple-junit-test-classes-but-they-share-a-large-amount-of-setup-i》;20150731;第1-3页 *
聊聊单元测试(三)——Spring Test+JUnit完美组合;shan9liang;《https://blog.csdn.net/shan9liang/article/details/40452469》;20141026;第1-3页 *
自定义测试执行器;LinkinPark8林肯;《https://blog.csdn.net/u011794238/article/details/50664751》;20160215;第1-14页 *

Also Published As

Publication number Publication date
CN108572909A (en) 2018-09-25

Similar Documents

Publication Publication Date Title
CN105763723B (en) Mobile terminal and method for upgrading system
CN107368560B (en) Page implementation method and device for mobile application and computer-readable storage medium
CN107402788B (en) Resource packaging management method and device
CN109471768A (en) Monitoring method, device and the electronic equipment of traffic issues
CN104899039A (en) Method and device for providing screen shooting service in terminal device
CN110457154B (en) Abnormal service processing method and device, storage medium and communication terminal
CN112988213B (en) Program data updating method, electronic equipment and computer storage medium
CN109857489B (en) Development system based on Android system, decoupling method and device
CN112023398A (en) Game running method, device, equipment, system and storage medium
US8964610B2 (en) System and method of reducing factory program time for wireless devices
CN103516557A (en) Method and system for testing
CN107832214A (en) Test method, device, storage medium, terminal equipment and system
CN110018859A (en) Equipment starting method, device, computer equipment and storage medium
CN112346965B (en) Test case distribution method, device and storage medium
CN108572909B (en) Test case processing method and device and electronic equipment
WO2016070690A1 (en) Method, device and system for realizing communication between application and webpage on terminal device
CN108073610B (en) Method and device for realizing webpage loading
CN108132816B (en) Method and device for realizing local framework layer calling in application
CN112764796A (en) Installation package generation system
CN110851370A (en) Program testing method and device, storage medium
CN111258877A (en) Method and device for detecting visible time of first screen page and electronic equipment
CN109656673B (en) Program loading method, device and system and electronic equipment
CN112997507B (en) Audio system control method, device, terminal and computer-readable storage medium
WO2020135129A1 (en) Method and device for loading plug-in of application, and terminal
CN108874381B (en) A method, device and electronic device for outputting page view controller

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