How do I rename a tSQLt test class?

后端 未结 4 407
不知归路
不知归路 2021-01-03 02:20

I\'m developing a database using the Red Gate SQL Developer tools. SQL Test, the SSMS add-in that runs tSQLt tests, lacks a way to rename test classes.

I have a test

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-03 02:47

    What is your workflow like? If you have all your tests for that test class in one script with exec tSQLt.NewTestClass 'BackendLayerCustomerAdministrationTests' then you can just find and replace the testclass name and you are done.

    e.g.

    EXEC tSQLt.DropClass 'BackendLayerCustomerAdministrationTests'
    GO
    EXEC tSQLt.NewTestClass 'CustomerTests'
    GO
    
    CREATE PROC [CustomerTests].[test_Insert_AddsACustomer]
    AS
    etc, etc
    

    This will work because the EXEC tSQLt.NewTestClass 'CustomerTests' will drop all objects in the testclass and they will be recreated as the rest of the script runs.

提交回复
热议问题