diff --git a/rider/src/test/kotlin/base/integrationTests/UnityTestEnvironment.kt b/rider/src/test/kotlin/base/integrationTests/UnityTestEnvironment.kt index c5d869a1a..7c0c5d082 100644 --- a/rider/src/test/kotlin/base/integrationTests/UnityTestEnvironment.kt +++ b/rider/src/test/kotlin/base/integrationTests/UnityTestEnvironment.kt @@ -37,5 +37,6 @@ val TestMethod.unityEnvironment: UnityTestEnvironmentInstance? method.annotations.filterIsInstance().firstOrNull()) enum class UnityVersion(val version: String) { - V2020("2020") + V2020("2020"), + V2022("2022") } \ No newline at end of file diff --git a/rider/src/test/kotlin/integrationTests/DebuggerTest2020.kt b/rider/src/test/kotlin/integrationTests/DebuggerTest2020.kt index 4daa591cf..86e9be8d9 100644 --- a/rider/src/test/kotlin/integrationTests/DebuggerTest2020.kt +++ b/rider/src/test/kotlin/integrationTests/DebuggerTest2020.kt @@ -15,7 +15,7 @@ import java.io.File @TestEnvironment(platform = [PlatformType.WINDOWS_ALL, PlatformType.MAC_OS_ALL]) class DebuggerTest2020 : IntegrationTestWithUnityProjectBase() { - override fun getSolutionDirectoryName() = "UnitTesting/Project2020" + override fun getSolutionDirectoryName() = "UnityDebugAndUnitTesting/Project" override val unityMajorVersion = UnityVersion.V2020 override fun preprocessTempDirectory(tempDir: File) { diff --git a/rider/src/test/kotlin/integrationTests/DebuggerTest2022.kt b/rider/src/test/kotlin/integrationTests/DebuggerTest2022.kt new file mode 100644 index 000000000..359ae9110 --- /dev/null +++ b/rider/src/test/kotlin/integrationTests/DebuggerTest2022.kt @@ -0,0 +1,58 @@ +package integrationTests + +import base.integrationTests.* +import com.intellij.xdebugger.XDebuggerManager +import com.intellij.xdebugger.breakpoints.XLineBreakpoint +import com.jetbrains.rider.debugger.breakpoint.DotNetLineBreakpointProperties +import com.jetbrains.rider.plugins.unity.debugger.breakpoints.UnityPausepointBreakpointType +import com.jetbrains.rider.plugins.unity.debugger.breakpoints.convertToLineBreakpoint +import com.jetbrains.rider.test.annotations.TestEnvironment +import com.jetbrains.rider.test.enums.PlatformType +import com.jetbrains.rider.test.scriptingApi.* +import org.testng.annotations.AfterMethod +import org.testng.annotations.Test +import java.io.File + +@TestEnvironment(platform = [PlatformType.WINDOWS_ALL, PlatformType.MAC_OS_ALL]) +class DebuggerTest2022 : IntegrationTestWithUnityProjectBase() { + override fun getSolutionDirectoryName() = "UnityDebugAndUnitTesting/Project" + override val unityMajorVersion = UnityVersion.V2022 + + override fun preprocessTempDirectory(tempDir: File) { + super.preprocessTempDirectory(tempDir) + + val newBehaviourScript = "NewBehaviourScript.cs" + val sourceScript = testCaseSourceDirectory.resolve(newBehaviourScript) + if (sourceScript.exists()) { + sourceScript.copyTo(tempDir.resolve("Assets").resolve(newBehaviourScript), true) + } + } + + @Test + fun checkBreakpoint() { + attachDebuggerToUnityEditorAndPlay( + { + toggleBreakpoint("NewBehaviourScript.cs", 8) + toggleBreakpoint("NewBehaviourScript.cs", 15) + }, + { + waitForPause() + dumpFullCurrentData() + resumeSession() + waitForPause() + dumpFullCurrentData() + resumeSession() + }, testGoldFile) + } + + @AfterMethod(alwaysRun = true) + fun removeAllUnityPausepoints() { + XDebuggerManager.getInstance(project).breakpointManager.allBreakpoints.filter { + it.type is UnityPausepointBreakpointType + }.forEach { + @Suppress("UNCHECKED_CAST") + convertToLineBreakpoint(project, it as XLineBreakpoint) + } + removeAllBreakpoints() + } +} \ No newline at end of file diff --git a/rider/src/test/kotlin/integrationTests/UnitTestingTest2020.kt b/rider/src/test/kotlin/integrationTests/UnitTestingTest2020.kt index 2c6ec2931..f587c068e 100644 --- a/rider/src/test/kotlin/integrationTests/UnitTestingTest2020.kt +++ b/rider/src/test/kotlin/integrationTests/UnitTestingTest2020.kt @@ -12,7 +12,7 @@ import org.testng.annotations.Test @TestEnvironment(platform = [PlatformType.WINDOWS_ALL, PlatformType.MAC_OS_ALL]) class UnitTestingTest2020 : IntegrationTestWithUnityProjectBase() { - override fun getSolutionDirectoryName() = "UnitTesting/Project2020" + override fun getSolutionDirectoryName() = "UnityDebugAndUnitTesting/Project" override val unityMajorVersion = UnityVersion.V2020 @Test fun checkRunAllTestsFromProject() { diff --git a/rider/src/test/kotlin/integrationTests/UnitTestingTest2022.kt b/rider/src/test/kotlin/integrationTests/UnitTestingTest2022.kt new file mode 100644 index 000000000..a19d87f18 --- /dev/null +++ b/rider/src/test/kotlin/integrationTests/UnitTestingTest2022.kt @@ -0,0 +1,66 @@ +package integrationTests + +import base.integrationTests.IntegrationTestWithUnityProjectBase +import base.integrationTests.UnityVersion +import com.jetbrains.rider.test.annotations.Mute +import com.jetbrains.rider.test.annotations.TestEnvironment +import com.jetbrains.rider.test.enums.PlatformType +import com.jetbrains.rider.test.scriptingApi.RiderUnitTestScriptingFacade +import com.jetbrains.rider.test.scriptingApi.changeFileContent +import com.jetbrains.rider.test.scriptingApi.withUtFacade +import org.testng.annotations.Test + +@TestEnvironment(platform = [PlatformType.WINDOWS_ALL, PlatformType.MAC_OS_ALL]) +class UnitTestingTest2022 : IntegrationTestWithUnityProjectBase() { + override fun getSolutionDirectoryName() = "UnityDebugAndUnitTesting/Project" + override val unityMajorVersion = UnityVersion.V2022 + @Test + fun checkRunAllTestsFromProject() { + withUtFacade(project) { + it.waitForDiscovering() + + val session = it.runAllTestsInProject( + "Tests", + 5, + RiderUnitTestScriptingFacade.defaultTimeout, + 5 + ) + it.compareSessionTreeWithGold(session, testGoldFile) + } + } + + @Mute("RIDER-95762") + @Test(description = "RIDER-54359") + fun checkRefreshBeforeTest() { + withUtFacade(project) { + val file = activeSolutionDirectory.resolve("Assets").resolve("Tests").resolve("NewTestScript.cs") + it.waitForDiscovering() + it.runAllTestsInProject( + "Tests", + 5, + RiderUnitTestScriptingFacade.defaultTimeout, + 5 + ) + + it.closeAllSessions() + + changeFileContent(project, file) { + it.replace("NewTestScriptSimplePasses(", "NewTestScriptSimplePasses2(") + } + + it.runAllTestsInProject( + "Tests", + 5, + RiderUnitTestScriptingFacade.defaultTimeout, -1 + ) + val session2 = it.runAllTestsInProject( + "Tests", + 5, + RiderUnitTestScriptingFacade.defaultTimeout, + 5 + ) + + it.compareSessionTreeWithGold(session2, testGoldFile) + } + } +} \ No newline at end of file diff --git a/rider/testData/integrationTests/DebuggerTest2022/checkBreakpoint/gold/checkBreakpoint.gold b/rider/testData/integrationTests/DebuggerTest2022/checkBreakpoint/gold/checkBreakpoint.gold new file mode 100644 index 000000000..f899ed544 --- /dev/null +++ b/rider/testData/integrationTests/DebuggerTest2022/checkBreakpoint/gold/checkBreakpoint.gold @@ -0,0 +1,13 @@ +--> NewBehaviourScript.cs:8(110,129) // Debug.Log("Start"); +NewBehaviourScript.Start() in , Assembly-CSharp.dll + +Active scene = SampleScene (Assets/Scenes/SampleScene.unity): null + +this.gameObject = Main Camera (active: true, layer: 0): null + +this = enabled: true, gameObject: Main Camera: NewBehaviourScript + +--> NewBehaviourScript.cs:15(310,336) // Debug.Log(binaryNotation); +NewBehaviourScript.Update() in , Assembly-CSharp.dll + +Active scene = SampleScene (Assets/Scenes/SampleScene.unity): null + +this.gameObject = Main Camera (active: true, layer: 0): null + +this = enabled: true, gameObject: Main Camera: NewBehaviourScript + binaryNotation = 2000000: int + diff --git a/rider/testData/integrationTests/UnitTestingTest2022/checkRefreshBeforeTest/gold/checkRefreshBeforeTest.gold b/rider/testData/integrationTests/UnitTestingTest2022/checkRefreshBeforeTest/gold/checkRefreshBeforeTest.gold new file mode 100644 index 000000000..51e790e3a --- /dev/null +++ b/rider/testData/integrationTests/UnitTestingTest2022/checkRefreshBeforeTest/gold/checkRefreshBeforeTest.gold @@ -0,0 +1,6 @@ +-ROOT + -Tests + -Tests + -NewTestScript + NewTestScriptSimplePasses2 + NewTestScriptWithEnumeratorPasses diff --git a/rider/testData/integrationTests/UnitTestingTest2022/checkRunAllTestsFromProject/gold/checkRunAllTestsFromProject.gold b/rider/testData/integrationTests/UnitTestingTest2022/checkRunAllTestsFromProject/gold/checkRunAllTestsFromProject.gold new file mode 100644 index 000000000..a15a711c3 --- /dev/null +++ b/rider/testData/integrationTests/UnitTestingTest2022/checkRunAllTestsFromProject/gold/checkRunAllTestsFromProject.gold @@ -0,0 +1,6 @@ +-ROOT + -Tests + -Tests + -NewTestScript + NewTestScriptSimplePasses + NewTestScriptWithEnumeratorPasses diff --git a/rider/testData/solutions/UnitTesting/Project2020/ProjectSettings/ProjectVersion.txt b/rider/testData/solutions/UnitTesting/Project2020/ProjectSettings/ProjectVersion.txt deleted file mode 100644 index c2a2f868f..000000000 --- a/rider/testData/solutions/UnitTesting/Project2020/ProjectSettings/ProjectVersion.txt +++ /dev/null @@ -1,2 +0,0 @@ -m_EditorVersion: 2020.1.0b5 -m_EditorVersionWithRevision: 2020.2.0b5 (e2067236bd5c) diff --git a/rider/testData/solutions/UnitTesting/Explicit/Problem.cs b/rider/testData/solutions/UnityDebugAndUnitTesting/Explicit/Problem.cs similarity index 100% rename from rider/testData/solutions/UnitTesting/Explicit/Problem.cs rename to rider/testData/solutions/UnityDebugAndUnitTesting/Explicit/Problem.cs diff --git a/rider/testData/solutions/UnitTesting/PlayMode/Problems.cs b/rider/testData/solutions/UnityDebugAndUnitTesting/PlayMode/Problems.cs similarity index 100% rename from rider/testData/solutions/UnitTesting/PlayMode/Problems.cs rename to rider/testData/solutions/UnityDebugAndUnitTesting/PlayMode/Problems.cs diff --git a/rider/testData/solutions/UnitTesting/PlayMode/Tests.asmdef b/rider/testData/solutions/UnityDebugAndUnitTesting/PlayMode/Tests.asmdef similarity index 100% rename from rider/testData/solutions/UnitTesting/PlayMode/Tests.asmdef rename to rider/testData/solutions/UnityDebugAndUnitTesting/PlayMode/Tests.asmdef diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Editor.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Editor.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/CommandLineParser.cs b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/CommandLineParser.cs similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/CommandLineParser.cs rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/CommandLineParser.cs diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/CommandLineParser.cs.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/CommandLineParser.cs.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/CommandLineParser.cs.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/CommandLineParser.cs.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/Editor.asmdef b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/Editor.asmdef similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/Editor.asmdef rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/Editor.asmdef diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/Editor.asmdef.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/Editor.asmdef.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/Editor.asmdef.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/Editor.asmdef.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/IntegrationTestHelper.cs b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/IntegrationTestHelper.cs similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/IntegrationTestHelper.cs rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/IntegrationTestHelper.cs diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/IntegrationTestHelper.cs.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/IntegrationTestHelper.cs.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Editor/IntegrationTestHelper.cs.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Editor/IntegrationTestHelper.cs.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/NewBehaviourScript.cs b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/NewBehaviourScript.cs similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/NewBehaviourScript.cs rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/NewBehaviourScript.cs diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/NewBehaviourScript.cs.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/NewBehaviourScript.cs.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/NewBehaviourScript.cs.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/NewBehaviourScript.cs.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Scenes.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Scenes.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Scenes.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Scenes.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Scenes/SampleScene.unity b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Scenes/SampleScene.unity similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Scenes/SampleScene.unity rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Scenes/SampleScene.unity diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Scenes/SampleScene.unity.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Scenes/SampleScene.unity.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Scenes/SampleScene.unity.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Scenes/SampleScene.unity.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Tests.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Tests.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/NewTestScript.cs b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/NewTestScript.cs similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/NewTestScript.cs rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/NewTestScript.cs diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/NewTestScript.cs.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/NewTestScript.cs.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/NewTestScript.cs.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/NewTestScript.cs.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/Tests.asmdef b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/Tests.asmdef similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/Tests.asmdef rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/Tests.asmdef diff --git a/rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/Tests.asmdef.meta b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/Tests.asmdef.meta similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Assets/Tests/Tests.asmdef.meta rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Assets/Tests/Tests.asmdef.meta diff --git a/rider/testData/solutions/UnitTesting/Project2020/Library/zero b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Library/zero similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Library/zero rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Library/zero diff --git a/rider/testData/solutions/UnitTesting/Project2020/Packages/manifest.json b/rider/testData/solutions/UnityDebugAndUnitTesting/Project/Packages/manifest.json similarity index 100% rename from rider/testData/solutions/UnitTesting/Project2020/Packages/manifest.json rename to rider/testData/solutions/UnityDebugAndUnitTesting/Project/Packages/manifest.json