Skip to content

04). Getting started

Jörgen Damberg edited this page Apr 20, 2018 · 15 revisions

Get started using TAF

  1. Make sure you have a Java development environment installed (IDE). The preferred way of accessing TAF currently is through maven. If you are un-sure of what IDE to use, the IntelliJ community edition certainly is sufficient.

Adding dependency to TAF

For maven supported IDE's:

  1. Create a new project for your tests within your IDE.

  2. In your maven pom.xml file, add the followin dependency under the dependencies tag:

     <dependency>
            <groupId>com.github.claremontqualitymanagement</groupId>
            <artifactId>TestAutomationFramework</artifactId>
            <version>2.7.31</version>
        </dependency>
    

For non-maven projects:

  1. Download the jar file that from this GitHub project.

  2. Import the jar file as a dependency to your project.

Setting up a test class

  1. Create a new class for your tests and make sure it extends the TestSet class of TAF.

  2. Set up the test class:

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import se.claremont.autotest.common.testset.TestSet;
import se.claremont.autotest.websupport.webdrivergluecode.WebInteractionMethods;

public class MyFirstWebTestClass extends TestSet {
    
    private WebInteractionMethods web;
    
    @Before
    public void testSetup(){
        web = new WebInteractionMethods(currentTestCase());
    }

    @After
    public void testTearDown(){
         web.makeSureDriverIsClosed();
    }

    @Test
    public void myFirstTest(){
        web.navigate("https://github.com/claremontqualitymanagement/TestAutomationFramework/");
        web.verifyPageTitleAsRegex(".*TAF.*");
    }

}
  1. The myFirstTest() class is your first test. The first time you run it a folder called TAF will be created in your home directory. The TAF folder will also have a file called runSettings.properties. This file will hold your run settings, and may be altered.

  2. Feel free to edit the test method, and add new ones. If you write the word 'web' and a dot you can then access all the web interaction methods.

When more than one test case is run in the same test execution a summary report will also be created. Test run logs can be found in the TAF folder in your user home folder.

If you want to access test capabilities for REST, just add

 RestSupport rest = new RestSupport(currentTestCase()); 

at the top of the class (just like the WebInteractionMethods is declared with the web instance). Or slit the instansiation into the @Before method, just like the web one in the example above. The same goes for file management or testing of rich Java clients, that is included through the

 private FileTester file;

or the

 private GenericInteractionMethods java = new GenericInteractionMethods(currentTestCase());