2016-11-25 55 views
1

傾城Java運行特定的測試我在我的測試類兩個方法:根據故事或功能

@Test 
@Stories("story1") 
public void test01(){ 
} 

@Test 
@Stories("story2") 
public void test02(){ 
} 

@Test 
@Stories("story1") 
public void test03(){ 
} 

要通過運行測試即時通訊:

mvn clean test site 

它將執行所有測試。但我的問題是,如何執行測試時,我想執行僅與特定的用戶故事(即story1)

我知道在Python可以通過

py.test my_tests/ --allure_stories=story1 

進行測試,但我不知道如何在java中使用maven

回答

0

在Java中,沒有必要使用Allure來做類似的事情,因爲你可以使用你的測試運行器來做到這一點,例如TestNG的。 只需創建ListenerBeforSuite這將檢查您的環境變量,例如-DallureStories並使其與ITestContext相匹配,以禁用不在您的故事列表中的測試。