Example #1
0
  /** Executes a test-run for the specified platform */
  private void executeForPlatform(
      TestRun.TestRunServer selServerConfig, Map<String, String> testServer, Platform platform) {

    List<Browser> availableBrowsers = platform.getAvailableBrowsers();
    for (Browser browser : availableBrowsers) {
      String connDef = browser.getConnectionDef();
      BaseTestCase.setBrowser(connDef);
      String msg =
          "Test Environment: name="
              + selServerConfig.getName()
              + " host="
              + testServer.get("host")
              + " port="
              + testServer.get("port")
              + " browser="
              + connDef
              + " speed="
              + selServerConfig.getSpeed();

      log.log(Level.INFO, msg);
      System.out.println("----------------------------------------");
      System.out.println(msg);
      System.out.println("----------------------------------------");

      // execute test suites
      executeTestClasses(selServerConfig.testSuites);
    }
  }
Example #2
0
  /**
   * Excutes the selected test run.
   *
   * @param testRunName name of the test run to execute
   */
  private void executeTestRun(String testRunName) {

    log.log(Level.INFO, "Executing Test Run '" + testRunName + "'");

    // get the selected test run
    TestRun testRun = config.getTestRun(testRunName);

    // check if the application under test is available
    BaseTestCase.testAUTHTTPConnection(testRun.getBaseURL());

    // check if all configured servers for this test run are responding
    BaseTestCase.testSeleniumHTTPConnection(config, testRun.getTestRunServerIterator());

    // set the Application-under-Test parameters in the JUnit Base Class
    BaseTestCase.setBaseURL(testRun.getBaseURL());

    String msg = "Application under Test:\n" + "BaseURL=" + testRun.getBaseURL();

    System.out.println(msg);
    log.log(Level.INFO, msg);

    // go through all servers defined in the test run and execute the tests
    Iterator<TestRun.TestRunServer> selServerIt = testRun.getTestRunServerIterator();
    while (selServerIt.hasNext()) {

      // get the next server entry from the test run
      TestRun.TestRunServer selServerConfig = selServerIt.next();
      // set the speed for this server/browser combination
      BaseTestCase.setSpeed(selServerConfig.getSpeed());

      // get the test server settings
      Map<String, String> testServer = config.getTestServers().get(selServerConfig.getName());

      // set the host,port and browser used for the next tests
      BaseTestCase.isExternallySetup = true;
      BaseTestCase.setSeleniumServerHost(testServer.get("host"));
      BaseTestCase.setSeleniumServerPort(testServer.get("port"));

      msg = "Platform is: " + System.getProperty("os.name");
      System.out.println(msg);
      log.log(Level.INFO, msg);

      Map<String, Platform> platforms = config.getPlatforms();
      for (Platform platformToCheck : platforms.values()) {
        if (platformToCheck.isValid()) {
          executeForPlatform(selServerConfig, testServer, platformToCheck);
        }
      }
    }
  }