LapisLazuli provides extra functionality for your cucumber test suites. The library is structured in the following way:
- It provides extensions to the cucumber World object - the object that provides all the methods you can use in your step definitions. These extensions are implemented in
- It provides an enhanced version of the watir browser. Extensions to the browser are implemented in
LapisLazuli module itself includes all
WorldModule functionality provided by the library. To use all the extensions at once, simply do the following:
# features/support/env.rb require 'lapis_lazuli' World(LapisLazuli)
However, you don't need to drink from the firehose, and can instead pick and choose which extensions to use:
# features/support/env.rb require 'lapis_lazuli/world/annotate' World(LapisLazuli::WorldModule::Annotate)
There's one caveat: the most useful `WorldModule` is the `Browser` module, which handles creating and destroying an enhanced watir browser instance for you. To do so, this module includes quite a few other
WorldModules. In fact, it's not the only module that does so. In many cases, then, simply including all of LapisLazuli is going to be the easiest.
Lapis Lazuli library consist of a module called LapisLazuli and its main class LapisLazuli. The class is a singleton, which means that any reference to LL will be the same instance with links to the same browser window.
In order to get the full power of LapisLazuli, you will most likely want to automatically add the hooks from the WorldModule:Hooks module. You can do this by also requiring the
# features/support/env.rb require 'lapis_lazuli' require 'lapis_lazuli/cucumber' World(LapisLazuli)
Interactive usage of LapisLazuli in
irb is just as easily possible:
require 'lapis_lazuli' include LapisLazuli browser.goto "http://www.spritecloud.com"
Which results in:
$ irb irb(main):001:0> require 'lapis_lazuli' => true irb(main):002:0> include LapisLazuli => Object irb(main):003:0> browser.goto "http://www.spritecloud.com" => "http://www.spritecloud.com/"
In many cases you will be starting out with a new test automation suite. LapisLazuli helps you with that, by creating one from a template included in the library:
$ lapis_lazuli create <projectpath>
A skeleton test suite with LapisLazuli loaded will be created at the given project path. You can use
create - or it's alias
update - to keep the test suite up-to-date when you upgrade to a new version of LapisLazuli, too.
Because of the structure of the library, the wiki documentation is structured by