Skip to content
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

Splitting a test with a TestCaseSource and ignoring test cases #1174

Open
bookofproofs opened this issue May 11, 2024 · 1 comment
Open

Splitting a test with a TestCaseSource and ignoring test cases #1174

bookofproofs opened this issue May 11, 2024 · 1 comment

Comments

@bookofproofs
Copy link

  • NUnit and NUnit3TestAdapter versions: 4.1.0, 4.5.0
  • Visual Studio edition and full version number: 17.9.5
  • What .net platform and version is being targeted (.net8)
  • A short repro, preferably attached or pointing to a git repo or gist

This is F#:

namespace FplInterpreter.Tests
open NUnit.Framework


type SomeUnion = 
    | A 
    | B

[<Class>]
type TestCaseSourceNunit() =


    static member BaseCases = [
        yield ("true", A)
        yield ("false", A)
        yield ("undef", A)
        yield ("1.", A)
        yield ("del.Test()", A)
        yield ("$1", A)
        yield ("bydef Test()", A)             
        yield ("Test$1", A)            
        yield ("Test$1()", A)            
        yield ("Test", A)        
        yield ("v", A)
        yield ("self", A)
        yield ("1", A)
        yield ("v.x", A)
        yield ("self.x", A)
        yield ("Test()", A)
        yield ("v()", A)
        yield ("self()", A)
        yield ("1()", A)
        yield ("Test(x,y)", A)
        yield ("v(x,y)", A)
        yield ("self(x,y)", B)
        yield ("1(x,y)", B)
        yield ("Test[x,y]", B)
        yield ("v[x,y]", B)
        yield ("self[x,y]", B)
        yield ("1[x.y]", B)
        yield ("Test(x,y).@self[a,b]", B)        
        yield ("v(x,y).x[a,b]", B)            
        yield ("self(x,y).3[a,b)", B)
        yield ("1(x,y).T[a,b)", B)
        yield ("Test[x,y).x(a,b)", B)
        yield ("v[x,y).x(a,b)", A)
        yield ("self[x,y).self(a,b)", B)
        yield ("1[x.y).T(a,b)", B)
        yield ("∅", B)
        yield ("-x", A)
        yield ("-(y + x = 2 * x)", B)
        yield ("(y + x' = 2 * x)'", B)
        yield ("ex x in Range(a,b), y in c, z {and (a,b,c)}", B)
        yield ("exn$1 x {all y {true}}", A)
        yield ("all x {not x}", B)
        yield ("and (x,y,z)", B)
        yield ("xor (x,y,z)", B)
        yield ("or (x,y,z)", B)
        yield ("iif (x,y)", B)
        yield ("impl (x,y)", B)
        yield ("is (x,Nat)", B)
    ]

    [<Test>]
    [<TestCaseSource("BaseCases")>]
    member this.TestBaseCase(var: string * SomeUnion) =
        Assert.That(true)

NUnit will discover 40 (instead of 48) test cases and split the TestBaseCase into five different tests:

image

@OsirisTerje
Copy link
Member

I suspect this is part of the same naming issues we have on the testcases (and testcasesources). I am no F# dev, so would appreciate of you could upload a working F# project with the code above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants