Forum Discussion

sastowe's avatar
sastowe
Super Contributor
12 years ago

run test items conditionally

I am trying to think of a way to have one project suite with tests for multiple versions of my application under test. Some of my tests will apply for version 1 forward for example, another for version 2 forward... MANY of the tests are going to be the same across all versions. I was thinking. Is there a way to set custom properties for a test item in a project? I dont see a means readily exposed in the tested items pane. But some of you brilliant people might know a way.

Thanks



S

8 Replies

  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)
    Stephanie,



    You can organize test items into groups in your project. By checking or unchecking groups in the project editor, you can easily include or exclude tests from the run. See the attached image to get the idea.



    Alternatively, you can create a project or project suite variable that will specify the tested app version and, at the beginning of each of your tests, check the variable value and run or exit the test. Before running your tests, you will have to set the variable value in the project editor.
  • sastowe's avatar
    sastowe
    Super Contributor
    Ok. I had completely misunderstood grouping. Time to watch the test item video again! Thanks.

    Stephanie

  • sastowe's avatar
    sastowe
    Super Contributor
    Looks like TestItem's enabled property is read only in script?
  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)
    Yes, according to the TestComplete documentation, this property is read-only. :-).
  • sastowe's avatar
    sastowe
    Super Contributor
    You mean you can't magically make it read/write for me? Geeeeeez. :)
  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)
    Unfortunately, no :-)

    As far as I know, changing the project contents at run time is not desirable and is disabled where possible, so...
  • sastowe's avatar
    sastowe
    Super Contributor
    "As far as I know, changing the project contents at run time is not desirable and is disabled where possible, so..."

     

    I don't see why changing project contents at runtime would be undesirable. TestItem.Items("whatever").Selected = true for the conditions under which it would be appropriate to execute that test item as in my case after a read of the registry to see what version I am running.

  • Hi Stephanie,

    One of the possibility may be to start each project with a sort of "master test" that will check  the version in the registry and pass or fail according to the version under test.

    Additionally you may design a small project that will start your Project Suite and set some variables of the Project Suite according to the version number or whatever may be a condition to run a project (or a part of the project) or not.

    I don't know how big are the differences between the version of your software, but this may also help you to design tests with a behavior adapted to each version.



    Christophe