Skip to content

Commit

Permalink
prepare for v0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rmpestano committed Jun 30, 2015
1 parent f14c84e commit 7c3a012
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cukedoctor-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>cukedoctor</artifactId>
<groupId>com.github.cukedoctor</groupId>
<version>0.2-SNAPSHOT</version>
<version>0.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -41,7 +41,7 @@
<plugin>
<groupId>com.github.cukedoctor</groupId>
<artifactId>cukedoctor-maven-plugin</artifactId>
<version>${project.version}</version>
<version>${parent.version}</version>
<executions>
<execution>
<goals>
Expand Down
2 changes: 1 addition & 1 deletion cukedoctor-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>cukedoctor</artifactId>
<groupId>com.github.cukedoctor</groupId>
<version>0.2-SNAPSHOT</version>
<version>0.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion cukedoctor-reporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.cukedoctor</groupId>
<artifactId>cukedoctor</artifactId>
<version>0.2-SNAPSHOT</version>
<version>0.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.*;

/**
Expand All @@ -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")
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public void shouldRenderAttributes() {
assertEquals(expected,document);
}


@Test
public void shouldRenderAttributesUsingDefaultConfig() {
List<Feature> features = new ArrayList<>();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.cukedoctor</groupId>
<artifactId>cukedoctor</artifactId>
<version>0.2-SNAPSHOT</version>
<version>0.2</version>
<packaging>pom</packaging>

<modules>
Expand Down

0 comments on commit 7c3a012

Please sign in to comment.