Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

例 : 設定メソッドおよびティアダウン・メソッドを使用したテストの実行

新しいユニット・テストを通常どおりに実行します。

  1. 作業してきたネームスペースでターミナルを開きます。

  2. ^UnitTestRoot の値を、テスト・クラスを収めたディレクトリの親に設定します。

    
    USER> Set ^UnitTestRoot="c:\unittests"
    
    
  3. %UnitTest.ManagerOpens in a new tab を使用してテストを実行します。

    
    USER> Do ##class(%UnitTest.Manager).RunTest("mytests")
    
    
  4. Caché は、XML ファイルからテスト・クラスをロードし、そのクラスをコンパイルし、テストを実行した後、ターミナルにレポートを出力します。

    
    ===============================================================================
    Directory: C:\unittests\mytests\
    ===============================================================================
    mytests begins ...
    Load of directory started on 09/29/2014 15:44:01 '*.xml;*.XML'
    
    Loading file C:\unittests\mytests\Test.xml as xml
    Imported class: MyPackage.Tests
    
    Compilation started on 09/29/2014 15:44:01 with qualifiers ''
    Compiling class MyPackage.Tests
    Compiling routine MyPackage.Tests.1
    Compilation finished successfully in 0.033s.
    
    Load finished successfully.
     
      MyPackage.Tests begins ...
        TestAdd() begins ...
          AssertEquals:Test Add(2,2)=4 (passed)
          AssertNotEquals:Test Add(2,2)'=5 (passed)
          LogMessage:Duration of execution: .002255 sec.
        TestAdd passed
        TestEditContact() begins ...
          AssertStatusNotOK:ContactType = Friend (passed)
          AssertStatusOK:ContactType = Personal (passed)
          LogMessage:Duration of execution: .10459 sec.
        TestEditContact passed
      MyPackage.Tests passed
    mytests passed
     
    
    
FeedbackOpens in a new tab