Forum Discussion
heldan
15 years agoNew Contributor
Hi Dain,
Thanks for the reply, unfortunately I still get problem which I do not now how to solve.
With Load Script yes I mentioned the Setup Script but on project level.
What I have done now is that in the Setup Script on project level (these parameters should be used by several different test cases) I use:
context.LoadTestContext['UserPrefix'] = "Some value"
And in the Groovy script on Test Case level I use:
def user_prefix = context.LoadTestContext['UserPrefix']
The problems now are:
1. If I try to run only the Setup script by it self to confirm the syntax I get a NullPointerException since LoadTestContext seems to be null. Do I need to initiate it somehow first or is it failing because I run it manually.
2. I create a load test in soapUI for the test case where I have the Groovy script that reads the parameters but it fails because the user_prefix get null back from the context.LoadTestContext['UserPrefix'].
3. In the Groovy script I have added a log.info of the context.LoadTestContext so I can see it is empty. Tried to do the same in the Setup script but nothing is written. Guess it because the Setup script is not executed which I thought it should be everytime I executed the test case?
It seems as if I have misunderstood something fundamental?
My plan is that if I can get it to work as a load test in soapUI I will export the test case to loadUI and run it there.
/Mikael
Thanks for the reply, unfortunately I still get problem which I do not now how to solve.
With Load Script yes I mentioned the Setup Script but on project level.
What I have done now is that in the Setup Script on project level (these parameters should be used by several different test cases) I use:
context.LoadTestContext['UserPrefix'] = "Some value"
And in the Groovy script on Test Case level I use:
def user_prefix = context.LoadTestContext['UserPrefix']
The problems now are:
1. If I try to run only the Setup script by it self to confirm the syntax I get a NullPointerException since LoadTestContext seems to be null. Do I need to initiate it somehow first or is it failing because I run it manually.
2. I create a load test in soapUI for the test case where I have the Groovy script that reads the parameters but it fails because the user_prefix get null back from the context.LoadTestContext['UserPrefix'].
3. In the Groovy script I have added a log.info of the context.LoadTestContext so I can see it is empty. Tried to do the same in the Setup script but nothing is written. Guess it because the Setup script is not executed which I thought it should be everytime I executed the test case?
It seems as if I have misunderstood something fundamental?
My plan is that if I can get it to work as a load test in soapUI I will export the test case to loadUI and run it there.
/Mikael