c# - NUnit 3.7.1: Assert.Inconclusive with InnerException -
i have onetimesetup
want verify integration connections prior running tests (databases, rest endpoints, etc.), short-circuiting suite if there issue. consider like
try dim testcontext dbcontext = new dbcontext(_configuredconnectionstring) verifysqlconnection(testcontext) catch ex exception dim actionableerror string = string.format(_verify_sql_connection_template, _configuredconnectionstring) dim actionableexception new configurationexception(actionableerror, ex) 'throw actionableexception assert.inconclusive(actionableerror) end try
if connection fails, don't want fail test, want assert entire suite inconclusive, because actual test never ran.
i'm noticing assert.inconclusive
lacks overload taking in inner exception. forces me either fail tests, full inner exception inspect, or mark tests inconclusive, lose actionable information nunit test runner window.
- is there reason or overload missing oversight?
- is there alternative use both inconclusive and full inner exception (not message, stack, etc.)?
nunit's inconclusive
result intended mean test cannot run because pre-condition has not been met. fact exception happens thrown part of internal implementation - it's how force test stop running @ point - nothing nature of exception exposed user.
assert.inconclusive
manual way provide such inconclusive result. absolutely, without making particular test, in similar way how assert.fail
works. if want make test of kind, "assumed" use assume.that
method produce result.
in case, verifysqlconnection
method sounds should testing in @ least 1 test method, failing if can't make it. other tests depend on connection having been made, use code similar to...
assume.that(() => verifysqlconnection(testcontext), throws.nothing);
the above c# syntax... leave vb translation you. :-)
Comments
Post a Comment