Start writing your Appium and Selenium tests fast
Convert fast from strait Appium and Selenium tests to FAST
Execute your tests fast
- Don't learn a new DSL - re-use the same Selenium interface you are used to
- Using the same Selenium commands, get reporting 'for free'
- Provides traceability
- Assists with debugging and triage
- Build custom reports to match your process and/or system
- Waits - TODO - explain me
- APIs - TODO - explain me
Getting started with FAST should be simple, and well, fast. You can do it in a few simple steps.
- Create a new project
- Add the FAST dependency to your project
- Create a class file in
src/test/java
- Start writing tests (look here for some examples)
-
Add the FAST dependency to your project
-
Change the imports in your project from
org.openqa.selenium.*
tocom.testpros.fast.*
-
After quitting your webdriver session (
driver.quit()
) write out your logsdriver.getReporter().simpleOut("[YOUR TEST NAME HERE]");
That's it. Now keep writing tests like you were before, but now you get all the additional logging and traceability from FAST.
Interested in using an entire framework built around FAST? Checkout ... (coming soon)
// TODO
If you're not really using any framework capabilities or tools, your test case(s) probably look something like the below:
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
public class WebDriverGenericIT {
@Test
public void sampleSeleniumTest() {
WebDriverManager.chromedriver().forceCache().setup();
WebDriver driver = new ChromeDriver();
driver.get("https://google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("cheese");
element.submit();
element = driver.findElement(By.name("q"));
assertEquals(element.getAttribute("value"), "cheese");
driver.quit();
}
}
After following the above instructions, it should look like this:
import io.github.bonigarcia.wdm.WebDriverManager;
import com.testpros.fast.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
public class FASTGenericIT {
@Test
public void sampleSeleniumTest() {
WebDriverManager.chromedriver().forceCache().setup();
WebDriver driver = new WebDriver(new ChromeDriver());
driver.get("https://google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("cheese");
element.submit();
element = driver.findElement(By.name("q"));
assertEquals(element.getAttribute("value"), "cheese");
driver.quit();
driver.getReporter().simpleOut("Sample Generic FAST Test");
}
}
It's just as easy to convert your tests when you're using a framework like TestNG or JUnit. The same steps apply, what you start off with:
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.*;
import static org.testng.Assert.assertEquals;
public class WebDriverIT {
WebDriver driver;
@BeforeMethod
public void setup() {
WebDriverManager.chromedriver().forceCache().setup();
driver = new ChromeDriver();
}
@Test
public void sampleSeleniumTest() {
driver.get("https://google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("cheese");
element.submit();
element = driver.findElement(By.name("q"));
assertEquals(element.getAttribute("value"), "cheese");
}
@AfterMethod(alwaysRun = true)
public void cleanup() {
driver.quit();
}
}
becomes:
import io.github.bonigarcia.wdm.WebDriverManager;
import com.testpros.fast.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.*;
import java.lang.reflect.Method;
import static org.testng.Assert.assertEquals;
public class FastIT {
WebDriver driver;
@BeforeMethod
public void setup() {
WebDriverManager.chromedriver().forceCache().setup();
driver = new WebDriver(new ChromeDriver());
}
@Test
public void sampleSeleniumTest() {
driver.get("https://google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("cheese");
element.submit();
element = driver.findElement(By.name("q"));
assertEquals(element.getAttribute("value"), "cheese");
}
@AfterMethod(alwaysRun = true)
public void cleanup(Method method) {
driver.quit();
driver.getReporter().simpleOut(method.getName());
}
}
One thing to note about the above, is that Dependency Injection was used to pass the method under test to the cleanup method, so that the correct test case name could be recorded in the reporter.
- waits
- custom - still need negatives
- built ins (now autowaits for element present, still needs to wait for custom actions (e.g. editable for sendKeys))
- discuss, do we want these or not?
- JavaDocs
- More tracability
- All-Screen screenshot
- recording...
- Alert
- Action/TouchAction
- ???
- expand on android/ios driver functionality (for example, back or keypress) ####NOTE Only use 'success' in step actual - AND ONLY IF CHECK IS PERFORMED - otherwise state fact