Skip to main content

This documentation is for an older version of this product. See the latest version of this content.Opens in a new tab

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

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

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

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

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

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

     
    ===============================================================================
    Directory: C:\unittests\mytests\cls\MyPackage\
    ===============================================================================
      mytests\cls\MyPackage begins ...
    Load of directory started on 07/05/2022 12:00:50 '*.xml;*.XML;*.cls;*.mac;*.int;*.inc;*.CLS;*.MAC;*.INT;*.INC'                                                   
    Loading file C:\unittests\mytests\cls\MyPackage\MyPackage.Tests.cls as udl
     
    Compilation started on 07/05/2022 12:00:50
    Compiling class MyPackage.Tests
    Compiling routine MyPackage.Tests.1
    Compilation finished successfully in 0.018s.
     
    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: .000032 sec.
          TestAdd passed
          TestEditContact() begins ...
            AssertStatusNotOK:ContactType = Friend (passed)
            AssertStatusOK:ContactType = Personal (passed)
            LogMessage:Duration of execution: .002808 sec.
          TestEditContact passed
        MyPackage.Tests passed
      mytests/cls/MyPackage passed
     
    Use the following URL to view the result:
    http://172.30.160.1:52797/csp/sys/%25UnitTest.Portal.Indices.cls?Index=5&$NAMESPACE=USER
    All PASSED
     
    
    
FeedbackOpens in a new tab