CN105607991A - Test method and device based on asynchronous threads - Google Patents

Test method and device based on asynchronous threads Download PDF

Info

Publication number
CN105607991A
CN105607991A CN201410670716.2A CN201410670716A CN105607991A CN 105607991 A CN105607991 A CN 105607991A CN 201410670716 A CN201410670716 A CN 201410670716A CN 105607991 A CN105607991 A CN 105607991A
Authority
CN
China
Prior art keywords
thread
threads
tested object
subject
subject thread
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410670716.2A
Other languages
Chinese (zh)
Inventor
倪军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 CN201410670716.2A priority Critical patent/CN105607991A/en
Publication of CN105607991A publication Critical patent/CN105607991A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a test method and device based on asynchronous threads. The method comprises the following steps: detecting a first amount of target threads, wherein the target threads are the asynchronous threads which execute a test object in a thread pool class; calling the target threads to execute the test object; detecting a second amount of the target threads; when the first amount is equal to the second amount, checking an execution result obtained by the test object executed by the target threads. On one hand, the embodiment of the invention does not waste redundant time to wait so as to reduce test time consumption, and on the other hand, test checking failure caused since a result is checked when the target threads do not finish execution can be avoided. The success rate of a test case is improved so as to improve test efficiency.

Description

A kind of method of testing and device based on asynchronous thread
Technical field
The application relates to technical field of measurement and test, particularly relate to a kind of method of testing based on asynchronous thread andA kind of testing arrangement based on asynchronous thread.
Background technology
Program test utilizes testing tool, according to testing scheme and flow process, product is carried out to function and property exactlyCan test, write even as required different testing tools, design and maintenance test system, to testThe problem that scheme may occur is carried out assessment and analysis. After implementation of test cases, need to follow the tracks of fault, withThe product of guaranteeing exploitation is applicable to demand.
Java's (a kind of object-oriented programming language that can write cross-platform software) is manyThread/asynchronous thread is that the very many one that use in systematic realizing program realize means, conventionalThe window of servlet (serve end program) or C/S (Client/Server or Client/Server) structureBody running in background process be multithreading, with reduce user foreground wait for time; Be for another exampleThe performance of raising system or application program, can adopt multithreading to improve the concurrent of system or application programDisposal ability etc.
The implementation of this asynchronous multithreading realizes and above performance boost, has brought very large to systemBenefit, but also above the test of system, increased difficulty.
Relate at present the test of asynchronous thread, especially UI (UserInterface, user interface) certainlyMovingization and interface testing be all to call certain interface testing script, and this interface inside have been used asynchronous threadImplementation, whether script function correctly needs the result of docking port inside to carry out verification.
But carry out because processing logic is asynchronous thread, if before asynchronous thread processing finishes, adjustWith interface just return results, just go check results this time, can because inner asynchronous thread also do not haveResult is made mistakes check results. So generally use now sleep (n) letter after calling interfaceNumber stand-by period n, after inner asynchronous thread processing finishes, then carries out result verification.
Due to asynchronous thread need to expend how long fixing, be subject to environment etc. because affect larger, soThe time n waiting for, is generally based on empirical value, and being set to this asynchronous thread execution under all environment needsThe maximum time of wanting, in order to improve the success rate of test case.
But be based on empirical value just because of the time n waiting for, can not ensure waiting for after time n,The certain execution of corresponding asynchronous thread is through with, and the success rate of test case is low.
And needed wait time n is so not of a specified duration under most of scene, although just caused differentStep thread treated being through with, but system is also in wait, causes test consuming time long, has reduced surveyExamination execution efficiency, especially in automated execution process, in the time that the test case quantity relating to is manyWait, especially obvious.
If do not adopt the mode of stand-by period n here, the general manual breakpoint (debug pattern) that just needs,Execute and carry out again test script check logic Deng asynchronous thread. This mode can only be carried out manual test and be coveredLid, cost is very high, and efficiency is very low.
Therefore, need at present the urgent technical problem solving of those skilled in the art to be exactly: how to carryGo out a kind of testing mechanism based on asynchronous thread, in order to improve the success rate of test case, reduce test consumptionTime, improve testing efficiency.
Summary of the invention
The embodiment of the present application technical problem to be solved is to provide a kind of test side based on asynchronous threadMethod, in order to improve the success rate of test case, reduces test consuming time, improves testing efficiency.
Accordingly, the embodiment of the present application also provides a kind of testing arrangement based on asynchronous thread, in order to protectThe implementation and application of card said method.
In order to address the above problem, the embodiment of the present application discloses a kind of test side based on asynchronous threadMethod, comprising:
Detect the first quantity of subject thread; Described subject thread is in thread pool class, to carry out tested objectAsynchronous thread;
Call described subject thread and carry out described tested object;
Detect the second quantity of described subject thread;
In the time that described the first quantity equates with described the second quantity, described subject thread is carried out to tested objectThe execution result obtaining carries out verification.
Preferably, described thread pool class has the method for enlivening number of threads of obtaining; Described detection scoreThe step of the first quantity of journey comprises:
Described in calling, obtain the method for enlivening number of threads, obtain the first quantity of subject thread.
Preferably, described in, calling described subject thread carries out the step of described tested object and comprises:
Import into and carry out the required parameter of described tested object;
In described subject thread, carry out described tested object according to described parameter.
Preferably, the step of the second quantity of the described subject thread of described detection comprises:
Described in calling, obtain the method for enlivening number of threads, obtain the second quantity of described subject thread.
Preferably, also comprise:
When described the first quantity and described the second quantity are when different, return and carry out the described score of described detectionThe step of the second quantity of journey.
Preferably, described thread pool class comprises ThreadPoolExecutor, described in obtain and enliven Thread CountThe method of amount comprises getActiveCount.
The embodiment of the present application also discloses a kind of testing arrangement based on asynchronous thread, comprising:
First detection module, for detection of the first quantity of subject thread; Described subject thread is thread poolIn class, carry out the asynchronous thread of tested object;
Test module, carries out described tested object for calling described subject thread;
The second detection module, for detection of the second quantity of described subject thread;
Correction verification module, in the time that described the first quantity equates with described the second quantity, to described scoreThe execution result that Cheng Zhihang tested object obtains carries out verification.
Preferably, described thread pool class has the method for enlivening number of threads of obtaining; Described first detects mouldPiece comprises:
First calls submodule, described in calling, obtains the method for enlivening number of threads, obtains scoreThe first quantity of journey.
Preferably, described test module comprises:
Import submodule into, carry out the required parameter of described tested object for importing into;
Implementation sub-module, for carrying out described tested object in described subject thread according to described parameter.
Preferably, described the second detection module comprises:
Second calls submodule, described in calling, obtains the method for enlivening number of threads, obtains described orderThe second quantity of graticule journey.
Preferably, also comprise:
Loop module, for, returning and call second when different in described the first quantity and described the second quantityDetection module.
Preferably, described thread pool class comprises ThreadPoolExecutor, described in obtain and enliven Thread CountThe method of amount comprises getActiveCount.
Compared with background technology, the embodiment of the present application comprises following advantage:
The embodiment of the present application, before carrying out tested object, detects the first quantity of subject thread, is carrying outAfter tested object, detect the second quantity of subject thread, in the time that the first quantity equates with the second quantity,The execution result of subject thread being carried out to tested object acquisition carries out verification, judges that exactly subject thread isNo execution finishes, and carries out result verification after subject thread finishes, and can not waste the unnecessary time on the one handWait for, reduce test consuming time, avoid on the other hand because subject thread does not also execute with regard to verification and tiesTab phenolphthaleinum causes test verification failure, has improved the success rate of test case, and then has improved testing efficiency.
Brief description of the drawings
Fig. 1 is a kind of exemplary plot of carrying out result verification based on sleep function;
Fig. 2 is the flow chart of steps of a kind of method of testing embodiment based on asynchronous thread of the application;
Fig. 3 is a kind of execution exemplary plot of obtaining the method for enlivening number of threads of the application;
Fig. 4 is the exemplary plot of a kind of method of testing of the application;
Fig. 5 is the structured flowchart of a kind of testing arrangement embodiment based on asynchronous thread of the application.
Detailed description of the invention
For the above-mentioned purpose, the feature and advantage that make the application can become apparent more, below in conjunction with accompanying drawingWith detailed description of the invention, the application is described in further detail.
During for multi-thread concurrent, multiple threads are asked same resource simultaneously, will inevitably cause resourceThere is security in data, when the data that will operate when multiple threads are single-point, these threads just can not soConcurrent execution, and need to wait for serial carry out, be referred to as synchronizing thread; But when these multithreading operationResource data be not single-point, each self-separation, or the content that will operate between multiple thread does not rely onProperty, separate, just do not need serial to wait for, and can concurrently carry out, accelerate to carry out effect with thisRate, this class is referred to as asynchronous thread.
In the time that program, system are realized, often can use this asynchronous thread technology. Such as, oneSecondary program is processed the inside, and thread A need to carry out three tasks, because thread A is single example, and so oneAs processing mode be, first Processing tasks 1, then Processing tasks 2, last Processing tasks 3. But processingAfter complete task 1, do not have dependence between discovery task 2 and task 3, that is to say to carry out does not haveSequencing, can parallel processing. Can obtain another thread B this time, allow thread B go to holdRow task 2, then thread A is concurrent executes the task 3, can improve greatly treatment effeciency.
In the time of asynchronous thread concurrent processing, there is individual shortcoming, from thread A, do not know that exactly thread B is assortedTime carry out finish.
Therefore, as shown in Figure 1, generally after use test script calling interface, use sleep (n) nowFunction stand-by period n, then carry out result verification. Even if cause calling after end in measurand, cannotJudge whether current inter-process all finishes, if at this time go check results data, no matter beNoly correctly all cannot determine that this result is that this is processed and produces.
But test case success rate is low like this, and test consuming time longly, reduced testing efficiency.
Based on this, one of core idea of the embodiment of the present application has been proposed, obtain by the attribute of asynchronous threadKnow that whether inner asynchronous thread is complete, waiting for that asynchronous thread carries out result after complete againVerification, the result data of guaranteeing this verification is that inner asynchronous thread executes generation.
With reference to Fig. 2, show the step of a kind of method of testing embodiment based on asynchronous thread of the applicationFlow chart, specifically can comprise the steps:
Step 101, the first quantity of detection subject thread;
It should be noted that, the embodiment of the present application can be applied in the environment of Java language, and Java canSo that a thread pool class to be provided, thread pool class can refer to the container of a thread, in this container, managesThe thread of reason load quantity. For example, this thread pool class can comprise ThreadPoolExecutor etc.
Each thread in thread pool can be used to initialize carries out each asynchronous operation, therefore, and lineThe thread of Cheng Chizhong can be called asynchronous thread.
In the embodiment of the present application, described subject thread can be carried out the different of tested object in thread pool classStep thread.
Described thread pool class can have the method for enlivening number of threads of obtaining, for example, described in obtain activeThe method of number of threads can comprise getActiveCount etc., and this obtains the method for enlivening number of threadsCan return to the proximal line number of passes of initiatively executing the task, return to the current active effectively line of (active)Number of passes amount.
As shown in Figure 3, invoke synchronous interface, in state 301, the current existing thread that enlivens is n;Having triggered an asynchronous thread will increase active (active) number of threads, in state 302,Enlivening Thread Count is n+1; Current after the content in this asynchronous thread is complete, current asynchronous lineJourney life cycle termination, will become the non-thread that enlivens, and enliven number of threads and subtract one, in state 303,Enlivening Thread Count is n.
Tested object can, for the object of testing, specifically can comprise java applet etc.
In a preferred embodiment of the present application, step 101 can comprise following sub-step:
Sub-step S11, obtains the method for enlivening number of threads described in calling, obtain first of subject threadQuantity.
In the embodiment of the present application, described in calling, obtain enliven the number of threads that the method for number of threads returns canFor example, to be designated quantity of removing the thread of processing particular task (carrying out tested object).
And the thread of this class processing particular task generally can be marked with special attribute, such as thread name,Define special thread variable.
Conventionally all threads, all in thread pool class, can be given when using thread in usingThread is marked with special attribute, so just can know in whole thread pool class, which thread is to holdThe thread of row particular task.
Carry out certain program if thread is activated, can think to enliven, carry out finish after justCan be released back in thread pool class.
The not all Thread Count that enlivens obtaining in the embodiment of the present application, but carry out the active of particular taskThread Count, provides the method (for example getActionCount) of enlivening number of threads of obtaining in JavaReturn to the Thread Count that enlivens of current attribute, by the side that enlivens number of threads that obtains providing in Java is providedMethod (for example getActionCount) can obtain the Thread Count that enlivens of carrying out particular task.
For example, the thread of all C that execute the task is called taskCexecutor, the thread of the D that executes the taskTaskDexecutor by name, calls taskCexecutor.getActiveCount so, and what return is exactly instituteThere is the number of threads of the C that executes the task, call taskDexecutor.getActiveCount, returnThe number of threads of all exactly D that executing the task.
In actual applications, can, before invocation target thread execution tested object, call to obtain and enliven lineThe method of number of passes amount, the first quantity of acquisition subject thread, because subject thread is not also carried out tested object,Therefore, the first quantity is generally 0.
Step 102, calls described subject thread and carries out described tested object;
In specific implementation, can test all or part of function in tested object, to guaranteeThis tested object can correctly move in the intended manner before commencement of commercial operation.
In a preferred embodiment of the present application, step 102 can comprise following sub-step:
Sub-step S21, imports into and carries out the required parameter of described tested object;
Sub-step S22 carries out described tested object according to described parameter in described subject thread.
In the embodiment of the present application, can realize by test script the execution of tested object.
Particularly, test script can refer to test code, by operation test code call application orThe interface method of person's system, providing is to trigger the execution entrance of carrying out tested object.
For example, the mode that system is served by webservice externally provides service, and test scriptLogic can be by calling this webservice service, import parameter into, allowing tested object according to interiorThe logic of portion is carried out and is processed, and subject thread can be the implementation of the inner interrelated logic of tested object.
Step 103, detects the second quantity of described subject thread;
In actual applications, can, after invocation target thread execution tested object, call to obtain and enliven lineThe method of number of passes amount, the second quantity of acquisition subject thread.
In a preferred embodiment of the present application, step 103 can comprise following sub-step:
Sub-step S31, obtain the method for enlivening number of threads described in calling, obtain described subject threadThe second quantity.
In the embodiment of the present application for example, by (calling method that obtaining of providing in Java enliven number of threadsGetActionCount) can obtain the line that enlivens of carrying out particular task (for example carrying out tested object)Number of passes, whether complete to monitor inner subject thread.
Step 104, in the time that described the first quantity equates with described the second quantity, holds described subject threadThe execution result that row tested object obtains carries out verification.
Before carrying out tested object, supposing specifically to enliven Thread Count (i.e. the first quantity) is n, adjustsWith after tested object, because tested object inter-process need to be opened new thread process interrelated logic, instituteCan become n+m (m is as tested object inter-process specifically to enliven Thread Count (i.e. the second quantity)The Thread Count that interrelated logic need to be opened, m > 0), like this when the inner interrelated logic of tested object is processedAfter completing, the thread of these unlatchings will be released, and specifically enlivens Thread Count (i.e. the second quantity)Can become again the n before starting.
So, in the time that the first quantity equates with the second quantity, can represent inner subject thread executionComplete, inter-process is through with, and can carry out verification to Output rusults.
In specific implementation, can adopt test script verification output valve checking application or system logic to beNo correct.
In a preferred embodiment of the present application, described method can also comprise the steps:
Step 105, when described the first quantity and described the second quantity are when different, returns to execution step 103.
In the embodiment of the present application, in the time of the first quantity and the second quantity different (unequal), canNot complete to represent inner subject thread, inner untreated being through with, needs to continue to wait for targetThread execution completes carries out result verification again.
The embodiment of the present application, before carrying out tested object, detects the first quantity of subject thread, is carrying outAfter tested object, detect the second quantity of subject thread, in the time that the first quantity equates with the second quantity,The execution result of subject thread being carried out to tested object acquisition carries out verification, judges that exactly subject thread isNo execution finishes, and carries out result verification after subject thread finishes, and can not waste the unnecessary time on the one handWait for, reduce test consuming time, avoid on the other hand because subject thread does not also execute with regard to verification and tiesTab phenolphthaleinum causes test verification failure, has improved the success rate of test case, and then has improved testing efficiency.
For making those skilled in the art understand better the embodiment of the present application, in the embodiment of the present application, willThe logic of saving describes as a kind of example of tested object.
One section of logical code example of saving is as follows:
The function of this tested object is that money is deposited into account, and the concrete execution of wherein saving is by asynchronousThread saveMoneyProcessor goes execution, when saves and finishes to learn from interface method.
The test mode of tradition based on sleep () function is as follows:
Can find out from example above, because when indefinite asynchronous thread of saving executes, instituteWaiting for, and this time is uncertain, generally can only rely on empirical value select one largerTime, cause the low and test percent of pass in efficiency not high.
As shown in Figure 4, the mode of application the embodiment of the present application is as follows:
After judging that subject thread finishes, can judge that money has deposited account in, has ensured test caseOld power, and, can carry out immediately verification, do not have any unnecessary stand-by period, reducedTest consuming timely, and then improved testing efficiency.
It should be noted that, for embodiment of the method, for simple description, therefore it is all expressed as to one beRow combination of actions, but those skilled in the art should know, the embodiment of the present application be not subject to describeThe restriction of sequence of movement because according to the embodiment of the present application, some step can adopt other orders orPerson carries out simultaneously. Secondly, those skilled in the art also should know, the embodiment described in descriptionAll belong to preferred embodiment, related action might not be that the embodiment of the present application is necessary.
With reference to Fig. 5, show the structural frames of a kind of testing arrangement embodiment based on asynchronous thread of the applicationFigure, specifically can comprise as lower module:
First detection module 501, for detection of the first quantity of subject thread; Described subject thread is lineIn Cheng Chi class, carry out the asynchronous thread of tested object;
Test module 502, carries out described tested object for calling described subject thread;
The second detection module 503, for detection of the second quantity of described subject thread;
Correction verification module 504, in the time that described the first quantity equates with described the second quantity, to described orderThe execution result that mark thread execution tested object obtains carries out verification.
In a preferred embodiment of the present application, described thread pool class can have to obtain enlivens Thread CountThe method of amount; Described first detection module 501 can comprise following submodule:
First calls submodule, described in calling, obtains the method for enlivening number of threads, obtains scoreThe first quantity of journey.
In a preferred embodiment of the present application, described test module 502 can comprise following submodule:
Import submodule into, carry out the required parameter of described tested object for importing into;
Implementation sub-module, for carrying out described tested object in described subject thread according to described parameter.
In a preferred embodiment of the present application, described the second detection module 503 can comprise following sonModule:
Second calls submodule, described in calling, obtains the method for enlivening number of threads, obtains described orderThe second quantity of graticule journey.
In a preferred embodiment of the present application, can also comprise as lower module:
Loop module, for, returning and call second when different in described the first quantity and described the second quantityDetection module 503.
In specific implementation, described thread pool class can comprise ThreadPoolExecutor, described in obtainThe method of enlivening number of threads can comprise getActiveCount.
For device embodiment, because it is substantially similar to embodiment of the method, so the comparison of describingSimply, relevant part is referring to the part explanation of embodiment of the method.
Each embodiment in this description all adopts the mode of going forward one by one to describe, and each embodiment stressesBe all and the difference of other embodiment, between each embodiment identical similar part mutually referring to.
Those skilled in the art should understand, the embodiment of the embodiment of the present application can be provided as method, dressPut or computer program. Therefore, the embodiment of the present application can adopt complete hardware implementation example, completeImplement software example or in conjunction with the form of the embodiment of software and hardware aspect. And, the embodiment of the present applicationCan adopt at one or more computers that wherein include computer usable program code and can be situated between with storageThe upper computer journey of implementing of matter (including but not limited to magnetic disc store, CD-ROM, optical memory etc.)The form of order product.
In a typical configuration, described computer equipment comprises one or more processors(CPU), input/output interface, network interface and internal memory. Internal memory may comprise computer-readable mediumIn volatile memory, the shapes such as random access memory (RAM) and/or Nonvolatile memoryFormula, as read-only storage (ROM) or flash memory (flashRAM). Internal memory is computer-readable mediumExample. Computer-readable medium comprises permanent and impermanency, removable and non-removable mediaCan realize information storage by any method or technology. Information can be computer-readable instruction,The module of data structure, program or other data. The example of the storage medium of computer comprises, butBeing not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic random depositsThe random access memory (RAM) of access to memory (DRAM), other types, read-only storage(ROM), in Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or otherDeposit technology, read-only optical disc read-only storage (CD-ROM), digital versatile disc (DVD) or otherOptical storage, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus or any itsHis non-transmission medium, can be used for the information that storage can be accessed by computing equipment. According to hereinDefine, computer-readable medium does not comprise the computer readable media (transitorymedia) of non-standing,As data-signal and the carrier wave of modulation.
The embodiment of the present application is that reference is according to the method for the embodiment of the present application, terminal device (system) and meterThe flow chart of calculation machine program product and/or block diagram are described. Should understand can be by computer program instructionsEach flow process in realization flow figure and/or block diagram and/or square frame and flow chart and/or square frameFlow process in figure and/or the combination of square frame. Can provide these computer program instructions to all-purpose computer,The processor of special-purpose computer, Embedded Processor or other programmable data processing terminal equipment is to produceA machine, carries out processor by computer or other programmable data processing terminal equipmentInstruction produce for realizing at flow process of flow chart or multiple flow process and/or square frame of block diagram orThe device of the function of specifying in multiple square frames.
These computer program instructions also can be stored in can vectoring computer or other programmable data processingIn the computer-readable memory of terminal device with ad hoc fashion work, make to be stored in this computer-readableInstruction in memory produces the manufacture that comprises command device, and this command device is realized one of flow chartThe function of specifying in square frame of flow process or multiple flow process and/or block diagram or multiple square frame.
These computer program instructions also can be loaded into computer or other programmable data processing terminals are establishedStandby upper, make to carry out sequence of operations step to produce on computer or other programmable terminal equipmentThe processing that calculation machine is realized, thus the instruction of carrying out on computer or other programmable terminal equipment provides useIn realizing in flow process of flow chart or multiple flow process and/or square frame of block diagram or multiple square frameThe step of the function of specifying.
Although described the preferred embodiment of the embodiment of the present application, once those skilled in the artObtain the basic creative concept of cicada, can make other change and amendment to these embodiment. So,Claims are intended to be interpreted as comprising preferred embodiment and fall into the institute of the embodiment of the present application scopeHave and change and amendment.
Finally, also it should be noted that, in this article, the relational terms such as the first and second gradesOnly be used for an entity or operation and another entity or operating space to separate, and not necessarily requirementOr imply the relation or the order that between these entities or operation, there are any this reality. And, artLanguage " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby makesThe process, method, article or the terminal device that comprise a series of key elements not only comprise those key elements, andAlso comprise other key elements of clearly not listing, or be also included as this process, method, article orThe key element that person's terminal device is intrinsic. In the situation that there is no more restrictions, " comprise one by statementIndividual ... " key element that limits, and be not precluded within the process, method, article or the end that comprise described key elementIn end equipment, also there is other identical element.
A kind of method of testing based on asynchronous thread above the application being provided and a kind of based on asynchronousThe testing arrangement of thread, is described in detail, and has applied the principle of specific case to the application hereinAnd embodiment sets forth, the explanation of above embodiment is just for helping to understand the application's methodAnd core concept; Meanwhile, for one of ordinary skill in the art, according to the application's thought,In detailed description of the invention and range of application, all will change, in sum, this description should notBe interpreted as the restriction to the application.

