Skip to content

Added RETRY-UNTIL-TEST-PASS directive - #79

Merged
Burgyn merged 4 commits into
masterfrom
feature/retry_until_test_pass
Dec 16, 2025
Merged

Added RETRY-UNTIL-TEST-PASS directive#79
Burgyn merged 4 commits into
masterfrom
feature/retry_until_test_pass

Conversation

@pavolbetak

@pavolbetak pavolbetak commented Dec 12, 2025

Copy link
Copy Markdown
Collaborator

This branch adds a new RETRY-UNTIL-TEST-PASS directive to TeaPie that allows HTTP requests to be retried until a specific test passes.

Key Features Added:

New Directive:

  1. RETRY-UNTIL-TEST-PASS - Retries HTTP requests until a named test passes

Architecture Changes:

  1. Split testing responsibilities into IRegistrator (for registering tests) and ITester (for executing tests)
  2. Tests are now registered during script execution and executed separately
  3. Added synchronous test execution for use in retry logic

Core Implementation:

  1. New parser: RetryUntilTestPassDirectiveLineParser.cs
  2. Enhanced retry pipeline to check test results in addition to status codes
  3. Modified test execution flow to support deferred test execution

Demo/Examples:

  1. Added comprehensive test scenarios in demo/Tests/002-Cars/003-Check-Car-*.{http,csx}
  2. Shows 3 scenarios: eventual success, exceeding max attempts, and combined retry conditions

Close #58

Equal(car.Year, retrievedCar.Year);
});

ClearVariables();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naozaj si toto chcel zmazat?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem je, ze ked chces precitat testy, tak musis executnut ten subor a vzhladom na toto, ze toto je mimo tych tp.Test, tak sa to hned odpali a premaze variables (toto sa deje pri nacitami testov, nie spusteny) a potom ked dojde na spustenie, tak niektore tie variables chybaju a padne to.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bude treba odstranit aj referenciu #load "$teapie/ClearVariables.csx"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V popise je napisane ze si rozdelil ITester a IRegistrator, ale tento subor je zmazany a pomizol aj z kodu (ApplicationBuilder napr). neviem ci je len popis zly alebo sa to nemalo mazat

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha tak uz vidim ze toje v Tester.cs, ok :)

@pavolbetak pavolbetak Dec 12, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ITester (povodny) sa rozdelil v na IRegistrator a ITester, IRegistrator executne script a vytiahne z neho testy, ITester sa potom stara o ich spustenie

@Burgyn Burgyn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Možno to tam je, ale nikde som si to explicitne nevšimol: očakávam, že keď do tej direktívy zadám názov neexistujúceho testu tak mi to padne na nejakej explicitnej exception. Dôvod je taký, že tým že sú to strings tak sa človek môže preklepnúť, tak nech sa o tom dozvie že tam dal niečo čo nebude vlastne fungovať.

Comment thread demo/Tests/002-Cars/003-Check-Car-test.csx Outdated
Comment thread demo/Tests/002-Cars/003-Check-Car-test.csx Outdated
Comment thread src/TeaPie/Http/Retrying/ResiliencePipelineProvider.cs
Comment thread src/TeaPie/Http/Retrying/RetryUntilTestPassDirectiveLineParser.cs
Comment thread src/TeaPie/Scripts/ScriptStepsFactory.cs
});

True(executed);
// Test is registered but not executed yet (that's Tester's job)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

komentáre v kóde nechceme

@Burgyn
Burgyn merged commit fc14936 into master Dec 16, 2025
4 checks passed
@Burgyn
Burgyn deleted the feature/retry_until_test_pass branch December 16, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 [NEW] Retry Until Tests Passed

3 participants