當前如果我編寫@Before方法,它將針對JUnit中存在的每個測試執行。不過,我想要以下。如何在JUnit中執行不同的@Before
我需要有多個@Before方法,只需要爲每個測試執行。
Example:
@Before
setUpBeforeForTest1AndTest3()
@Before
setUpBeforeForTest2AndTest4()
對於TEST1和TEST2,setUpBeforeForTest1AndTest3()應執行和用於setUpBeforeForTest2AndTest4應執行其它測試。
我該如何實現這個目標?
你爲什麼要用不同設置的2個測試在同一個類中?實際的目標是什麼? –