From 93b836f8f2a811ee75a89194af7407d64e1ac464 Mon Sep 17 00:00:00 2001 From: John Ferguson Smart Date: Thu, 19 Feb 2015 12:11:44 +1100 Subject: [PATCH] fix: fixed an issue loading the JSON test reports during aggregate report generation. --- .../java/net/thucydides/core/model/TestOutcome.java | 4 ++-- .../gson/WhenSerializingJSONObjectWithGSON.groovy | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/net/thucydides/core/model/TestOutcome.java b/core/src/main/java/net/thucydides/core/model/TestOutcome.java index 8fb8a02d80..756d3b353b 100644 --- a/core/src/main/java/net/thucydides/core/model/TestOutcome.java +++ b/core/src/main/java/net/thucydides/core/model/TestOutcome.java @@ -76,7 +76,7 @@ public class TestOutcome { /** * The class containing the test method, if the test is implemented in a Java class. */ - private Class testCase; + private transient Class testCase; private String testCaseName; @@ -1732,7 +1732,7 @@ public boolean equals(Object o) { if (manual != that.manual) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false; if (qualifier != null ? !qualifier.equals(that.qualifier) : that.qualifier != null) return false; - if (testCase != null ? !testCase.equals(that.testCase) : that.testCase != null) return false; + if (testCaseName != null ? !testCaseName.equals(that.testCaseName) : that.testCaseName != null) return false; if (title != null ? !title.equals(that.title) : that.title != null) return false; if (userStory != null ? !userStory.equals(that.userStory) : that.userStory != null) return false; diff --git a/core/src/test/groovy/net/thucydides/core/reports/json/gson/WhenSerializingJSONObjectWithGSON.groovy b/core/src/test/groovy/net/thucydides/core/reports/json/gson/WhenSerializingJSONObjectWithGSON.groovy index 51813a68c1..d7130c9c1e 100644 --- a/core/src/test/groovy/net/thucydides/core/reports/json/gson/WhenSerializingJSONObjectWithGSON.groovy +++ b/core/src/test/groovy/net/thucydides/core/reports/json/gson/WhenSerializingJSONObjectWithGSON.groovy @@ -41,4 +41,15 @@ class WhenSerializingJSONObjectWithGSON extends Specification { then: loadedTestOutcome == testOutcome } + + def "should load serialized test outcomes from JSON"() { + given: + GsonJSONConverter converter = new GsonJSONConverter(environmentVariables) + and: + def jsonFile = this.class.getResource("/json-reports/sample-report-1.json").getPath() + when: + def loadedTestOutcome = converter.fromJson(new FileInputStream(new File(jsonFile))) + then: + loadedTestOutcome != null + } }