Search code examples
databaseunit-testingssmstsqlt

Progress feedback while executing tSQLt.RunAll


Is there a way to get any feedback from tSQLt.RunAll while it is running. On a very big project with high % DB Unit Test coverage this command takes ages. I would like to be able to see (and display) a progress of this command. Is it possible?


Solution

  • If I want to see where tSQLt has gotten to in a long list of tests, I use

    SELECT Class,TestCase,Result FROM tSQLt.TestResult (NOLOCK)
    

    which shows the results of tests executed to date in the current execution. You can join that to tSQLt.Tests:

    SELECT Tests.TestClassName,Tests.Name,TestResult.Result 
    FROM tSQLt.Tests (NOLOCK)
    LEFT JOIN tSQLt.TestResult (NOLOCK)
     ON tSQLt.Tests.TestClassName = tSQLt.TestResult.Class
     AND tSQLt.Tests.Name = tSQLt.TestResult.TestCase
    

    The Result column will be NULL until the test passes, fails, or errors. I'm using NOLOCK, so a dirty read, but this is sufficient for my purposes to establish progress, and prevent any interruption to the test in progress.

    Hope that helps,

    Dave.