Forum Discussion

craigtaylor's avatar
15 years ago

trouble with context variables - always null

Hi,

I have groovy code that accesses a DB, returns multiple fields and multiple rows, sets it as an array object, which works fine. I then set the array to a context variable in the setup script (tried all setup areas). I have a groovy step in my test case that grabs the array and sets the properties variables so that I only hit the DB once during setup. I am having trouble accessing the context variable in the setup scripts. Only the TestCase setup script can access the variable. The problem is that the load test runs the TestCase setup for each run which calls the DB each time.

I placed the same setup script in the Project level, TestSuite level and LoadTest level setup scripts, but they always show the context variable as null.

I am setting the context using:

context.persons = persons

and accessing using (example):

log.info("context.persons " + context.persons)

I prefer to have the setup script work at the LoadTest or TestSuite level setup script, am I not setting the context variable correctly?

Any help is much appreciated,

Craig
No RepliesBe the first to reply