Forum Discussion

zwcmic's avatar
zwcmic
New Contributor
2 years ago

Is there a way to change settings to all test cases?

Hi, we have 300+ cases, is there a way to change a setting for them all in one go?   I'm aware that there is a global preference, but they only apply to newly created cases.
  • groovyguy's avatar
    groovyguy
    2 years ago

    You can accomplish this, as I said, with a groovy script. It's very powerful, but prone to error, so you have to be careful. There's two options here, "failOnError" which is failing as soon as there's a failure with any given step, and "failTestCaseOnError" which marks a test case failed for any given error. I think you want "failOnError" here. That said, here's some code that might help.

    // assuming you have multiple projects that you want to adjust.
    def workspace = context.testCase.testSuite.project.workspace;
    
    for (p in workspace.getProjectList())
    {
         for (s in p.testSuiteList)
         {
              for (c in s.testCaseList)
              {
                   c.getSettings().setBoolean("failOnError", true)
              }
         }
    }