jediwhale / fitsharp

Functional testing tools for .NET
http://fitsharp.github.io
Other
152 stars 73 forks source link

StopSuiteException not handled? #145

Closed essenius closed 7 years ago

essenius commented 8 years ago

Reading the FitNesse SLIM documentation it is supposed to be possible to throw an exception with StopSuite in the name which then should stop execution of the currently running test suite, similarly to the StopTest exception which only stops the current test.

It works fine with a StopTestException, but FitSharp doesn't seem to be handling the StopSuiteException.

I've created a small fixture to show:

        private static void ThrowStopIf(string conditionString, bool stopSuite, bool expectedValue)
        {
            bool condition;

            var raiseException = !bool.TryParse(conditionString, out condition) || condition == expectedValue;
            if (raiseException)
            {
                if (stopSuite)
                {
                    throw new StopSuiteException();
                }
                throw new StopTestException();
            }
        }

        public void StopTestIf(string condition)
        {
            ThrowStopIf(condition, false, true);
        }

        public void StopSuiteIf(string condition)
        {
            ThrowStopIf(condition, true, true);
        }

When I run StopTestIf (using FitNesse 20160618 and FitSharp 2.4) all works fine: the exception is recognized as special and it stops the test. image

But when I run StopSuiteIf, the StopSuiteException doesn't seem to get handled in a special way:

image

Is FitSharp indeed not handling the StopSuiteException? If so can that be fixed? If not, what am I doing wrong?

jediwhale commented 8 years ago

This has not been implemented in fitSharp yet. It will be in the next release.

On 2016-08-20 13:54, essenius wrote:

Reading the FitNesse SLIM documentation it is supposed to be possible to throw an exception with |StopSuite| in the name which then should stop execution of the currently running test suite, similarly to the |StopTest| exception which only stops the current test.

It works fine with a |StopTestException|, but FitSharp doesn't seem to be handling the |StopSuiteException|.

I've created a small fixture to show:

| private static void ThrowStopIf(string conditionString, bool stopSuite, bool expectedValue) { bool condition;

         var raiseException = !bool.TryParse(conditionString, out condition) || condition == expectedValue;
         if (raiseException)
         {
             if (stopSuite)
             {
                 throw new StopSuiteException();
             }
             throw new StopTestException();
         }
     }

     public void StopTestIf(string condition)
     {
         ThrowStopIf(condition, false, true);
     }

     public void StopSuiteIf(string condition)
     {
         ThrowStopIf(condition, true, true);
     }

works fine: the exception is recognized as special and it stops the test. image https://cloud.githubusercontent.com/assets/17417493/17833505/632bd4b0-671f-11e6-9f1e-79ad2a4fbb85.png

But when I run 'StopSuiteIf|, the|StopSuiteException` doesn't seem to get handled in a special way:

image https://cloud.githubusercontent.com/assets/17417493/17833506/83efaff0-671f-11e6-895a-d4efff90542a.png

Is FitSharp indeed not handling the StopSuiteException? If so can that be fixed? If not, what am I doing wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jediwhale/fitsharp/issues/145, or mute the thread https://github.com/notifications/unsubscribe-auth/AACXY5V-CLhDdVYvkLwrUjg7ZIMQziDeks5qh1uRgaJpZM4JpJpD.

Cheers, Mike Stockdale

/fit/Sharp http://fitsharp.github.com