Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Testing dynamic content

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello...
Quite new to using jUnit, and of course, I am trying to use it for something other than it's base intended purpose.
I am part of a group who itegrate customers onto a platform. In this case, we take data in from many customers in many different formats and parse it. The parsed data is stored in a DB which was designed via IBM's VAP. The data is therefore organized and accessed through objects. In my case, each data file that is run is a batch, and contains many records, which in turn contain information that is accessed by other objects.
What I am looking to do, is to build a framework around writing tests on the data stored inside these records.
I am struggling with the organization of these tests and resources.
Here is what I know I need:
- Something to open the DB connection and close it once for the enitre suite of tests.
- Something to create a batch object for the batch I am wanting to test
- Something to cycle through each record within a batch and execute a suite of tests on each record.
The problems I am trying to solve are thus:
- Because the data from our customers is in a format intended for printing, I need to verify that information is where they say it is. By writing a test to see if data has been parsed, I can quickly determine which records in the batch I need to troubleshoot.
- If our customer adds new data, I can quickly determine if the new data caused any of the original logic to break.
- By creating a framework that gets a record, I can write tests on the record, or on anything that the record creates, be it a web page, PDF, report, etc.
I know this really isn't a unit test in the classic sence, as the data I'm getting is dynamic. The problem is, I don't need to test if the object will get me the data I'm looking for. It will....if it exists. I need to determine if the data exists.
Does anyone have any thoughts on how I might organize the things I need to do within the jUnit framework (or extensions)
So far I have been successful at opening a DB connection, but its not persisting the way I need it to...which may be due to the way I'm trying to organize the objects.
Writing a simple test case with bounds has been easy so far...this I'm stuggling with as I'm not quite sure which objects to extend and when to use them.
-Mike
 
author & internet detective
Posts: 40912
840
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mike,
dbUnit provides some of the functionality you are looking for.
The parameterized test case pattern will let you run your tests for each record of data. This pattern is described in the archives of the yahoo group for junit: http://groups.yahoo.com/group/junit/
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic