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 449
梦谈多话
梦谈多话 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:39

    jUnit can't do that sort of thing -- though TestNG does have @BeforeSuite and @AfterSuite annotations. Normally, you get your build system to do it. In maven, there are the "pre-integration-test" and "post-integration-test" phases. In ANT, well you just add the steps to the task.

    Your question is pretty much a dup of Before and After Suite execution hook in jUnit 4.x, so I'd take a look at the suggestions over there.

提交回复
热议问题