How could be a good way to create a member which would be used in many test cases of a test suite?
I am just starting to use SoapUI recently. Can someone nicely help me figure out this problem? I have a method to create a member which would be used in many test cases of a test suite only. So won't be a good way to put the method in the global function I guess.
Solved! Go to Solution.
What do you mean by member? Can you tell a little bit more about what you're trying to do?
Hi @Lucian ,
Thank you for your reply!
Sure! For example, I have a method to generate a memberID and password so that I can login using them to check some functionalities.
I have a test suite which includes a few test cases and all of those cases have the same step: generate a new memebrID, pwd and login.
My question is that is there a better way to generate the memberID in the test suite level so that all the cases under that test suite can use the memberID?
You could create a test case in your TestSuitte that would generate a memberID and password.
This would be the first testcase to run in your suite.
Not sure how you are creating these new memberID and Pwd ??
TestSuite level : Custom Properties: create variables i.e. memberID and Pwd
Using Groovy script in this test cases you can extract these from a Response
or however you know these values
Then store them into a TestSuite: Custom Properties variables i.e. memberID and Pwd
testRunner.testCase.testSuite.project.setPropertyValue( "memberID ", <your value>);
testRunner.testCase.testSuite.project.setPropertyValue( "Pwd", <your value>);
Then in the following test cases where you need these values, refernce your TestSuite level
using this in the appropiate spot for your memberID or Pwd
Another suggestion also:
2. and 3. on this page is another approach
Something like @jkrolczy should do the trick. However, I would advise using a Test Suite Setup script for this. So the scenario would look like this:
1. Before a certain test suite is started, ReadyApi executes the Setup script (which generates the memberId and password and saves them at Test Suite level)
2. Every Test Case references that memberId and password.
Hi @jkrolczy ,
Thank you for your reply. My concern is how could we guarantee the test case we used to generate memberID can be run firstly? I think they were run simultaneously.
Thanks again. I think using the test suite setup script would be the best way for this. The problem is I don't know how to do it? It'd be nice you can send me some materials/ documentation related to this to learn?
If you click on your test suite then you'll have the Setup tab available. That's the place where you can put your actual code (I guess you already have some code for generating the userid and password, right?)
Later edit: The print screen is from SoapUI Pro but it is the same on SoapUI Open Source. Just double click on your test suite to open the test suite window and then you'll see the Setup tab just like in the attached photo.