I am testing a data migration project and in that I have to confirm if data is migrated as expected . In most of the cases I have requirements in If - Else format for example : -
If Table_Name.Column_Name = 'a' set New_Column = 1 If Else Table_Name.Column_Name = 'b' set New_Column = 2 Else set New_Column = 3
and It could go even crazier . Right now I am doing unit testing and just picking 10 records and then comparing to the target. In this scenario if I use CASE , I might miss the coverage because I may not use some conditions in my testing. I can create different test cases but this is not efficient.
So cold you please suggest me a Select statement which will select at-least one if condition values.
You could create a select to get data from source by applying a filter using IN to get all possible values. Then you can apply the mapping logic based on CASE ..WHEN or IIF to get corresponding values and check it against the values in your migrated table.