Saturday, 23 November 2013

Sample Spring TTD BDD :: Revisiting

Planning to revisit my old blog.

Going to explain Step by Step

> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.geethsangam.music -DartifactId=Geethsangam


I am going to use eclipse

>  mvn eclipse:eclipse


You can change the pom.xml


<packaging>jar</packaging> to <packaging>pom</packaging>

This is going to be the parent pom for us

You can create the mvn module from the command prompt or from eclipse

From terminal


>cd Geethsangam

> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.geethsangam.music -DartifactId=geethsangam-core


From Eclipse 


File > New > Maven > Maven module 

or

Right click on the project 

Maven > New Maven Module Project



Adding cucumber-jvm to projects

Add these 2 dependencies in the pom.xml

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.1.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.1.2</version>
        <scope>test</scope>

    </dependency>

Create Folders for cucumber BDD test


> cd Geethsangam

> mkdir cucumber

> cd cucumber

> mkdir features

 encies in the pom.xml

In the cucumber folder create test acceptance folder.

> mkdir test

Then Add the following class

import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty""html:target/cucumber-html-report""json-pretty:target/cucumber-json-report.json"}, tags = "~@wip")
public class RunCukesTest {
}