Skip to content

Commit

Permalink
VisualTestingListenerImpl#beforeTestSuite() displays messages: before…
Browse files Browse the repository at this point in the history
…/after creating MaterialStorage
  • Loading branch information
kazurayam committed Jul 12, 2020
1 parent 3a9d63f commit 5352c70
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public class VisualTestingListenerImpl {
Files.createDirectories(materialsDir)

// create the MaterialRepository object, save it as a GlobalVariable
KeywordUtil.logInfo("${hd} creating MaterialRepository")
MaterialRepository mr = MaterialRepositoryFactory.createInstance(materialsDir)
mr.markAsCurrent(testSuiteId, executionProfile, testSuiteTimestamp)
def tsr = mr.ensureTSuiteResultPresent(testSuiteId, executionProfile, testSuiteTimestamp)
Expand All @@ -159,22 +160,33 @@ public class VisualTestingListenerImpl {
VisualTestingLogger vtLogger4Repos = new VisualTestingLoggerDefaultImpl()
mr.setVisualTestingLogger(vtLogger4Repos)
GVH.ensureGlobalVariable(MGV.MATERIAL_REPOSITORY, mr)
KeywordUtil.logInfo("${hd} created MaterialRepository")


// create the MaterialStorage object, save it as a GlobalVariable
KeywordUtil.logInfo("${hd} creating MaterialStorage")
Files.createDirectories(storageDir)
MaterialStorage ms = MaterialStorageFactory.createInstance(storageDir)
VisualTestingLogger vtLogger4Storage = new VisualTestingLoggerDefaultImpl()
ms.setVisualTestingLogger(vtLogger4Storage)
GVH.ensureGlobalVariable(MGV.MATERIAL_STORAGE, ms)
KeywordUtil.logInfo("${hd} created MaterialStorage")


// create the ReportsAccessor object, save it as a GlobalVariable
KeywordUtil.logInfo("${hd} creating ReportsAccessor")
ReportsAccessor ra = ReportsAccessorFactory.createInstance(reportsDir)
GVH.ensureGlobalVariable(MGV.REPORTS_ACCESSOR, ra)
KeywordUtil.logInfo("${hd} created ReportsAccessor")


// read TestSuiteId and ExecutionProfile of the last executed test suite
// from GlobalVariables.json file
if (Files.exists(GLOBAL_VARIABLES_JSON)) {
List<String> names = [MGV.LAST_EXECUTED_TESTSUITE_ID.getName(), MGV.LAST_APPLIED_EXECUTION_PROFILE.getName()]
List<String> names = [
MGV.LAST_EXECUTED_TESTSUITE_ID.getName(),
MGV.LAST_APPLIED_EXECUTION_PROFILE.getName()
]
Reader reader = new InputStreamReader(new FileInputStream(GLOBAL_VARIABLES_JSON.toFile()), "utf-8")
Map<String, Object> gvs = GlobalVariableHelpers.read(names, reader)
for (String name in gvs.keySet()) {
Expand Down Expand Up @@ -294,7 +306,10 @@ public class VisualTestingListenerImpl {

//
Files.createDirectories(GLOBAL_VARIABLES_JSON.getParent())
List<String> names = [MGV.LAST_EXECUTED_TESTSUITE_ID.getName(), MGV.LAST_APPLIED_EXECUTION_PROFILE.getName()]
List<String> names = [
MGV.LAST_EXECUTED_TESTSUITE_ID.getName(),
MGV.LAST_APPLIED_EXECUTION_PROFILE.getName()
]
Writer writer = new OutputStreamWriter(new FileOutputStream(GLOBAL_VARIABLES_JSON.toFile()), "utf-8")
GVH.write(names, writer)
}
Expand Down

0 comments on commit 5352c70

Please sign in to comment.