How FuncUnit works
FuncUnit is a mashup of a bunch of awesome JavaScript projects. It can be useful knowing how they all work together to make FuncUnit tick. This article details the components and how they fit together. This is a primer for anyone wanting to contribute to FuncUnit.
FuncUnit is is comprised of the following parts:
- Selenium - Provides browser automation
- QUnit - A browser-based testing an assertion API.
- jQuery - Used for CSS selector and DOM utilities.
- EnvJS - A simulated browser environment.
- Syn - A synthetic event library.
FuncUnit supports 2 modes: Browser and Selenium mode.
Browser Mode
Browser mode is when you open up your browser to a funcunit html page. This page includes the funcunit script which has inside it QUnit, jQuery, Syn and the FuncUnit API.
When you use FuncUnit (or S), it basically sends those commands to a popup window. This is pretty straightforward.
Selenium Mode
Selenium mode is used when you use envjs to open the funcunit html page. Here, EnvJS reads the html page and then loads and runs any script tags it finds (just like a normal browser). But instead of sending commands to a popup window, funcunit.js starts selenium, serializes those commands, and send them to a custom Selenium server build. The selenium server has jQuery and Syn and will run the commands the same way browser mode ran the commands. Selenium server will return the results to FuncUnit which reports them to the console.
The Secret
Now that you know the secret to FuncUnit's awesomeness - how you are able to write a test with just a browser and funcunit.js, but automatically run it - please help us make this project even better. Here are some things we want to work on:
- An in-browser Selenium like IDE.
- Cucumber-like API.
- Plugins for testing Flash / Silverlight integration.
Related Content
About Jupiter
Jupiter is dedicated to making JavaScript an easy and enjoyable place to develop kick ass apps. We open-source everything and provide expert web application development, support, and training.
Recent Posts
- Significant Whitespace
- 3.2 $.Controller - Templated Event Binding
- Deferreds and 3.1
- jQuery Resize Event
- FuncUnit Humor
- Having your Cake and Eating it without Getting Fat
- Why You Should Never Use jQuery Live
- Knock JavaScriptMVC's Back Out
- Advanced jQuery Training at SF jQuery Conf 2011
- JavaScriptMVC and List Performance
JavaScript development, design, and consulting.