DotNet Auto Run Tests in Rider (Jetbrains)

I have been trying out the Jetbrains Rider product – found here.

I wanted to automatically run tests when files had been saved. It took me a little bit to get this up and going (getting the right combination and setup). This may save someone the effort.

Note: Done on Mac OS X

  1. Within Rider
  2. Go to Preferences -> Tools -> File Watchers
  3. Add File Watcher -> Custom
  4. Enter a name. I called mine: “UnitTestWatcher”
  5. Set the FileType and Scope. Mine are: Any, All Places. You could be more restrictive
  6. Program: /usr/local/share/dotnet/dotnet (You can find this path under the Build, Execution, Deployment – in the Preferences screen we launched the File Watchers from)
  7. Arguments: test
  8. Other options -> Working directory: /Users/[your user]/[path to the location of your csproj file containing the tests]
  9. Further down the setup, uncheck “Immediate file synchronisation” (unless you want the unit tests to run every time the file is updated – and not necessarily saved)
  10. Click -> ‘Ok’
  11. Click -> ‘Save’

Now you should be able to execute unit tests every time you save a file.

Rider may require a restart.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s