Serial unit testing is a cross-platform cli application and rust library. Using serial unit testing communication and testing with any serial port device can be done and most important automated.
If you have rust installed:
cargo install serial-unit-testing
If you don't have rust installed:
You can download the compiled binaries from the releases. Downloads are available for Windows, macOS and Linux.
The application, called sut
(which is short for serial unit testing), is structured in the following sub commands:
list
: List all available serial portssend
: Send data to a serial portcheck
: Send data to a serial port and check for correct responsemonitor
: Interactive serial communication monitorrun
: Run a script on a serial portverify
: Verify a script can be parsed without failurehelp
: Print information about the application or a sub commandversion
: Print version information
The run
and verify
commands are used to work with the test script language to automate testing easily. For a complete syntax of the language see script.
# Example script
(Test One) "h\n" : "Help"
(Test Two, repeat = 2) h"00FF" : h"00"
h"00af" : h"03"
[Group One]
(Group Test One) "gp\n" : "yes"
(Group Test Two) "gq\n" : "no"
MIT License
Copyright (c) 2020 MarkAtk
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.