c# - 从固定装置内杀死 FitNesse

标签 c# database fitnesse fitnesse-slim ab-initio

我正在使用 FitNesse 对用 C# 编写的 Fixtures 进行一些测试。我的一个装置启动了一些测试套件,以便在 Unix 环境中的 Ab Initio 中运行。如果其中一个测试失败,我希望能够终止整个测试套件。我想我需要从测试套件(在 unix 盒子上)返回某种返回值,然后将其传递回我的固定装置,这将杀死 FitNesse(从我的 C# 固定装置内)。这就是我的 KickOff() 方法现在的样子:

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";
}

我想我需要一些东西来捕获EtlStatus.IsEtlSuccessful()的值,如果它是假的,它将终止FitNesse。我的两个问题是:

这个推理正确吗?

终止/终止 FitNesse(或者如果有更优雅的方式则结束测试套件)所需的代码是什么?

编辑:我做了更多研究,看来我必须杀死它。但仍然不确定如何做到这一点......

最佳答案

如果您使用 Slim,则可以抛出类名中带有“StopTest”的异常来停止测试。

http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.ExceptionHandling

如果您使用 Fit,则可以抛出 AbandonStoryTestExeption 来停止测试。

http://fitsharp.github.io/Fit/AbandonStoryTest.html

下一个版本(现在的任何一天!)将推出一个新的 Fit 功能,可以抛出 AbandonTestSuiteException 来停止整个测试套件。 AFAIK 没有与 Slim 类似的功能。

关于c# - 从固定装置内杀死 FitNesse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23549780/

相关文章:

mysql - DB Complex 增量计数器

java - 在运行时替换类中的方法调用

C# 泛型 : Explicit restate of inherited constraints in overriden methods could break polymorphism?

c# MySQL like 查询不带参数

c# - ASP.NET 表单值验证场景

javascript - IBM Informix NodeJS 设置问题 - INFORMIXSERVER 值未在 sqlhosts 文件或注册表中列出

c# - 将 DataTable 导入 SQL Server 的最快方法是什么?

c# - 格式化规则在类成员声明之间有空行

java - Fitnesse Maven Linux 运行

.net - 如何从 FitNesse 调用 WCF 服务