Skip to content

Repository files navigation

Testy

Automated Acceptance Testing.

Selenium WebDriver test framework for web applications. You don't have to worry anymore about complex XPATH or CSS selector because we are taking care for you about that. Simply set each property on the element and we will generate the necessary selector. You can combine more properties/attributes on the same selector very easy.

This project is optimized for:

Java Usage Example

<button>Save</button><button>Cancel</button><divclass="close" title="Close">x</div><spanclass="minimize" title="Minimize">_</span>
ButtonsaveButton = newButton().setText("Save");
ButtoncancelButton = newButton().setText("Cancel");
// more properties for selecting/testing specific element with wanted attributesWebLocatorcloseIcon = newWebLocator().setClasses("close").setTitle("Close");
WebLocatorminimIcon = newWebLocator().setClasses("minimize").setTitle("Minimize");
publicclassSubscribePage {
privateWebLocatorheader = newWebLocator().setClasses("header");
privateTextFieldemailField = newTextField().setLabel("Email");
privateWebLinksubscribeLink = newWebLink(header, "Subscribe now");
publicvoidsubscribe(Stringemail) {
emailField.setValue(email);
subscribeLink.click();
}
}
publicclassSubscribeTestextendsTestBase {
SubscribePagesubscribePage = newSubscribePage();
@TestpublicvoidsubscribeTest() {
subscribePage.subscribe("me@testy.com");
}
}

Table and rows examples

publicclassSubscribersPage {
privateTabletable = newTable();
publicbooleanunsubscribe(Stringemail) {
// find row that contains specified email in second columnRowrow = table.getRow(newCell(2, email));
// find remove button inside specified rowButtonremoveButton = newButton(row, "Remove");
returnremoveButton.click();
}
}
publicclassRemoveSubscriberTestextendsTestBase {
SubscribersPagesubscribersPage = newSubscribersPage();
@TestpublicvoidunsubscribeTest() {
booleanremoved = subscribersPage.unsubscribe("me@testy.com");
//... assert
}
}

Prerequisites

  • Java
  • Maven

Setup Guide

For full setup and run instructions, see setup.md.

For Button examples and API notes, see button.md.

Getting the maven plugin

<dependency>
<groupId>com.sdl.lt</groupId>
<artifactId>Testy</artifactId>
<version>2.13.1</version>
</dependency>

Here is how these lines appear in a project pom.xml

Initialize Testy

Simple way to migrate or use Testy

After you create your driver, pass the reference to Testy, then just it use as you want

driver = newFirefoxDriver();
WebDriverConfig.init(driver);
// then just use WebLocator or any other classes from Testy

OR Create your driver using Testy much simpler

publicstaticWebDriverdriver;
static {
startSuite();
}
privatestaticvoidstartSuite() {
try {
driver = WebDriverConfig.getWebDriver(Browser.FIREFOX);
} catch (Exceptione) {
LOGGER.error("Exception when start suite", e);
}
}

To use Selenium Grid you need the following:

  1. Set this system property: remoteDriver=true
  2. Pass the remote hub url as a parameter when initializing the WebDriver. e.g.:
WebDriverdriver = WebDriverConfig.getWebDriver(EnvConfig.getBrowserConfigPath(), newURL("http://localhost:4444/wd/hub"));
orWebDriverdriver = WebDriverConfig.getWebDriver(URLremoteUrl, DesiredCapabilitiescapabilities);

Here is how these lines appear in a project

Example project

Here is a sample project with cucumber and Testy on Chrome browser:

Full example

Release Notes

Release Notes for Testy 2.13.1

  • added setChildNodes(SearchType searchType, final WebLocator... childNodes) method
  • improvement select(boolean doScroll, String... nodes) method in Tree
  • update webdriver version 3.141.59
  • TODO

Detailed Release Notes

Getting SNAPSHOT versions of the plugin

 <repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>sonatype-nexus-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependency>
<groupId>com.sdl.lt</groupId>
<artifactId>Testy</artifactId>
<version>2.14.0-SNAPSHOT</version>
</dependency>

Demo application links

Setting up Testy project

License

Testy is MIT licensed.

About

Automated Acceptance Testing: Selenium and Selenium WebDriver test framework for web applications (best suited for ExtJS and complex UI)

Resources

Stars

35 stars

Watchers

17 watching

Forks

Releases

Packages

Used by

Contributors

Languages