Introducing Yeti: The YUI Easy Testing Interface

By Reid BurkeAugust 25th, 2010

Welcome to Yeti

Testing JavaScript is an important but often overlooked part of web development. One reason is because developing for the web means targeting more than one browser. YUI currently classifies 11 different environments that enjoy our highest support level. In addition, we also test YUI on emerging X-grade environments like mobile devices. When you have so many different environments to support, it’s tempting to just pick a couple important ones to develop with locally and hope for the best.

At YUI, we use Selenium and Hudson for running YUI Test-based unit tests on various browser and operating system configurations as part of our continuous integration strategy. This is great for catching problems that result from integrating your work with the rest of a complex software stack. It comes with a price: CI tools like these are complicated to setup and maintain. In any case, they don’t help you while you’re developing code and testing before you commit.

Today, I’m excited to release Yeti 0.1.0, an experimental command-line tool designed to make cross-browser testing easier before you commit a line of code.

Yeti automatically launches JavaScript unit tests in a browser and reports the results without leaving your terminal. It’s very simple to use: Just run yeti test.html to get the results of the YUI Test-based test in test.html. You can pass multiple HTML documents to test multiple components at once.

$ yeti dom/tests/dom.html attribute/tests/attribute.html json/tests/json.html 
✔  DOM Tests from Safari (Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16)
  20 passed
  0 failed

✔  Y.JSON (JavaScript implementation) from Safari (Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16)
  68 passed
  0 failed

✔  Attribute Unit Tests from Safari (Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16)
  106 passed
  0 failed

194 tests passed! (3217ms)

The real power of Yeti is running tests in multiple browsers simultaneously. Although Yeti can open your tests one-by-one on your computer, Yeti allows you to run tests on any browser on any device—all at the same time.

If you run Yeti without arguments, it will start a web server that you can access at http://localhost:8000. You can then point browsers or devices on your network to that URL and every test you run from that point will be executed on all browsers visiting the test page.

Multiple browsers with Yeti

When combined with the excellent localtunnel, firewalls between you and other computers are less painful. If you’re not working with sensitive information, it’s a simple way to make your Yeti available to the internet:

$ localtunnel 8000
   Port 8000 is now publicly accessible from http://example.localtunnel.com

You can then visit that URL to access Yeti and start running tests:

Yeti on iOS 4 Safari

This is especially useful for cellular devices: You can use your carrier’s internet connection without needing to get your device on the same network as your development computer.

Yeti aims to make JavaScript testing easier; however, it’s far from being complete. (Don’t take the 0.1.0 version number lightly.) Yeti assumes you’re using YUI Test, has only been tested on Mac OS X, and may not work with some kinds of testing scenarios. Despite these shortcomings, Yeti has been so useful internally that we didn’t want to wait any longer to share it with the YUI community.

Getting the code

Yeti is available on GitHub and offered under YUI’s BSD license.

Installing

Yeti is written entirely in JavaScript and runs on top of NodeJS. If you’re already a NodeJS and npm user, installing is very simple:

$ npm install yeti@stable

If you haven’t installed NodeJS and npm and you’re on a recent Mac, you can still install Yeti with a convenient installer.

Yeti Icon Download the Yeti 0.1.0 Installer 2.7 MB
Requires Mac OS X 10.6 and a Intel Core 2 processor or better

If your computer doesn’t meet the installer’s requirements, you can still use Yeti if you’re able to install npm. More installation and usage instructions are available in Yeti’s README.

Your participation is welcome

Yeti is the first project we’ve launched in YUI Labs, an umbrella category where our new ideas and initiatives will take shape. As such, Yeti is offered without the same level of support as our other projects. We still encourage you to ask questions and give feedback in Yeti’s forums and hope Yeti makes testing easy and fun. If it doesn’t, please tell us, file a bug or consider contributing to Yeti.

Happy testing!

