Prepare dynamic csv test data in setup thread

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Prepare dynamic csv test data in setup thread

Tong Sun
Hi,

I want to

- prepare dynamic csv test data in setup thread
- and use the generated .csv data for all other thread groups
- ideally, the name of the .csv is better be changed in the setup
thread as well.

How much of the above steps are possible?

Point 2 & 3 seems to be impossible to me at this point.

thx!

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Prepare dynamic csv test data in setup thread

glinius@live.com
Everything is possible, just make sure to:

 1. Use  setUp Thread Group
<https://www.blazemeter.com/blog/how-use-setup-thread-group-jmeter-when-preparing-load-test>  
which is executed *before* other thread groups
 2. If you want to make csv file names dynamic make sure to define them
using  __setProperty() function
<https://jmeter.apache.org/usermanual/functions.html#__setProperty>   in the
setUp Thread Group and read them via  __P() function
<https://jmeter.apache.org/usermanual/functions.html#__P>   in the "normal"
Thread Groups



--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Prepare dynamic csv test data in setup thread

Tong Sun
On Wed, Dec 16, 2020 at 7:37 AM [hidden email] <[hidden email]> wrote:

>
> Everything is possible, just make sure to:
>
>  1. Use  setUp Thread Group
> <https://www.blazemeter.com/blog/how-use-setup-thread-group-jmeter-when-preparing-load-test>
> which is executed *before* other thread groups
>  2. If you want to make csv file names dynamic make sure to define them
> using  __setProperty() function
> <https://jmeter.apache.org/usermanual/functions.html#__setProperty>   in the
> setUp Thread Group and read them via  __P() function
> <https://jmeter.apache.org/usermanual/functions.html#__P>   in the "normal"
> Thread Groups

Sorry I can't get it to work. I'm getting

java.lang.IllegalArgumentException: File 1 must exist and be readable

It must be something simple but I just can't figure it out now. So
here is my code:

---------------------
CsvFile = "Test.csv"

log.info("CsvFile: ${CsvFile}")
props.put("CsvFile", CsvFile)
log.info("CsvFile: ${__P(CsvFile)}")
setProperty("CsvFile", CsvFile)
log.info("CsvFile: ${__P(CsvFile)}")
---------------------

And for that, I'm getting:

2020-12-16 16:48:49,970 INFO o.a.j.p.j.s.J.init: CsvFile: Test.csv
2020-12-16 16:48:49,970 INFO o.a.j.p.j.s.J.init: CsvFile: 1
2020-12-16 16:48:49,970 INFO o.a.j.p.j.s.J.init: CsvFile: 1

What's wrong? Thx!!

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]