05.01 - Repositories

The Repositories, as stated in the previous sections, give you access to your test data from your script using the LOAD instruction. The present subsection will teach you how to configure and use them.

IMPORTANT: By default you can always access the Resources in your 'resources' directory (a default Repository pointing to that directory always exists). So if all you need is this unique directory you don't need to declare any Repository.

Classpath

Category-name: classpath

What: Retrieves files present in the classpath of Squash TA and is helpful to load Resources embedded in other TA plugins. If you don't know what it means, then you probably don't need it.

Configuration: A simple .properties file dropped in the 'repositories' directory of your test project. It must contain EXACTLY : 'squashtest.ta.classpath', with any values you like (it doesn't matter). Any other properties present in this file will disqualify it.

Example : valid configuration file

squashtest.ta.classpath=whatever

URL

Category-name: url

What: A generic repository for files (and ONLY FILES) accessible using an URL. An ideal choice for http or file-system based repositories. Technical note: the supported protocols depends on the protocol handlers available in the jvm at runtime, so adding your own handlers will naturally increase the range of addresses accessible from Squash TA. (For more informations see Java Documentation Here)

Configuration: A simple .properties file dropped in the 'repositories' directory of your test project. The file must contain AT LEAST 'squashtest.ta.url.base'. Available properties are :

    • squashtest.ta.url.base: The base url representing your repository.

    • squashtest.ta.url.useCache: Whether to use a cache, to speed up future references to recurrent resources

    • squashtest.ta.url.login: Specifies a username for http authentication (special, see below)

    • squashtest.ta.url.password: Specifies the password for the username above (special, see below)

HTTP Authentication: The login and password options above only hold for http authentication (protocols listed here). It may also fail if the http server implements a custom protocol.

Note: You can also use the URL repository as a cheap replacement for the FTP repository. You must then format the url with respect to the standard: ftp://user:password@host:port/path/to/basedir. In that case the login and password properties are useless (since they're inlined in the url itself).

Example : valid configuration file, pointing to a file .txt

# note that the space in 'Program Files' is url encoded.

squashtest.ta.url.base = file:///C:/Program%20Files/fileTest.txt

squashtest.ta.ftp.useCache = false