Red Gate forums :: View topic - How to test a trigger?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Test
SQL Test forum

How to test a trigger?

Search in SQL Test forum
Post new topic   Reply to topic
Jump to:  
Author Message
AdamY



Joined: 15 Oct 2010
Posts: 41

PostPosted: Thu Mar 28, 2013 9:19 pm    Post subject: How to test a trigger? Reply with quote

TableA has Trigger1 that inserts data into TableB. I'd like to test that the trigger works correctly. Can I do that with SQL Test? I haven't been able to find a way yet. Does FakeTable handle triggers?
Back to top
View user's profile Send private message
stanori



Joined: 23 Apr 2012
Posts: 84

PostPosted: Fri Mar 29, 2013 10:22 pm    Post subject: Reply with quote

Hi AdamY,

Thanks for your post. It looks like something simliar has been covered in stackoverflow:

http://stackoverflow.com/questions/13553928/faketable-with-tsqlt-remove-triggers

It looks like there is a workaround solution to make this happen.

Best Regards,
Steve
_________________
_________________
Steve Tanori
Product Support
Red Gate Software Ltd.
866-997-0378
Back to top
View user's profile Send private message
AdamY



Joined: 15 Oct 2010
Posts: 41

PostPosted: Fri Oct 04, 2013 5:40 pm    Post subject: Reply with quote

kenbroz - the answer Steve (stanori) posted has a link to a work-around solution. tSQLt is working on a permanent solution, I think. The tSQLt Google Group is very helpful and has more info, too.
Back to top
View user's profile Send private message
datacentricity



Joined: 18 Jul 2012
Posts: 18
Location: London

PostPosted: Mon Oct 07, 2013 3:22 pm    Post subject: Re: Reply with quote

kenbroz wrote:
why has been answered, I would like to know the answer because it has a similar problem.


The latest version of tSQLt (the framework that underpins RedGate's SQL Test) now has an ApplyTrigger method which used in conjunction with FakeTable should allow you to do test your trigger. Not sure of this version is packaged up with SQL test yet though.

I have successfully used SQL Test with a more recent build of tSQLt (based on the SQL script download via tsqlt.org) but YMMV.
_________________
"Your mind is like a parachute, it works best when open" Frank Zappa
"Be wary of strong drink. It can make you shoot at tax collectors…and miss" Robert Heinlein
blog: http://datacentricity.net
twitter: @datacentricity
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group