Forum Discussion

RJanecek's avatar
RJanecek
Regular Contributor
15 years ago

[SOLVED]NPE when I loop over testCases

Hi,

I have some testSuites and I wanna enabled disable testSuites:

context.getTestSuite().getTestCaseList().each{
context.getTestSuite().getTestCaseByName( it.getLabel() ).setDisabled(false)
}

but unfortunately it.getLabel() return nameOfTestCase + (disabled) if test is disabled so this method getTestCaseByName cannot find these testCase.
So I think it.getLabel() should return just name of testCase even this tesCase is disabled or not. or there will be new method getName of tesCase of new method getTestCaseByLabel

thx

4 Replies

  • Hi,

    can you programmatically remove 'disabled' text (if present in label) before looking up in test case list ?
    I believe that should be a quick fix for this problem.

    Regards,
    Vladimir
    SmartBear Software
  • RJanecek's avatar
    RJanecek
    Regular Contributor
    yes sure, I used replacedAll and trim to removed this but i post here because I think you can fix it so nobody else will have no problem with this issue
  • Hi,

    the label is what is shown in the UI - please use getName() instead (or just .name).

    To really short it down you could write

    context.testSuite.testCaseList.each
    {
    context.testSuite.testCases[it.name].disabled = false
    }

    regards!

    /Ole
    SmartBear Software