Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 24th, 2007, 9:16 AM   #1
hoffmandirt
Hobbyist Programmer
 
hoffmandirt's Avatar
 
Join Date: Jul 2005
Location: PA
Posts: 125
Rep Power: 4 hoffmandirt is on a distinguished road
Send a message via AIM to hoffmandirt
Serial Port Devices and Unit Tests

I am looking for some insight on writing unit tests for serial port devices. In my case I can't depend on the device being attached every time I build and run the tests. I am finding it difficult to write the code without the device being attached. Thanks ahead of time for any information on this.
hoffmandirt is offline   Reply With Quote
Old Oct 24th, 2007, 9:50 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Serial Port Devices and Unit Tests

What's not always attached? The external (target) device, or the local device? If you have the local device, you might consider some sort of loopback tests.

Without the local device, I don't see how you can be expected to verify the software, since there's a successful software-to-hardware transition, relying on accurate timing, involved.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 24th, 2007, 10:01 AM   #3
hoffmandirt
Hobbyist Programmer
 
hoffmandirt's Avatar
 
Join Date: Jul 2005
Location: PA
Posts: 125
Rep Power: 4 hoffmandirt is on a distinguished road
Send a message via AIM to hoffmandirt
Re: Serial Port Devices and Unit Tests

The external device would not be attached to the other end of the serial cable. I am assuming that without writing some sort of simulator, that it will not be possible to write any useful unit tests without the external device being connected.
hoffmandirt is offline   Reply With Quote
Old Oct 24th, 2007, 10:13 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Serial Port Devices and Unit Tests

You might be able to with a loopback situation.

If your external device is very complex and expensive, with the serial interface being a small part, then you might consider building some kind of simulator that involves only the serial interface and some display/measurement attachments. Otherwise, I would consider the investment in an external device, as a permanent tool in your set, to be wise.

If this is a reasonably important project, your bosses are being shortsighted.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC