Tsqlt - create a separate database for unit testing

I started using tsqlt, and my question is: is it possible to have a separate database with only test materials? (tables / sp / assemblies, etc.).

This test database will be in the same instance as the actual / target database.

If I try to fake a table, I get the following error:

FakeTable could not resolve the object name, 'target_db.dbo.Sometable' 

Does anyone have any experience?

Thanks.

+8
tsql tsqlt
source share
2 answers

As you have discovered, this is currently not possible, as bullying procedures do not accept three part names. This is what has been reviewed on the SQL Test user feedback forums (RedGate product that acts as the tSQLt interface): http://sqltest.uservoice.com/forums/140716-sql-test-forum/suggestions/2421628-reduce- the-footprint

Dennis Lloyd, one of the authors of the tSQLt framework, wrote at the end of this thread that supporting the separate "tSQLt" database was what they looked at.

Also a related issue of bullying deleted objects at http://sqltest.uservoice.com/forums/140716-sql-test-forum/suggestions/2423449-being-able-to-mock-fake-remote-objects

I hope this helps,

Dave

+8
source share

Now you can do this while the tSQLt framework is in another database:

 EXEC tSQLt.FakeTable '[dbo].[Position]'; EXEC OtherDB.tSQLt.FakeTable '[dbo].[PositionArchive]'; 

A source

This means that you can at least put your tests where you need them, although you need to install the framework in the current test database. Which is not perfect, but it is better.

+9
source share

All Articles