Answer the question
In order to leave comments, you need to log in
What tools are there for black box testing via stdin/stdout?
I need a tool to perform unit testing of the same program written in different languages. Writing test code for it every time in each of the languages, firstly, is long, and secondly, which is worse, is fraught with errors in the tests themselves. I need a guarantee that all versions of the program work identically, and if the tests are different, this cannot be guaranteed.
My idea is to make the tests in groups of:
[test of words]
options=-w
input=one two three
output=3
[test of characters]
options=-c
input=one two three
output=13
$ some-utility --tests=wc_tests.ini --command=wc
Answer the question
In order to leave comments, you need to log in
Found this solution: Bats (Bash Automated Testing System) . It is a unit testing system for bash scripts and console utilities. Allows you to do what I wanted, as well as much more.
The example given in the question would look like this on Bats (test.bats file):
#!/usr/bin/env bats
@test "test of words" {
result="`printf 'one two three' | wc -w`"
}
@test "test of characters" {
result="`printf 'one two three' | wc -c`"
}
✓ test of words
✓ test of characters
2 tests, 0 failures
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question