Forum Discussion

M_McDonald's avatar
M_McDonald
Super Contributor
16 years ago

[SOLVED]ThreadIndex in DataSink file name

I am running a load test with a test case that has a DataSink that writes to an Excel file. I want to use the ThreadIndex to create unique filenames, but I keep getting 0 for all threads.

Here is the Out File value:

${projectDir}/results/${#TestCase#datasinkFile} - ${=String.format('%tY%<tm%<td-%<tH%<tM%<tS', new GregorianCalendar())} - ${ThreadIndex}.xls


and a resulting filename:

Test Results - 20091014-144643 - 0.xls


What am I doing wrong?

I am using build 3.0-pro-daily-build-2009-09-28-[1]

Thanks.

9 Replies

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    I have isolated the problem. The test case I am running uses the Run TestCase step to run another test case which contains the DataSink step.

    I have created and attached a simple project to demonstrate this. Running the load test in TestCase 2 will create files in the project directory with a ThreadIndex of 0 in all filenames.
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    It would be nice if this worked as-is, but I have a workaround now. I created a parameter "threadIndex" in the called test case and I pass in ${ThreadIndex} in the Run TestCase step; then I use ${#TestCase#threadIndex} in the Out File field.
  • Hi!

    Thanks for your detective work! The upcoming nightly build propagates the ThreadIndex and any other context variables to the called TestCase, hopefully that fixes this issue.

    regards!

    /Ole
    eviware.com
  • Hi!

    Actually, there is now a new option in the RunTestCase options dialog that allows you to promote LoadTest related properties to the target testcase, try selecting that when running your loadtest.

    let us know!

    regards,

    /Ole
    eviware.com