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 — Parameter drive tests · Issue #151 · utPLSQL/utPLSQL

Parameter drive tests #151

New issue
Copy link
New issue
Copy link
Closed
Closed
Parameter drive tests#151
Copy link
Labels
enhancement

Description

@jgebal
jgebal
opened on Jan 10, 2017
Issue body actions

There is an interesting extension to JUnit:
https://github.com/Pragmatists/JUnitParams
We could think of implementing something similar.

Here are examples of different ways to use it.
https://github.com/Pragmatists/JUnitParams/blob/master/src/test/java/junitparams/usage/SamplesOfUsageTest.java

Activity

  1. jgebal
    added
    enhancement
    on Jan 10, 2017
  2. Pazus commented on Apr 18, 2018

    @Pazus
    Pazus
    on Apr 18, 2018
    Member
    More actions
    —%test
    —%parametrized(select name, birthdate from test_clients)
    procedure tst_client_proc(a_name varchar2, a_birthdate date);
    

    We can call it providing parameter values by iterating over sql statement using dbms_sql

    We can also accept a function which returns a cursor.

    Parameters should be mapped by name if the column aliases in the query correspond equally or by position if not.

    Reacted by David Pyke, Matt Davies, Jasmin Fluri, Philipp Salvisberg and marko-granzin-ais
  3. mathewbutler commented on Apr 18, 2018

    @mathewbutler
    mathewbutler
    on Apr 18, 2018
    More actions

    Does this need to support query input? The model I have in mind is;

    • a data setup step
    • parameterised annotation passing list of items set up in data (without SQL)

    With this you have the same capability, just without exposing SQL to the annotation.

    My concern is opening up avenue of issues where users want to persist test / results data to drive tests rather that keep tests isolated and UtPLSQL clean from data storage.

    Reacted by alesana-san and marko-granzin-ais
  4. alesana-san commented on Dec 19, 2018

    @alesana-san
    alesana-san
    on Dec 19, 2018
    More actions

    I agree with @mathewbutler. I guess the better option is to preset all test data (like test_clients) and then iterate over it in a single test and check the results. Given that we have:

    • Knowing that ut.expect doesn't stop execution after the first fail we will iterate through all given data;
    • We don't have tons of test executions in reports about every single launch of iterated test but still keep data about all fails;
    • I think that inventing a new annotation should provide some sort of a utility but we just take parametrizing (params, query or whatever) out of the test body and put it in a declaration part. Instead test-writer can do it by himself feeling free to write any kind of query and handle it in a way he wants it inside of the test body.

    No offense, guys, just thoughts out of my head :)

  5. Pazus commented on Sep 5, 2019

    @Pazus
    Pazus
    on Sep 5, 2019
    Member
    More actions

    We should look at something like this:
    https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests

    Reacted by Jasmin Fluri
  6. jfluri commented on Jun 16, 2020

    @jfluri
    jfluri
    on Jun 16, 2020
    More actions

    We should look at something like this:
    https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests

    I like the Functionality that the @MethodSource annotation in jUnit has. It provides a Stream of (multiple) parameters that are handed to the test executions. Like a rowtype in a way...

  7. marko-granzin-ais commented on May 4, 2022

    @marko-granzin-ais
    marko-granzin-ais
    on May 4, 2022
    More actions

    I think there must be some kind of cursor as parameter ... so i can enter all i like - i hope you implemet this soon ....

  8. lwasylow commented on May 4, 2022

    @lwasylow
    lwasylow
    on May 4, 2022
    Member
    More actions

    I think we could approach that problem with a new annotation to imitate an above junit5 approach.

    --%parameterizedtest
    --%valuesource{"Test"}
    procedure testme(a_displayname in varchar2);

    result in :
    Test was expected to be called Test

    or

    --%parameterizedtest
    --%valuesource{"Test,10"}
    procedure testme(a_displayname in varchar2, a_beer_count in number);

    result in :
    Test was expected to be called Testand had a 10 beers

    or

    --%parameterizedtest
    --%valuesource{"Test,10":"Test2,5"}
    procedure testme(a_displayname in varchar2, a_beer_count in number);

    as alternative we could use a different annotation for multiple parameters so the code is more readable. e.g.

    --%parameterizedtest
    --%valuesource{"Test,10"}
    --%valuesource{"Test2,5"}
    procedure testme(a_displayname in varchar2, a_beer_count in number);

    result in :
    Test was expected to be called Testand had a 10 beers
    Test was expected to be called Test2,5and had a 5 beers

    The value source would be a colon separated inputs with list of coma separated values hat would have to be ordered in same way parameters in procedure each parameter entry as an annotation entry one below the other.
    The valuesource would be iterated over list of values.
    This would not solve the problem of complex types and to be fair not sure how to approach as the complexity is infinite here.
    I can see maybe using a datatype information as junit5 to cast to datatype e.g.--%valuesource{"test.test_type=Test"} but there are nested types, types that are not part of tested schema ( so extra grants complexity ).

    Personally if we would to implement this I would suggest stick to basic datatypes.

  9. lwasylow commented on May 8, 2022

    @lwasylow
    lwasylow
    on May 8, 2022
    Member
    More actions

    Actually I take it back. We could try to write a tests with anydata and let the user define a logic to handle the type inside tests.
    What you think about it @jgebal and above suggestions ?

  10. jgebal commented on May 9, 2022

    @jgebal
    jgebal
    on May 9, 2022
    MemberAuthor
    More actions

    I think it would be good to do a full review of what JUnit is proposing for parametrized tests and maybe check how other testing frameworks are solving this.

    In essence the key challenge is to come up with a good specification of annotations and parameters that will be relatively easy to use for average Oracle PL/SQL engineer.
    Having that said, I would refrain from leveraging ANYDATA, as it's API is quite complicated and not very friendly to use.

    I think we should consider using DB tables for storing and reading parameters.

  11. utPLSQL
    locked and limited conversation to collaborators on May 9, 2026
  12. jgebal
    converted this issue into a discussion #1326 on May 9, 2026
  13. jgebal
    marked Support for data driven testing #1265 as a duplicate of this issue on May 9, 2026
  14. jgebal
    marked 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

    enhancement

    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.