Users

From Autodrive
Jump to: navigation, search

Userguide

This is the userguide descriping how to setup and run the autodriver. After reading this chapter you be able to understand the environment for the autodriver, create new automation projects, execute existing projects, and to look at the generated output especially the html report.

Java version

Due to a bug in older versions of java when binding ports below 1024, JDK 1.7 should be used. To test which java version you got type:

java -version

Please note that you might want to update the policy files in your java installation in order to be able to benefit from strong encryption. This is due to US export restriction.

Ant

For optimal use ant version 1.8.3 should be used. Ant is only a mean to provide an easy way to setup the execution environment. The driver could very well be started in other ways too. To test if ant is setup properly, type

ant -p

Either it complains about a missing build.xml or it will show which ant targets are available. All other results suggest a bad installation.

To provide system properties used in ant scripts set ANT_OPTS accordingly.

Directory structure

It is recommended to use a directory structure enforcing separation of the driver and the scripts that need to run. This can be accomplished by the following structure:

  • Automation
    • Driver
    • Scripts

Driver contains the release of the autodriver project and the Scripts folder can be used as home for different automation projects. The autodriver has a selftest which is placed exactly under Scripts/AutoDriver. Please refer to the Developers section to compile and fetch binary dependencies.

Running ant -p should give a similar result as this:

 ant -p
Buildfile: build.xml

    This local build file is used for each project in order to be able to support the different test types
    a project is sujected to.

    Autodriver suite without any system properties other than scriptdir and script set.

Main targets:

 all               Execute all main test suites
 clean             clean up
 cmd               Command suite
 cookie            Cookie suite
 error             Error suite
 experimental      Experimental suite
 init              Execute all suites
 interrupt         Interrupt suite
 localdns          localdns suite
 logging           logging suite
 nestedscripts     nestedscripts suite
 plugin            plugin suite
 reporting         reporting suite
 systemproperties  systemproperties suite
 util              Util suite
Default target: all

For more information on how to use ant, pease consult the Ant manual.

From here the automation suite can be executed by typing ant or ant with some target. The result of the execution can be found in the subfolder file htmlreport/index.html file created.

Currently there is a window script to aid in creating a new project structure. From the Scripts folder run:

 create_template.bat myDemoProject

Project structure

  • ProjectName
    • DATA
      • CONFIG - could contain certificates and other configuration items needed for automation
      • INPUT - could contain input files for the automation
      • OUTPUT - could contain collected output during automation
      • REQUESTS - could contain requests
      • RESPONSES - could contain results
    • scripts - folder containing the entire automation logic
    • autodriver.properties - java properties defining script variables
    • build.properties - ant property file
    • build.xml - ant build file
    • htmlreport - report folder
    • *.log - contains the log output
    • hosts - defines local domain name service entries
    • *.js files - defining script modules for frequent used functions

System properties

A set of system properties control the behavior of the driver. Each property is set by the –D option and has the form of name=value. Take a look on the build.xml to see an example of how they can be used.

Main properties
Property Default Value
ad.stoponerrors false Whether to stop on errors or not
ad.scriptdir . script folder to load scripts from
ad.script N/A script to run at startup, if not set read from stdin
Report properties
Property Default Value
ad.suitename Default Specify an automation suite name for the report
ad.startsuite False When true, previous reports are overwritten


Log properties
Property Default Value
ad.logtoconsole false When true, log to out stream and stdout
ad.loglevel INFO Log4j log level
ad.logoutput Autodriver.log Log4j logfile
DNS properties
Property Default Value
ad.localdns N/A hosts file to use for resolving dns entries
sun.net.spi.nameservice.provider.1 dns,LocalManagedDns
sun.net.spi.nameservice.provider.2 dns,sun
Advanced properties
Property Default Value
ad.properties N/A Property file to load for variable substitution
ad.plugin.list Used plugins
ad.threadInstances 1 Number of automation threads to run
ad.threadsDisabled N/A Useful for debugging. Comma separated list of threads to disable
Utility properties
Property Default Value
ad.messagequeuesize 5 MessageQueue size