-
Notifications
You must be signed in to change notification settings - Fork 9
04). Getting started
- 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.
-
Create a new project for your tests within your IDE.
-
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>
-
Download the jar file that from this GitHub project.
-
Import the jar file as a dependency to your project.
-
Create a new class for your tests and make sure it extends the TestSet class of TAF.
-
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.*");
}
}
-
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.
-
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());