Y.H.
Y.H.

Reputation: 2846

Scala inconclusive Assertion

I am writing an integration test in Scala. The test starts by searching for a configuration file to get access information of another system.

If it finds the file then the test should run as usual, however if it does not find the file I don't want to fail the test, I would rather make it inconclusive to indicate that the test can not run because of missing configurations only.

In C# I know there is Assert.Inconclusive which is exactly what I want, is there anything similar in Scala?

Upvotes: 1

Views: 88

Answers (1)

Eugene Loy
Eugene Loy

Reputation: 12426

I think what you need here is assume / cancel (from "Assumptions" section, found here):

Trait Assertions also provides methods that allow you to cancel a test. You would cancel a test if a resource required by the test was unavailable. For example, if a test requires an external database to be online, and it isn't, the test could be canceled to indicate it was unable to run because of the missing database.

Upvotes: 2

Related Questions