TestContext.CurrentContext.Outcomeを見ましたが、探しているものがありません。私が正しくあなたの質問を理解していればMbUnit TestContextからテストが失敗する原因となった例外を取り出す方法
おかげ
パヴェル
TestContext.CurrentContext.Outcomeを見ましたが、探しているものがありません。私が正しくあなたの質問を理解していればMbUnit TestContextからテストが失敗する原因となった例外を取り出す方法
おかげ
パヴェル
は、私はあなたがして例外をキャッチするのtry-catchステートメントを使用して例外オブジェクトではありませんが
から、それを使用することができることを考えますスタックトレースなどをログから抽出することは可能です(https://github.com/Gallio/Gallio-VS2011-Integration/blob/master/MbUnitAdapter/MbUnitAdapter/StackTraceHunter.cs参照)。
おそらく行うための最善のことは、サブクラスTestAttributeです:
public class InspectExceptionAttribute : TestAttribute
{
protected override void Execute(PatternTestInstanceState state)
{
try
{
base.Execute(state);
}
catch (Exception e)
{
// do something with e
}
}
}
public class InspectExceptionTests
{
[InspectException]
public void With_interceptor()
{
throw new NotImplementedException();
}
[Test]
public void Without_interceptor()
{
throw new NotImplementedException();
}
}
その後、私は私は避けるようにしようとしているものですすべてのテストでこれをしなければならないでしょう –