Tutorial :MSTest and custom messages



Question:

Recently I started using mstest for testing.

  1. Is there any way to write messages to test window if test successed? I don't see the way, messages are alowed only if test fails. What if I want to let say, print little description of a test, so I can see what test means without having to open the test. Or, as now is the case, I'm measuring times of execution for some tests, I want to print that time out.

  2. Is there a way to extend test methods so to easy choose if I want tests with or without time measuring, choosing the mode of test execution?

Thanx


Solution:1

Right click on the columns in the test result window and choose "Add/Remove Columns". Add the columns for "Duration" and "Output (StdOut)". That will give you test timing and let you see what the tests print.


Solution:2

Why not give your tests descriptive names?

[Test]  public void AddsTwoNumbersTogether() {...}    [Test]  public void DividesFirstNumberBySecondNumber() {...}  

etc.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »