Forum Discussion

Pavel_1's avatar
Pavel_1
Contributor
14 years ago

Disabling project suite test items

Hi,


How is it possible to disable a project from the script in another project?


Its possible to disable test items of the project using Project.TestItems.TestItem(i).Enabled property.


But there is no such object as ProjectSuite.TestItem.


I need to skip several projects on certain condition but have no idea how to do it.


Thanks in advance for any help.

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Pavel,



    Disabling test items results in configuration files changes that may cause inconveniences if the project is under source control.

    I would instead consider introduction of the project suite variable (of Temporary category but not of the Persistent one to avoid changes in the configuration files during test run). The script may check the value of this variable and either proceed further or exit.
  • Hi Alexei,


    Thanks for the reply.


    I already have such temporary project suite variables of object type that are intended to store information about which tests/subtests should be skipped for each project and certainly they can be used to skip all tests of the given project.


    But when skipping the whole projects in this way I will have a lot of superfluous nodes in the log afterwards (per each test project, even if it was skipped). And I need to have these nodes only for projects containing actually passed tests, otherwise I will have to look through all the project nodes to search which ones really contain some test actions.


    As for projects under source control system ( yes I really have them linked to source control) - afaik its just .mds files that will be changed in this case, and they can always be reverted to initial state, and besides that, its always possible to launch some initialization procedures in the beginning.

  • Isn't it really not possible to disable projects from scripts?


    Had just an idea to modify xml data of .pjs file  from script, where information about enabled projects stored (to change "enabled" property for needed item in "test data" node.


    But such changes will be applied only after reloading the project suite, and not during the current run.


    So, are there any other solutions for this?

  • Hi Pavel,


    How is it possible to disable a project from the script in another project?

    ...

    But there is no such object as ProjectSuite.TestItem.


    I need to skip several projects on certain condition but have no idea how to do it.



    We have an appropriate suggestion in our DB, and your post has increased its rating. However, I cannot tell you for sure whether and when it will be implemented. Currently, it is possible to enable\disable projects and their items using an external *.js file working with TC via COM. The Integration.TestSuite property allows managing projects (and their test items).


    //Disable an item of a project suite

    IntegrationObj.TestSuite("").TestItem(Index).Enabled = false;


    Its possible to disable test items of the project using Project.TestItems.TestItem(i).Enabled property.


    This property is read-only, you cannot modify its value.


    Had just an idea to modify xml data of .pjs file  from script, where information about enabled projects stored (to change "enabled" property for needed item in "test data" node.


    We do not recommend working with project files manually.

  • Thanks for clarification, 


    Will try using COM access from external wsh script