Question

I have a lot of webServices that I want to test with Junit. For each webService I have between 5 and 40 tests to do, and writing those tests by hand take a lot of time and it is very tedious to do because they are almost the same.

In fact, I send an xml request to my web service, get the response and compare it with the one expected. So for each test, I need only the webService URL, the body of the request and the response expected.

What is the best way to achieve this? Thanks

Était-ce utile?

La solution

I found a good way to do this. I use JUnit parameterized tests. This is a good tutorial to learn how to implement those tests.

I use also generic methods that read a WSDL file and retrieve the types needed to do my tests. So now I have just one generic parameterized test for all my webServices, and parameters are paths of my WSDL files, input files and expected output files.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top