diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5426c5f200..9227d740c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,14 @@ public @interface FeatureHtml5Report { }
## New Annotations
* Introduced the `@As` annotation that replaces the `@Description` annotation when used on step methods and test methods. The `@Description` annotation should only be used for descriptions of test classes.
+* Added `@Pending` annotation to replace the `@NotImplementedYet` annotation.
+
+## Backwards incompatible JSON Model Changes
+
+* The field `notImplementedYet` of the `ScenarioModel` was renamed to `pending`
+* The `StepStatus` `NOT_IMPLEMENTED_YET` was renamed to `PENDING`.
+
+Note: in general, backwards incompatible model changes should be no problem, as long as you use the same version for all JGiven modules (core, html5-report, maven-plugin).
# v0.7.3
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/IsTag.java b/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/IsTag.java
index 9c06eab4de..a352bd4a86 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/IsTag.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/IsTag.java
@@ -41,7 +41,7 @@
* Whether values should be ignored.
* If true only a single tag is created for the annotation and the value does not appear in the report.
* This is useful if the value is used as an internal comment
- * @see NotImplementedYet
+ * @see Pending
*/
boolean ignoreValue() default false;
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/NotImplementedYet.java b/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/NotImplementedYet.java
index 860ac56ef8..75001277ef 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/NotImplementedYet.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/NotImplementedYet.java
@@ -35,7 +35,9 @@
* }
*
*
+ * @deprecated use {@link Pending} instead
*/
+@Deprecated
@Documented
@Inherited
@Retention( RUNTIME )
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/Pending.java b/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/Pending.java
index 1ea996c7c0..6da0895b9b 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/Pending.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/annotation/Pending.java
@@ -12,7 +12,7 @@
/**
* Marks methods of step definitions as not implemented yet.
* Such steps will not be executed, but will appear in
- * the report as not implemented yet.
+ * the report as pending.
*
* This is useful if one already wants to define the scenario without
* already implementing all steps, for example, to verify that
@@ -29,12 +29,13 @@
*
*
Example
*
- * {@literal @}NotImplementedYet
+ * {@literal @}Pending
* public void my_cool_new_feature() {
*
* }
*
*
+ * @since 0.8.0
*/
@Documented
@Inherited
@@ -48,7 +49,7 @@
String value() default "";
/**
- * Instead of only reporting not implemented yet steps,
+ * Instead of only reporting pending steps,
* the steps are actually executed.
* This is useful to see whether some steps fail, for example.
* Failing steps, however, have no influence on the overall test result.
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/exception/FailIfPassedException.java b/jgiven-core/src/main/java/com/tngtech/jgiven/exception/FailIfPassedException.java
index 8478ddd5a6..89e6da8183 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/exception/FailIfPassedException.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/exception/FailIfPassedException.java
@@ -1,7 +1,7 @@
package com.tngtech.jgiven.exception;
/**
- * @see com.tngtech.jgiven.annotation.NotImplementedYet
+ * @see com.tngtech.jgiven.annotation.Pending
*/
public class FailIfPassedException extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutor.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutor.java
index 90396f6b47..e2af98f819 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutor.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutor.java
@@ -13,8 +13,6 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
-import net.sf.cglib.proxy.Enhancer;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,23 +20,12 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.tngtech.jgiven.CurrentStep;
-import com.tngtech.jgiven.annotation.AfterScenario;
-import com.tngtech.jgiven.annotation.AfterStage;
-import com.tngtech.jgiven.annotation.BeforeScenario;
-import com.tngtech.jgiven.annotation.BeforeStage;
-import com.tngtech.jgiven.annotation.Hidden;
-import com.tngtech.jgiven.annotation.NotImplementedYet;
-import com.tngtech.jgiven.annotation.ScenarioRule;
-import com.tngtech.jgiven.annotation.ScenarioStage;
+import com.tngtech.jgiven.annotation.*;
import com.tngtech.jgiven.attachment.Attachment;
import com.tngtech.jgiven.exception.FailIfPassedException;
import com.tngtech.jgiven.exception.JGivenUserException;
import com.tngtech.jgiven.impl.inject.ValueInjector;
-import com.tngtech.jgiven.impl.intercept.InvocationMode;
-import com.tngtech.jgiven.impl.intercept.NoOpScenarioListener;
-import com.tngtech.jgiven.impl.intercept.ScenarioListener;
-import com.tngtech.jgiven.impl.intercept.StandaloneStepMethodInterceptor;
-import com.tngtech.jgiven.impl.intercept.StepMethodHandler;
+import com.tngtech.jgiven.impl.intercept.*;
import com.tngtech.jgiven.impl.util.FieldCache;
import com.tngtech.jgiven.impl.util.ParameterNameUtil;
import com.tngtech.jgiven.impl.util.ReflectionUtil;
@@ -46,6 +33,8 @@
import com.tngtech.jgiven.integration.CanWire;
import com.tngtech.jgiven.report.model.NamedArgument;
+import net.sf.cglib.proxy.Enhancer;
+
/**
* Main class of JGiven for executing scenarios.
*/
@@ -447,7 +436,17 @@ public void startScenario( String description ) {
public void startScenario( Method method, List arguments ) {
listener.scenarioStarted( method, arguments );
- if( method.isAnnotationPresent( NotImplementedYet.class ) ) {
+ if( method.isAnnotationPresent( Pending.class ) ) {
+ Pending annotation = method.getAnnotation( Pending.class );
+
+ if( annotation.failIfPass() ) {
+ failIfPass();
+ } else if( !annotation.executeSteps() ) {
+ methodInterceptor.disableMethodExecution();
+ executeLifeCycleMethods = false;
+ }
+ suppressExceptions = true;
+ } else if( method.isAnnotationPresent( NotImplementedYet.class ) ) {
NotImplementedYet annotation = method.getAnnotation( NotImplementedYet.class );
if( annotation.failIfPass() ) {
@@ -458,6 +457,7 @@ public void startScenario( Method method, List arguments ) {
}
suppressExceptions = true;
}
+
}
@Override
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/InvocationMode.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/InvocationMode.java
index 95c3a247f5..e71a7626ac 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/InvocationMode.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/InvocationMode.java
@@ -6,7 +6,7 @@ public enum InvocationMode {
NORMAL,
FAILED,
SKIPPED,
- NOT_IMPLEMENTED_YET;
+ PENDING;
public StepStatus toStepStatus() {
switch( this ) {
@@ -14,8 +14,8 @@ public StepStatus toStepStatus() {
return StepStatus.PASSED;
case FAILED:
return StepStatus.FAILED;
- case NOT_IMPLEMENTED_YET:
- return StepStatus.NOT_IMPLEMENTED_YET;
+ case PENDING:
+ return StepStatus.PENDING;
case SKIPPED:
return StepStatus.SKIPPED;
default:
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/StepMethodInterceptor.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/StepMethodInterceptor.java
index e1580593f0..88d0dde02d 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/StepMethodInterceptor.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/StepMethodInterceptor.java
@@ -1,8 +1,6 @@
package com.tngtech.jgiven.impl.intercept;
-import static com.tngtech.jgiven.impl.intercept.InvocationMode.NORMAL;
-import static com.tngtech.jgiven.impl.intercept.InvocationMode.NOT_IMPLEMENTED_YET;
-import static com.tngtech.jgiven.impl.intercept.InvocationMode.SKIPPED;
+import static com.tngtech.jgiven.impl.intercept.InvocationMode.*;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicInteger;
@@ -11,8 +9,9 @@
import org.slf4j.LoggerFactory;
import com.tngtech.jgiven.annotation.NotImplementedYet;
+import com.tngtech.jgiven.annotation.Pending;
-public class StepMethodInterceptor {
+public class StepMethodInterceptor {
private static final Logger log = LoggerFactory.getLogger( StepMethodInterceptor.class );
private StepMethodHandler scenarioMethodHandler;
@@ -41,9 +40,8 @@ public StepMethodInterceptor( StepMethodHandler scenarioMethodHandler, AtomicInt
this.stackDepth = stackDepth;
}
-
- public final Object doIntercept(final Object receiver, Method method,
- final Object[] parameters, Invoker invoker) throws Throwable {
+ public final Object doIntercept( final Object receiver, Method method,
+ final Object[] parameters, Invoker invoker ) throws Throwable {
long started = System.nanoTime();
InvocationMode mode = getInvocationMode( receiver, method );
@@ -52,14 +50,14 @@ public final Object doIntercept(final Object receiver, Method method,
scenarioMethodHandler.handleMethod( receiver, method, parameters, mode );
}
- if( mode == SKIPPED || mode == NOT_IMPLEMENTED_YET ) {
+ if( mode == SKIPPED || mode == PENDING) {
return returnReceiverOrNull( receiver, method );
}
try {
stackDepth.incrementAndGet();
return invoker.proceed();
- } catch (Exception e) {
+ } catch( Exception e ) {
return handleThrowable( receiver, method, e, System.nanoTime() - started );
} catch( AssertionError e ) {
return handleThrowable( receiver, method, e, System.nanoTime() - started );
@@ -107,8 +105,10 @@ protected InvocationMode getInvocationMode( Object receiver, Method method ) {
}
if( method.isAnnotationPresent( NotImplementedYet.class )
- || receiver.getClass().isAnnotationPresent( NotImplementedYet.class ) ) {
- return NOT_IMPLEMENTED_YET;
+ || receiver.getClass().isAnnotationPresent( NotImplementedYet.class )
+ || method.isAnnotationPresent( Pending.class )
+ || receiver.getClass().isAnnotationPresent( Pending.class ) ) {
+ return PENDING;
}
return NORMAL;
@@ -132,20 +132,16 @@ public StepMethodHandler getScenarioMethodHandler() {
return scenarioMethodHandler;
}
-
public AtomicInteger getStackDepth() {
return stackDepth;
}
-
- public void setScenarioMethodHandler(StepMethodHandler scenarioMethodHandler) {
+ public void setScenarioMethodHandler( StepMethodHandler scenarioMethodHandler ) {
this.scenarioMethodHandler = scenarioMethodHandler;
}
-
- public void setStackDepth(AtomicInteger stackDepth) {
+ public void setStackDepth( AtomicInteger stackDepth ) {
this.stackDepth = stackDepth;
}
-
}
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java
index a2dcce0b46..98def5817a 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java
@@ -1,8 +1,8 @@
package com.tngtech.jgiven.report.model;
public enum ExecutionStatus {
- NONE_IMPLEMENTED,
+ SCENARIO_PENDING,
SUCCESS,
FAILED,
- PARTIALLY_IMPLEMENTED;
+ SOME_STEPS_PENDING;
}
\ No newline at end of file
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatusCalculator.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatusCalculator.java
index 6e4bedc5ca..11b642b8cd 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatusCalculator.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatusCalculator.java
@@ -2,14 +2,14 @@
final class ExecutionStatusCalculator extends ReportModelVisitor {
private int failedCount;
- private int notImplementedCount;
+ private int pendingCount;
private int totalCount;
private ExecutionStatus status;
@Override
public void visit( ScenarioModel scenarioModel ) {
- if(scenarioModel.isNotImplementedYet()) {
- status = ExecutionStatus.NONE_IMPLEMENTED;
+ if(scenarioModel.isPending()) {
+ status = ExecutionStatus.SCENARIO_PENDING;
}
}
@@ -24,8 +24,8 @@ public void visit( ScenarioCaseModel scenarioCase ) {
public void visit( StepModel stepModel ) {
if( stepModel.isFailed() ) {
failedCount++;
- } else if( stepModel.isNotImplementedYet() ) {
- notImplementedCount++;
+ } else if( stepModel.isPending() ) {
+ pendingCount++;
}
totalCount++;
}
@@ -39,11 +39,11 @@ public ExecutionStatus executionStatus() {
return ExecutionStatus.FAILED;
}
- if( notImplementedCount > 0 ) {
- if( notImplementedCount < totalCount ) {
- return ExecutionStatus.PARTIALLY_IMPLEMENTED;
+ if( pendingCount > 0 ) {
+ if( pendingCount < totalCount ) {
+ return ExecutionStatus.SOME_STEPS_PENDING;
}
- return ExecutionStatus.NONE_IMPLEMENTED;
+ return ExecutionStatus.SCENARIO_PENDING;
}
return ExecutionStatus.SUCCESS;
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java
index 63a7e96f7c..f4769fd6d9 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java
@@ -107,7 +107,7 @@ public List getFailedScenarios() {
}
public List getPendingScenarios() {
- return getScenariosWithStatus(ExecutionStatus.NONE_IMPLEMENTED, ExecutionStatus.PARTIALLY_IMPLEMENTED);
+ return getScenariosWithStatus(ExecutionStatus.SCENARIO_PENDING, ExecutionStatus.SOME_STEPS_PENDING);
}
public List getScenariosWithStatus(ExecutionStatus first, ExecutionStatus... rest) {
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java
index f10df9eb1c..e72d2cc448 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java
@@ -330,8 +330,8 @@ private void readAnnotations( Method method ) {
scenarioStarted( scenarioDescription );
- if( method.isAnnotationPresent( NotImplementedYet.class ) ) {
- currentScenarioModel.setNotImplementedYet( true );
+ if( method.isAnnotationPresent( NotImplementedYet.class ) || method.isAnnotationPresent( Pending.class ) ) {
+ currentScenarioModel.setPending(true);
}
if( currentScenarioCase.getCaseNr() == 1 ) {
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ScenarioModel.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ScenarioModel.java
index 29005ae76a..472c59c4e2 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ScenarioModel.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ScenarioModel.java
@@ -17,7 +17,7 @@ public class ScenarioModel {
* A list of tag ids
*/
private Set tagIds = Sets.newLinkedHashSet();
- private boolean notImplementedYet;
+ private boolean pending;
private List explicitParameters = Lists.newArrayList();
private List derivedParameters = Lists.newArrayList();
private boolean casesAsTable;
@@ -142,12 +142,12 @@ public void setTagIds(Set tagIds) {
this.tagIds = tagIds;
}
- public boolean isNotImplementedYet() {
- return notImplementedYet;
+ public boolean isPending() {
+ return pending;
}
- public void setNotImplementedYet( boolean notImplementedYet ) {
- this.notImplementedYet = notImplementedYet;
+ public void setPending(boolean pending) {
+ this.pending = pending;
}
}
\ No newline at end of file
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StatisticsCalculator.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StatisticsCalculator.java
index d5292aa1e5..244c020710 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StatisticsCalculator.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StatisticsCalculator.java
@@ -27,7 +27,7 @@ public void visit( ScenarioModel scenarioModel ) {
ExecutionStatus executionStatus = scenarioModel.getExecutionStatus();
if( executionStatus == ExecutionStatus.FAILED ) {
statistics.numFailedScenarios += 1;
- } else if( executionStatus == ExecutionStatus.NONE_IMPLEMENTED || executionStatus == ExecutionStatus.PARTIALLY_IMPLEMENTED ) {
+ } else if( executionStatus == ExecutionStatus.SCENARIO_PENDING || executionStatus == ExecutionStatus.SOME_STEPS_PENDING) {
statistics.numPendingScenarios += 1;
} else {
statistics.numSuccessfulScenarios += 1;
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepModel.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepModel.java
index d392f6d242..c14775af7e 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepModel.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepModel.java
@@ -60,8 +60,8 @@ public StepModel addWords( Word... words ) {
return this;
}
- public boolean isNotImplementedYet() {
- return getStatus() == StepStatus.NOT_IMPLEMENTED_YET;
+ public boolean isPending() {
+ return getStatus() == StepStatus.PENDING;
}
public boolean isFailed() {
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepStatus.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepStatus.java
index 2949330065..d9d7d6808a 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepStatus.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepStatus.java
@@ -4,5 +4,5 @@ public enum StepStatus {
PASSED,
FAILED,
SKIPPED,
- NOT_IMPLEMENTED_YET;
+ PENDING;
}
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriter.java
index cc3c7647b7..56835ea596 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriter.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriter.java
@@ -114,8 +114,8 @@ public void visit( StepModel stepModel ) {
}
String rest = joinWords( words.subList( introWord, restSize ) );
- if( stepModel.isNotImplementedYet() ) {
- rest = withColor( Color.BLACK, true, Attribute.INTENSITY_FAINT, rest + " (not implemented yet)" );
+ if( stepModel.isPending() ) {
+ rest = withColor( Color.BLACK, true, Attribute.INTENSITY_FAINT, rest + " (pending)" );
} else if( stepModel.isSkipped() ) {
rest = withColor( Color.BLACK, true, Attribute.INTENSITY_FAINT, rest + " (skipped)" );
} else if( stepModel.isFailed() ) {
diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutorTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutorTest.java
index 570273501a..7f83318f80 100644
--- a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutorTest.java
+++ b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/StandaloneScenarioExecutorTest.java
@@ -6,12 +6,7 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import com.tngtech.jgiven.annotation.AfterStage;
-import com.tngtech.jgiven.annotation.BeforeStage;
-import com.tngtech.jgiven.annotation.ExpectedScenarioState;
-import com.tngtech.jgiven.annotation.NotImplementedYet;
-import com.tngtech.jgiven.annotation.ProvidedScenarioState;
-import com.tngtech.jgiven.annotation.ScenarioStage;
+import com.tngtech.jgiven.annotation.*;
import com.tngtech.jgiven.exception.JGivenExecutionException;
public class StandaloneScenarioExecutorTest {
@@ -62,6 +57,32 @@ public void stepclasses_annotated_with_NotImplementedYet_are_not_really_executed
assertThat( true ).as( "No exception was thrown" ).isTrue();
}
+ @Test
+ public void methods_annotated_with_Pending_are_not_really_executed() {
+ ScenarioExecutor executor = new StandaloneScenarioExecutor();
+ PendingTestStep steps = executor.addStage( PendingTestStep.class );
+ executor.startScenario( "Test" );
+ steps.something_pending();
+ assertThat( true ).as( "No exception was thrown" ).isTrue();
+ }
+
+ @Test
+ public void methods_annotated_with_Pending_must_follow_fluent_interface_convention_or_return_null() {
+ ScenarioExecutor executor = new StandaloneScenarioExecutor();
+ PendingTestStep steps = executor.addStage( PendingTestStep.class );
+ executor.startScenario( "Test" );
+ assertThat( steps.something_pending_with_wrong_signature() ).isNull();
+ }
+
+ @Test
+ public void stepclasses_annotated_with_Pending_are_not_really_executed() {
+ ScenarioExecutor executor = new StandaloneScenarioExecutor();
+ PendingTestStepClass steps = executor.addStage( PendingTestStepClass.class );
+ executor.startScenario( "Test" );
+ steps.something_pending();
+ assertThat( true ).as( "No exception was thrown" ).isTrue();
+ }
+
@Test
public void steps_are_injected() {
ScenarioExecutor executor = new StandaloneScenarioExecutor();
@@ -160,6 +181,25 @@ public void after_stage_was_executed() {
}
}
+ static class PendingTestStep {
+ @Pending
+ public PendingTestStep something_pending() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Pending
+ public String something_pending_with_wrong_signature() {
+ return "something";
+ }
+ }
+
+ @Pending
+ static class PendingTestStepClass {
+ public PendingTestStepClass something_pending() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
static class NotImplementedYetTestStep {
@NotImplementedYet
public NotImplementedYetTestStep something_not_implemented_yet() {
diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/report/model/ReportModelBuilderTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/report/model/ReportModelBuilderTest.java
index 0696a7c154..c4d0e2f164 100644
--- a/jgiven-core/src/test/java/com/tngtech/jgiven/report/model/ReportModelBuilderTest.java
+++ b/jgiven-core/src/test/java/com/tngtech/jgiven/report/model/ReportModelBuilderTest.java
@@ -57,7 +57,7 @@ public void test( int a, int b, int expectedResult ) throws Throwable {
assertThat( case0.getExplicitArguments() ).isEmpty();
assertThat( case0.getSteps() ).hasSize( 3 );
assertThat( case0.getSteps() ).extracting( "failed" ).isEqualTo( asList( false, false, false ) );
- assertThat( case0.getSteps() ).extracting( "notImplementedYet" ).isEqualTo( asList( false, false, false ) );
+ assertThat( case0.getSteps() ).extracting( "pending" ).isEqualTo( asList( false, false, false ) );
assertThat( case0.getSteps() ).extracting( "skipped" ).isEqualTo( asList( false, false, false ) );
StepModel step0 = case0.getSteps().get( 0 );
diff --git a/jgiven-examples/src/test/java/com/tngtech/jgiven/examples/notimplementedyet/NotImplementYetExampleTest.java b/jgiven-examples/src/test/java/com/tngtech/jgiven/examples/notimplementedyet/PendingExampleTest.java
similarity index 57%
rename from jgiven-examples/src/test/java/com/tngtech/jgiven/examples/notimplementedyet/NotImplementYetExampleTest.java
rename to jgiven-examples/src/test/java/com/tngtech/jgiven/examples/notimplementedyet/PendingExampleTest.java
index f035de02ff..f1397c4d8d 100644
--- a/jgiven-examples/src/test/java/com/tngtech/jgiven/examples/notimplementedyet/NotImplementYetExampleTest.java
+++ b/jgiven-examples/src/test/java/com/tngtech/jgiven/examples/notimplementedyet/PendingExampleTest.java
@@ -3,29 +3,29 @@
import org.junit.Test;
import com.tngtech.jgiven.annotation.Description;
-import com.tngtech.jgiven.annotation.NotImplementedYet;
+import com.tngtech.jgiven.annotation.Pending;
import com.tngtech.jgiven.junit.SimpleScenarioTest;
-import com.tngtech.jgiven.tags.FeatureNotImplementedYet;
+import com.tngtech.jgiven.tags.FeaturePending;
@Description( "As a good BDD practitioner,
"
+ "I want to write my scenarios before I start coding
"
+ "In order to discuss them with business stakeholders" )
-public class NotImplementYetExampleTest extends SimpleScenarioTest {
+public class PendingExampleTest extends SimpleScenarioTest {
@Test
- @FeatureNotImplementedYet
- @NotImplementedYet
- public void scenarios_that_are_not_implemented_yet_can_be_annotated_with_the_NotImplementedYet_annotation() {
+ @FeaturePending
+ @Pending
+ public void scenarios_that_are_pending_can_be_annotated_with_the_Pending_annotation() {
given().some_state();
when().some_action();
then().some_result();
}
@Test
- @FeatureNotImplementedYet
- public void single_steps_can_be_annotated_with_NotImplementedYet() {
+ @FeaturePending
+ public void single_steps_can_be_annotated_with_Pending() {
given().some_state();
- when().some_not_implemented_yet_action();
+ when().some_pending_action();
then().some_result();
}
@@ -43,8 +43,8 @@ public TestSteps some_action() {
return this;
}
- @NotImplementedYet
- public TestSteps some_not_implemented_yet_action() {
+ @Pending
+ public TestSteps some_pending_action() {
return this;
}
}
diff --git a/jgiven-html5-report/src/app/css/jgivenreport.css b/jgiven-html5-report/src/app/css/jgivenreport.css
index 93949e7ab1..75763b7b6b 100644
--- a/jgiven-html5-report/src/app/css/jgivenreport.css
+++ b/jgiven-html5-report/src/app/css/jgivenreport.css
@@ -311,7 +311,7 @@ table.steps tr.steps:hover {
color: red;
}
-.SKIPPED, .NOT_IMPLEMENTED_YET {
+.SKIPPED, .PENDING {
color: #aaa !important;
}
diff --git a/jgiven-html5-report/src/app/index.html b/jgiven-html5-report/src/app/index.html
index f514b462b2..069de5c07c 100644
--- a/jgiven-html5-report/src/app/index.html
+++ b/jgiven-html5-report/src/app/index.html
@@ -430,7 +430,7 @@
-
"
+ "In order to discuss them with business stakeholders" )
@Retention( RetentionPolicy.RUNTIME )
-public @interface FeatureNotImplementedYet {
+public @interface FeaturePending {
}
diff --git a/jgiven-tests/src/test/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriterScenarioTest.java b/jgiven-tests/src/test/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriterScenarioTest.java
index abc17d355f..f249840eb8 100644
--- a/jgiven-tests/src/test/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriterScenarioTest.java
+++ b/jgiven-tests/src/test/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriterScenarioTest.java
@@ -25,8 +25,8 @@ public static Object[][] statusTexts() {
{ StepStatus.PASSED, "something happens.*" },
{ StepStatus.FAILED, "something happens failed.*" },
{ StepStatus.SKIPPED, "something happens skipped.*" },
- { StepStatus.NOT_IMPLEMENTED_YET,
- "something happens not implemented yet.*" },
+ { StepStatus.PENDING,
+ "something happens pending.*" },
};
}
@@ -181,10 +181,10 @@ public void the_duration_of_scenarios_are_reported() {
@FeatureTableStepArguments
public void the_static_HTML_report_generator_handles_data_table_arguments() throws IOException {
given().a_report_model()
- .and().a_step_has_a_data_table_with_following_values(asList(
- asList("header1", "header2"),
- asList("value1", "value2"),
- asList("value3", "value4")));
+ .and().a_step_has_a_data_table_with_following_values( asList(
+ asList( "header1", "header2" ),
+ asList( "value1", "value2" ),
+ asList( "value3", "value4" ) ) );
when().the_HTML_report_is_generated();
then().the_HTML_report_contains_pattern( "
.*\n" +
".*.*header1.* | .*.*header2.* | .*
.*\n" +
diff --git a/jgiven-tests/src/test/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriterTest.java b/jgiven-tests/src/test/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriterTest.java
index b62accaad6..e02fa81278 100644
--- a/jgiven-tests/src/test/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriterTest.java
+++ b/jgiven-tests/src/test/java/com/tngtech/jgiven/report/text/PlainTextScenarioWriterTest.java
@@ -28,7 +28,7 @@ public static Object[][] statusTexts() {
{ StepStatus.PASSED, "something happens" },
{ StepStatus.FAILED, "something happens (failed)" },
{ StepStatus.SKIPPED, "something happens (skipped)" },
- { StepStatus.NOT_IMPLEMENTED_YET, "something happens (not implemented yet)" },
+ { StepStatus.PENDING, "something happens (pending)" },
};
}
diff --git a/jgiven-tests/src/test/java/com/tngtech/jgiven/testframework/TestFrameworkExecutionTest.java b/jgiven-tests/src/test/java/com/tngtech/jgiven/testframework/TestFrameworkExecutionTest.java
index 63ef6910fe..e7093f99c3 100644
--- a/jgiven-tests/src/test/java/com/tngtech/jgiven/testframework/TestFrameworkExecutionTest.java
+++ b/jgiven-tests/src/test/java/com/tngtech/jgiven/testframework/TestFrameworkExecutionTest.java
@@ -10,7 +10,7 @@
import com.tngtech.jgiven.GivenScenarioTest;
import com.tngtech.jgiven.JGivenScenarioTest;
import com.tngtech.jgiven.tags.FeatureJUnit;
-import com.tngtech.jgiven.tags.FeatureNotImplementedYet;
+import com.tngtech.jgiven.tags.FeaturePending;
import com.tngtech.jgiven.tags.FeatureTags;
import com.tngtech.jgiven.tags.FeatureTestNg;
import com.tngtech.jgiven.tags.Issue;
@@ -35,7 +35,7 @@ public TestFrameworkExecutionTest( TestFramework testFramework ) {
}
@Test
- @FeatureNotImplementedYet
+ @FeaturePending
public void failing_tests_annotated_with_NotImplementedYet_are_ignored() {
given().a_failing_test()
.and().the_test_is_annotated_with_NotImplementedYet();
@@ -44,7 +44,7 @@ public void failing_tests_annotated_with_NotImplementedYet_are_ignored() {
}
@Test
- @FeatureNotImplementedYet
+ @FeaturePending
public void passing_tests_annotated_with_NotImplementedYet_are_ignored() {
given().a_passing_test()
.and().the_test_is_annotated_with_NotImplementedYet();
@@ -54,7 +54,7 @@ public void passing_tests_annotated_with_NotImplementedYet_are_ignored() {
@Test
@Issue( "#4" )
- @FeatureNotImplementedYet
+ @FeaturePending
public void passing_tests_annotated_with_NotImplementedYet_with_failIfPassed_set_to_true_fail() {
given().a_passing_test()
.and().the_test_is_annotated_with_NotImplementedYet()
@@ -65,7 +65,7 @@ public void passing_tests_annotated_with_NotImplementedYet_with_failIfPassed_set
@Test
@Issue( "#4" )
- @FeatureNotImplementedYet
+ @FeaturePending
public void failing_tests_annotated_with_NotImplementedYet_with_failIfPassed_set_to_true_are_ignored() {
given().a_failing_test()
.and().the_test_is_annotated_with_NotImplementedYet()
@@ -75,7 +75,7 @@ public void failing_tests_annotated_with_NotImplementedYet_with_failIfPassed_set
}
@Test
- @FeatureNotImplementedYet
+ @FeaturePending
public void failing_tests_annotated_with_NotImplementedYet_with_executeSteps_set_to_true_are_ignored() {
given().a_failing_test()
.and().the_test_is_annotated_with_NotImplementedYet()