Skip to content

malaskowski/aet-modifier-template

Repository files navigation

AET Modifier template

This repository contains implementation of a sample AET Modifier:

AET uses Modifiers to achieve certain conditions before collecting the data (e.g. set browser viewport size or wait for some element to appear). In fact, Modifiers are Collectors which use webdriver to perform some actions, bug simply do not collect any data.

Creating new Modifier

All AET Modifiers implement CollectorJob interface. To create a Modifier in AET instance, you will need CollectorFactory that provides a new instance of Modifier each time it is required. It also equips Modifier with WebDriver - so that it can interact with the browser.

You can see the example code in this repository:

More (Java) code examples are in the AET core Modifiers.

Repo structure

.
├── conf
│   └── com.github.aet.modifier.ExampleModifier.cfg
├── features
│   └── kotlin-features.xml
├── misc
│   └── suite.xml
└── src
    └── main
        ├── java
        │   └── com
        └──  kotlin
            └── com
  • conf contains OSGi configuration files for the modifiers
  • features contains Karaf provisioning configuration file for kotlin-osgi-bundle
  • misc contains sample suite that can be use to run the test with sample modifiers
  • src contains code of two sample modifiers: example (written in Java) and another (written in Kotlin), together with their factories and configs

How to develop a custom modifier

Choose one of the options:

Choose whether you want to develop a Java or Kotlin version. Hack the modifier's code, rename it do whatever you need using webdriver. Remember to give your modifier a unique name. With that name it will be triggered when AET test collection phase is processed, e.g.

  • When you name your component my-custom-mod you will call it with <my-custom-mod> from the suite (see the <example> in this repo).

Build and deploy it following instructions below.

How to build

Run ./gradlew build.

This will produce jar in the build/libs as well as compress the config file to build/distributions.

How to deploy on local dev environment

Run ./setup.sh. This script will create try-me directory with:

You will have following structure:

├── instance
│   ├── aet-swarm.yml
│   ├── bundles
│   ├── configs
│   ├── features
│   └── report
└── tests
    ├── aet.sh
    └── suite.xml

To deploy example modifier run ./deploy.sh (that will copy the bundle and configs to proper instance directories).

Run the AET instance from the try-me/instance directory using docker stack deploy -c aet-swarm.yml aet.

When the instance is up (see details in the AET Doker instance setup guide) you may run sample suite. From the tests directory run ./aet.sh http://localhost:8181.

Every time you change the code/config of the custom module, simply run ./deploy.sh and wait a moment for the instance to update (changes are auto-discovered by Karaf).

Tutorial

To see a more detailed description on how to use this modifier template, please refer to this article:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published