EasyTest.Plugins.Retry 1.0.1

dotnet add package EasyTest.Plugins.Retry --version 1.0.1
                    
NuGet\Install-Package EasyTest.Plugins.Retry -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyTest.Plugins.Retry" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasyTest.Plugins.Retry" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="EasyTest.Plugins.Retry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EasyTest.Plugins.Retry --version 1.0.1
                    
#r "nuget: EasyTest.Plugins.Retry, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EasyTest.Plugins.Retry@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EasyTest.Plugins.Retry&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=EasyTest.Plugins.Retry&version=1.0.1
                    
Install as a Cake Tool

EasyTest.Plugins.Retry

Overview

EasyTest.Plugins.Retry is a foundational helper plugin integrated into the EasyTest suite aimed specifically at resolving test instability, famously known as "flakiness". When interacting with dynamic web applications, unstable network connections, or asynchronous database transactions, strict sequential commands often fail unexpectedly.

This plugin resolves this by injecting a highly configurable Retry and Polling mechanism directly into the JavaScript Execution state, abstracting away complex setInterval or nested try-catch structures.

Core Capabilities

  • Configurable Retry Policies: Allows script developers to dictate explicitly how many times a code block should be attempted, and the rest period (Backoff Strategy) between attempts.
  • Semantic Exception Filtering: Prevents blind retries by allowing configuration rules—for example, retry on ElementNotVisibleException but fail immediately on AuthenticationFailedException.
  • Telemetry Emitting: Deeply integrated with EasyTest.Sdk.Logging. During every failed attempt, it emits a Warn level pipe message detailing the attempt number and reason, so QA supervisors can trace instability directly from the graphical UI console.

Architecture & Integration

Unlike the Oracle plugin which interfaces with external systems, the Retry plugin interfaces directly with the V8 JavaScript Execution Context.

  1. It leverages the Microsoft ClearScript capability to pass Anonymous JavaScript Functions (Callbacks) back into C#.
  2. The RetryHelper C# class executes the anonymous JS function wrapped inside a managed C# try-catch block inside a custom while loop.
  3. If an exception is thrown, it evaluates the policy, utilizes Thread.Sleep (or Task.Delay equivalent) to pause execution securely, and tries again.
  4. If the max attempts are exhausted, the original JS stack trace is preserved and re-thrown instantly back to the Engine to cleanly halt the test.

Usage in Scripts

The syntax is designed to be highly readable and elegant, preventing "spaghetti code" inside the test cases.

import { RetryHelper } from 'EasyTest.Plugins.Retry';

// The function to retry, retry count (3), delay in milliseconds (2000)
var result = RetryHelper.execute(() => {
    
    // Simulate UI interaction
    var isReady = UI.checkElementVisible("#dashboard-view");
    
    if (!isReady) {
        // Throwing an error indicates to the C# plugin that the attempt failed
        throw new Error("Dashboard not yet painted on screen."); 
    }
    
    return UI.getInnerText("#user-balance");
}, 3, 2000);

log.success("Extracted balance successfully after loading: " + result);

Benefits

By moving complex polling logic down into the highly efficient .NET Core C# layer rather than writing slow JavaScript .delay() helper wrappers, the CPU overhead is drastically minimized, and thread-blocking scenarios inside V8 are mitigated.

Product Compatible and additional computed target framework versions.
.NET net9.0-windows7.0 is compatible.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 106 4/27/2026