top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Informatica Testing: Date Ranges

0 votes
174 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 by Sunil

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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.

answer Aug 25, 2014 by Shweta Singh
Similar Questions
+2 votes

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?

+3 votes

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

+2 votes

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?

0 votes

In informatica i receive dates from flat files in the format of dd-mm-yyyy and dd/mm/yyyy i need to convert all date to one format i.e dd-mm-yyyy using any expression and push into target ,so no rows gets rejected.how to proceed with them?

0 votes

I am loading date fields from file to teradata table. In a file my date format is mm-dd-yyyy and in my teradata table the format is yyyy/mm/dd.

I used the below function for formatting:

To_date(to_char(date field,'mm-dd-yyyy'),'yyyy/mm/dd')
But all my records are going in rejected records. When I checked session log my date field was mentioned as invalid date.

Please help on this.

...