Spring远程服务集成测试。 Jetty与AbstractTestNGSpringContextTests

时间:2012-07-19 15:49:33

标签: java spring integration-testing embedded-jetty

我正在通过HTTPInvoker进行Spring Remote Service。我想为此编写集成测试,我有两种技巧,我不确定哪一种更好,或者我完全误解了这两种技术。

我对这两种技术有点困惑。一种技术是Spring能够在测试之前加载上下文,所以我可以只指定上下文xml。另一种技术是让Embedded Jetty加载上下文,我们还有另一个测试来命中端点。我不确定哪一个更好。

我从这里开始了解嵌入式Jetty测试的想法。 http://code.google.com/p/jianwikis/wiki/SpringHttpRemotingWithEmbeddedJettyServer

另一种方法是将其放在测试用例中。例如,


@ContextConfiguration(location = {"/application_context.xml"})
public class SpringIntegrationTest extends AbstractTestNGSpringContextTests {

   @Autowired
   private TheService theService
   ...
}

两者兼有的优点和缺点是什么?

非常感谢。

0 个答案:

没有答案