Thread overview | ||||||
---|---|---|---|---|---|---|
|
July 24, 2014 Mocking serial device | ||||
---|---|---|---|---|
| ||||
Hello, I am writing an application that connects to a serial device in /dev/ttyUSB0 and trows some binary data back and forth. How can i mock and run some unit testing without having to connect to the device every time? -- Regards, Alfredo Palhares |
July 24, 2014 Re: Mocking serial device | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alfredo Palhares | On Thu, 24 Jul 2014 17:15:02 +0000, Alfredo Palhares wrote:
> Hello,
>
> I am writing an application that connects to a serial device in /dev/ttyUSB0 and trows some binary data back and forth.
>
>
> How can i mock and run some unit testing without having to connect to the device every time?
How about capturing some data from the device and writing it to a file? When you want to test, open the test data file instead of the device file.
|
July 24, 2014 Re: Mocking serial device | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Whear |
Hello,
> How about capturing some data from the device and writing it to a file?
> When you want to test, open the test data file instead of the device file.
That would not work since the data is two way, for the device to even trow data at me I need to send some values to it.
--
Regards,
Alfredo Palhares
|
July 25, 2014 Re: Mocking serial device | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alfredo Palhares | Hello. Just to finish this thread, umockdev[1] seems to be just what I want. Thank you for your sugestion! [1] https://github.com/martinpitt/umockdev |
Copyright © 1999-2021 by the D Language Foundation