Is there any difference between assert and expect statements?
1 Like
Lots.
The expect directive is not counted by coverage metrics. That is to say that a failure does not the test failed, just that you were testing something to occur and it didn’t happen. Think of expect as a temporal-if statement.
The expect directive is blocks the current thread until it either passes or fails. An assert directive has no impact on the current thread.
You usually want an assert rather than an expect directive.