Windmill has to provide a few different ways to run. Windmill tries to provide some environments that make debugging easier depending on what your regular test authoring and debugging style is.
Command Line Utility
First, let’s look at the windmill command line usage output.
The Available Actions denote that available environments windmill can start up.
The ’’shell’’ environment will start windmill and drop in to a python shell. The shell has various objects and functions in the local scope to help you with debugging and running tests.
The ’’run_service’’ environment just runs windmill in the foreground until it gets a proper signal to end. This is good for continuous integration and for someone who wishes to just run tests without the need for debugging.
The ’’wx’’ environment will launch our experimental wxPython UI for the service. This UI is still under heavy development and have some limitations and rough edges. We hope in the future to make this the default environment for windmill.
Browsers and URLs
The windmill binary can take an argument for the browser you would like to launch on startup. Although the shell has specific commands for launching the browser it’s a matter of necessity that this be available as a command line option to the other actions, and a matter of convenience when starting the shell.
Windmill also takes the URL for the web page you would like to begin testing. Although windmill starts without this option you may find that you can run things much smoother if you include it. More on this in CrossDomainTesting (TBD).
windmill firefox http://www.example.com
The Shell Environment
Ok, let’s start the windmill shell.
windmill shell http://www.example.com
- A quick divergence to talk about ipython.
- If you are new to python it is strongly suggested that you install and use ipython. ipython has lot’s of handy object introspection and command history features that will make your life easier. We’ve tried to make it as easy as possibly for anyone to use and debug in windmill and we don’t think that you need to know python to use the shell environment and ipython makes this much easier.
- If you have ipython installed windmill will use that as it’s shell environment rather than the regular python shell available in the ’’code’’ module. If you have ipython installed but you want to use the regular python shell instead you can give windmill the ’’usecode’’ option.
- Pre-compiled binaries should ship with ipython.
- The rest of this section will assume you are using ipython.
Back to using the shell environment.
After starting the shell environment you’ll notice an interesting prompt.
From here you can use any of the ’’objects’’ that windmill automatically gives you in the shell. You can see a list of these objects by typing dir() in the shell.
[ ... 'clear_queue', 'frame', 'help', 'httpd', 'httpd_thread', 'jsonrpc_client', 'load_test', 'logger', 'logging', 'os', 'run_test', 'show_queue', 'sleep', 'start_firefox', 'start_ie', 'start_safari', 'sys', 'windmill', 'xmlrpc_client']
Most of these objects are just functions that you can call. If you want to find out more about a specific object just type ? at the end and ipython will inspect the object and tell you more about it.
In : start_firefox? Type: function Base Class: <type 'function'> String Form: <function start_firefox at 0x172ed30> Namespace: Interactive File: /Users/mikeal/Documents/projects/windmill/trunk/windmill/bin/shell_objects.py Definition: start_firefox() Docstring: Start the Firefox web browser configured for windmill Class Docstring: function(code, globals[, name[, argdefs[, closure]]]) Create a function object from a code object and a dictionary. The optional name string overrides the name from the code object. The optional argdefs tuple specifies the default argument values. The optional closure tuple supplies the bindings for free variables. Constructor Docstring: x.__init__(...) initializes x; see x.__class__.__doc__ for signature Callable: Yes Call def: Calling definition not available.Call docstring: x.__call__(...) <h2. > x(...)
If you want to use this function and start the firefox browser;
In : start_firefox()