Reputation: 2681
I'm using FitNesse to do some testing with Fixtures written in C#. One of my fixtures kicks off some testing suites to run in Ab Initio in a Unix environment. I would like to be able to kill the whole test suite if one of the tests within it fail. I imagine I would need some kind of return value from the test suite (on the unix box) and then that would get passed back up to my fixture which would kill FitNesse (from within my C# fixture). This is what my KickOff() method looks like right now:
public string KickOff()
{
var data = new Dictionary<string, string>();
foreach (var row in System.IO.File.ReadAllLines(unixConfigFile))
data.Add(row.Split('=')[0], String.Join("=", row.Split('=').Skip(1).ToArray()));
string server = data["servername"];
string userId = data["username"];
string password = data["password"];
StringEncryptor3DES encryptor = new StringEncryptor3DES("fitnesse");
password = encryptor.Decrypt(password);
UnixScriptRunner runner = new UnixScriptRunner(server, userId, password, unixPath, scriptName,EtlType.AbInitio);
return runner.Run() & EtlStatus.IsEtlSuccessful(runner.LogFile,EtlType.AbInitio) ? "True":"False";
}
I think I need something that catches the value of EtlStatus.IsEtlSuccessful(), if it is false it will terminte FitNesse. The two questions I have are this:
Is this reasoning correct?
What is the code needed to terminite/kill FitNesse (or end the test suite if there is a more graceful way)?
Edit: I did a little more research and it looks like it is the 'runner' that I have to kill. Still not sure how to do this though...
Upvotes: 2
Views: 1044
Reputation: 5266
If you're using Slim, you can throw an exception with "StopTest" in the class name to stop the test.
http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.ExceptionHandling
If you're using Fit, you can throw an AbandonStoryTestExecption to stop the test.
http://fitsharp.github.io/Fit/AbandonStoryTest.html
There's a new Fit feature coming in the next release (any day now!) to throw AbandonTestSuiteException to stop the entire test suite. There's no comparable feature with Slim AFAIK.
Upvotes: 2