Forum Discussion

negative_zero's avatar
negative_zero
New Contributor
6 years ago

Sharing test scripts between multiple projects

I am testing a WPF application with TestComplete and already have a couple of tests for "manual" use. Now I want to execute these tests in a continuous integration environment, and for that I need di...
  • AlexKaras's avatar
    AlexKaras
    6 years ago

    Hi,

     

    If I got you right...

     

    > Seeing that "//USEUNIT" apparently can't do what I thought it could do [...]

    Every nation has its customs... :)

    Yes, #include/import directives do not require an entity to be explicitly included into the project. Instead they are utilizing some internal search logic that is usually based on the values from either OS environment (Path/ClassPath/...) or the values stored in the IDE/project file.

    This definitely easies your work as you are not forced to fully qualify required file. But on the other hand it creates a risk that some other file but not expected one is used. And you may be really surprized of why things are working not as expected until you dig into debugging.

     

    One of the possible approaches is to consider the structure of your test code and make it 'linear-dependent'. For example: units of 'utils' type that do not contain any code that is specific to the tested application. Then units of 'helpers' type that contain specific, but generic code. Like selection from the list, button click, waiting for the control, etc. And, finally, the units of 'test' type that contain actual test code.

    With the proper design, the set of 'utils' and 'helpers' units is quite stable. These units can be put on the same level of folders structure on the disk where test projects are located. And then you may reference them from test projects.

    Like this:

    |

    +Libs\

      +Utils\

      +Helpers\

    +Project1\

      + ...

    +Project2\

      +...