Skip to content

exceedhl/petstore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project borrows mathibodeau's petstore project and use it as a base for cuke4duke showcase.

How to run this demo
~~~~~~~~~~~~~~~~~~~~

Prepare the db
==============

* run `mvn db-migration:migrate -Denv=dev` to create the db with schemas.
* run `mvn sql:execute` to insert some test data.

Launch the app
==============

* run `mvn jetty:run` to start the web server, then you can see the app running at `http://localhost:8080/petstore`.

Run cucumber tests
==================

* run `mvn integration-test` to execute all cucumber tests


How to use cuke4duke in your own project
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Before you can use cuke4duke you have to prepare your environment. Here are the steps:

Install JRuby
=============

On Mac
------

You can use mac ports to install JRuby, then use jruby gem to install the cuke4duke gem into `YOUR_MAVEN_REPO/.jruby`.

For example, in the console, type: `GEM_HOME=~/.m2/repository/.jruby GEM_PATH=~/.m2/repository/.jruby jruby -S gem install cuke4duke`

On Windows
----------

JRuby has a windows installer so you just need to download it and double click it. You need to add jruby bin directory to your path env variable.

On windows you can create two environment variables `GEM_HOME` and `GEM_PATH`, then in the cmd type:

`jruby -S gem install cuke4duke`

If you are behind a http proxy, you can set you proxy by creating three env variables: `HTTP_PROXY`, `HTTP_PROXY_USER`, `HTTP_PROXY_PASS`. (see `jruby -S gem help env`)

Prepare your POM
================

You need to prepare your POM to include these declarations just as I did in this demo project:

* add repositories to codehaus and cuke4duke, these two will be used to download cuke4duke and jruby dependencies from.
* add dependency to cuke4duke.
* add cuke4duke plugin, and add a pluginRepository to cuke4duke.
* create features directory under the project root dir.

Then you should be ready to go. `mvn cuke4duke:cucumber` will not compile test java files, you have to compile them first(`mvn compiler:testCompile`) or bind this goal to some phase such as integration-test phase.

Troubleshooting
==============

* you can also use the cuke4duke maven plugin to automatically install jruby and gems, just use
    `mvn cuke4duke:cucumber -Dcucumber.installGems=true`

* there is a intellij idea plugin for cucumber, though very limited.
* on windows if you want to see the colored output in the console, you need [wac](https://github.com/aslakhellesoy/wac).
* if you want to run only part of the existing features, you can use `features` parameter of cuke4duke plugin:

   `mvn cuke4duke:cucumber -Dcucumber.features="features\call_step.feature features\second.feature"`

  The default value of this parameter is "features", mean all features under the "features" dir.

About

use cuke4duke, selenium to test a petstore web application

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%