GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — allure-java/allure-awaitility at master · is-ivanov/allure-java

Expand file tree

/

allure-awaitility

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

allure-awaitility

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src
src
 
 
build.gradle.kts
build.gradle.kts
 
 
readme.md
readme.md
 
 

readme.md

Outline

Allure-awaitility

Extended logging for poling and ignored exceptions for awaitility

Wiki

For more information about awaitility highly recommended look into awaitility usage guide

Configuration examples

Single line for all awaitility conditions in project

Awaitility.setDefaultConditionEvaluationListener(new AllureAwaitilityListener());

Moreover, it's possible logging only few unstable conditions with method .conditionEvaluationListener()

final AtomicInteger atomicInteger = new AtomicInteger(0);
await().with()
        .conditionEvaluationListener(new AllureAwaitilityListener())
        .alias("Checking that important counter reached value around 3")
        .atMost(Duration.of(1000, ChronoUnit.MILLIS))
        .pollInterval(Duration.of(50, ChronoUnit.MILLIS))
        .until(atomicInteger::getAndIncrement, is(3));

How it looks like:

  1. Top-level step with condition evaluation definition such as alias or default information.
  2. Second-level steps with poling process information
  3. Optional second-level step with timeout information
  4. Optional second-level steps with ignored information

TimeUnit

Most awaitility users count time as milliseconds, but you can feel free to change print poll information.

Awaitility.setDefaultConditionEvaluationListener(new AllureAwaitilityListener().setUnit(TimeUnit.SECONDS));

Exceptions handling

By default, it's not possible to handle and log any exceptions, but you can try to ignore and log ignored exceptions.

final AtomicInteger atomicInteger = new AtomicInteger(0);
await().with()
        .ignoreExceptions() //required
        .atMost(Duration.of(1000, ChronoUnit.MILLIS))
        .pollInterval(Duration.of(500, ChronoUnit.MILLIS))
        .until(() -> {
            if (atomicInteger.getAndIncrement() != 3) {
                //this exception will be ignored by awaitility, but logged into Allure
                throw new RuntimeException("Something wrong happens");
            } else {
                return true;
            }
        });

Then, if you are not impressed with the large volume of logged exceptions, there is the way to disable logging for ignored exceptions globally.

Awaitility.ignoreExceptionsByDefault();
Awaitility.setDefaultConditionEvaluationListener(new AllureAwaitilityListener().setLogIgnoredExceptions(false));
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.