diff --git a/README.md b/README.md index 1916a42f..eaa31f98 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ Requirements ------------ * Java 8 +1.0.6 +----- +* Redacted some of the output of the config +* Passed the name of the running feature and scenario into the context. +* RemoteWebDriverFactory sets up additional information to pass though via capabilities (current git branch, version) + 1.0.5 ----- * Single Maven plugin, glossary functionality moved into the same plugin that provides execution and report building, diff --git a/api/src/main/java/com/technophobia/substeps/model/Configuration.java b/api/src/main/java/com/technophobia/substeps/model/Configuration.java index ae8b3f71..065fdc2b 100644 --- a/api/src/main/java/com/technophobia/substeps/model/Configuration.java +++ b/api/src/main/java/com/technophobia/substeps/model/Configuration.java @@ -19,9 +19,7 @@ package com.technophobia.substeps.model; -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import com.typesafe.config.ConfigRenderOptions; +import com.typesafe.config.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,8 +69,18 @@ public String getConfigurationInfo() { ConfigRenderOptions options = ConfigRenderOptions.defaults().setComments(false).setFormatted(true).setJson(false).setOriginComments(false); - return config.withoutPath("java") - .withoutPath("sun").withoutPath("awt").withoutPath("idea").withoutPath("line.separator").withoutPath("os").withoutPath("path.separator").root().render(options); + return config + .withoutPath("java") + .withoutPath("sun") + .withoutPath("awt") + .withoutPath("idea") + .withoutPath("line.separator") + .withoutPath("os") + .withoutPath("path.separator") + .withValue("remote.token", ConfigValueFactory.fromAnyRef("******")) + .withValue("remote.username", ConfigValueFactory.fromAnyRef("******")) + + .root().render(options); } diff --git a/api/src/main/java/com/technophobia/substeps/runner/ExecutionContext.java b/api/src/main/java/com/technophobia/substeps/runner/ExecutionContext.java index 9a6a8f88..82e58da8 100644 --- a/api/src/main/java/com/technophobia/substeps/runner/ExecutionContext.java +++ b/api/src/main/java/com/technophobia/substeps/runner/ExecutionContext.java @@ -80,6 +80,14 @@ private Object getInternal(final Scope scope, final String key) { } return rtn; } + public static void clear(final Scope scope, String key) { + ExecutionContext ec = executionContextThreadLocal.get(); + Map map = ec.scopedData.get(scope); + if (map != null) { + map.remove(key); + } + + } public static void clear(final Scope scope) { executionContextThreadLocal.get().scopedData.remove(scope); diff --git a/api/src/main/resources/reference.conf b/api/src/main/resources/reference.conf index 1d3f9e3f..a4e8e395 100644 --- a/api/src/main/resources/reference.conf +++ b/api/src/main/resources/reference.conf @@ -23,4 +23,15 @@ parameter{ } } +} + +substeps{ + current { + branchname = "" + branchname = ${?SUBSTEPS_CURRENT_BRANCHNAME} + + projectversion="" + projectversion = ${?SUBSTEPS_CURRENT_PROJECT_VERSION} + } + } \ No newline at end of file diff --git a/core/src/main/java/com/technophobia/substeps/runner/node/AbstractNodeRunner.java b/core/src/main/java/com/technophobia/substeps/runner/node/AbstractNodeRunner.java index c984498d..e6f03e26 100644 --- a/core/src/main/java/com/technophobia/substeps/runner/node/AbstractNodeRunner.java +++ b/core/src/main/java/com/technophobia/substeps/runner/node/AbstractNodeRunner.java @@ -100,7 +100,7 @@ private void afterExecute(final NODE_TYPE node, final boolean success, final Roo private boolean runSetup(final NODE_TYPE node, final RootNodeExecutionContext context) { try { - context.getSetupAndTeardown().runSetup(getScope()); + context.getSetupAndTeardown().runSetup(getScope(), node); return true; } catch (final Throwable t) { diff --git a/core/src/main/java/com/technophobia/substeps/runner/setupteardown/SetupAndTearDown.java b/core/src/main/java/com/technophobia/substeps/runner/setupteardown/SetupAndTearDown.java index 93cf7d7d..287072a0 100644 --- a/core/src/main/java/com/technophobia/substeps/runner/setupteardown/SetupAndTearDown.java +++ b/core/src/main/java/com/technophobia/substeps/runner/setupteardown/SetupAndTearDown.java @@ -19,7 +19,9 @@ package com.technophobia.substeps.runner.setupteardown; import com.technophobia.substeps.execution.MethodExecutor; +import com.technophobia.substeps.execution.node.IExecutionNode; import com.technophobia.substeps.model.Scope; +import com.technophobia.substeps.runner.ExecutionContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -123,9 +125,11 @@ private void removeLoggingConfig() { } - public void runSetup(final Scope currentScope) throws Throwable { + public void runSetup(final Scope currentScope, IExecutionNode node) throws Throwable { this.log.trace("running setup for scope: " + currentScope); + ExecutionContext.put(currentScope, "SCOPE_DESCRIPTION", node.getDescription()); + switch (currentScope) { case SUITE: { runBeforeAll(); @@ -152,6 +156,7 @@ public void runSetup(final Scope currentScope) throws Throwable { public void runTearDown(final Scope currentScope) throws Throwable { this.log.trace("runTearDown: " + currentScope); + // TODO: could implement this as methods on Scope itself switch (currentScope) { case SUITE: { @@ -177,5 +182,8 @@ public void runTearDown(final Scope currentScope) throws Throwable { } } + ExecutionContext.clear(currentScope, "SCOPE_DESCRIPTION"); + + } } diff --git a/core/src/test/resources/localhost.conf b/core/src/test/resources/localhost.conf index 9cbae294..e3e65f06 100644 --- a/core/src/test/resources/localhost.conf +++ b/core/src/test/resources/localhost.conf @@ -29,4 +29,3 @@ users{ } } - diff --git a/runner/Maven/pom.xml b/runner/Maven/pom.xml index 12ae9252..07a121c9 100644 --- a/runner/Maven/pom.xml +++ b/runner/Maven/pom.xml @@ -124,7 +124,11 @@ gson - + + org.eclipse.jgit + org.eclipse.jgit + 4.6.0.201612231935-r +