Sunday, March 31, 2013

test report generation (50 mcg)

Report generation is a common function of the applications especially financial applications. For example, all the banks provide statement download function through their websites. I am not sure how they test that functionality, this is what I did for one of my client.

The report downloading process contains following steps, thus a template method or composite approach will be suitable to design a generic ReportDownload, let me design an interface first,

public interface Report{
}

public interface ReportDownload {
   void navigate();
   void enterCriteria(ReportCriteria criteria);
   void triggering();
   Clickable trigger();
   Report findReport();
   Report resolveExpection(Report actual)
}

Report is a type, based on its file type, it can be a CSV, Excel or PDF document.

This is an article about how to save the downloaded file a certain folder, selenium forefox profile, with design, we can add a variable to hold the directory of the download files as per test base, so the findReport() method can look into that directory to find newly arrived file, in that way, you don't need to specify the download file name in the test. To test the result, a simple way is to use pre generation file as an expectation to compare the downloaded report. The expectation can be stored in a classpath directory which can be resolved by the file name of the actual report.

Once expectation and actual report are founded, we can compare two files to find out whether they are same, we can override the equals method to compare the content of the two files.


Report actual = page.findReport();
Report expected = page.resolveExpectation();
assertEquals(expected, actual)

1 comment:

  1. Betway Casino Review 2021
    We will review Betway 실시간 바카라 Casino in this review of their casino, including its promotions, bet banking options 오락실 슬롯 머신 게임 and other important 승부사 온라인 환전 information.Games: 700+Number of Games: 화이트 벳 550+

    ReplyDelete