Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Testing dynamic content  RSS feed

Mike Cornell
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Jeanne Boyarsky
author & internet detective
Posts: 37180
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!