Claims (12)

1. the method for testing based on asynchronous thread, is characterized in that, comprising:
Detect the first quantity of subject thread; Described subject thread is in thread pool class, to carry out tested objectAsynchronous thread;
Call described subject thread and carry out described tested object;
Detect the second quantity of described subject thread;
In the time that described the first quantity equates with described the second quantity, described subject thread is carried out to tested objectThe execution result obtaining carries out verification.
2. method according to claim 1, is characterized in that, described thread pool class has to be obtainedEnliven the method for number of threads; The step of the first quantity of described detection subject thread comprises:
Described in calling, obtain the method for enlivening number of threads, obtain the first quantity of subject thread.
3. method according to claim 1, is characterized in that, described in call described subject threadThe step of carrying out described tested object comprises:
Import into and carry out the required parameter of described tested object;
In described subject thread, carry out described tested object according to described parameter.
4. method according to claim 2, is characterized in that, the described subject thread of described detectionThe step of the second quantity comprise:
Described in calling, obtain the method for enlivening number of threads, obtain the second quantity of described subject thread.
5. according to the method described in claim 1 or 2 or 3 or 4, it is characterized in that, also comprise:
When described the first quantity and described the second quantity are when different, return and carry out the described score of described detectionThe step of the second quantity of journey.
6. method according to claim 5, is characterized in that, described thread pool class comprisesThreadPoolExecutor, described in obtain the method for enlivening number of threads and comprise getActiveCount.
7. the testing arrangement based on asynchronous thread, is characterized in that, comprising:
First detection module, for detection of the first quantity of subject thread; Described subject thread is thread poolIn class, carry out the asynchronous thread of tested object;
Test module, carries out described tested object for calling described subject thread;
The second detection module, for detection of the second quantity of described subject thread;
Correction verification module, in the time that described the first quantity equates with described the second quantity, to described scoreThe execution result that Cheng Zhihang tested object obtains carries out verification.
8. device according to claim 7, is characterized in that, described thread pool class has to be obtainedEnliven the method for number of threads; Described first detection module comprises:
First calls submodule, described in calling, obtains the method for enlivening number of threads, obtains scoreThe first quantity of journey.
9. device according to claim 7, is characterized in that, described test module comprises:
Import submodule into, carry out the required parameter of described tested object for importing into;
Implementation sub-module, for carrying out described tested object in described subject thread according to described parameter.
10. device according to claim 8, is characterized in that, described the second detection module comprises:
Second calls submodule, described in calling, obtains the method for enlivening number of threads, obtains described orderThe second quantity of graticule journey.
11. according to the device described in claim 7 or 8 or 9 or 10, it is characterized in that, also comprises:
Loop module, for, returning and call second when different in described the first quantity and described the second quantityDetection module.
12. methods according to claim 11, is characterized in that, described thread pool class comprisesThreadPoolExecutor, described in obtain the method for enlivening number of threads and comprise getActiveCount.
CN201410670716.2A 2014-11-20 2014-11-20 Test method and device based on asynchronous threads Pending CN105607991A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410670716.2A CN105607991A (en) 2014-11-20 2014-11-20 Test method and device based on asynchronous threads

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410670716.2A CN105607991A (en) 2014-11-20 2014-11-20 Test method and device based on asynchronous threads

