Skip to content

[wishlist] parametric tests #241

@yarikoptic

Description

@yarikoptic

It is quite often desired to run the same test logic in various scenarios. ATM there is no dedicated facility in bats to make that easy, so I resorted to placing test logic into a dedicated function and ugly copy/pasting for invocations with different parameters where I needed it

I am not yet sure what could be the "bats way" to specify parametric tests but since there is parsing and preparation of the test code is happening anyways could be something like

BACKEND=( docker singularity )
NJOBS=( 1 10 )

@test "description" BACKEND NJOBS {
   echo "Here I am with backend=$backend njobs=$njobs"
   ...
}

and running it would result in 4 tests with adjusted descriptions:

  • description [backend=docker,njobs=1]
  • description [backend=docker,njobs=10]
  • description [backend=singularity,njobs=1]
  • description [backend=singularity,njobs=10]

and still subject to --filter selection (so e.g. I could select only the ones for backend=docker)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Bash CodeEverything regarding the bash codePriority: HighBroken behavior in specific environments like in parallel mode or only on some operating systemsSize: LargeChanges across several filesStatus: DuplicateType: Enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions