java - Jbehave 0 stories run -


i'm new in java , jbehave. wanted try bdd jbehave seems doing wrong - test run step not executed.

pojo class:

public class addition {      public int result;      public void addvalues(int a,int b){         result=a+b;     }      public int getresult(){         return result;     }  } 

steps class:

public class additionstep {      private addition calc;      @given("open calc")     public void opencalc(){         calc=new addition();         system.out.println("opened calc");     }      @when("i add $number1 $number2")     public void addition(@named("number1")int a,@named("number2")int b){         calc.addvalues(a, b);     }      @then("outcome $result")         public void checksum(@named("result")int output){         assert.assertequals(output, calc.getresult());         system.out.println("sum : "+output);     } } 

story runner:

public class additionstory extends junitstories {      @override     public configuration configuration(){         return new mostusefulconfiguration().usestoryloader(new loadfromclasspath(this.getclass())).             usestoryreporterbuilder(new storyreporterbuilder().withdefaultformats().             withformats(format.console,format.txt));     }      @override     public injectablestepsfactory stepsfactory(){         return new instancestepsfactory(configuration(),new additionstep());     }      @override     protected list<string> storypaths() {         return new storyfinder().findpaths(codelocations.codelocationfromclass(this.getclass()),"**/*addition*.story","");     } } 

story file:

scenario: add 2 valid numbers given open calc when add 1 1 outcome 2` 

pom file:

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0"      xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"      xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion>  <groupid>jbehavecalculatortest</groupid> <artifactid>jbehavecalculatortest</artifactid> <version>1.0-snapshot</version>  <properties>     <project.build.sourceencoding>utf-8</project.build.sourceencoding>     <jbehave.core.version>4.1</jbehave.core.version> </properties>  <dependencymanagement>     <dependencies>         <dependency>             <groupid>org.hamcrest</groupid>             <artifactid>hamcrest-library</artifactid>             <version>1.2.1</version>         </dependency>     </dependencies> </dependencymanagement>  <dependencies>     <dependency>         <groupid>org.jbehave</groupid>         <artifactid>jbehave-core</artifactid>         <version>${jbehave.core.version}</version>     </dependency>     <dependency>         <groupid>junit</groupid>         <artifactid>junit</artifactid>         <version>4.8.1</version>         <scope>test</scope>     </dependency>     <dependency>         <groupid>org.slf4j</groupid>         <artifactid>slf4j-simple</artifactid>         <version>1.7.12</version>     </dependency>     <dependency>         <groupid>org.hamcrest</groupid>         <artifactid>hamcrest-all</artifactid>         <version>1.3</version>     </dependency>     <dependency>         <groupid>junit</groupid>         <artifactid>junit</artifactid>         <version>4.12</version>     </dependency>  </dependencies>   <build>     <testresources>         <testresource>             <directory>src/test/java</directory>             <includes>                 <include>**/*.story</include>             </includes>         </testresource>     </testresources>     <plugins>     <plugin>         <groupid>org.jbehave</groupid>         <artifactid>jbehave-maven-plugin</artifactid>         <version>${jbehave.core.version}</version>         <executions>             <execution>                 <id>run-stories</id>                 <phase>test</phase>                 <configuration>                     <!--<scope>test</scope>-->                     <includes>                         <include>**/stories/*.java</include>                     </includes>                 </configuration>                 <goals>                     <goal>run-stories-as-embeddables</goal>                 </goals>             </execution>         </executions>     </plugin>     </plugins> </build> </project> 

my story file placed in src/test/java/stories/...

output:

processing system properties {} using controls embeddercontrols[batch=false,skip=false,generateviewafterstories=true,ignorefailureinstories=false,ignorefailureinview=false,verbosefailures=false,verbosefiltering=false,storytimeouts=300,threads=1,failonstorytimeout=false]

(beforestories)

(afterstories)

generating reports view 'd:\knowledgecentre\workspace\jbehavecalculatortest\target\jbehave' using formats '[stats, console, txt]' , view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, nondecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}' reports view generated 0 stories (of 0 pending) containing 0 scenarios (of 0 pending) disconnected target vm, address: '127.0.0.1:49908', transport: 'socket'

process finished exit code 0


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -