Although Go language allows to run multiple test files in a sequence by using the command $go test packagename ,
is there a way to control this sequence using a textfile.
Like for eg: textfile should just contain the names of all the testcase files to be run in a sequence so that the user just modify this textfile to run the desirable testcases
like $go test textfile.txt Is there a way of customizing in this way?
The go test
command allows you to specify test functions to run using go test -test.run <regex>
. You could, for example, write a little bash script or alias:
FILE=$1 # first argument
cat $FILE | while read regex; do # read file one line at a time
go test -test.run "$regex"
done
and then you could do ./myscript.sh testFuncs.txt
, for example.