geberit / Revit.TestRunner

Unit Test Runner for Autodesk Revit
MIT License
83 stars 30 forks source link

Assert.Pass() causes tests to faul #20

Closed sylvesp closed 2 years ago

sylvesp commented 2 years ago
    [Test]
    public void ShouldPassSomeTest()
    {
        Assert.Pass("All is OK");
    }

Assert.Pass() - shouldn't cause the test runner to report failed test.

The fix should probably go into

    TestInstance.ExecuteTestMethod(...)

to account for NUnit.Framework.SuccessException ?

    /// <summary>
    /// Executes the test method.
    /// </summary>
    public async Task ExecuteTestMethod( string methodName )
    {
        var method = Type.GetMethod( methodName );

        try {
            await InvokeMethod( Instance, mSetUp, mPossibleParams );
            await InvokeMethod( Instance, method, mPossibleParams );
        }
        catch(NUnit.Framework.SuccessException e) {
            //Ignore 
        }
        finally {
            await InvokeMethod( Instance, mTearDown, mPossibleParams );
        }
    }        
tobiasfloescher-geberit commented 2 years ago

Done

sylvesp commented 2 years ago

Thanx!