Skip to content

Running the first test

claudiob edited this page Dec 23, 2010 · 6 revisions

Pyccuracy Console

The pyccuracy_console app is provided as means of executing Pyccuracy files (.acc). It is just a regular Python App (pyccuracy_console.py) and thus can be run like other python apps. The only difference is that it takes command-line arguments in the form of:

$ python /path/to/pyccuracy_console.py [options]

If you have followed the installation guide (the “Using directly the source” section), you will notice that we create a symbolic link in a folder that’s part of the PATH, and we also omit the “.py” extension. If you install through PyPI or Debian packages we do that for you automatically. We do that to make pyccuracy_console behave just like any other regular Unix command line tool:

$ pyccuracy_console [options]

If no options are specified it gets executed with the defaults and runs all the tests in the current folder. You can learn more about the defaults in each of the accepted arguments by using the “—help” option:

$ pyccuracy_console --help

Command line options

Like many other Unix command line applications, pyccuracy_console options can be specified in two forms:

$ pyccuracy_console -<short_option_name> <value>
$ pyccuracy_console --<long_option_name>=<value>

Both forms specify exactly the same configuration. Choose the one you’re more comfortable with.

Some of the most used arguments

1) -d or —dir

This is the tests root directory. Defines where the tests to be executed are.
Note: The test execution is recursive, so all the tests under the specified directory (even in sub-directories) get executed.
Default: Defaults to the current shell directory.

Example:

$ pyccuracy_console -d /path/to/tests
$ pyccuracy_console --dir=/path/to/tests

2) -p or —pattern

Test File naming pattern. Defines which tests will get executed.
Note: This parameter can use wildcards supported by the OS.
Default: Defaults to “*.acc”.

Examples:

# this will only execute the "some_test.acc" test
$ pyccuracy_console -p some_test.acc
$ pyccuracy_console --pattern=some_test.acc
# runs tests with other extension
$ pyccuracy_console -p *.login_acc
# run "*.acc" without running "*.DONT_RUN.acc"
$ pyccuracy_console -p *[!DONT_RUN].acc

3) -u or —url
Description

This is the website being tested base URL. When the user navigates to a given page (e.g. “/home”) that page will be joined with this url (e.g. “http://pyccuracy.org/home”).
Note: This parameter can be specified with a physical url (/some/path/to/html) or a web url (http://pyccuracy.org).
Default: Defaults to None.

Example:

$ pyccuracy_console -u http://www.mysite.com
$ pyccuracy_console --url=http://www.mysite.com

This means that if some user navigates to “some_page.htm” Pyccuracy will actually navigate to “http://www.mysite.com/some_page.htm”.

4) Other parameters

To learn about the other parameters and default values, type:

$ pyccuracy_console --help

Run it!

Now that you understood how pyccuracy_console works, follow the quick start guide to quickly learn how to run your tests.