Skip to content

Commit

Permalink
Rename tab 'Errors and Failures' to 'Test Results', activate tab on t…
Browse files Browse the repository at this point in the history
…est run finished
  • Loading branch information
rowo360 committed Feb 21, 2025
1 parent cffa489 commit 2e11777
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private void WireUpEvents()
UpdateViewCommands();

_lastFilesLoaded = _model.TestCentricProject.TestFiles.ToArray();
_view.ResultTabs.InvokeIfRequired(() => _view.ResultTabs.SelectedIndex = 0);
};

_model.Events.TestsUnloading += (TestEventArgse) =>
Expand Down Expand Up @@ -210,6 +211,8 @@ void OnRunFinished(ResultNode result)

string resultPath = Path.Combine(_model.WorkDirectory, "TestResult.xml");
_model.SaveResults(resultPath);
_view.ResultTabs.InvokeIfRequired(() => _view.ResultTabs.SelectedIndex = 1);

//try
//{
// _model.SaveResults(resultPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ private void InitializeComponent()
this.errorTab.Name = "errorTab";
this.errorTab.Size = new System.Drawing.Size(490, 333);
this.errorTab.TabIndex = 0;
this.errorTab.Text = "Errors and Failures";
this.errorTab.Text = "Test Results";
this.errorTab.UseVisualStyleBackColor = true;
//
// errorsAndFailuresView1
Expand Down
8 changes: 8 additions & 0 deletions src/TestCentric/tests/Presenters/Main/WhenTestRunCompletes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace TestCentric.Gui.Presenters.Main
{
using System.Windows.Forms;
using Model;

public class WhenTestRunCompletes : MainPresenterTestBase
Expand All @@ -22,6 +23,7 @@ public void SimulateTestRunFinish()
_model.ResultSummary.Returns(new ResultSummary() { FailureCount = 1 });
_model.IsTestRunning.Returns(false);
_model.SelectedTests.Returns(new TestSelection(new[] { new TestNode("<test-case id='1' />") }));
_view.ResultTabs.InvokeIfRequired(Arg.Do<MethodInvoker>(x => x.Invoke()));

var resultNode = new ResultNode("<test-run id='XXX' result='Failed' />");
FireRunFinishedEvent(resultNode);
Expand Down Expand Up @@ -61,5 +63,11 @@ public void RunSummaryIsDisplayed()
{
_view.RunSummaryButton.Received().Checked = true;
}

[Test]
public void TestResultTabIsDisplay()
{
_view.ResultTabs.Received().SelectedIndex = 1;
}
}
}
8 changes: 8 additions & 0 deletions src/TestCentric/tests/Presenters/Main/WhenTestsAreLoaded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace TestCentric.Gui.Presenters.Main
{
using System.Windows.Forms;
using Model;

public class WhenTestsAreLoaded : MainPresenterTestBase
Expand All @@ -23,6 +24,7 @@ public void SimulateTestLoad()
TestNode testNode = new TestNode("<test-suite id='1'/>");
_model.LoadedTests.Returns(testNode);
_model.SelectedTests.Returns(new TestSelection(new[] { testNode }));
_view.ResultTabs.InvokeIfRequired(Arg.Do<MethodInvoker>(x => x.Invoke()));

var project = new TestCentricProject(_model, "dummy.dll");
_model.TestCentricProject.Returns(project);
Expand Down Expand Up @@ -59,6 +61,12 @@ public void CheckElementVisibility(string propName, bool visible)
ViewElement(propName).Received().Visible = visible;
}

[Test]
public void TestPropertiesTabIsDisplay()
{
_view.ResultTabs.Received().SelectedIndex = 0;
}

#if NYI
[Test]
public void View_Receives_TestAssembliesLoaded()
Expand Down

0 comments on commit 2e11777

Please sign in to comment.