Edgar_Brodie
12 years agoNew Contributor
Disable test items during execution
Hi,
I would like to disable (child) test items during execution of the parent item.
A Project Suite variable (DoLightRun) is defined to manage skipping specific (child) tests that have this script attached:
function SkipMeAndMyChildren()
{
if (ProjectSuite["Variables"]["GetVariableDefaultValue"]("DoLightRun"))
{
var childCount = Project["TestItems"]["Current"]["ItemCount"];
var childIndex = 0;
for (childIndex = 0 ; childIndex < childCount ; childIndex++)
{
//DOES NOT WORK BECAUSE PROPERTY IS READ ONLY
//Project["TestItems"]["TestItem"](childIndex)["Count"] = 0;
//DOES NOT WORK BECAUSE PROPERTY IS READ ONLY
//Project["TestItems"]["TestItem"](childIndex)["Enabled"] = false;
}
// Quit this parent test project
Runner["Stop"](true);
}
}
Is there some posibility to get this to work? I would really like to disable/enable test items during execution of the suite. Many thanks in advance for any tips.
- Hi,
> I don't know if you can from a script [...]
No, this is not possible from the script.
Alternative (to COM-based) approach may be to read some configuration file that specifies what test items should be either executed and/or skipped, iterate through all test items in the given test project and either execute or skip them.