2017-09-05 8 views
1

soapuiには約400のテストケースがあります。テストケースの開始時間と終了時間がないか、または合計実行がカスタムレポートに追加されていません。私は、各テストケースでスクリプトを分割してスクリプトを追加することでこれを得ることができます。しかし、私は400テストケースを持っているので、少し時間がかかる。我々はグルーヴィーでクロージャを使用して取得することができます任意の方法は...soapuiでクロージャを使用して、各テストケースごとにテスト実行を取得できますか

おかげで、プロジェクト全体でティアダウンをセットアップする例を示します

+0

ありますあなたはすでに 'ティアダウンScript'を持っていますか?あなたがその質問にそれを加えることができればいいでしょうか?そして、あなたはそれをどのようにしたいのですか?サンプルレポートが役に立ちます。どのような種類のレポートをお探しですか? html?プレーンテキスト? – Rao

+0

これまでに報告されたレポート生成に関する別の質問があります。関連性はないかもしれませんが、それを見てください。 https://stackoverflow.com/questions/41700437/creating-a-test-report-from-project-level-tear-down-script – Rao

+0

@Rao、私はTeardownスクリプトを持っていません..私はTotal Execution Timeスイートのようなカード管理開始時間:xxxと終了時間:xxxxまたは合計時間がかかる:xxx – ChanGan

答えて

1

def project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName("MyProject"); 

    //TearDownTemplate 
    def tearDownTemplate = """ 
     /*BEGINNING CUSTOM TEARDOWN FOR THIS TESTCASE ONLY*/ 
      //Reserved for this testcase only, because the teardown is populated automaticly, we don't want to loose some work if we need specials things. 

     /*END OF CUSTOM TEARDOWN HERE £££*/ 

     // Common teardown for all testcases Here 
     // Here do the stuff for your time execution 
    """; 

    //Loop through each Test Suite in the project 
    for(suite in project.getTestSuiteList()) { 
      //Loop through each Test Case 
      for(tcase in suite.getTestCaseList()) { 
       teardown = tcase.getTearDownScript(); 
       if(teardown != null){ 
       // we split the teardownTemplate and the teardown already set by our delimiter '£££' 
        def fields = teardown.tokenize("£££"); 
        def fieldsTemplate = tearDownTemplate.tokenize("£££"); 
        //teardown replacement 
        tcase.setTearDownScript(fields[0] + "£££" + fieldsTemplate[1]); 
       }else{ 
        tcase.setTearDownScript(tearDownTemplate); 
       } 
      } 

    } 
    log.info 'finished' 
関連する問題