Setting Custom Properties on project level through JUnit
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Setting Custom Properties on project level through JUnit
Hello!
I'm running automated SOAPUI tests through JUnit.
I've succeded transferred properties to the different Test Cases by sending a Map of different properties - but now I need to do the same on project level("Custom Parameters).
I've tried this:
SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setProjectFile(folder + "\\" + s);
runner.setIgnoreErrors(true);
runner.setProjectProperties({"DbUsername=testuser","DbPassword=testpw"});
runner.run();
Unfortunately it doesn't work - the properties(e.g: #Project#DbUsername) remain empty when running the code.
Any ideas how to fix this? 🙂
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have use as ${#Project#DbUsername}
For more details, refer documentation here:
https://www.soapui.org/scripting---properties/property-expansion.html
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for being inaccurate - I am using "${#Project#DbPassword}".
It works when putting in the properties manually under "Custom Properties" - but I can't set it automatically through JUnit.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the Custom (project) Properties I'm referring to in my SOAP UI tests which runs fine.
But I need to change these properties through my JUnit project so I can execute my tests automatically on different environments(that has different usernames/passwords). However, it seems like the TestRunner.setProjectProperties() has no effect.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure what code you want. The relevant Java code from my JUnit test is posted in my first post.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be you want to try as below:
runner.setProjectProperties(new String[]{"DbUsername=testuser","DbPassword=testpw"});
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
NP :). But same result unfortunately
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could save the project after run
like the command-line argument
-S: Commands the runner to save the test project after the test run finishes. Use this command-line argument if you store data within the project during the test.
https://support.smartbear.com/readyapi/docs/soapui/running/automating/cli.html
