Migrating from Appium desktop app to Appium 1.6 CLI for testing iOS 10 with XCUITest

I do test automation for an iOS application and have been struggling to support iOS 10. Since the iOS 10 release the UI Automation Instrument is deprecated and now it uses Xcode UI Testing. To […]

Scroll to an element with Selenium WebDriver

We need to take into account that a web element, for instance a button, can dynamically go out of view depending on the screen resolution we test with. So how do we wait for an […]

JMeter and WebDriver – 2 ways to combine them effectively

In my previous post I wrote about why it can┬ábe useful to combine running load tests in combination with functional automated tests (checks). In this post I will go in a bit deeper and give […]

Assertion chaining with Hamcrest

In some cases we want to assert more than one thing in a test. For instance when testing a financial application with a chart of accounts that contains multiple calculated fields. Those fields change after […]

A guide to clear assertions with Hamcrest

A good practice in test automation is the use of Descriptive And Meaningful Phrases (also known as DAMP). This means that our tests clearly tell us what they do in language that is relevant to […]

Combining assertions

allOf Given the following example: <code lang="java"> public void testAssert() { String s = "This is some text."; assertThat( "Assert a string starting with Tis and a string ending with ext.", s, Matchers.allOf(Matchers.startsWith("Tis"), Matchers .endsWith("ext."))); […]

Assert collections

hasItems Given the following example: <code lang="java"> public void testAssert() { List<String> list = new ArrayList<String>(); list.add("test"); list.add("webdriver"); assertThat("Assert that the list contains: tedst", list, Matchers.hasItems("tedst")); } </code> Returns the following output when the assertion […]

Assert booleans

Given the following example: <code lang="java"> public void testAssert() { boolean b = false; assertThat("Assert boolean b against expected result: true", b, Matchers.equalTo(true)); } </code> Returns the following output when the assertion fails: <code lang="console"> […]

Assert numbers

equalTo Given the following example: <code lang="java"> public void testAssert() { int n = 4; assertThat("Assert that n is equal to 5", n, Matchers .equalTo(5)); } </code> Returns the following output when the assertion fails: […]

Assert text

equalTo Given the following example: <code lang="java"> public void testAssert() { String s = "This is some text."; assertThat("Assert s to match the exact text", s, Matchers .equalTo("Tis is some text.")); } </code> Returns the […]

Add dependency to your project

There are two ways of adding dependencies to your project, as discussed in chapter 4. You can manually add dependencies or you can add the dependency to the POM file (then it will be automatically […]

Improved assertions – Introduction

Matchers are the way to validate the result in your test script. Hamcrest is a Java library of Matchers objects. Hamcrest has been ported to several languages, like: Java, C++, Objective-C, Python, ActionScript 3, PHP, […]

Take screenshots

Screenshot of page <code lang="java"> public void takeScreenshot() throws IOException { File scrFile = ((TakesScreenshot) driver) .getScreenshotAs(OutputType.FILE); String fileName = UUID.randomUUID().toString(); File targetFile = new File("target/screenshots/" + fileName + ".jpg"); FileUtils.copyFile(scrFile, targetFile); } </code> Screenshot […]