Using the SDK
To simplify workflows and make automation of test cases and test suites as simple and as powerful as possible, we offer a webmate SDK. In this tutorial, we will show you how to integrate the SDK into your tests and make use of its features.
Installing the SDK
The Java SDK is available via Maven Central. Add the following dependency to your pom.xml (or another Maven based build tool):
You can find the source code on this repository.
Add the following line to the devDependencies in your package.json.
|
|
The SDK is open-source, so, if you want to, you can also build it from source, modify or extend it. If you want to build your own webmate SDK, clone the repository from there and install the compiled artifacts to your local Maven repository with
|
|
You can then include the SDK as a Maven dependency in your project as shown above. Make sure to use the version number that is set in the sources you build to prevent your dependency manager from downloading it from Maven Central.
Install the sdk with all your other dependencies by running
|
|
Getting Started
You can find more code examples of how to use the SDK in this repository
First, you need to store your credentials, and specify the context in which you want to work.
To do so, we recommend defining variables for the login credentials for webmate, and the id of the project you want to work in.
With these, you can create a new WebmateAPISession
which is needed for most SDK functionality.
|
|
|
|
Set up an Automated Test
When setting up the authentication capabilities for webmate, there is no need to specify the capability names yourself, you can use the constants from the SDK. That way you can be sure that you always supply the correct names.
When an automated Selenium or Appium test is running, you can use the SDK to obtain a seleniumSession
by adding it to the created webmateSession
using the session ID from your test driver.
Even though the type is called WebmateSeleniumSession
this also works when testing with Appium on Android or iOS.
|
|
|
|
Report Test Results
If you want to make use of all features of the TestLab, we recommend synchronizing test results of your functional tests with webmate.
By calling finishTestRun()
on the test session object obtained from the SDK, you can pass test results (such as logical failures or exceptions thrown in your test) to the webmate API.
|
|
|
|
Extract State Information for Analysis in webmate
You can create checkpoints (called States) in your test run to inspect in the TestLab. This allows you to structure your tests and make the logical steps visible in webmate. It also serves as a basis for visual testing, since it allows inspection of layouts in webmate and can be used to create visual comparison or regression tests.