Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

ETL DATA TESTING Expand / Collapse
Posted Friday, September 30, 2011 12:18 PM


Group: General Forum Members
Last Login: Yesterday @ 5:33 PM
Points: 190, Visits: 619
I have source side stored procedure.Using which i need to do analysis and write test cases.
In the stored procedure , they are updating data after wrting the stored procedure.Do any one know how to write testcases for update statments.

Post #1183878
Posted Friday, September 30, 2011 2:49 PM



Group: General Forum Members
Last Login: Sunday, January 4, 2015 7:55 AM
Points: 5,333, Visits: 25,280
To be honest I do not know of any "Standard" test procedure as you are requesting. But you can do a great deal of "testing", checking for "good practices" by examining the T-SQL statements. I would for example.

1. Each SP should include a TRY CATCH block - if some mistakes exist the TRY CATCH can be coded to return a appropriate error message.

2. Each SP should (in my opinion) have a BEGIN / COMMIT / ROLL BACK transaction. To some extent makes each SP check itself and "undo" errors. Try reading this


3. Visual examination to insure that each update SP has the appropriate WHERE clause. (MOST IMPORTANT)

Hope this gets you started.

If everything seems to be going well, you have obviously overlooked something.


Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1183957
Posted Thursday, May 28, 2015 1:27 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, May 3, 2016 7:09 PM
Points: 231, Visits: 384
Remember SEAT for testing.

Table A
Column1 varchar(4),
Column2 int

Select a row of data to be updated.
Select Column1, Column2 from A where Column1 Is Null

Run the test/code

Insert into A_Changes
Select Column1, Column2 from A where Column1 Is Null
Update A Set Column1 = 'TEST' where Column1 Is Null

Select *
from A
inner join A_Changes
on Column2 = Column2

Tear down (Clean up)

Drop table A_Changes



We are the pilgrims, master.
We shall go always, a little further.
Post #1689419
Posted Tuesday, February 23, 2016 9:09 AM



Group: Administrators
Last Login: Yesterday @ 10:21 AM
Points: 33,688, Visits: 17,776
As Jamie wrote. Have a specific, curated set of data. Know the opening state, make the change, query for the end state, which you should know.

To do this right, you should have multiple cases, NULLS, blanks, negatives, etc. Test how your code handles a variety of beginning cases, with rules for how things should end up.

Note that you won't catch everything at once. Write a few cases you know, but add tests as you discover new issues.

Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1763528
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse