Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

Easy and Repeatable Testing of DB Code (Stored Procs, etc.) with DbFit Expand / Collapse
Author
Message
Posted Wednesday, November 19, 2008 3:25 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, December 14, 2009 2:47 PM
Points: 6, Visits: 6
Most of the Fit fixtures you can run from Fitnesse can also be run by FitRunner.exe from the command line. You can run a DoFixture, ActionFixture, ColumnFixture, RowFixture, etc. via FitRunner.exe. Is it possible to use FitRunner.exe to execute DbFit fixtures?
Post #605440
Posted Friday, November 21, 2008 4:13 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, October 28, 2014 3:30 AM
Points: 30, Visits: 533
Is there any way to increase the command timeout in DBFit?

I would like to test some complex data warehouse ETL stored procedures, but I've hit a problem as several run for longer than the default timeout (30 seconds), even on test data.
Post #606404
Posted Friday, November 21, 2008 7:17 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Saturday, May 24, 2014 7:58 PM
Points: 219, Visits: 824
Solomon Rutzky (11/13/2008)
Alexander Kuznetsov (11/13/2008)
Solomon Rutzky (11/13/2008)
Alexander Kuznetsov (11/13/2008)
How would you test the following cases:
- my stored procedure modifies two tables and returns a result set;


3) To test any result set, use either the "Query" or "Ordered Query" operations. It does not matter what else the Stored Procedure does.


IMO yes it does - how do you verify that the modifications are exactly as you expect?



Ok, sorry, I misunderstood the intent of that question. To test both the modifications made in the Stored Procedure and the result set returned, you would do the following all within the same page:

a) use the "Query" operation calling EXEC on the Stored Procedure to test the result set
b) use the "Query" operation again calling SELECT * FROM Table1 to test that change
c) use the "Query" operation again calling SELECT * FROM Table2 to test that change


Solomon, in my experience the "SELECT * FROM Table1 to test that change" approach is very inefficient. Come to think of it, next month or next year you will have to add some more test data for some other requirement, and that will break your "test that change" piece. It is much better to test exactly the change - the difference between the original and the modified states.
Post #606501
Posted Friday, November 21, 2008 10:33 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 21, 2008 4:41 PM
Points: 3, Visits: 2

Most of the Fit fixtures you can run from Fitnesse can also be run by FitRunner.exe from the command line. You can run a DoFixture, ActionFixture, ColumnFixture, RowFixture, etc. via FitRunner.exe. Is it possible to use FitRunner.exe to execute DbFit fixtures?


in .NET, yes. FolderRunner and other .NET runners are 100% compatible with the normal fitnesse runner. In Java, the fit runner is not 100% compatible with fitnesse runners, so you can't do it from the command line.
Post #606691
Posted Friday, November 21, 2008 10:34 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 21, 2008 4:41 PM
Points: 3, Visits: 2
Is there any way to increase the command timeout in DBFit?

if you can do that in the connection string, then yes (just set it in the connect operation). Otherwise, not at the moment.
Post #606693
Posted Friday, November 21, 2008 10:38 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 21, 2008 4:41 PM
Points: 3, Visits: 2


Solomon, in my experience the "SELECT * FROM Table1 to test that change" approach is very inefficient. Come to think of it, next month or next year you will have to add some more test data for some other requirement, and that will break your "test that change" piece. It is much better to test exactly the change - the difference between the original and the modified states.


for large tables, if the table has an autoincremented id, you can do something like:

|query|select max(id) as top from table|
|top|
|>>currentmax|

// do your test here

|query|select * from table where id>@currentmax|
|col1|col2|col3|
Post #606697
Posted Friday, November 21, 2008 11:41 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Saturday, May 24, 2014 7:58 PM
Points: 219, Visits: 824
gojko adzic (11/21/2008)


Solomon, in my experience the "SELECT * FROM Table1 to test that change" approach is very inefficient. Come to think of it, next month or next year you will have to add some more test data for some other requirement, and that will break your "test that change" piece. It is much better to test exactly the change - the difference between the original and the modified states.


for large tables, if the table has an autoincremented id, you can do something like:

|query|select max(id) as top from table|
|top|
|>>currentmax|

// do your test here

|query|select * from table where id>@currentmax|
|col1|col2|col3|


works only for inserts and only if the table has identity.
Post #606758
Posted Thursday, February 10, 2011 6:15 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, October 17, 2012 5:22 AM
Points: 2, Visits: 43
I would like to be able to create a test around the metadata returned from a stored procedure.

My scenario :- I will receive Column A, Column B & Column C from a stored procedure.

If another developer changes the sproc to return another column, Column D, I want my test to fail.

'Inspect Query' does return the metadata but I can't figure out a way of sticking that into a test.

Any idea how I can acheive this?

Post #1061900
Posted Saturday, February 12, 2011 3:06 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 9:20 PM
Points: 370, Visits: 1,972
ian.gregson (2/10/2011)
I would like to be able to create a test around the metadata returned from a stored procedure.

My scenario :- I will receive Column A, Column B & Column C from a stored procedure.

If another developer changes the sproc to return another column, Column D, I want my test to fail.


Hi Ian. The only way I can get this to work is to cause a SQL Server exception when the test runs as opposed to a handled DbFit error. I hope this ok as it does kinda work.

1) Use the |Execute| method to create a temp table to hold the expected columns
2) Use a second |Execute| to INSERT into the temp table from an EXEC to the Stored Proc

Example:

!|Execute| CREATE TABLE #ResultSetTest (first VARCHAR(50), second VARCHAR(50), third INT) |
!|Execute| INSERT INTO #ResultSetTest (first, second, third) EXEC Test.dbo.TestProc |

If the result set of the Proc does not match the temp table, then you will get an exception stating:

System.Data.SqlClient.SqlException: Column name or number of supplied values does not match table definition.


Take care,
Solomon...





SQL# - http://www.SQLsharp.com/
Post #1063040
Posted Saturday, February 12, 2011 5:55 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 5:34 PM
Points: 35,609, Visits: 32,200
eharper (11/21/2008)
Is there any way to increase the command timeout in DBFit?

I would like to test some complex data warehouse ETL stored procedures, but I've hit a problem as several run for longer than the default timeout (30 seconds), even on test data.


I'm not trying to be a "smart guy" here... I'm concerned about the code being tested. Wouldn't the fact that something takes longer than 30 seconds "even on test data" be the first indication of a possible major performance problem which needs to fixed prior to going to production?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1063062
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse