Skip to content

Commit

Permalink
Mod README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nowsprinting committed Apr 30, 2024
1 parent ef0eaa7 commit ad0a7e2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,40 @@ public class MyTestClass
```


#### UnityVersion

`UnityVersionAttribute` is an NUnit test attribute class to skip test run if Unity version is older and/or newer than specified.

This attribute can attached to test method, test class (`TestFixture`) and test assembly.
Can be used with sync Test, async Test, and UnityTest.

Usage:

```csharp
using System;
using NUnit.Framework;
using TestHelper.Attributes;

[TestFixture]
public class MyTestClass
{
[Test]
[UnityVersion(newerThanOrEqual: "2022")]
public void MyTestMethod()
{
// Test run only for Unity 2022.1.0f1 or later.
}

[Test]
[UnityVersion(olderThan: "2019.4.0f1")]
public void MyTestMethod()
{
// Test run only for Unity older than 2019.4.0f1.
}
}
```


#### CreateScene

`CreateSceneAttribute` is an NUnit test attribute class to create new scene before running test.
Expand Down
1 change: 1 addition & 0 deletions Runtime/Attributes/UnityVersionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class UnityVersionAttribute : NUnitAttribute, IApplyToTest

/// <summary>
/// Skip this test run if Unity version is older and/or newer than specified.
/// Valid format, e.g., "2023.2.16f1", "2023.2", and "2023".
/// </summary>
/// <param name="newerThanOrEqual">This test will run if the Unity editor version is newer than or equal the specified version.</param>
/// <param name="olderThan">This test will run if the Unity editor version is older than the specified version.</param>
Expand Down

0 comments on commit ad0a7e2

Please sign in to comment.