/QTAF

QTAF is a Java test framework based on TestNG and offers easy setup of Selenium and fast extensibility.

Primary LanguageJavaMIT LicenseMIT

Qytera logo

QTAF - Qytera Test Automation Framework

The Qytera Test Automation Framework (QTAF) is a Java test framework developed by Qytera GmbH based on TestNG and offers easy setup of new Selenium test projects, HTML reporting, Cucumber support, connection to Jira Xray and fast extensibility.

Blog · Report bug · Request feature


License PRs Welcome Sonarcloud Maintainability Rating Maven Central Version

Table of contents

Requirements

In order to use QTAF, you will need:

Quick start

The easiest way to start using QTAF is by including it in a Maven project's dependencies. To include QTAF as a testing dependency, add the following lines to your project's pom.xml:

<dependency>
    <groupId>de.qytera</groupId>
    <artifactId>qtaf-core</artifactId>
    <version>0.2.0</version>
    <scope>test</scope>
</dependency>

Afterwards, simply run mvn install to automatically download and make available QTAF and its dependencies from Maven's Central Repository.

Example Usage

Having QTAF installed, using it is very straightforward. A very basic, page-object-based example for testing https://duckduckgo.com could look like this:

  1. open https://duckduckgo.com
  2. enter test automation into the search area
  3. click on the search button
  4. assert that the result page's title contains the search term test automation


Test Case Visualization
The test case visualized.

The test can be realized with two classes: one for the page object and one for the test cases. The complete project can be found here.

Click to view project structure
src
├───main
│   └───java
└───test
    └───java
        └───de
            └───qtaf
                ├───pages
                │       DuckDuckGoPage.java
                │
                └───tests
                        DuckDuckGoPageTest.java

Page object

package de.qtaf.pages;

import de.qytera.qtaf.core.guice.annotations.Step;
import de.qytera.qtaf.testng.context.QtafTestNGContext;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import static com.codeborne.selenide.Selenide.$

public class DuckDuckGoPage extends QtafTestNGContext {
    By searchInputSelector = By.id("search_form_input_homepage");
    By searchButtonSelector = By.id("search_button_homepage")

    @Step(
            name = "open test page",
            description = "opens a browser window and navigates to the test page"
    )
    public void openTestPage() {
        driver.get("https://duckduckgo.com");
        driver.manage().window().maximize();
    }

    @Step(
            name = "enter search term",
            description = "enters the given search term into the search field"
    )
    public void enterSearchTerm(String term) {
        $(searchInputSelector).sendKeys(term);
    }

    @Step(
            name = "click search button",
            description = "clicks on the search button next to the search field"
    )
    public void clickSearchButton() {
        $(searchButtonSelector).click();
    }

}

Test case

package de.qtaf.tests;

import de.qtaf.pages.DuckDuckGoPage;
import de.qytera.qtaf.core.config.annotations.TestFeature;
import de.qytera.qtaf.testng.context.QtafTestNGContext;
import org.testng.annotations.Test;


@TestFeature(
        name = "duckduckgo search",
        description = "tests the search feature from https://duckduckgo.com"
)
public class DuckDuckGoPageTest extends QtafTestNGContext {
    @Test(
        testName = "QTAF-001",
        description = "test a simple search"
    )
    public void testSearch() {
        DuckDuckGoPage page = load(DuckDuckGoPage.class)
        page.openTestPage();
        page.enterSearchTerm("test automation");
        page.clickSearchButton();
        assertTrue(driver.getTitle().contains("test automation"));
    }

}

Documentation

You will find an extensive documentation on our GitHub page qytera-gmbh.github.io.

Contributing

Feel free to join our discussion in the issues. If you want to contribute directly, you may do so any time by opening an informal pull request.