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

Add BuildSceneAttribute and SceneManagerHelper.LoadSceneAsync method #73

Merged
merged 6 commits into from
Apr 29, 2024

Conversation

nowsprinting
Copy link
Owner

@nowsprinting nowsprinting commented Apr 29, 2024

Add BuildSceneAttribute and SceneManagerHelper.LoadSceneAsync method.

The intended use cases:

  • It needs to be set up before the load scene
  • load other scenes in the test

Usage:

using NUnit.Framework;
using TestHelper.Attributes;
using TestHelper.RuntimeInternals;
using UnityEngine;

[TestFixture]
public class MyTestClass
{
    [Test]
    [BuildScene("../../Scenes/SampleScene.unity")]
    public void MyTestMethod()
    {
        // Setup before load scene

        // Load scene
        await SceneManagerHelper.LoadSceneAsync("../../Scenes/SampleScene.unity");

        // Excercise the test
    }
}

Changes

  • Add BuildSceneAttribute. and LoadSceneAttribute inherits it.
  • Mod extract LoadSceneAsync method to SceneManagerHelper class (rename from ScenePathFinder).

@github-actions github-actions bot added the enhancement New feature or request label Apr 29, 2024

This comment has been minimized.

@nowsprinting nowsprinting changed the title Add BuildScene attribute Add BuildScene attribute and LoadSceneCoroutine method Apr 29, 2024
@nowsprinting nowsprinting changed the title Add BuildScene attribute and LoadSceneCoroutine method Add BuildScene attribute and LoadSceneAsync method Apr 29, 2024
Copy link

Code Metrics Report

master (5519b78) #73 (e3e8fe5) +/-
Coverage 70.8% 71.5% +0.7%
Code to Test Ratio 1:0.9 1:0.9 +0.0
Details
  |                    | master (5519b78) | #73 (e3e8fe5) |  +/-  |
  |--------------------|------------------|---------------|-------|
+ | Coverage           |            70.8% |         71.5% | +0.7% |
  |   Files            |               25 |            26 |    +1 |
  |   Lines            |              637 |           617 |   -20 |
- |   Covered          |              451 |           441 |   -10 |
+ | Code to Test Ratio |            1:0.9 |         1:0.9 |  +0.0 |
  |   Code             |             1190 |          1211 |   +21 |
+ |   Test             |             1117 |          1141 |   +24 |

Code coverage of files in pull request scope (64.7% → 81.2%)

Files Coverage +/-
Editor/TemporaryBuildScenesUsingInTest.cs 30.0% -13.9%
Runtime/Attributes/BuildSceneAttribute.cs 100.0% +100.0%
Runtime/Attributes/LoadSceneAttribute.cs 100.0% +8.9%
RuntimeInternals/SceneManagerHelper.cs 93.2% +93.2%

Reported by octocov

@nowsprinting nowsprinting merged commit fad6d14 into master Apr 29, 2024
8 checks passed
@nowsprinting nowsprinting deleted the feature/buildscene_attribute branch April 29, 2024 09:18
@nowsprinting nowsprinting changed the title Add BuildScene attribute and LoadSceneAsync method Add BuildSceneAttribute and SceneManagerHelper.LoadSceneAsync method Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant