Forum Discussion

Logica_Norway's avatar
Logica_Norway
Occasional Contributor
15 years ago

How to configure a thread to run test step for only once in a load test

Hi

I am executiong a load test with  1 test step

i have total thread count of 60

one teststep of mine looks like


       
        12
       
        SoapUI Pro
       
        GBR
   

how can i configure each thread to execute this test step for only once 

I am having a properties file with 60 booknames

i want each thread to put book buy requests taking booknames one by one  from my properties file

on a whole 60 threads  should put 60 book requests as 1 book buy request per thread


if u can provide some sample code for this requirement .it would be really helpful

7 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    Each thread runs test case only once. In SetUp script for loadtest load property file and add properties to test case ( book1, book2, etc)

    than in request you could have :


    <pub:BookBuyRequest>
            <!--Optional:-->
            <com:bookId>12</com:bookId>
            <!--Optional:-->
            <com:bookName>${#TestCase#book${#ThreadIndex}}</com:bookName>
            <!--Optional:-->
            <com:Language>GBR</com:Language>
    </pub:BookBuyRequest>



    So, each thread will send one request with one book based on thread index.

    Let me know does it helps,
    robert
  • Logica_Norway's avatar
    Logica_Norway
    Occasional Contributor
    Hi

    I think i didnt explain my problem clearly .I am explaining it once agian
    i am running a load test. i have one test step like above mentioned
    i have thread count of 60. i am using strategy as simple.i am running the test for 600 sec.
    all my sixty threads should execute the test step only once .
    i want to take all my values from text file as (CSV).

    i have run some normal test.i found same thread is exceuting the test step again and again and other threads just putting empty requests .i want to restrict such that when a thread gets started.it should take its values from text file based on its index. and run the test step only once.such that 60 threads should run a test step only once and put on a whole 60 requests taking values from text file based on their  thread index.


    if u can provide some sample code for this requirement .it would be really helpful
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    when you are using load test every test case is running in separate thread.
    And ThreadIndex property is counting from 0 to number of threads you choosen.
    You can use this ThreadIndex property to fetch indexed row from your file.

    Example:
    on test case level add 5 properties :
    book - value0
    book1 - value1
    book2 - value2
    book3 - value3
    book4 - value4


    then in test request

           
            12
           
            ${#TestCase#book${#ThreadIndex}}
           
            GBR


    when you run load test with 5 threads you will have requests like this
    ...
            book0
      ...
    ...
            book1
      ...

    ...
            book2
      ...


    Hope this helps

    Regards Nebojsa
    eviware.com
  • Logica_Norway's avatar
    Logica_Norway
    Occasional Contributor
    Hi

    I have done the same.i have given thread count as 60.but only eight threads  executed the test step . 52 threads didnt have their run .I am explaining more details in the attachment
  • Logica_Norway's avatar
    Logica_Norway
    Occasional Contributor
    I cannot send my project.But its simple to reproduce it. its just a scenario.it doesnt depend  any project.i.Just apply the same steps on any sample project .it will happen the same on any project.I am using soapui pro 3.0.1
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    can you please try the upcoming nightly-build to see if this is working better now?

    thanks in advance!

    regards,

    /Ole
    eviware.com