Utilizing your .NET Project's Automated Acceptance Tests on Crystal Reports - Part 1
page 5 of 7
by Eric Landes
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 25525/ 72

Fitnesse Code

Below is a snapshot of the fitnesse code used to validate your report.

Listing 1

public class fieldsinreport: ColumnFixture
{
  public string fieldname;
  public string datatype;
  public Boolean ok()
  {
    CrystalReport1 report = new CrystalReport1();
 
    foreach (CrystalDecisions.CrystalReports.Engine.ReportObject currentObject
      in report.ReportDefinition.ReportObjects)
    {
      if (currentObject.Name == fieldname)
      {
        return true;
      }
 
    }
    return false;
  }
}

The code in listing 1 assumes that you have a report called CrystalReport1 in an assembly somewhere. In our solution we have placed the report in the namespace Eric.Landes.Sample.AutomateCRTest.TestingCR. 

Notice that our fixture simply runs tests. The fixture is a wrapper that runs basic functions needed to determine if your code can pass the tests. For our report, iterate through the objects in CrystalReport1 to determine if the current objects fieldname equals the fieldname in the report.  Let us look at the actual report to see what that means for the Crystal Reporting side of things.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 



Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-04-16 11:01:40 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search