Autotests

This course is about how to configure and run autotests in Easygenerator

webdriver.io

The basic

        WebdriverIO comes with its own test runner to help you get started with integration testing as quickly as possible. 

        All the fiddling around hooking up WebdriverIO with a test framework belongs to the past. The WebdriverIO runner does all the work for you and helps you to run your tests as efficiently as possible.

The WDIO Testrunner

The WDIO Testrunner

The main purpose of WebdriverIO though is end to end testing on big scale. We therefore implemented a test runner that helps you to build a reliable test suite that is easy to read and maintain. The test runner takes care of many problems you are usually facing when working with plain automation libraries. For one it organizes your test runs and splits up test specs so your tests can be executed with maximum concurrency. It also handles session management and provides a lot of features that help you to debug problems and find errors in your tests. Here is an same example from above written as test spec and executed by wdio:

The test runner is an abstraction of popular test frameworks like Mocha, Jasmine or Cucumber. Different than using the standalone mode all commands that get executed by the wdio test runner are synchronous. That means that you don’t use promises anymore to handle async code.

Selectors

         The JsonWireProtocol provides several strategies to query an element. WebdriverIO simplifies these to make it more familiar with the common existing selector libraries like Sizzle. The following selector types are supported:

CSS Query Selector:

browser.click('h2.subheading a');

Link Text:

To get an anchor element with a specific text in it, query the text starting with an equal (=) sign. For example:

<a href="http://webdriver.io">WebdriverIO</a>

console.log(browser.getText('=WebdriverIO')); // outputs: "WebdriverIO"console.log(browser.getAttribute('=WebdriverIO', 'href')); // outputs: "http://webdriver.io"

xPath:

It is also possible to query elements via a specific xPath. The selector has to have a format like for example //BODY/DIV[6]/DIV[1]/SPAN[1]

In near future WebdriverIO will cover more selector features like form selector (e.g. :password,:fileetc) or positional selectors like :first or :nth.

Examples

What language have to be used to write tests with webdriver.io ?

  • C#
  • javascript
  • python
  • java

Jasmine

The basic