How to abort a test

I know how to make a test succeed or to make it fail, but is there any way to abort a test, to say that it neither failed or succeeded?

The use case is this. I want to check that the output of library is consistent with another one written in Java. To do this, I need to run some Java over that output and see if it returns the expected answer. I have this all working, but it requires some infrastructure (some commands, written in Java, installed in the path). It's all a bit hairy.

So, I would like the test to succeed if the command returns the correct output, fail if it returns the incorrect output, but if the command does not run at all, I'd like the test to effectively be skipped since it just cannot return a sensible result.

Is that at all possible?

You can mark the tests that need that extra environment set up as #[ignore] so someone running the tests has to explicitly opt in to running them.

I have also combined ignore with cfg_attr in the past to conditionally ignore tests based on feature flags but not sure that will be useful here.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.