2017-03-06 33 views
0

對於我的單元測試,我使用這些批註:
@RunWith(SpringJUnit4ClassRunner.class)來
@SpringBootTest(類= MyApplication.class)
如何在使用JUnit4運行硒測試之前真正啓動spring引導應用程序?

我probleme發生時,我試圖測試與GUI硒。 在我的gui測試中,我調用了一些頁面並驗證了html消息的內容。

我不需要模擬,我需要在測試之前啓動應用程序。 什麼是優雅的方式待辦事項?

註解是什麼@SpringBootTest(classes = MyApplication.class),它不啓動應用程序,並根據日誌,它嘗試啓動應用程序。

回答

2

您可以使用註釋@WebIntegrationTest,@RunWith@SpringApplicationConfiguration的組合。你可以找到一個工作示例here

+0

註釋WebIntegrationTest和SpringApplicationConfiguration被折舊,但該解決方案起作用。 –

相關問題