# Informatica Testing: Date Ranges

58 views

How to comprehensively test the following code.

``````if(date_1 <= MAX_PROC_DATE && date_2 >= MIN_PROC_DATE){
// do some stuff
}
``````

What should my test cases be? I figure with three possibilities for each comparison, there should be 9 total unique cases.

``````date_1 < MAX_PROC_DATE && date_2 > MIN_PROC_DATE
date_1 = MAX_PROC_DATE && date_2 > MIN_PROC_DATE
date_1 < MAX_PROC_DATE && date_2 = MIN_PROC_DATE
date_1 = MAX_PROC_DATE && date_2 = MIN_PROC_DATE
date_1 > MAX_PROC_DATE && date_2 > MIN_PROC_DATE
date_1 < MAX_PROC_DATE && date_2 < MIN_PROC_DATE
date_1 > MAX_PROC_DATE && date_2 < MIN_PROC_DATE
date_1 = MAX_PROC_DATE && date_2 < MIN_PROC_DATE
date_1 > MAX_PROC_DATE && date_2 = MIN_PROC_DATE
``````

Could some of these be combined? Like does Test case 4 cover test cases 2 and 3 for testing that the program recognizes when the dates are equal? Please let me know your thoughts. Thanks!

posted Aug 21, 2014

The && operator is a short-circuit, and therefore anything on the left that is false in turn makes everything on the right false.

Therefore the result is:

1 => always false => date 2 > IN_PROC_DATE
2 => always false => date_2 > MIN_PROC_DATE
5 => always false => date_1 > MAX_PROC_DATE
7 => always false => date_1 > MAX_PROC_DATE
9 => always false => date_1 > MAX_PROC_DATE

3 date_1 < MAX_PROC_DATE && date_2 = MIN_PROC_DATE
4 date_1 = MAX_PROC_DATE && date_2 = MIN_PROC_DATE
6 date_1 < MAX_PROC_DATE && date_2 < MIN_PROC_DATE
8 date_1 = MAX_PROC_DATE && date_2 < MIN_PROC_DATE
So 3, 4, 6 and 8 will trigger your //if done part, but the others won't.

Similar Questions

I want to display the time stamp in following format '2011-04-22 10:41:57.000' to date as '04/22/2011' but when it convert it to following form TO_DATE(TO_CHAR(Date), 'MM/DD/YYYY HH24:MI:SS') it is displaying as null.

I am planning to use substring after the conversion

Can someone please tell me where i am going wrong?

How to calculate the Monday date of a week using the week number in Informatica?!

I have two sessions I a workflow like below

``````workflow1->session1->session2
``````

I have a join_date column in a table in Mapping1 , in session1. I want to pick this join_date value and pass to mpping2/session2

If join date value changes in the table in session1 then the same value should pick and pass to session2. I will use this date value in a query in session2 .

Please suggest how to achieve this?