2017-04-12 23 views
0

我想爲eclipse插件編寫單元測試用例。通過http://www.vogella.com/tutorials/EclipseTycho/article.html#run-the-build-with-the-tests,並創建了一個eclipse-test-plugin。使用mvn-tycho傳遞參數到依賴eclipse插件

所以,測試插件(我們稱之爲plugin-b)對另一個插件的插件(插件-a)有依賴性。 當我運行mvn clean install時,我可以看到tycho-surefire正在嘗試運行測試,並且正在嘗試啓動插件-a。但是,插件-a需要一組虛擬機參數才能正確啓動。我試圖通過如下參數: mvn -Dabc.properties = bridge \ bundles \ com.blah.blah.blah.blah.bridge \ abc.properties clean install

但他們沒有通過插件-一個。

任何幫助,非常感謝。

回答

0

終於想通了這一點:

MVN全新安裝-Dtycho.testArgLine =「 - Dabc.properties = ../.. /包/ com.blah.blah.blah.blah.bridge/abc.properties 「

這會將系統屬性傳遞給測試運行時。

+0

從命令行(使用'-D')設置分叉測試VM的系統屬性時,這是正確的選項。但是,您也可以將系統屬性直接保存在POM中;只需將['元素](https://eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#systemProperties)添加到''的'tycho-surefire-plugin'。 –