-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decorator for computed test cases #413
Labels
Comments
Nice idea @Nysosis, Might be nice to wrap this up as a decorator that takes a generator specifically for this. What do you think? |
Yup, I did consider making it use a generator at the time. Built it taking
an array for simplicity sake just to get it done quick.
I'll take a look at re-impl with a generator and submit a PR for it
…On 30 July 2017 at 00:08, James Richford ***@***.***> wrote:
Nice idea @Nysosis <https://github.com/nysosis>,
Might be nice to wrap this up as a decorator that takes a generator
specifically for this. What do you think?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#413 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFOQHjJV9LxzX9b8Vwsjs7GI9d4go_juks5sS7tygaJpZM4OlSfu>
.
|
I guess if we make it a separate decorator e.g. |
Well taking a quick look, I can make it work both ways, generators or
explicit array, for the one function easily enough, with a signature of
`export function TestCases(caseArguments: IterableIterator<any> | any[][])
{ ... }`. Though can't use the spread operator on on the `any[][]` argument
to make that mode a bit nice to work with (by saving you typing `[` and `]`)
…On 30 July 2017 at 09:24, James Richford ***@***.***> wrote:
I guess if we make it a separate decorator e.g. TestCasesFor or something
along those lines there's no reason it couldn't take both? So you can work
with whatever suits the situation?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#413 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFOQHkK2hGkY_zpY6uXdmwzTTyIS_Esrks5sTD3SgaJpZM4OlSfu>
.
|
Nysosis
pushed a commit
to Nysosis/alsatian
that referenced
this issue
Aug 10, 2017
Added TestCases decorator, which allows you to specify multiple TestCases via use of an explicit array of cases, generator, or delegate which returns an array of cases or generator
Closed by #414 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Recently came across the desired to be able to specify multiple test cases programmatically (i.e. I had a matrix of combinations I wanted to feed through).
The current
@TestCase
decorator works great, but AFAIK there's no way to easily specify multiple in that way (there could be, my knowledge of how decorators works is limited).So what I did was to create a local
@TestCases
decorator, which was inspired heavily by the@TestCase
decorator - except it took anany[][]
instead ofany[]
, which allowed me to add multiple items to theTEST_CASES
metadata at once.This allowed me to do something like:
Obviously a contrived example, but I've found similar functionality very helpful in other unit testing frameworks.
If there's a way of doing it already (native TS/JS or through the library) then point me how and we can close this issue down, otherwise I can either submit a pull request with the decorator I've done and/or we can discuss the interface for specifying computed test cases
The text was updated successfully, but these errors were encountered: