単体テスト

テストメソッドの中でDebug.Write()を使う

 namespace WebApplication1.Tests.Controllers
 {
     [TestClass]
     public class UnitTest1
     {
         [TestMethod]
         public void TestMethod1()
         {
             Trace.WriteLine("DEBUG: Tace");
             Debug.WriteLine("DEBUG: Debug");
             Console.WriteLine("DEBUG: Console");
 
             Assert.IsTrue(true);
         }
     }
 }

テストを実行後、テストエクスプローラーで目的のテストメソッドを選択すると「出力」というリンクがあるので、それをクリックすると、テスト出力が表示されたウィンドウが開く。

参考

http://stackoverflow.com/questions/8562888/unit-testing-mvc-controllers


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2014-02-20 (木) 21:31:45