Skip to content

Complete RunAsyncAction tests in FrameworkControllerTests #3075

Closed
@ChrisMaddock

Description

@ChrisMaddock

There are currently three tests with all assertions commented out. We should either make them work, or remove them.

#region RunAsyncAction
[TestCaseSource(nameof(EmptyFilters))]
public void RunAsyncAction_AfterLoad_ReturnsRunnableSuite(string filter)
{
new FrameworkController.LoadTestsAction(_controller, _handler);
new FrameworkController.RunAsyncAction(_controller, filter, _handler);
//var result = TNode.FromXml(_handler.GetCallbackResult());
//Assert.That(result.Name.ToString(), Is.EqualTo("test-suite"));
//Assert.That(result.Attributes["type"], Is.EqualTo("Assembly"));
//Assert.That(result.Attributes["id"], Is.Not.Null.And.StartWith("ID"));
//Assert.That(result.Attributes["name"], Is.EqualTo(EXPECTED_NAME));
//Assert.That(result.Attributes["runstate"], Is.EqualTo("Runnable"));
//Assert.That(result.Attributes["testcasecount"], Is.EqualTo(MockAssembly.Tests.ToString()));
//Assert.That(result.Attributes["result"], Is.EqualTo("Failed"));
//Assert.That(result.Attributes["passed"], Is.EqualTo(MockAssembly.Success.ToString()));
//Assert.That(result.Attributes["failed"], Is.EqualTo(MockAssembly.ErrorsAndFailures.ToString()));
//Assert.That(result.Attributes["skipped"], Is.EqualTo((MockAssembly.NotRunnable + MockAssembly.Ignored).ToString()));
//Assert.That(result.Attributes["inconclusive"], Is.EqualTo(MockAssembly.Inconclusive.ToString()));
//Assert.That(result.FindDescendants("test-suite").Count, Is.GreaterThan(0), "Run result should have child tests");
}
[Test]
public void RunAsyncAction_WithoutLoad_ReturnsError()
{
var ex = Assert.Throws<InvalidOperationException>(
() => new FrameworkController.RunAsyncAction(_controller, EMPTY_FILTER, _handler));
Assert.That(ex.Message, Is.EqualTo("The Run method was called but no test has been loaded"));
}
[Test]
public void RunAsyncAction_FileNotFound_ReturnsNonRunnableSuite()
{
var controller = new FrameworkController(MISSING_FILE, "ID", _settings);
new FrameworkController.LoadTestsAction(controller, _handler);
new FrameworkController.RunAsyncAction(controller, EMPTY_FILTER, _handler);
//var result = TNode.FromXml(_handler.GetCallbackResult());
//Assert.That(result.Name.ToString(), Is.EqualTo("test-suite"));
//Assert.That(result.Attributes["type"], Is.EqualTo("Assembly"));
//Assert.That(result.Attributes["runstate"], Is.EqualTo("NotRunnable"));
//Assert.That(result.Attributes["testcasecount"], Is.EqualTo("0"));
// Minimal check here to allow for platform differences
//Assert.That(GetSkipReason(result), Contains.Substring(MISSING_FILE));
//Assert.That(result.SelectNodes("test-suite").Count, Is.EqualTo(0), "Load result should not have child tests");
}
[Test]
public void RunAsyncAction_BadFile_ReturnsNonRunnableSuite()
{
var controller = new FrameworkController(BAD_FILE, "ID", _settings);
new FrameworkController.LoadTestsAction(controller, _handler);
new FrameworkController.RunAsyncAction(controller, EMPTY_FILTER, _handler);
//var result = TNode.FromXml(_handler.GetCallbackResult());
//Assert.That(result.Name.ToString(), Is.EqualTo("test-suite"));
//Assert.That(result.Attributes["type"], Is.EqualTo("Assembly"));
//Assert.That(result.Attributes["runstate"], Is.EqualTo("NotRunnable"));
//Assert.That(result.Attributes["testcasecount"], Is.EqualTo("0"));
// Minimal check here to allow for platform differences
//Assert.That(GetSkipReason(result), Contains.Substring(BAD_FILE));
//Assert.That(result.SelectNodes("test-suite").Count, Is.EqualTo(0), "Load result should not have child tests");
}
#endregion

Here's where they were added, looks like the tests were never completed: #173 (diff)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions