![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
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.
|
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
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.
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|