Skip to content

feat(assertions): support custom assertions#891

Merged
yesnault merged 2 commits into
masterfrom
feat-custom-assertions
Jan 2, 2026
Merged

feat(assertions): support custom assertions#891
yesnault merged 2 commits into
masterfrom
feat-custom-assertions

Conversation

@lowlighter

Copy link
Copy Markdown
Member

This PR introduces a way to call user-defined executors directly in the assertions array so it's possible for end-users to create custom assertions functions.

If the custom executor name starts with Should, it is also automatically registered in the assertMap allowing its use as a regular assertion keywords

Example:

# lib/ShouldBeHttp2XX.yml
executor: ShouldBeHttp2XX 
steps:
  - assertions:
    - a ShouldBeGreaterThanOrEqualTo 200
    - a ShouldBeLessThan 300
# test.yml
testcases:
- steps:
  - type: http
    url: https://example.com
    assertions:
    - result.statuscode ShouldBeHttp2XX

The code reuses the same implementation as user defined executors which makes it a really low maintenance feature despite bringing a nice QOL change. The only difference is that the variables context is cleaned (as assertions executes independently from venom testcases) to ensure assertions are context independent and only depends on the given operands

@lowlighter lowlighter force-pushed the feat-custom-assertions branch from ffa82e6 to c06ca20 Compare December 23, 2025 19:03
@ovh-cds

ovh-cds commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

CDS Report build-venom-a#327.0 ✘

  • Build
    • Build ✔
    • Unit Tests ✔
  • Tests
    • Acceptance Tests ✘

@ovh-cds

ovh-cds commented Jan 2, 2026

Copy link
Copy Markdown
Collaborator

CDS Report build-venom-a#327.1 ✘

  • Build
    • Build ✔
    • Unit Tests ✔
  • Tests
    • Acceptance Tests ✘

@yesnault yesnault force-pushed the feat-custom-assertions branch 2 times, most recently from e609422 to a7fa030 Compare January 2, 2026 15:51
lowlighter and others added 2 commits January 2, 2026 17:02
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>
@yesnault yesnault force-pushed the feat-custom-assertions branch from a7fa030 to 95b1e7c Compare January 2, 2026 16:02
@yesnault yesnault merged commit 4873c26 into master Jan 2, 2026
5 checks passed
ivan-velasco pushed a commit to socotra/venom that referenced this pull request Mar 25, 2026
* feat(assertions): support custom assertions

Signed-off-by: GitHub <noreply@github.com>

* custom to user assertion

Signed-off-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>

---------

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>
Co-authored-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>
Signed-off-by: Ivan Velasco <ivan.velasco@socotra.com>
storagebits pushed a commit to storagebits/venom that referenced this pull request Apr 17, 2026
* feat(assertions): support custom assertions

Signed-off-by: GitHub <noreply@github.com>

* custom to user assertion

Signed-off-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>

---------

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>
Co-authored-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>
ivan-velasco pushed a commit to socotra/venom that referenced this pull request Jun 6, 2026
* feat(assertions): support custom assertions

Signed-off-by: GitHub <noreply@github.com>

* custom to user assertion

Signed-off-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>

---------

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>
Co-authored-by: Yvonnick Esnault <yvonnick.esnault@ovhcloud.com>
Signed-off-by: Ivan Velasco <ivan.velasco@socotra.com>
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.

3 participants