The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Interaction with third party app. How to unit test?

Hello,

I am planning to write an application that will interact with a third party web app that is not designed to be programmatically controlled. The "web app" is really a windows application that constantly pools a central server and displaying some information. I can do a number of actions on this app, and also chose what kind of information is displayed. But the application can decide on its own to change what info it is giving – changing the range of actions I can do.

The business logic I must implement is quite simple, so the bulk of my application will be maintaining an internal representation of the state of the web app. I must update this state when I detect something is happening in the web app, and do sanity checks to verify that my internal representation is in synch with what is really happening.

My question is: how do I unit checks this?

My current plans are to make a class for every type of event I am expecting. These classes will implement:

Creator(all info relevant for this event)
sanityCheckPreAction(...)
ActUponThisEvent(...)
sanityCheckPostAction(...)

The problem is that the internal representation has a huge number of states + I do not have a direct control on the third party app.

To be complete: Widows environment, I will write this in Java with small bits of C to interact with WinAPI (The C will be kept to the minimum).

Any help will be appreciated.
AlphaBeta
Thursday, September 15, 2005
 
 
Prioritize the possible states according to how important they are to you having a useful and functional application.

If something has already changed in the past and has broken your app, move it up a spot in the list.

Proceed in that order and determine where to stop.
KC Send private email
Thursday, September 15, 2005
 
 
To unit test your code you need to build an abstraction layer between you and the other system. Then you can implement a test version of the layer to completely unit test your code separete from the other code.

Using events seems like a good idea. There may be a lot of states, but if that's the way it is you need to simulate as much as you feel comfortable doing.

As the real app will likely be different than whatever you code at first this could be a long process.
son of parnas
Thursday, September 15, 2005
 
 
It looks like you're overdesigning a great deal. I wrote a lot of this kind of code, and did very well with a single class for the third-party app having one method for each action. Sanity checks are put in the method that performs the action, and throw exceptions on failure. Unit testing is also simple - just create the object and call each action-method on it.
A regular
Wednesday, September 21, 2005
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz