Forum Discussion

cameronh's avatar
cameronh
New Contributor
10 months ago

Running a TestCompelte project with a nonexistent tag fails instead of skips

I have a test suite built of multiple project suites each with multiple projects. Some test cases have a label "@UniqueLabel". I've been looping through the project suite files and running all tests which works correctly, but now I need to run the subset of tests from all projects in all project suites labeled @UniqueLabel. I can iterate through each of the projects in each of the project suites as you can't run from the project suite level with tags.

 

The problem is if I encounter a project in my loop with no tests labeled @UniqueLabel, the project fails with the error "There are no tests that match the "@UniqueLabel" tag expression."

 

If the project doesn't contain any tests labeled @UniqueLabel I just want the project to be skipped. Is there any way I can ignore this error or not run the project if it doesn't contain any tests with that tag?

 

For ignoring the error, I tried using the OnLogError even handler but there were two problems with this. One was that on regular errors the error still gets put in the log, it's just that you can perform additional actions, but the original error stays in. The other problem was this seems like it's not a regular error: the error handler didn't work on it and I'm guessing it's because it's not part of normal test execution (it's an error that happens when the project is run).

 

For not running the project if it doesn't contain any tests with that tag, there doesn't seem to be a decent way of doing this. All I can think of is finding the execution plan file, opening and reading it, getting the tests that are run, and opening each of the test files to see if they contain the string "@UniqueLabel". This seems really convoluted though.

 

Edit: Additional info: I'm running this through Jenkins, though if you have a solution with the command line use of TestComplete it may translate over.

 

If anyone has ideas on how to accomplish what I'm trying to do I'd be very grateful!

4 Replies

    • cameronh's avatar
      cameronh
      New Contributor

      Hi Marsha, thanks for the reply!

      Unfortunately I've already looked through this page. I had another look but I don't see anything to help me.

      I should also mention I'm running this through Jenkins, so GUI-based solutions are out. Without Jenkins though the equivalent would be a similar loop through projects and running TestComplete through the command line.

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    What if you add a test to every project with @UniqueLabel that is just a 200ms delay?

    This way it won't crash since there is now a test with that label