Disable assertions during testing
I want to check my API contract so that if for example an object is created with some parameter before the nil
assertion is raised, but if the assertions are disabled (Release config) it just returns nil.
My test schema has a build config for Debug, so in my tests on the API contract, I check if creating an object with some parameters returns nil, returns a nil object. But the constructor assertion occurs before execution XCTAssertNil
, so my test always fails.
Can assertions be turned off during testing? I tried adding NS_BLOCK_ASSERTIONS
to the schema arguments passed on startup, but that doesn't work.
+3
source to share