How to enable/disable multiple assertions in a test Suite via groovy script
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to enable/disable multiple assertions in a test Suite via groovy script
I need to enable/disable multiple assertions in a test Suite via groovy script
I know how to disable individual assertion via
testSuite.getTestCaseByName("TestCaseName").getTestStepByName("TestStepName").getAssertionByName( "ConciseResponse" ).disabled = true
But I would like to enable / disable all the assertions named "ConciseResponse" in a test suite via groovy script. Any help would be appreciated
Solved! Go to Solution.
- Labels:
-
Assertions
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How are you disabling it? Because that script should not be part of any test case, correct? Just a temporary one.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Open setup script of test suite and add the following and run it.
Once you verify the assertions are disabled, you take remove the same from setup script as it is no more needed.
testSuite.testCaseList?.each { kase -> kase.testStepList?.each { it?.assertions['ConciseResponse']?.disabled = true } }
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@mithunbhat : You need to loop through each Test case in that Test Suite and write the same code which you have mentioned.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@nmrao - Tried the script you have posted at the Setup script at the TestSuite level, but i am getting a script error
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also try removing ? marks one by one to see if that helps.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tried your suggestions of removing ? , but its still erroring out.
Here is the screenshot of the project. Btw I am using version 3.5.1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BTW, all of your test steps have assertions?
What are the different type of test steps that you have and they don't have the assertions.
The ? marks is to handle if no tests or no steps or no assertions.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attached is the snapshot of the project. There are multiple test steps under the testcase. and not all the test steps have the assertion 'ConciseResponse'.
The error I am getting while just running the setup script at the TestSuite level is
com.eviware.soapui.support.scripting.ScriptException: Error in Setup Script of Search Options
