How To Use Asserts In NUnit Using Selenium?

1 Year Subscription

When you are working on unit tests, there are scenarios where you wished that the execution should have stopped but alas, the most important part, ‘The Assertion,’ was missed. While developing tests using different test frameworks, my fellow developers frequently asked one question: ‘Should I use an assert or an exception in my test code’? It depends on what the test code should do after a certain condition is met.

By the end of this article, you will get in-depth insights about NUnit asserts and how these asserts can be used with C# & Selenium. I will walk you through the Assertions’ basics and when assertions should be used to get started. We will be covering the following constraints (discussed later) used with NUnit assert:

  1. Equal Constraints
  2. Comparison Constraints
  3. String Constraints
  4. Condition Constraints
  5. Collection Constraints


If you already know the constraints, you can head straight to the sections (NUnit Asserts – In Action and NUnit…


Continue reading on source link

Leave a Comment

Your email address will not be published. Required fields are marked *

4 + 5 =