Failure types

13 views
Skip to first unread message

Daniel Brahneborg

unread,
Feb 22, 2016, 1:11:47 PM2/22/16
to Tcases Forum
Hi,

Is it possible to specify different failure types? If not, could it be added?

I have a program which exits with different exit codes depending on the error, mostly different arguments that are missing. There is no point trying these invalid values in combinations with everything else, since the program will stop immediately anyway. So, failure="true" seems reasonable. However, I would also like to specify the exit code. It's more "output" than "input", so it doesn't seem to fit the current configuration. I tried various versions of setting the failure on the parameter value or the exit code, parameter and When blocks everywhere, but nothing made it work the way I wanted.

Regards,
/Daniel

Kerry Kimbrough

unread,
Feb 24, 2016, 10:45:30 AM2/24/16
to Tcases Forum
You're right that Tcases focuses on modeling inputs, not outputs. You will definitely want to model the inputs that lead to the various failure exit code. But in general the Tcases input model has nothing to say about the results of running a test case.

I'm not sure what the result you want would look like. Perhaps an example would help? But you might consider using output annotations, especially if you want to transform the output test case definition into executable tests (which might very well include assertions about expected results). For example, you could annotate <Value> elements that lead to exit code=N, with <Has name="exitCode" value="N"/>.

Daniel Brahneborg

unread,
Feb 25, 2016, 9:45:54 AM2/25/16
to Tcases Forum
Adding a "Has" tag was exactly what I needed, now the exit code is copied to the output file.

I'm not sure how I should handle it though... the test has already failed, which is the expected behaviour, so it's ok. However, as it hasn't failed in the correct way, I have to mark it as "epic fail" or something. Ah well, that's my own problem I guess. :)

Thanks for your help pointing me in the right direction.

Regards,
/Daniel

Reply all
Reply to author
Forward
0 new messages