Forum Discussion

frank_vanderstr's avatar
frank_vanderstr
Contributor
8 years ago

Enabling/Disabling Test Item To Be Run From Script

I am currently trying to find a way to be able to edit what test items are to be run using Test Execute that is both easy to use and has conveyance. I so far have tried looking into ways to edit the .mds file in a way that makes it clear where the test item enabled field is but I have not made great progress.

 

I then had the idea that maybe it is possible to create a script that could display what test items are currently enabled to run, and with pop up inputs, let the user set which test items will be run. I so far have looked into getting local test item data but it seems the Enabled Property is read only.

 

Has anyone had any luck changing the enabled property of test items from a script or possibly outside testcomplete?

10 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    One idea would be to use keyword tests to launch your scripts instead of test items.

    • frank_vanderstr's avatar
      frank_vanderstr
      Contributor

      How would using the keyword tests enable another user who is running from TestExecute to select which tests to run?

      • ghuff2's avatar
        ghuff2
        Contributor

        From what I've toyed around with there is no perfect way of doing this. There's a couple workarounds that should theoretically do what you need, but neither is perfect.

         

        The first is to edit the .mds file like you mentioned. But the script you have edit the .mds has to run independently of the rest of the project. TestComplete loads the project .mds file when your test run starts executing, so even if you edit it programatically during a test run, you have to end the test run and start a new one for the changes to be recognized. So you could have a project in your project suite that opens a user input form when run and then edits the .mds file for the other project accordingly. That means the user would run that first project, input which tests to run in the next project, then run that next project. Adds an extra couple steps to the process, but it would work.

         

        Other option is to get rid of using Project Items all together. Then write a Launcher function that gets called directly when running from TestExecute. That Launcher function could open a user input form and depending on the input could run other test functions accordingly. The test log isn't as well organized with this option, all the test hierarchy on the left tree panel is under a single test function instead of having separate items for each Project item.

         

        Maybe there's a better option out there I don't know about, but I don't think there's anything inherently built-in to TestComplete/TestExecute to allow for this nicely. I think what Ryan was trying to say is basically the same thing as the second option I laid out, just using keyword tests instead of script functions.