Search⌘ K
AI Features

Parameterizing Tests More Effectively

Explore how to make NUnit unit tests more effective by mastering parameterization attributes such as Combinatorial, Range, Random, Pairwise, Sequential, and TestCaseSource. Understand how to reduce code redundancy and increase test coverage by efficiently supplying multiple data sets to test methods.

Introduction

Unit tests are either non-parameterized or parameterized:

  • A non-parameterized test means that a single test case is associated with a single test method.
  • A parameterized test means that multiple cases are associated with a test method. Furthermore, there are ways in which tests are parameterized.

Parameterization-specific attributes are attributes that enrich or enhance parametrization. There are six parameterization-specific attributes:

  • Combinatorial
  • Range
  • Random
  • Pairwise
  • Sequential
  • TestCaseSource

Each parameterization-specific attribute is covered below with other related attributes.

The Values attribute

The Values attribute is used with the ...