2016-10-07 7 views
0

TestNGのスーツが正しく実行としてではなく、それはテストテストをどのように実行するのか?

testing.xml

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> 
<suite guice-stage="DEVELOPMENT" name="Default suite"> 
    <test verbose="2" name="test"> 
    <classes> 
     <class name="com.example.EmpBusinessLogicTest"/> 
    </classes> 
    </test> <!-- Default test --> 
</suite> <!-- Default suite --> 

ビルドを実行しません Gradleのテストタスクを実行したときに私は私のtesting.xmlを実行します。グラデル

buildscript { ext { springBootVersion = '1.4.1.RELEASE' } リポジトリ{mavenCentral() }依存関係{ クラスパス( "org.springframework.boot:スプリングブートのGradle-プラグイン:$ {springBootVersion}") }}

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'spring-boot' 

jar { 
    baseName = 'demo' 
    version = '0.0.1-SNAPSHOT' 
} 
sourceCompatibility = 1.8 
targetCompatibility = 1.8 


repositories { 
    mavenCentral() 
} 


dependencies { 
    compile('org.springframework.boot:spring-boot-starter-web') 
    testCompile('org.springframework.boot:spring-boot-starter-test') 
    compile('org.testng:testng:6.9.10') 

} 

test { 
    useTestNG() 
    {   
     suites 'src/main/resources/testing.xml' 

    } 
} 

缶誰も私はgradleテストタスクを実行するのに役立ちますか?あなたは、テストタスクでのGradleで直接XMLを生成することができます。オプションとして

答えて

1

、それは例えば、このテストのタスクを実行するには

useTestNG() { 
    suiteXmlBuilder().suite(name: 'Default suite') { 
     test(name : 'test') { 
      classes('') { 
       'class'(name: 'com.example.EmpBusinessLogicTest') 
      } 
     } 
    } 
} 

私たちのプロジェクトでは正常に動作しますJenkinsではシステムプロパティを渡す必要があります:

systemProperties System.getProperties() 
systemProperty 'user.dir', project.projectDir 
関連する問題