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 — Allow beforetest/aftertest procedures to accept parameters · Issue #491 · utPLSQL/utPLSQL

Allow beforetest/aftertest procedures to accept parameters #491

New issue
Copy link
New issue
Copy link
Closed
Closed
Allow beforetest/aftertest procedures to accept parameters#491
Copy link
Labels
enhancementidea

Description

@kyleholgate
kyleholgate
opened on Oct 10, 2017
Issue body actions

You can call procedures with beforetest or aftertest annotation, but it doesn't seem possible to pass any parameters through them. Is it possible to add this capability?

For example -

--% beforetest(build_user(123))
--% beforetest(build_user('missing_name'))

It would allow much greater reusability of setup procedures.

Activity

  1. jgebal commented on Oct 12, 2017

    @jgebal
    jgebal
    on Oct 12, 2017
    Member
    More actions

    @Hkyle
    That is a nice idea. It is related to #151
    It not trivial to implement, if we want to get it done right.
    Definitely worth doing.

  2. jgebal
    added
    enhancement
    idea
    on Oct 12, 2017
  3. jgebal commented on Oct 14, 2017

    @jgebal
    jgebal
    on Oct 14, 2017
    Member
    More actions

    I am having a second thought now.
    To achieve this, you can simply call the setup inside a test, if the setup is test-specific.
    so instead of:

    create or replace package my_test is
      --%suite
    
      procedure build_user(a_param varchar2);
    
      --%test
      --%beforetest( build_user(123) )
      procedure do_the_test;
    end;
    /
    
    create or replace package body my_test is
      procedure build_user(a_param varchar2) is
      begin
        --do some stuff here
        null;
      end;
    
      procedure do_the_test is
      begin
        --Assert
        ut.expect(get_user()).to_equal('123');
      end;
    end;
    /

    You could have:

    create or replace package my_test is
      --%suite
    
      --%test
      procedure do_the_test;
    end;
    /
    
    create or replace package body my_test is
      procedure build_user(a_param varchar2) is
      begin
        --do some stuff here
        null;
      end;
    
      procedure do_the_test is
      begin
        --Arrange
        build_user(123);
        --Assert
        ut.expect(get_user()).to_equal('123');
      end;
    
    end;
    /
  4. jgebal commented on Oct 17, 2017

    @jgebal
    jgebal
    on Oct 17, 2017
    Member
    More actions

    @Hkyle
    The main benefit of having beforetest/aftertest invoked from the framework than from within test procedure is that it will be executed outside of the test and that it will get executed even if the test throws an exception.
    Though adding parameters procedures in annotations is something I have in mind it requires significant amount of work. We will probably get there at some point, just not now.

  5. t3mp0rary commented on Aug 10, 2023

    @t3mp0rary
    t3mp0rary
    on Aug 10, 2023
    More actions

    Since at least in version 3.1.13 it is possible to pass parameters to procedures called in before... and after.. annotations, the problem described by @kyleholgate is solved, isn't it?

    But I have a follow-up question:
    Currently it is only possible to pass a single parameter because the , is interpreted as a splitter between methods, not between parameters.

    --%beforetest(do_something('value1', 'value2')) will result in Call params for beforetest are not valid: USER.SUITE.DO_SOMETHING('VALUE1

    Also note the capitalization of the passed value. This could sometimes lead to confusion 😅

    Is there any way to pass more than one value?

  6. utPLSQL
    locked and limited conversation to collaborators on May 9, 2026
  7. jgebal
    converted this issue into a discussion #1328 on May 9, 2026
  8. jgebal
    marked Allow running tests with params #1028 as a duplicate of this issue on May 9, 2026
  9. jgebal
    unmarked Allow running tests with params #1028 as a duplicate of this issue on May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementidea

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.