Publications (1)

Publication Number Publication Date
CN105607991A true CN105607991A (en) 2016-05-25

Family

ID=55987943

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410670716.2A Pending CN105607991A (en) 2014-11-20 2014-11-20 Test method and device based on asynchronous threads

Country Status (1)

Country Link
CN (1) CN105607991A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108595331A (en) * 2018-04-24 2018-09-28 杭州朗和科技有限公司 Test method, medium, device and the computing device of asynchronous interface
CN116166566A (en) * 2023-04-23 2023-05-26 成都华兴汇明科技有限公司 Test case multithreading scheduling method, system and test management device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567205A (en) * 2003-06-25 2005-01-19 英业达股份有限公司 Method for stopping multi executable line simultaneously
CN102831053A (en) * 2011-06-17 2012-12-19 阿里巴巴集团控股有限公司 Scheduling method and device for test execution
CN103544103A (en) * 2013-09-02 2014-01-29 烟台中科网络技术研究所 Method and system for test, simulation and concurrence of software performance
CN103838654A (en) * 2012-11-27 2014-06-04 重庆新媒农信科技有限公司 Multithreading and concurrency testing simulator and testing method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567205A (en) * 2003-06-25 2005-01-19 英业达股份有限公司 Method for stopping multi executable line simultaneously
CN102831053A (en) * 2011-06-17 2012-12-19 阿里巴巴集团控股有限公司 Scheduling method and device for test execution
CN103838654A (en) * 2012-11-27 2014-06-04 重庆新媒农信科技有限公司 Multithreading and concurrency testing simulator and testing method thereof
CN103544103A (en) * 2013-09-02 2014-01-29 烟台中科网络技术研究所 Method and system for test, simulation and concurrence of software performance

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨志茹,温尚书著: "《JAVA入门与实战教程》", 31 March 2010 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108595331A (en) * 2018-04-24 2018-09-28 杭州朗和科技有限公司 Test method, medium, device and the computing device of asynchronous interface
CN116166566A (en) * 2023-04-23 2023-05-26 成都华兴汇明科技有限公司 Test case multithreading scheduling method, system and test management device

