Introduction

All test project setup and test commands that are run from an integrated development environment’s (IDE’s) graphical user interface (GUI) have corresponding console commands. There are numerous advantages of interacting with and using NUnit from the console over a graphical user interface. This lesson delves into what those advantages are as well as some of the most important NUnit commands.

Advantages of interacting with NUnit through the console

Using a terminal to interact with NUnit has advantages compared to using a user interface. The following are some of these advantages:

  • Repeatability: Commands are more repeatable. For instance, if you had to configure or use NUnit on multiple computers or servers, commands are consistent across each instance. On the other hand, the graphical user interface may vary. For instance, one computer may have a different IDE installed compared to another computer.

  • Ease of communication: Console commands are easier to communicate and share. Sharing GUI commands requires complicated instructions or screenshots. Sharing console commands takes a few lines of text.

  • Ease of use: GUI interaction may require multiple clicks to navigate through menus to reach the required command. With console commands, no such navigation is required. One can simply issue the command with the desired arguments.

  • Clear audit trail: Commands entered are usually stored in the terminal history. Therefore at any point in time, the series of actions taken can be recalled. This may be useful in instances where this is requested from another user when a mistake is made, when an action must be reversed or if the user would like to save the series of steps taken.

  • Automation: Command-line interface makes automation possible as the commands may be included as part of a script.

  • Technological constraints: Command-line interaction on remote machines or virtual environments requires less bandwidth and lower latency. Sometimes, it is impossible to use a GUI because the remote environment does not allow for GUI interaction. A handy example of this is the process followed to develop this course. The author only had a Docker environment at his disposal. Interacting with this containerized environment meant using console commands. If you look carefully at the console when running the course single-page applications, you can see some of the commands that are run. A screenshot example is shown below with a sample NUnit command circled in red.

Get hands-on with 1200+ tech skills courses.