Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure each TestCase runs all tests under one GameHost #1524

Merged
merged 9 commits into from Apr 18, 2018

Conversation

peppy
Copy link
Sponsor Member

@peppy peppy commented Apr 17, 2018

Aligns headless nUnit testing to how we expect tests to behave in VisualTests.

Aligns headless nUnit testing to how we expect tests to behave in VisualTests.
public override void RunTest()
{
using (var host = new HeadlessGameHost())
host.Run(new FrameworkTestCaseTestRunner(this));

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -42,6 +42,11 @@ public abstract class GameHost : IIpcHost, IDisposable

private FrameworkDebugConfigManager debugConfig;

internal void Run(object p)
{
throw new NotImplementedException();

This comment was marked as off-topic.

This comment was marked as off-topic.

}
catch
{
}

host.Dispose();

This comment was marked as off-topic.

[TearDown]
public void RunTests()
{
var task = runner.Schedule(() => runner.RunTest(this));

This comment was marked as off-topic.

}, time_between_tests);
}, e =>

{
// Other tests may run even if this one failed, so the TestCase still needs to be removed
Remove(test);

This comment was marked as off-topic.

}, time_between_tests);
}, e =>

This comment was marked as off-topic.

/// Blocks execution until TestCase runs to completion.
/// </summary>
/// <param name="testCase">The TestCase to run.</param>
public void RunTestFromOtherThread(TestCase testCase)

This comment was marked as off-topic.

@peppy peppy added this to the April 2018 milestone Apr 17, 2018
@@ -74,7 +82,9 @@ public virtual void RunTest()
/// This test must run before any other tests, as it relies on <see cref="StepsContainer"/> not being cleared and not having any elements.
/// </summary>
[Test, Order(int.MinValue)]
public void TestConstructor() { mainTest = false; }
public void TestConstructor()
{

This comment was marked as off-topic.

This comment was marked as off-topic.

@smoogipoo
Copy link
Contributor

I think you'll want to make an osu!-side PR before this is merged in. Some of it might have to change to accomodate for OsuTestCase.

@peppy
Copy link
Sponsor Member Author

peppy commented Apr 18, 2018

Yep, that's next thing on my list.

@smoogipoo
Copy link
Contributor

Plz check the last commit and merge whenever.

@peppy
Copy link
Sponsor Member Author

peppy commented Apr 18, 2018

What's the reasoning for that change?

@smoogipoo
Copy link
Contributor

Because OsuTestCase creates a TestCaseTestRunner that derives from OsuGameBase and not Game (interface), and that object needs to construct a TestRunner (made public).

@peppy
Copy link
Sponsor Member Author

peppy commented Apr 18, 2018

Aha

@peppy peppy merged commit 16e6a45 into ppy:master Apr 18, 2018
@peppy peppy deleted the better-test-case branch July 5, 2018 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants