From 7c3a0128e4057f2af7d5741b73ba9076f2052da4 Mon Sep 17 00:00:00 2001 From: rmpestano Date: Mon, 29 Jun 2015 23:36:08 -0300 Subject: [PATCH] prepare for v0.2 --- cukedoctor-main/pom.xml | 4 +- cukedoctor-maven-plugin/pom.xml | 2 +- cukedoctor-reporter/pom.xml | 2 +- .../github/cukedoctor/api/model/Feature.java | 3 +- .../cukedoctor/api/model/FeatureTest.java | 40 +++++++++++++++++-- .../reporter/CukedoctorReporterTest.java | 1 + pom.xml | 2 +- 7 files changed, 43 insertions(+), 11 deletions(-) diff --git a/cukedoctor-main/pom.xml b/cukedoctor-main/pom.xml index b0e2e03a..1a61dac2 100644 --- a/cukedoctor-main/pom.xml +++ b/cukedoctor-main/pom.xml @@ -7,7 +7,7 @@ cukedoctor com.github.cukedoctor - 0.2-SNAPSHOT + 0.2 ../pom.xml @@ -41,7 +41,7 @@ com.github.cukedoctor cukedoctor-maven-plugin - ${project.version} + ${parent.version} diff --git a/cukedoctor-maven-plugin/pom.xml b/cukedoctor-maven-plugin/pom.xml index 10cb64e3..13447e2f 100644 --- a/cukedoctor-maven-plugin/pom.xml +++ b/cukedoctor-maven-plugin/pom.xml @@ -7,7 +7,7 @@ cukedoctor com.github.cukedoctor - 0.2-SNAPSHOT + 0.2 ../pom.xml diff --git a/cukedoctor-reporter/pom.xml b/cukedoctor-reporter/pom.xml index 05f16342..428d6cb5 100644 --- a/cukedoctor-reporter/pom.xml +++ b/cukedoctor-reporter/pom.xml @@ -6,7 +6,7 @@ com.github.cukedoctor cukedoctor - 0.2-SNAPSHOT + 0.2 ../pom.xml diff --git a/cukedoctor-reporter/src/main/java/com/github/cukedoctor/api/model/Feature.java b/cukedoctor-reporter/src/main/java/com/github/cukedoctor/api/model/Feature.java index 39f4cb01..91f79f98 100755 --- a/cukedoctor-reporter/src/main/java/com/github/cukedoctor/api/model/Feature.java +++ b/cukedoctor-reporter/src/main/java/com/github/cukedoctor/api/model/Feature.java @@ -227,13 +227,12 @@ public boolean equals(Object o) { Feature feature = (Feature) o; - if (!name.equals(feature.name)) return false; return !(id != null ? !id.equals(feature.id) : feature.id != null); } @Override public int hashCode() { - return id.hashCode(); + return name != null ? name.hashCode():42; } } diff --git a/cukedoctor-reporter/src/test/java/com/github/cukedoctor/api/model/FeatureTest.java b/cukedoctor-reporter/src/test/java/com/github/cukedoctor/api/model/FeatureTest.java index 17f72bb3..30c72162 100644 --- a/cukedoctor-reporter/src/test/java/com/github/cukedoctor/api/model/FeatureTest.java +++ b/cukedoctor-reporter/src/test/java/com/github/cukedoctor/api/model/FeatureTest.java @@ -1,5 +1,6 @@ package com.github.cukedoctor.api.model; +import com.github.cukedoctor.Cukedoctor; import com.github.cukedoctor.util.builder.FeatureBuilder; import com.github.cukedoctor.util.builder.ScenarioBuilder; import com.github.cukedoctor.util.builder.StepBuilder; @@ -8,6 +9,9 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import java.util.ArrayList; +import java.util.List; + import static org.assertj.core.api.Assertions.*; /** @@ -32,6 +36,12 @@ public void fixture() { Step step3 = StepBuilder.instance().match(new Match("/match2")) .name("my step 3").result(result).build(); + Step stepMissing = StepBuilder.instance().match(new Match("/match3")) + .name("step missing").result(new Result(Status.missing)).build(); + + Step stepPending = StepBuilder.instance().match(new Match("/match4")) + .name("step pending").result(new Result(Status.pending)).build(); + Scenario passingScenario = ScenarioBuilder.instance().name("scenario 1") .type(Type.scenario).description("scenario desc") @@ -41,23 +51,45 @@ public void fixture() { .type(Type.scenario).keyword("keyword") .step(step1).step(step2).step(step3).step(step3).build(); + Scenario missingScenario = ScenarioBuilder.instance().name("scenario 3") + .type(Type.scenario).keyword("keyword") + .step(stepMissing).build(); + + Scenario pendingScenario = ScenarioBuilder.instance().name("scenario 4") + .type(Type.scenario).keyword("keyword") + .step(stepPending).build(); + + feature = FeatureBuilder.instance().id("id").name("feature").keyword("keyword"). uri("uri").description("feature description"). - scenario(passingScenario).scenario(failingScenario).build(); + scenario(passingScenario).scenario(failingScenario). + scenario(missingScenario).scenario(pendingScenario). + build(); } @Test public void shouldProcessSteps() { feature.processSteps(); - assertThat(feature.getNumberOfScenarios()).isEqualTo(2); - assertThat(feature.getNumberOfSteps()).isEqualTo(5); //2 steps in scenario 1 and 3 in scenario 2 + assertThat(feature.getNumberOfScenarios()).isEqualTo(4); + assertThat(feature.getNumberOfSteps()).isEqualTo(7); //2 steps in scenario 1 and 3 in scenario 2 assertThat(feature.getStatus()).isEqualTo(Status.failed); assertThat(feature.getStepResults().getTotalDuration()).isEqualTo(5000000L); assertThat(feature.getDurationOfSteps()).isEqualTo("005ms"); assertThat(feature.getNumberOfFailures()).isEqualTo(1); //1 in scenario 2 assertThat(feature.getNumberOfPasses()).isEqualTo(4);//2 passes in each scenario - assertThat(feature.getNumberOfPending()).isEqualTo(0); + assertThat(feature.getNumberOfPending()).isEqualTo(1); assertThat(feature.getNumberOfSkipped()).isEqualTo(0); + assertThat(feature.getNumberOfMissing()).isEqualTo(1); + assertThat(feature.getNumberOfUndefined()).isEqualTo(0); + assertThat(feature.getNumberOfScenariosPassed()).isEqualTo(1); + assertThat(feature.getNumberOfScenariosFailed()).isEqualTo(3); + } + + @Test + public void shouldNotProcessStepsForInvalidFeature(){ + Feature invalidFeature = new Feature(); + invalidFeature.setName("name"); + invalidFeature.processSteps(); } } diff --git a/cukedoctor-reporter/src/test/java/com/github/cukedoctor/reporter/CukedoctorReporterTest.java b/cukedoctor-reporter/src/test/java/com/github/cukedoctor/reporter/CukedoctorReporterTest.java index bac82042..037f81c0 100644 --- a/cukedoctor-reporter/src/test/java/com/github/cukedoctor/reporter/CukedoctorReporterTest.java +++ b/cukedoctor-reporter/src/test/java/com/github/cukedoctor/reporter/CukedoctorReporterTest.java @@ -106,6 +106,7 @@ public void shouldRenderAttributes() { assertEquals(expected,document); } + @Test public void shouldRenderAttributesUsingDefaultConfig() { List features = new ArrayList<>(); diff --git a/pom.xml b/pom.xml index 26850087..c7d62170 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.cukedoctor cukedoctor - 0.2-SNAPSHOT + 0.2 pom