What are the challenges you face when working across database platforms? Take the survey

Test multiple classes using tSQLt

DLyesDLyes Posts: 16 Bronze 1
I have a build definition set up in VSTS which is running Build, Test and Sync steps.
I currently have the Test build step running all tSQLt tests in the database, but I was wondering if I could specific a subset of my tests to run.

I know that I can specific a specific class or a specific test for it to run, but is it possible to specific multiple classes or tests?
Or maybe is it possible to run all tests except for a specific test class or test?

I assume the other option I have is to include multiple build steps, one for each test class I do wish to run, but that seems like a lot of extra overhead.


  • Options
    Hey DLyes,

    Thanks for contacting us!
    There are multiple ways to set this up - if you never want to run certain tests - you can remove them from the database, then commit that change to the repository so that they will never run.

    Barring that, you should be able to Link to the "Run only specified class/test" and put in the names of the classes and tests in a comma separated format.


    Let me know if you have any issues with that!

    Andrew Pierce
    Technical Sales Engineer
    Redgate Software
  • Options
    DLyesDLyes Posts: 16 Bronze 1
    Thanks for your response Andrew.

    My environment looks a little different to your screenshots, and I can't see a link button to bring up the "Link Settings" window that you have.


    Maybe we are using different versions? I am using "Redgate DLM Automation 2:Build".

    I had a go at adding multiple classes straight into the "Run only specified class/test" option but it wouldn't run any tests when I did this.

    Can you think of anything else I can try?
  • Options
    Andrew PAndrew P Posts: 194 Silver 3
    edited June 27, 2017 3:27AM
    Hey DLyes,

    It looks like my option was only in VSTS - I think you will need to do one class for each run of SQL Test, so that it runs every test in that class - not necessarily one test per run.

    I'll ping some colleagues to confirm.

    EDIT: Confirmation - the Test step (using the Invoke-DlmDatabaseTests PowerShell cmdlet) in DLM Automation simply uses the tSQLt.Run stored procedure which only accepts one class per run.

    This does sound like an excellent candidate for future work, so I recommend you create this idea and vote on our UserVoice page here.

    Do let me know if you have any other questions or issues!

    Warm Regards,
    Andrew Pierce
    Technical Sales Engineer
    Redgate Software
Sign In or Register to comment.