/** * 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); } } } }
/** * Executes the test suites defined for one server in a test run. * * @param testSuites list of test suites defined for an server. */ private void executeTestClasses(List<String> testSuites) { // go through all test suites for (String testSuiteName : testSuites) { // get the name of the next test suite System.out.println("Executing suite '" + testSuiteName + "'"); // get the configuration for the test suite TestSuite testSuite = config.getTestSuite(testSuiteName); // get an iterator over all test classes Iterator<Class> testClassIt = testSuite.getTestClassesIterator(); // go through all test classes while (testClassIt.hasNext()) { Class testClass = testClassIt.next(); jUnitRunner.run(testClass); } } }