Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 185483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:28:39+00:00 2026-05-11T15:28:39+00:00

I looked at the documentation and all it says is to create a servlet…

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:28:40+00:00Added an answer on May 11, 2026 at 3:28 pm

    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.

    package com.your.package.path;  import java.io.IOException; import java.util.Collection; import java.util.LinkedList; import java.util.List;  import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;  public class SeleniumResultsServlet extends HttpServlet {      private static TestResults results;      public static TestResults getResults() {         return results;     }      public static void setResults(TestResults testResults) {         results = testResults;     }      protected void doGet(HttpServletRequest request,             HttpServletResponse response) throws ServletException, IOException {          if (request.getParameter('clear') != null) {             results = null;             ServletOutputStream out = response.getOutputStream();             out.println('selenium results cleared!');         } else {             forwardToResultsPage(request, response);         }     }      protected void doPost(HttpServletRequest request, HttpServletResponse response)                                                  throws ServletException, IOException {         String result = request.getParameter('result');         String totalTime = request.getParameter('totalTime');         String numTestPasses = request.getParameter('numTestPasses');         String numTestFailures = request.getParameter('numTestFailures');         String numCommandPasses = request.getParameter('numCommandPasses');         String numCommandFailures = request.getParameter('numCommandFailures');         String numCommandErrors = request.getParameter('numCommandErrors');         String suite = request.getParameter('suite');          int numTotalTests = Integer.parseInt(numTestPasses) + Integer.parseInt(numTestFailures);          List testTables = createTestTables(request, numTotalTests);          results = new TestResults(result, totalTime,                 numTestPasses, numTestFailures, numCommandPasses,                 numCommandFailures, numCommandErrors, suite, testTables);          forwardToResultsPage(request, response);     }      private List createTestTables(HttpServletRequest request, int numTotalTests) {         List testTables = new LinkedList();         for (int i = 1; i <= numTotalTests; i++) {             String testTable = request.getParameter('testTable.' + i);             System.out.println('table ' + i);             System.out.println(testTable);             testTables.add(testTable);         }         return testTables;     }       private void forwardToResultsPage(HttpServletRequest request, HttpServletResponse response)             throws ServletException, IOException {         request.setAttribute('results', results);         request.getRequestDispatcher('/WEB-INF/jsp/viewResults.jsp').forward(request, response);     }      public static class TestResults {          private final String result;         private final String totalTime;         private final String numTestPasses;         private final String numTestFailures;         private final String numCommandPasses;         private final String numCommandFailures;         private final String numCommandErrors;         private final String suite;          private final List testTables;          public TestResults(String postedResult, String postedTotalTime,                  String postedNumTestPasses, String postedNumTestFailures,                  String postedNumCommandPasses, String postedNumCommandFailures,                  String postedNumCommandErrors, String postedSuite, List postedTestTables) {              result = postedResult;             numCommandFailures = postedNumCommandFailures;             numCommandErrors = postedNumCommandErrors;             suite = postedSuite;             totalTime = postedTotalTime;             numTestPasses = postedNumTestPasses;             numTestFailures = postedNumTestFailures;             numCommandPasses = postedNumCommandPasses;             testTables = postedTestTables;         }          public String getDecodedTestSuite() {             return new UrlDecoder().decode(suite);         }          public List getDecodedTestTables() {             return new UrlDecoder().decodeListOfStrings(testTables);         }          public String getResult() {             return result;         }         public String getNumCommandErrors() {             return numCommandErrors;         }         public String getNumCommandFailures() {             return numCommandFailures;         }         public String getNumCommandPasses() {             return numCommandPasses;         }         public String getNumTestFailures() {             return numTestFailures;         }         public String getNumTestPasses() {             return numTestPasses;         }         public String getSuite() {             return suite;         }         public Collection getTestTables() {             return testTables;         }         public String getTotalTime() {             return totalTime;         }         public int getNumTotalTests() {             return Integer.parseInt(numTestPasses) + Integer.parseInt(numTestFailures);         }     } } 

    then go ahead and create a UrlDecoder class in the same package

     package your.package.path; import java.io.UnsupportedEncodingException;import java.net.URLDecoder;     import java.util.Iterator;     import java.util.LinkedList;     import java.util.List;      /**      * @author Darren Cotterill      * @author Ajit George      * @version $Revision: $      */     public class UrlDecoder {          public String decode(String string) {             try {                 return URLDecoder.decode(string, System.getProperty('file.encoding'));             } catch (UnsupportedEncodingException e) {                 return string;             }         }          public List decodeListOfStrings(List list) {             List decodedList = new LinkedList();              for (Iterator i = list.iterator(); i.hasNext();) {                 decodedList.add(decode((String) i.next()));             }              return decodedList;         }  } 

    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.

    <%@taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>  

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've looked through all the class documentation for Core Data and I can't find
So I've looked at this use of the freebase API and I was really
How can I start writing a plugin for Eclipse ? I've looked for documentation,
I've looked on Wikipedia, googled it, and read the official documentation, but I still
I looked in the Rails docs under inflector and found this message... Module deprecated
This link http://msdn.microsoft.com/en-us/library/aa772153(VS.85).aspx says: You can register up to five notification requests on a
I was wondering if there was a way to display all text in a
I looked for the name of a procedure, which applies a tree structure of
I looked at the AdaCore site, as well as for A# (which now appears
I looked at SQL Server dateformat codes but I couldn't find dd.mm.yyyy hh:mm format

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.