Skip to content

Commit d1477ce

Browse files
committed
Better logging from the new core runner
Including correctly reporting the number of tests run.
1 parent fd008f5 commit d1477ce

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

java/server/src/org/openqa/selenium/server/htmlrunner/Results.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
public class Results {
2929

3030
private final String suiteSource;
31-
private final List results = new LinkedList<>();
3231
private final List<String> allTables = new LinkedList<>();
3332
private final StringBuilder log = new StringBuilder();
3433
private final long start = System.currentTimeMillis();
@@ -66,6 +65,7 @@ public void addTest(String rawSource, List<CoreTestCase.StepResult> stepResults)
6665
if (passed) {
6766
numberOfPasses++;
6867
}
68+
succeeded &= passed;
6969
}
7070

7171
public HTMLTestResults toSuiteResult() {
@@ -75,10 +75,10 @@ public HTMLTestResults toSuiteResult() {
7575
buildInfo.getReleaseLabel(),
7676
buildInfo.getBuildRevision(),
7777
isSuccessful() ? "PASS" : "FAIL",
78-
String.valueOf(SECONDS.convert(System.currentTimeMillis() - start, MILLISECONDS)),
79-
String.valueOf(results.size()),
78+
String.valueOf(System.currentTimeMillis() - start),
79+
String.valueOf(allTables.size()),
8080
String.valueOf(numberOfPasses),
81-
String.valueOf(results.size() - numberOfPasses),
81+
String.valueOf(allTables.size() - numberOfPasses),
8282
String.valueOf(commandPasses),
8383
String.valueOf(commandFailures),
8484
String.valueOf(commandErrors),

java/server/test/org/openqa/selenium/server/htmlrunner/CoreSelfTest.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.openqa.selenium.server.htmlrunner;
1919

20+
import static org.junit.Assert.assertEquals;
2021
import static org.junit.Assert.assertTrue;
2122

2223
import com.google.common.collect.ImmutableSortedSet;
@@ -60,18 +61,22 @@ public static void stopTestServer() {
6061
@Test
6162
public void executeTests() throws IOException {
6263
String testBase = server.whereIs("/selenium-server/tests");
63-
File outputFile = File.createTempFile("core-test-suite", browser.replace('*', '-') + ".txt");
64+
File outputFile = File.createTempFile("core-test-suite", browser.replace('*', '-') + ".html");
6465
assertTrue(outputFile.delete());
6566

66-
new HTMLLauncher().runHTMLSuite(browser,
67-
// We need to do this because the path relativizing code in java.net.URL is
68-
// clearly having a bad day. "/selenium-server/tests" appended to "../tests/"
69-
// ends up as "/tests" rather than "/selenium-server/tests" as you'd expect.
70-
testBase + "/TestSuite.html",
71-
testBase + "/TestSuite.html",
72-
outputFile,
73-
TimeUnit.MINUTES.toMillis(5),
74-
true);
67+
String result = new HTMLLauncher()
68+
.runHTMLSuite(
69+
browser,
70+
// We need to do this because the path relativizing code in java.net.URL is
71+
// clearly having a bad day. "/selenium-server/tests" appended to "../tests/"
72+
// ends up as "/tests" rather than "/selenium-server/tests" as you'd expect.
73+
testBase + "/TestSuite.html",
74+
testBase + "/TestSuite.html",
75+
outputFile,
76+
TimeUnit.MINUTES.toMillis(5),
77+
true);
78+
79+
assertEquals("PASSED", result);
7580
}
7681

7782
@Parameterized.Parameters
@@ -96,7 +101,6 @@ public static Iterable<String> parameters() {
96101
break;
97102
}
98103

99-
System.out.println("browsers.build() = " + browsers.build());
100104
return browsers.build();
101105
}
102106
}

0 commit comments

Comments
 (0)