I looked at the documentation and all it says is to create a servlet… With what?
Is there code I need to use for this servlet?
Does it just need to be blank and have the name of postResults?
Is there a provided ant script for this?
I can’t find anything on google or selenium’s site that lets me in on this.
Thanks
UPDATE: I found the following example
<servlet> <servlet-name>postResults</servlet-name> <servlet-class>com.thoughtworks.selenium.results.servlet.SeleniumResultsServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>postResults</servlet-name> <url-pattern>/postResults</url-pattern> </servlet-mapping>
However I can’t seem to find this Class file anywhere in my selenium jars. I have the RC and regular core downlaods but no dice. Where do I get this jar file from?
If you are using the pure html/javascript capabilities of Selenium like I am then you know that you do not get a results report when testing unless you have a postResults servlet setup somewhere to push the results to.
I found a solution by taking apart the fitRunner plug-in to determine what I would need to get one setup.
This is a java solution btw.
http://jira.openqa.org/browse/SEL-102 you can download a zip file here with everything you would need and a bunch of stuff you don’t need.
In your webapp just add the servlet mapping you find in the web.xml to your web app. make sure the package your reference is created as such below
Then add the following jars you will find in the zip to your web app library if you don’t already have them.
jstl.jar and standard.jar
create two classes your.package.path.SeleniumResultServlet
paste the following code in it.
then go ahead and create a UrlDecoder class in the same package
In your web-inf create a folder called jsp
copy the viewResults.jsp into it that is in the zip file. copy the c.tld to the /web-inf
restart your server
if you get some goofy errors when trying to load the postResults servlet from selenium try changing the taglib reference int the viewResults.jsp to use the sun url instead due to different version dependencies it may not work. servlet 1.0 vs. 2.0 stuff.
Then when you run the test runner and choose automatic option in your selenium screen you will have a postResults servlet that you can use and customize at will.
Hope this helps others. Having a way to format test results is a great help when trying to create documentation and the stuff that comes out of the zip with regular selenium doesn’t give you this basic functionality and you have to bake it up yourself.