JUnit 4: Set up things in a test suite before tests are run (like a test's @BeforeClass method, just for a test suite)

后端 未结 4 438
梦谈多话
梦谈多话 2020-11-30 04:59

I want to do some functional testing on a (restful) webservice. The testsuite contains a bunch of test cases, each of which performs a couple of HTTP requests on the webserv

4条回答
  •  情深已故
    2020-11-30 05:35

    One option is to use something like Apache Ant to launch your unit test suite. You can then put a target invocation before and after your junit target to start and stop your webservice:

    
    
    
    
    
    

    You then run your suite using ant (or your integration tool of choice). Most IDEs have Ant support, and it makes it much easier to move your tests into a continous integration environment (many of which use Ant targets to define their own tests).

提交回复
热议问题