diff --git a/src/main/java/org/nexial/core/model/ExecutionSummary.java b/src/main/java/org/nexial/core/model/ExecutionSummary.java index 0e782d8c2..bf4ab3763 100644 --- a/src/main/java/org/nexial/core/model/ExecutionSummary.java +++ b/src/main/java/org/nexial/core/model/ExecutionSummary.java @@ -366,15 +366,6 @@ public String toString() { text.append(formatLabel("PASS")).append(formatStat(passCount, totalSteps)); text.append(formatLabel("FAIL")).append(formatStat(failCount, totalSteps)); - //if (MapUtils.isNotEmpty(referenceData)) { - // StringBuffer refData = new StringBuffer(); - // referenceData.forEach((key, value) -> refData.append(" [") - // .append(key).append("=") - // .append(referenceData.get(key)) - // .append("]")); - // text.append(formatLabel("References")).append(formatValue(refData.toString())); - //} - return text.toString(); } @@ -528,8 +519,14 @@ protected int createScenarioExecutionSummary(Worksheet sheet, ExecutionSummary s if (MapUtils.isNotEmpty(ref)) { List refNames = CollectionUtil.toList(ref.keySet()); for (String name : refNames) { + if (StringUtils.isBlank(name)) { continue; } + + String value = ref.get(name); + if (StringUtils.isEmpty(value)) { continue; } + + // don't print empty/missing ref data createCell(sheet, "B" + rowNum, name, STYLE_EXEC_SUMM_DATA_NAME, rowHeight); - createCell(sheet, "C" + rowNum, ref.get(name), STYLE_EXEC_SUMM_DATA_VALUE, rowHeight); + createCell(sheet, "C" + rowNum, value, STYLE_EXEC_SUMM_DATA_VALUE, rowHeight); rowNum++; } } else { @@ -647,10 +644,20 @@ protected static String formatDuration(long elapsedTime) { } protected void createTestExecutionSection(Worksheet sheet, int rowNum, String title, Map data) { + // gotta make sure we don't print empty/missing ref. + if (MapUtils.isEmpty(data)) { return; } + + List names = CollectionUtil.toList(data.keySet()); + names.forEach(name -> { + if (StringUtils.isBlank(name) || StringUtils.isEmpty(data.get(name))) { data.remove(name); } + }); + + if (MapUtils.isEmpty(data)) { return; } + float rowHeight = EXEC_SUMMARY_HEIGHT; createCell(sheet, "A" + rowNum, title, STYLE_EXEC_SUMM_DATA_HEADER, rowHeight); - List names = CollectionUtil.toList(data.keySet()); + names = CollectionUtil.toList(data.keySet()); for (int i = 0; i < names.size(); i++) { String name = names.get(i); createCell(sheet, "B" + (i + rowNum), name, STYLE_EXEC_SUMM_DATA_NAME, rowHeight); @@ -659,7 +666,6 @@ protected void createTestExecutionSection(Worksheet sheet, int rowNum, String ti String[] values = StringUtils.splitByWholeSeparator(value, "\n"); for (int j = 0; j < values.length; j++) { String dataValue = values[j]; - if (StringUtils.isBlank(dataValue)) { continue; } createLinkCell(sheet, (char) ('C' + j) + "" + (i + rowNum), dataValue, STYLE_EXEC_SUMM_DATA_VALUE); } } diff --git a/src/main/java/org/nexial/core/tools/NexialSetup.java b/src/main/java/org/nexial/core/tools/NexialSetup.java index 747cd0c74..86bba3648 100644 --- a/src/main/java/org/nexial/core/tools/NexialSetup.java +++ b/src/main/java/org/nexial/core/tools/NexialSetup.java @@ -52,6 +52,7 @@ import static javax.crypto.Cipher.ENCRYPT_MODE; import static org.nexial.core.NexialConst.*; import static org.nexial.core.NexialConst.ExitStatus.*; +import static org.nexial.core.utils.ExecUtils.BIN_SCRIPT_EXT; /** * This class is a utility for encrypting the setup/data file with the given key file passed as options @@ -93,7 +94,7 @@ public final class NexialSetup { private static final String ENCRYPTION_ALGORITHM = "AES"; private static final String MSG_MISSING_ENV = "Missing environment details. Please be sure to run via " + - "bin/nexial-setup.cmd or bin/nexial-setup.sh script"; + "bin/nexial-setup" + BIN_SCRIPT_EXT + " script"; private static final String MSG_CANT_WRITE_TEMP = "Unable to read/write directory '" + TEMP + "' to generate " + "setup artifacts. Please fix permission and re-run again."; private static Options cmdOptions = initCmdOptions(); diff --git a/src/main/java/org/nexial/core/utils/ExecUtils.java b/src/main/java/org/nexial/core/utils/ExecUtils.java index 9c05a59d5..b47fd963e 100644 --- a/src/main/java/org/nexial/core/utils/ExecUtils.java +++ b/src/main/java/org/nexial/core/utils/ExecUtils.java @@ -36,6 +36,7 @@ import org.nexial.commons.utils.DateUtility; import org.nexial.core.Nexial; +import static org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS; import static org.nexial.core.NexialConst.Data.DEF_TEXT_DELIM; import static org.nexial.core.NexialConst.Data.SCRIPT_REF_PREFIX; import static org.nexial.core.NexialConst.Integration.*; @@ -71,6 +72,8 @@ public final class ExecUtils { public static final List JUNIT_CLASSES = Arrays.asList("org.junit.runner.JUnitCore", "org.junit.runners.ParentRunner"); + public static final String BIN_SCRIPT_EXT = (IS_OS_WINDOWS ? ".cmd" : ".sh"); + public static String manifest; private ExecUtils() {} diff --git a/src/main/java/org/nexial/core/utils/InputFileUtils.java b/src/main/java/org/nexial/core/utils/InputFileUtils.java index 2d7b47b3d..27aad273a 100644 --- a/src/main/java/org/nexial/core/utils/InputFileUtils.java +++ b/src/main/java/org/nexial/core/utils/InputFileUtils.java @@ -41,6 +41,7 @@ import static org.nexial.core.NexialConst.Data.DEF_OPEN_EXCEL_AS_DUP; import static org.nexial.core.NexialConst.Data.SHEET_SYSTEM; import static org.nexial.core.excel.ExcelConfig.*; +import static org.nexial.core.utils.ExecUtils.BIN_SCRIPT_EXT; public final class InputFileUtils { private static final Logger LOGGER = LoggerFactory.getLogger(InputFileUtils.class); @@ -50,13 +51,15 @@ public final class InputFileUtils { ArrayUtils.toString(ADDR_HEADER_SCENARIO_INFO1) + "," + ArrayUtils.toString(ADDR_HEADER_SCENARIO_INFO2) + "," + ArrayUtils.toString(ADDR_HEADER_TEST_STEP) + "; please run " + - "bin/nexial-script-update.cmd to update your test script"; + "bin/nexial-script-update" + BIN_SCRIPT_EXT + + " to update your test script"; private static final String MSG_HEADER_NOT_FOUND = "required script header NOT found at " + ArrayUtils.toString(ADDR_HEADER_SCENARIO_INFO1) + "," + ArrayUtils.toString(ADDR_HEADER_SCENARIO_INFO2); private static final String MSG_V1_SCRIPT_HEADER = "Outdated format found at " + ArrayUtils.toString(ADDR_HEADER_TEST_STEP) + "; please run " + - "bin/nexial-script-update.cmd to update your test script"; + "bin/nexial-script-update" + BIN_SCRIPT_EXT + + " to update your test script"; private static final String MSG_SCRIPT_HEADER_NOT_FOUND = "required script header not found at " + ArrayUtils.toString(ADDR_HEADER_TEST_STEP); private static final String MSG_MISSING_TEST_ACTIVITY = "First test step must be accompanied by a test activity";