blog

Let's talk about testing

Announcing LapisLazuli

We’re thrilled to announce the public release of LapisLazuli.

The Open Source project is the fruit of our years of experience with automated testing of web applications and APIs. When we provide automated testing, we use other Open Source tools like cucumber, Watir and Selenium. LapisLazuli adds functionality on top of those projects for test suites that are less fragile and more maintainable.

Motivation

When you’re writing a test suite for your own software project, it’s very likely that the tests and software will evolve alongside each other. As the project grows, you’ll add more and more functionality to the test suite, because you don’t want to repeat yourself.

Now picture writing and maintaining not one, but many test suites. You’ve added a nifty piece of helper code to one test suite that solves a pesky little problem. A few days later you are working on another test suite, and run into a similar problem. What do you do?

Essentially, you’re running into a release management issue here, except not for the software you want to test, but for the test suite itself. Instead of wildly copying & pasting code, you start building a library of utility functions… that is how LapisLazuli started.

But you don’t have to write test automation code for a living to benefit from LapisLazuli. It simplifies things you would also run into in a single project.

Open Source

We want to give back to the FOSS community. And we don’t want to charge our customers for solving problems again that we already solved elsewhere. That made it an easy choice to publish LapisLazuli under the MIT +no-false-attribs License.

We hope you like it!

Example

In lieu of a full user guide, here’s a few lines of ruby code to give you some idea of the help LapisLazuli provides:

$ BROWSER=firefox irb
irb(main):001:0> require 'lapis_lazuli'
=> true
irb(main):002:0> include LapisLazuli
=> Object
irb(main):003:0> browser.goto "http://spritecloud.com"
Could not load configuration from: config/config.yml
=> "http://www.spritecloud.com/"
irb(main):004:0> browser.take_screenshot
A, [2015-03-30T16:58:36.081356 #25370]   ANY
    -- : Logging to #<IO:0x007fbdb09321d0> initialized with level
    INFO.
D, [2015-03-30T16:58:36.081552 #25370] DEBUG
    -- #<IO:0x007fbdb09321d0>: Screenshot saved:
    ./screenshots/150330_165834_screenshot.png
=> "./screenshots/150330_165834_screenshot.png"

In this example, you can observe the following features:

  1. Selecting a browser to run tests in can be as easy as setting the BROWSER environment variable.
  2. To avoid poisoning the global namespace, explicitly include the LapisLazuli module.
  3. The module provides a browser object that creates a Firefox window all by itself. The goto method is from Watir.
  4. LapisLazuli tries to load a configuration file, by default from config/config.yml — with that, you can customize much of the library’s behaviour.
  5. There’s a built-in logger using our own teelogger gem for easier post-mortem debugging.
  6. In contrast to stock Watir, screenshots are automatically named. In interactive ruby, the name is not particularly exciting — but called from within cucumber, screenshots are named after the scenario from which they’re generated.

Yep, that’s 6 features in 4 lines. And from within cucumber, a lot more stuff happens than in interactive ruby.

Further Reading

The LapisLazuli project is documented on the github Wiki.


Comments are closed.

Reputation. Meet spriteCloud

Find out today why startups, SMBs, enterprises, brands, digital agencies, e-commerce, and mobile clients turn to spriteCloud to help improve their customer experiences. And their reputation. With complete range of QA services, we provide a full service that includes test planning, functional testing, test automation, performance testing, consultancy, mobile testing, and security testing. We even have a test lab — open to all our clients to use — with a full range of devices and platforms.

Discover how our process can boost your reputation.