How to assign descriptive names to unit tests

249 Views Asked by At

Using Visual Studio 2015 Community. I have a unit test project with all these methods named "Step01_AddUser", "Step02_AddHomework", etc. However I'd like to give them descriptive names which will appear in the Test Explorer window. Basically I want to accomplish 2 things:

  1. Sort the tests (within the playlist) so that they run in a particular order
  2. Remove the underscores from the method names, so that for example they read "01 - Add User", "02 - Add Homework".

Is there a way to do this?

1

There are 1 best solutions below

1
On BEST ANSWER

I'll answer your questions in the same order they were asked in:

  1. This issue has already been gone over here.
  2. The names of the tests are determined by the Test Explorer by the names of their methods. There can be no spaces in method names therefore there can be no spaces in test names.

I would also highly recommend going over this article. It goes over some conventions of best naming practices for unit tests.