2016-11-10 21 views
0

下面是一個JUnit Runner,我需要從另一個類中獲取類名RunTest如何在另一個類中獲取Junit類名

@RunWith(Cucumber.class) 
@CucumberOptions(
     features = { "src/test/resources/features/Automated" }, 
     tags = { "@Create_Account_Without_Entering_Mandatory_Fields", "[email protected]","[email protected]" } 
     , dryRun = false, 

     monochrome = true, 
     glue = "tv.nativ.mio.automation.stepdef", plugin = {"html:target/cucumber", "json:target/cucumber/cucumber1.json"}) 

public class RunTest { 
} 

我試圖Thread.dumpStack()Thread.currentThread().getStackTrace()但列表中

回答

0

我不會建議沒有得到RunTest類,但你可以記住測試類的一些靜態變量。做測試:

@BeforeClass 
public static void beforeClass() { 
    // holder is just a class with static variable, create it 
    CurrentClassHolder.setClass(RunTest.class); 
} 

你可以在每個測試類做這樣的事情,然後從那裏得到它..

相關問題