Skip to content

Commit 3ad8f01

Browse files
committed
Jython atest fixes after adding "origname" listener attribute by robotframework#2962.
Also better error reporting in tests.
1 parent e7fe9b4 commit 3ad8f01

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed
-1 Bytes
Binary file not shown.
120 Bytes
Binary file not shown.

atest/testresources/listeners/JavaAttributeVerifyingListener.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java.io.*;
22
import java.util.*;
3-
import org.python.core.PyList;
4-
import org.python.core.PyDictionary;
3+
import org.python.core.*;
4+
55

66
public class JavaAttributeVerifyingListener {
77
public static final String ROBOT_LISTENER_API_VERSION = "2";
@@ -10,7 +10,7 @@ public class JavaAttributeVerifyingListener {
1010

1111
public JavaAttributeVerifyingListener() throws IOException {
1212
createOutputFile();
13-
createExcpectedTypes();
13+
createExpectedTypes();
1414
}
1515

1616
public void createOutputFile() throws IOException {
@@ -20,7 +20,7 @@ public void createOutputFile() throws IOException {
2020
outfile = new BufferedWriter(new FileWriter(outpath));
2121
}
2222

23-
public void createExcpectedTypes() {
23+
public void createExpectedTypes() {
2424
expectedTypes = new HashMap<String, Class>() {{
2525
put("elapsedtime", Integer.class);
2626
put("tags", PyList.class);
@@ -45,12 +45,12 @@ public void endSuite(String name, Map attrs) {
4545

4646
public void startTest(String name, Map attrs) {
4747
verifyAttributes("START TEST", attrs,
48-
new String[] {"id", "doc", "starttime", "longname", "tags", "critical", "template"});
48+
new String[] {"id", "doc", "starttime", "longname", "origname", "tags", "critical", "template"});
4949
}
5050

5151
public void endTest(String name, Map attrs) {
5252
verifyAttributes("END TEST", attrs,
53-
new String[] {"id", "doc", "starttime", "longname", "tags", "critical", "template", "endtime", "elapsedtime", "status", "message"});
53+
new String[] {"id", "doc", "starttime", "longname", "origname", "tags", "critical", "template", "endtime", "elapsedtime", "status", "message"});
5454
}
5555

5656
public void startKeyword(String name, Map attrs) {
@@ -72,18 +72,19 @@ private void verifyAttributes(String methodName, Map attrs, String[] names) {
7272
outfile.write(methodName + "\n");
7373
if (attrs.size() != names.length) {
7474
outfile.write("FAILED: wrong number of attributes\n");
75-
outfile.write("Expected: " + names + "\n" + "Actual: " + attrs.keySet() + "\n");
75+
outfile.write("Expected: " + Arrays.toString(names) + "\n" + "Actual: " + attrs.keySet() + "\n");
7676
}
7777
else {
7878
for (String name: names) {
79+
if (name.equals("origname"))
80+
continue;
7981
Object attr = attrs.get(name);
8082
String status = "PASSED";
8183
Class expectedClass = Class.forName("java.lang.String");
8284
if (expectedTypes.containsKey(name))
8385
expectedClass = (Class)expectedTypes.get(name);
84-
if (!(attr.getClass()).equals(expectedClass)) {
86+
if (!(attr.getClass()).equals(expectedClass))
8587
status = "FAILED";
86-
}
8788
outfile.write(status + " | " + name + ": " + attr.getClass() + "\n");
8889
}
8990
}

0 commit comments

Comments
 (0)