Similar Documents

Publication Publication Date Title
US8756460B2 (en) Test selection based on an N-wise combinations coverage
US20170161182A1 (en) Machine learning based software program repair
US11861394B2 (en) Automated semantic tagging
CN109635568B (en) Concurrent vulnerability detection method based on combination of static analysis and fuzzy test
CN105183564A (en) Equipment scheduling method, device and system based on cloud testing platform
CN105279017A (en) Cloud test platform based task distribution method, apparatus and system
CN108021507B (en) Parallel path searching method and device for symbol execution
WO2017021269A1 (en) Vector processing using loops of dynamic vector length
CN104978272A (en) Program scheduling method for data race detection
CN103995778A (en) Script file generation method and device based on event and action
CN112130923A (en) Container management method and device, electronic equipment and computer-readable storage medium
CN105279092A (en) Software testing method and apparatus
CN106528281A (en) Satellite telemetry data offline unified rapid processing system
CN106528065B (en) A kind of thread acquisition methods and equipment
CN107479866A (en) The method that open terminal applies data and function are realized based on reconfiguration technique
CN111198754A (en) Task scheduling method and device
CN109885489B (en) Data race detection method and device in driver
CN105607991A (en) Test method and device based on asynchronous threads
CN110289043B (en) Storage device testing method and device and electronic device
EP2972880B1 (en) Kernel functionality checker
WO2017016590A1 (en) Scheduling heterogenous processors
US9489284B2 (en) Debugging method and computer program product
CN115202662B (en) Code checking method under weak memory sequence architecture and corresponding equipment
CN106250298B (en) A kind of test method and device
CN109522048B (en) Synchronous multithreading interrupt verification method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160525