tags:

views:

139

answers:

2

We do not use a Maven framework in our environments. Can you suggest a way to use the Jersey test framework for testing the Rest web services? I have tried to override the TestContaioner and TestContainerFactory interfaces to set up an AppDescriptor but I fail to understand how to set the LowLevelDescriptor to use the HTTPContainerFactory instead of the default one. I tried also settign the System property jersey.test.containerFactory. Does not work?Any ideas?

A: 

Well according to this article it is test.containerFactory and not jersey.test.containerFactory. I realize this article primarily focuses on Maven but this little tidbit might be your answer.

the container on which the tests have to be run is specified using the system property test.containerFactory which holds the fully-qualified classname of the test container factory which creates an instance of the test container

Alex Winston
A: 

The hook you are looking for is not maven, or any other build tool, but JUnit4. Your tests should extend JerseyTest, then JUnit scans your test sources for methods annotated with @Test.

It's been a while since I ran JUnit (then v3) from, e.g., the command line, but you should be able to read the JUnit4 docs to figure out how to bootstap a JUnit instance that essentially puts together a test suite, then runs it.

ae6rt