I am writing testcases for method with doesnt return any values , for eg:
func GetByNameReturnNull(serName string)
{
//Logic
}
My testcasefile is myTest.go which has two parameters , one calling the method with invalid input and calling the method with valid input.
func Test1(t *testing.T) {
GetByNameReturnNull("Invalid")
}
func Test2(t *testing.T) {
GetByNameReturnNull("valid")
}
So , the first testcase will fail and throw the exception , I cant handle it in the conventional way like ,
"check for err from the returned method because the method doesnt return anything at all. When I execute the command,
$go test ./... -v
the second testcase will not execute because of the exception of the first.
So Without changing any logic in the base method(GetByNameReturnNull) to return err or anything , is there any way to handle this scenario in the testcase file itself to print
1 fail 1 pass in the output?