About the Author: Reid Burke (@reid) is the newest member of the YUI team. He loves abominable snow monsters and JavaScript.

16 Comments

  1. Gilles Devaux said:
    August 25, 2010 at 3:48 pm

    Congrat’s Reid

  2. Interesting looking tool. At first glance it looks similar to jstestdriver, which already supports running tests with yui test. Want to share the motivation for rolling your own?

  3. [...] via Intro­duc­ing Yeti: The YUI Easy Test­ing Inter­face » Yahoo! User Inter­face Blog (YUIBlog). [...]

  4. Yeti: das YUI Easy Testing Interface…

    Gestern gab es eine gute Nachricht im YUIblog, denn es wurde über die Veröffentlichung vom YUI Easy Testing Interface gebloggt. Das gute daran ist, dass es nun ein Testinterface für JavaScript und alle möglichen Anwendungsgebiete gibt. Die meisten Tool…

  5. Hi,

    Very interesting, waiting for windows version. As developers out are mostly work on Windows, it would be very useful once we have windows version.

    Regards,
    L. Ravi Kiran

  6. Christian,

    Thanks! I’d love to share our motivation.

    Yeti began as an internal helper tool for testing YUI 3.2.0 PR1 on mobile devices and different virtual machines. Yeti was designed to just work: no configuration, no setup—just run existing tests and run them fast. Nearly all of our tests (and our example code for YUI Test) are full HTML documents, which doesn’t fit in well with JSTestDriver’s pure JS test strategy.

    JSTestDriver is more mature, focuses on pure JS, and integrates with CI tools. Yeti is new, only supports YUI Test, but just works with existing tests. We hope other YUI Test users will find it useful right away.

    Reid

  7. [...] control in order to kick it off. Reid Burke, the newest member of the YUI team has just built a solution to that quandary. Yeti is a command-line tool that fires up a NodeJS server that serves up the page with your tests [...]

  8. Great stuff, can’t wait to try it out :)

  9. @Reid: Thanks, that makes sense :) Looking forward to keeping an eye on he project going forward

  10. [...] Yeti, YUI for Node.js, and more: The team continues to push the envelope with projects aimed at the most promising frontiers in frontend engineering. Reid Burke’s Yeti was just launched, allowing command-line cross-browser testing for anyone using YUI Test. Dav Glass’s work to make YUI 3 work seamlessly with NodeJS has been documented on the blog and will be an official YUI offering soon. And there’s more to come. [...]

  11. Just so you know…

    YETI is also a tool for random testing that stands for York Extensible Testing Infrastructure mainly developed at University of York, UK and was announced over a year ago (there are 2-3 research papers published around it already).

    It is in BSD license at http://www.yetitest.org and can test Java, JML, .NET, C, and command-line programs…

  12. [...] 118. Introducing Yeti: The YUI Easy Testing Interface [...]

  13. [...] new to a lot of things that YETI requires to run, and I’ve made it through most of the steps to get it to work. I have [...]

  14. [...] Yeti – This is the framework introduced by Yahoo for automating browser tests. Yeti uses server-side JavaScript and depends on Node.js. Learn more about Yeti at http://www.yuiblog.com/blog/2010/08/25/introducing-yeti-the-yui-easy-testing-interface/ [...]

  15. Interesting project! There are a couple of items that deserve clarification, though:

    1) By mentioning Selenium in the same sentence as Hudson (now called Jenkins, BTW), it sounds like you’re implying that Selenium is a CI tool — it’s actually a browser automation framework.

    2) Similarly, it’s not true that Selenium can’t help you *before* you check in. It’s perfectly reasonable to drive your app development with browser-automation tests written with Selenium.

    I’d agree with you that Selenium essentially requires you to
    set up your complete software stack to test — and as a result, the tests are fairly slow to execute. There’s probably a happy medium between using JS unit tests in a tool like Yeti for quick feedback and full-stack automated tests using Selenium for greater developer confidence when it comes to preventing regressions.