How could be a good way to create a member which would be used in many test cases of a test suite?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Flora,
What do you mean by member? Can you tell a little bit more about what you're trying to do?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
${#TestSuite#memberID}
${#TestSuite#Pwd}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another suggestion also:
https://www.soapui.org/docs/functional-testing/properties/working-with-properties.html
2. and 3. on this page is another approach
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Lucian
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?
Thanks, heaps!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Flora ,
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.
