[Dev] Test script with concurrent threads

Frank Cohen fcohen at pushtotest.com
Thu May 24 13:28:56 PDT 2007


Hi Filipa: Take a look at the XSTest scripts in TestMaker 4.x under  
TestMaker_home/xstest. The master.py script in particular  
instantiates concurrently running threads. You may also find an  
article on the PushToTest site that pertains to your question. Use  
the search function on the site to search for 'threads'. Hope this  
helps. -Frank




On May 24, 2007, at 4:23 AM, Filipa Martins Soares Abrantes wrote:

>
>  Hi!
>
> I'm still trying to execute a test script with concurrent threads,  
> but the threads are being executed in a sequential order instead.  
> Can anyone tell me how can put the threads executing concurrently?
>
> I really need some help!
>
> This is the code I'm executing:
>
>
>     numThread = 3
>     numThreadPerBlocks = 5
>     fimThread = 0
>     tinicio = Date().time
>
>     while (i < numThread):
>         x = 0
>         if (numThread - i < numThreadPerBlocks):
>             numThreadPerBlocks = numThread - i
>
>         while (x < numThreadPerBlocks):
>                 print "Start thread ", i
>                 test = Portal5( 1, 'console file ', 0, '20.|300|301| 
> 302|303|304|307|401|403|408|41.', ' log.xml', 5, 5, 5, 1, 1,  
> 'Portal5', 1 )
>                 test.setUp()
>                 thread.start_new_thread( test.runTest(), (i,))
>                 x += 1
>                 i += 1
>                 time.sleep(10)
>
>         time.sleep (40)
>         print "Stop between blocks"
>
>     while (fimThread < i):
>         time.sleep(1)
>
> This is my text output:
>
> Start thread  0
> Portal5: Initialize
> test: setUp
> test: runTest
> Request step: 1, http://www1.asd.pt/PortalWeb/content/
> Request step: 2, http://www1.asd.pt/PortalWeb/content/
> ..
> Start thread  1
> Portal5: Initialize
> test: setUp
> test: runTest
> Request step: 1, http://www1.asd.pt/PortalWeb/content/
> Request step: 2, http://www1.asd.pt/PortalWeb/content/
>
>
>
> Thanks in advance,
> Filipa
> _______________________________________________
> Dev mailing list
> Dev at lists.pushtotest.com
> http://lists.pushtotest.com/mailman/listinfo/dev



--
Frank Cohen, PushToTest, http://www.PushToTest.com, phone 408 374 7426
TestMaker: The open-source SOA test automation tool





More information about the Dev mailing list