Google Base, Reporting Xml, and VS Unit Testing

I have been working on an interesting project here at work.  I had previously been working on some fixes for a windows service (written in C#) that uploaded our catalog items to Google Base, based on some logging and comparison diffs, every fifteen minutes if there were new items or updates to items.  But, with that seemingly on its way now, I was assigned this new project.  Basically I am working on a system that will allow the definition of sql queries, or data “views” via an XML schema.  Yes, I know there is already RDL for SQL Reporting Services, but that is not what they want.  They want a much, much simpler setup that will make it easier for a developer on the team to make changes to, or add a new report, by editing the XML  definition file.

So, off I go.  I started with the whiteboard notes that were put up during my initial meeting about this, and the sample XML there-in, and have tried to keep it as simple as possible.  I am using classes for each logical report entity, such as:  Report, Query, Column, Parameter, etc.  I am also using the VS unit testing framework for this project, which is something I hadn’t done previously, but wanted to.  Let me qualify that by saying up front that I am not using TDD strictly speaking.  But I am writing tests for code, classes and methods, as I go.  I must say I am quickly becoming hooked on the idea of unit testing everything, whether you are designing with TDD or not, it just makes sense, and it does honestly help with design decisions.  By testing your code as you go or before hand you get a quick look at how it will be called, which in my case where I am developing what hopes to be an api of sorts that will be extended and re-used often is a great benefit.  

I am going to try and post my progress with work and specifically this project as I go because I am learning a lot and because this one is already a fun one.  Here is a quick taste.  This is the XML markup for a report as far as I have designed yet.  No, it is not complete, and yes, I will probably change it many times before it is done, but it is a start.  I have coded interfaces, base classes and implementations for all of this markup so far…

<?xml version="1.0" encoding="utf-8"?>
<report name="test report"
  author="programmer"
  title="A Test Report"
  description="A test report description."
  created-on="2007-12-31"
  modified-on="2008/01/01">
  <column name="ID" display="ID" type="Bound" />
  <column name="NAME" display="Advertiser Name" type="Bound" />
  <column name="MODIFY_DATE" display="Last Modified" type="Bound" />
  <column name="TOTAL_ITEMS" display="Total Items" type="ReportLink">
    <displayinfo type="reportlink">
      <href>itemsbyadvertiser.xml?id=[ID]</href>
      <placeholder name="ID" value="[ID]" />
    </displayinfo>
  </column>
  <query name="AdvertiserItemCounts">
    <sql>
      SELECT ID, NAME, MODIFY_DATE, (
      SELECT COUNT(ID) FROM ITEM
      WHERE ADVERTISER_ID = a.ID
      ) AS TOTAL_ITEMS FROM ADVERTISER a
      ORDER BY TOTAL_ITEMS DESC
    </sql>
    <connection database="Internet" />
  </query>
</report>
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s