Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problems with TestRunnerDriver Configuration

    Hi Isomorphic,

    i try to get the TestRunnerDriver to work, to run Tests recorded with the Selenium IDE.

    Setup:
    SmartClient Version: v11.1p_2018-05-14/PowerEdition Deployment (built 2018-05-14)
    Apache Tomcat v8.5

    In our system i made a new Servlet SeleniumTests:

    Code:
    <servlet>
            <servlet-name>SeleniumTests</servlet-name>
            <servlet-class>com.lmscompany.lms.server.SeleniumTests</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>SeleniumTests</servlet-name>
            <url-pattern>/SeleniumTests</url-pattern>
        </servlet-mapping>
    And created the Class for the Servlet:

    Code:
    public class SeleniumTests extends HttpServlet {
        private static final long serialVersionUID = -7397909713823548814L;
    
        @Override
        public void doGet(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
    
            TestRunnerDriver testRunner;
            try {
                testRunner = new TestRunnerDriver();
                testRunner.setBatchCommit(false);
                testRunner.setBrowser("*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe");
                testRunner.setTestRoot("/C:/Selenium/root/");
                String[] files = { "running.rctest.html" };
                testRunner.setFiles(files);
                testRunner.setMaximizeBrowser(true);
                testRunner.setNoEmail();
    
                testRunner.run();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
        }
    
        @Override
        public void doPost(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
            doGet(servletRequest, servletResponse);
        }
    }
    When i then trigger the Servlet, the following console output is received:

    === 2018-05-21 12:12:29,093 [c-17] INFO RequestContext - URL: '/lms/SeleniumTests', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36': Safari with Accept-Encoding header
    === 2018-05-21 12:12:29,093 [c-17] WARN TestRunnerConfiguration - Danger - ServletContext detected as org.apache.catalina.core.ApplicationContextFacade@1dca895b
    === 2018-05-21 12:12:29,093 [c-17] INFO TestRunnerConfiguration - Detected webRoot as C:/Program Files/Apache Software Foundation/Tomcat 8.5/lms/lms
    === 2018-05-21 12:12:29,093 [c-17] INFO TestRunnerConfiguration - Setting fileRoot to webRoot
    === 2018-05-21 12:12:29,094 [c-17] INFO SeleniumServerHelper - Selenium server starting on port: 4444
    INFO | Writing debug logs to \tmp\selenium.log
    INFO | Java: Oracle Corporation 25.144-b01
    INFO | OS: Windows 10 10.0 amd64
    INFO | v2.53.1, with Core v2.53.1. Built from revision a36b8b1
    12:12:29.103 INFO - Driver class not found: com.opera.core.systems.OperaDriver
    12:12:29.103 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
    12:12:29.103 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
    registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10
    12:12:29.103 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
    12:12:29.104 INFO - Driver provider org.openqa.selenium.phantomjs.PhantomJSDriver is not registered
    12:12:29.104 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
    12:12:29.104 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
    INFO | Version Jetty/5.1.x
    INFO | Started HttpContext[/selenium-server,/selenium-server]
    INFO | Started org.openqa.jetty.jetty.servlet.ServletHandler@2d96b6f2
    INFO | Started HttpContext[/wd,/wd]
    INFO | Started HttpContext[/selenium-server/driver,/selenium-server/driver]
    INFO | Started HttpContext[/,/]
    INFO | Started SocketListener on 0.0.0.0:4444
    INFO | Started org.openqa.jetty.jetty.Server@72ee89b2
    === 2018-05-21 12:12:29,108 [c-17] INFO SeleniumServerHelper - Selenium server started on port: 4444
    INFO | Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,localport=4444]
    INFO | Stopped SocketListener on 0.0.0.0:4444
    INFO | Stopped HttpContext[/selenium-server,/selenium-server]
    INFO | Stopped org.openqa.jetty.jetty.servlet.ServletHandler@2d96b6f2
    INFO | Stopped HttpContext[/wd,/wd]
    INFO | Stopped HttpContext[/selenium-server/driver,/selenium-server/driver]
    INFO | Stopped HttpContext[/,/]
    INFO | Stopped org.openqa.jetty.jetty.Server@72ee89b2
    === 2018-05-21 12:12:29,538 [c-17] INFO SeleniumServerHelper - Selenium server stopped

    So, it seems to be working but does not execute the running.rctest.html. Can you give any advice?

    Thanks in advance

    Kind Regards

    #2
    The output is consistent with no files being found, since the Selenium server is started and then immediately stopped. Can you verify that the expected file is underneath your test root and readable? We would suggest trying to wildcard the files argument to see if that picks anything up:
    Code:
    String[] files = { "*.rctest.html" };
    That should use file globbing to pick up all files with the rctest.html extension. (Note that you probably don't need the initial "/" in the test root path, but for us it still worked whether that was present or not.)

    In our testing, an error was thrown if the Firefox path was invalid, so that's probably not what's going on. However, for consistency you could install the 32-bit version of Firefox 52ESR and see if that makes a difference.

    We'll add some additional logs to show what files were picked up by TestRunner.


    Comment


      #3
      I've tried your suggestions. I've installed the 32-bit version of Firefox 52ESR, but the result stayed the same. I also changed the files argument to wildcard and i can confirm that the file is underneath the test root.

      I also tried the following:

      Code:
      package com.lmscompany.lms.server;
      
      import java.io.IOException;
      
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      import com.isomorphic.autotest.TestRunnerDriver;
      
      
      public class SeleniumTests extends HttpServlet {
          private static final long serialVersionUID = -7397909713823548814L;
      
          @Override
          public void doGet(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
      
              TestRunnerDriver testRunner;
              try {
                  testRunner = new TestRunnerDriver();
                  testRunner.setBatchCommit(false);
                  testRunner.setBrowser("*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe");
                  // testRunner.setTestRoot("/C:/Selenium/root/");
                  String[] files = { "*.rctest.html" };
                  testRunner.setFiles(files);
                  testRunner.setMaximizeBrowser(true);
                  testRunner.setNoEmail();
      
                  testRunner.run();
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
      
          }
      
          @Override
          public void doPost(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
              doGet(servletRequest, servletResponse);
          }
      }
      With the following output:

      === 2018-05-23 10:20:14,591 [ec-3] INFO RequestContext - URL: '/lms/SeleniumTests', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36': Safari with Accept-Encoding header
      === 2018-05-23 10:20:14,616 [ec-3] WARN TestRunnerConfiguration - Danger - ServletContext detected as org.apache.catalina.core.ApplicationContextFacade@3b0aec3b
      === 2018-05-23 10:20:14,616 [ec-3] INFO TestRunnerConfiguration - Detected webRoot as C:/Program Files/Apache Software Foundation/Tomcat 8.5/lms/lms
      === 2018-05-23 10:20:14,617 [ec-3] INFO TestRunnerConfiguration - Setting fileRoot to webRoot
      === 2018-05-23 10:20:14,636 [ec-3] INFO SeleniumServerHelper - Selenium server starting on port: 4444
      INFO | Writing debug logs to \tmp\selenium.log
      INFO | Java: Oracle Corporation 25.144-b01
      INFO | OS: Windows 10 10.0 amd64
      INFO | v2.53.1, with Core v2.53.1. Built from revision a36b8b1
      10:20:14.819 INFO - Driver class not found: com.opera.core.systems.OperaDriver
      10:20:14.819 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
      10:20:14.829 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
      registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10
      10:20:14.830 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
      10:20:14.830 INFO - Driver provider org.openqa.selenium.phantomjs.PhantomJSDriver is not registered
      10:20:14.831 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
      10:20:14.831 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
      INFO | Version Jetty/5.1.x
      INFO | Started HttpContext[/selenium-server,/selenium-server]
      INFO | Started org.openqa.jetty.jetty.servlet.ServletHandler@2713475f
      INFO | Started HttpContext[/wd,/wd]
      INFO | Started HttpContext[/selenium-server/driver,/selenium-server/driver]
      INFO | Started HttpContext[/,/]
      INFO | Started SocketListener on 0.0.0.0:4444
      INFO | Started org.openqa.jetty.jetty.Server@6ed1081e
      === 2018-05-23 10:20:14,862 [ec-3] INFO SeleniumServerHelper - Selenium server started on port: 4444
      java.lang.IllegalArgumentException: Path [C:/Program Files/Apache Software Foundation/Tomcat 8.5/lms/lms/tests] does not start with a "/" character
      at org.apache.catalina.core.ApplicationContext.getResourcePaths(ApplicationContext.java:583)
      at org.apache.catalina.core.ApplicationContextFacade.getResourcePaths(ApplicationContextFacade.java:180)
      at com.isomorphic.io.ISCFile.list(ISCFile.java:748)
      at com.isomorphic.io.ISCFile.find(ISCFile.java:816)
      at com.isomorphic.autotest.Utils.find(Utils.java:379)
      at com.isomorphic.autotest.Utils.getFilesSpecifiedByPath(Utils.java:425)
      at com.isomorphic.autotest.TestRunnerLauncher.getTestScripts(TestRunnerLauncher.java:497)
      at com.isomorphic.autotest.TestRunnerHelper.testAll(TestRunnerHelper.java:117)
      at com.isomorphic.autotest.TestRunner.testAll(TestRunner.java:255)
      at com.isomorphic.autotest.TestRunnerLauncher.launch(TestRunnerLauncher.java:445)
      at com.isomorphic.autotest.TestRunnerDriver.run(TestRunnerDriver.java:65)
      at com.lmscompany.lms.server.SeleniumTests.doGet(SeleniumTests.java:31)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
      at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:93)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)

      In this case the test files also are underneath the test root directory.

      Comment


        #4
        Today's builds (dated 2018-05-23) include an additional log when TestRunner starts listing the files found. Can you post that log? (It's likely that just updating isomorphic_autotest.jar may be enough.)

        Comment


          #5
          Since you're running TestRunnerDriver inside a servlet container, your test root must be a Unix-style path, starting with a /, and will be interpreted relative to the servlet container root directory.

          So if your test directory isn't already under the servlet root (which it appears not to be), you need to move it, and then set a Unix-style path from the root when configuring TestRunnerDriver.

          Comment


            #6
            I build the project again and the SmartClient Version is now: v11.1p_2018-05-23/PowerEdition Deployment
            I also adjusted the root directory and now the files in the root folder are visible to the TestRunner.

            I ran the following code:

            Code:
                public void doGet(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
            
                    TestRunnerDriver testRunner;
            
                    try {
                        testRunner = new TestRunnerDriver();
                        testRunner.setBatchCommit(false);
                        testRunner.setBrowser("*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe");
                        testRunner.setTestRoot("/root/");
                        String[] files = { "*.rctest.html" };
                        testRunner.setFiles(files);
                        testRunner.setMaximizeBrowser(true);
                        testRunner.setNoEmail();
            
                        testRunner.run();
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
            
                }
            with the following output:

            === 2018-05-28 16:18:32,651 [ec-6] INFO RequestContext - URL: '/lms/SeleniumTests', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36': Safari with Accept-Encoding header
            === 2018-05-28 16:18:32,651 [ec-6] WARN TestRunnerConfiguration - Danger - ServletContext detected as org.apache.catalina.core.ApplicationContextFacade@5c5b853d
            === 2018-05-28 16:18:32,651 [ec-6] INFO TestRunnerConfiguration - Detected webRoot as C:/Program Files/Apache Software Foundation/Tomcat 8.5/lms/lms
            === 2018-05-28 16:18:32,651 [ec-6] INFO TestRunnerConfiguration - Setting fileRoot to webRoot
            === 2018-05-28 16:18:32,652 [ec-6] INFO SeleniumServerHelper - Selenium server starting on port: 4444
            INFO | Writing debug logs to \tmp\selenium.log
            INFO | Java: Oracle Corporation 25.144-b01
            INFO | OS: Windows 10 10.0 amd64
            INFO | v2.53.1, with Core v2.53.1. Built from revision a36b8b1
            16:18:32.663 INFO - Driver class not found: com.opera.core.systems.OperaDriver
            16:18:32.663 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
            16:18:32.663 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
            registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10
            16:18:32.664 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
            16:18:32.664 INFO - Driver provider org.openqa.selenium.phantomjs.PhantomJSDriver is not registered
            16:18:32.664 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
            16:18:32.664 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
            INFO | Version Jetty/5.1.x
            INFO | Started HttpContext[/selenium-server,/selenium-server]
            INFO | Started org.openqa.jetty.jetty.servlet.ServletHandler@f9e7c17
            INFO | Started HttpContext[/wd,/wd]
            INFO | Started HttpContext[/selenium-server/driver,/selenium-server/driver]
            INFO | Started HttpContext[/,/]
            INFO | Started SocketListener on 0.0.0.0:4444
            INFO | Started org.openqa.jetty.jetty.Server@609ae5fe
            === 2018-05-28 16:18:32,667 [ec-6] INFO SeleniumServerHelper - Selenium server started on port: 4444
            === 2018-05-28 16:18:32,668 [ec-6] INFO Utils - getFilesSpecifiedByPath() found the following files:
            /root/running.rctest.html
            === 2018-05-28 16:18:32,669 [ec-6] ERROR TestRunnerHelper - Problems with selenium test: /root/running.rctest.html
            java.io.FileNotFoundException: Source '\root\running.rctest.html' does not exist
            at org.apache.commons.io.FileUtils.checkFileRequirements(FileUtils.java:1405)
            at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1072)
            at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1040)
            at com.isomorphic.autotest.TestRunnerHelper.testRctest(TestRunnerHelper.java:242)
            at com.isomorphic.autotest.TestRunnerHelper.processSeleniumTests(TestRunnerHelper.java:145)
            at com.isomorphic.autotest.TestRunnerHelper.testAll(TestRunnerHelper.java:120)
            at com.isomorphic.autotest.TestRunner.testAll(TestRunner.java:255)
            at com.isomorphic.autotest.TestRunnerLauncher.launch(TestRunnerLauncher.java:445)
            at com.isomorphic.autotest.TestRunnerDriver.run(TestRunnerDriver.java:65)
            at com.lmscompany.lms.server.SeleniumTests.doGet(SeleniumTests.java:30)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
            at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:93)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
            at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
            at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
            at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
            at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
            at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
            at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
            at java.lang.Thread.run(Unknown Source)
            INFO | Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,localport=4444]
            INFO | Stopped SocketListener on 0.0.0.0:4444
            INFO | Stopped HttpContext[/selenium-server,/selenium-server]
            INFO | Stopped org.openqa.jetty.jetty.servlet.ServletHandler@f9e7c17
            INFO | Stopped HttpContext[/wd,/wd]
            INFO | Stopped HttpContext[/selenium-server/driver,/selenium-server/driver]
            INFO | Stopped HttpContext[/,/]
            INFO | Stopped org.openqa.jetty.jetty.Server@609ae5fe
            === 2018-05-28 16:18:33,378 [ec-6] INFO SeleniumServerHelper - Selenium server stopped

            Comment


              #7
              We've applied a fix to SGWT 5.1/SC 10.1p and newer releases. It will be in the nightly builds dated 2018-05-30 and beyond.

              Comment

              Working...
              X