In order to test codes that involves httpServletRequest and
httpServletResponse, I can't create these object in Java.
These objects get created when I'm running my web app in my browser.
So my JUnit tests can't cover big portion of my Servlet codes.
By setting up Eclemma and browsing my web app on the other hand, these
codes gets easily covered when I do a login
(because login involves httpServletRequest and httpServletResponse)
So what I want to do is I want to set up Eclemma, browse my web client
and somehow in my Servlet code, I want to automatically run all test
test cases,
stop the server, and then import my coverage.ec file to cover all the
Servlet code that involves httpServletRequest, httpServletResponse and
mu JUnit test
Am I even in the right track?
In other words, what I want to ask you is:
How can I cover both Servlet codes that involves httpServletRequest,
httpServletResponse AND JUnit test cases in Eclemma?
Thanks for reading my confusing quesiton.
Beom-soo Kim
Eric
I've tried just using regular URL request to perform tests on a
Servlet and also the code you provided.
While the requests do infact call the Servlet, and the response has
the contents of the JSON Objects in it, Emma shows 0% code coverage
for the Servlet.
We're at the last push for testing where we need to be able to have
emma recognize our tests for Servlets to reach the 80% code coverage.
Any suggestions?
Justin.
Thanks, Is there a way to merge the two .ec files so we can verify
that the combined coverage between the client and server side achieves
80% (As some of the code coverage calls may overlap). Simply taking
the number of instructions covered for the two files wouldn't work as
the coverage may refer to different lines of code within the same
file.
For anyone else looking for the client/server code coverage.. the
client side coverage is located in the directory of your project in
workspace, while the server side coverage is located in the eclipse
installation directory.
Thanks
Justin
java emma merge -in [data_files] -out [data_file]