For executing tests that make use of the xUnit framework, you’ll have to install the corresponding test runner i.e. runner. Installation of the xUnit framework and its runner can be done by installing the packages using the package manager from GUI or executing the equivalent package manager (PM) commands on the terminal. For this xUnit testing tutorial, I’ll explore both these options for installing the xUnit framework. Before the installation of the required packages, you’ll have to perform the following steps:
Step 1: Create a new project of the type ‘xUnit Test Project (.Net Core)’ in Visual Studio.
Step 2: Since I have created the project based on the xUnit.net framework, the default .cs file contains the [Fact] attribute in it. Also, the xUnit package is also included by default in the source code.
In case you have not created a project of the type mentioned above, you can still use the xUnit framework for performing automation testing with Selenium C#. The xUnit framework and the runner can be installed using the package manager from GUI or the terminal.