Search Issue Tracker
Won't Fix
Votes
0
Found in
2017.4.0f1
2018.3.0a1
2018.4.0f1
2019.1.0a1
2019.1.5f1
2019.2.0a1
2019.3.0a1
Issue ID
1160202
Regression
No
It is not possible to write Unit Tests in C# that Fakes modal dialogs
To reproduce:
1. Download attached “UnitTestFaking.zip" project and open in Unity
2. Open Test Runner
3. Press EditMode tab
4. Select "TestDialogWithCancel" Test and press "Run Selected" button
5. In the opened Dialog box press Cancel button
6. Observe that Test succeeded
7. Select "TestDialogWithCancel" Test and press "Run Selected" button
8. In the opened Dialog box press Save button
9. Observe that Test failed
Expected Result: Automated Unit-Test runs without the need for User Interaction
Actual Result: User Interaction is needed to complete Automated Unit-Test
Notes:
- This case is more like a Feature request
Reproduced on Unity 2017.4.0f1, 2017.4.29f1, 2018.3.14f1, 2018.4.2f1, 2019.1.6f1, 2019.2.0b5 and 2019.3.0a5
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "UnassignedReferenceException" is thrown when building the project and a scene is selected in the Project View
- Android Player freezes on some Mali GPU devices when Lighting Cast Shadows changed to OFF at runtime
- Desktop Linux runtime does not respect -popupwindow command line argument
- Shader Graph more options dropdown button does not open the dropdown when clicked all the way to the right of the button
- “Attempting to draw with missing bindings“ warning lacks root cause indication and is thrown each frame when StructuredBuffer is accessed on DirectX12
Resolution Note:
I am not sure why it is necessary to invoke the dialog.
If the intention of the test is to save the scene, then EditorSceneManager.SaveScene can be called, rather than EditorSceneManager.SaveModifiedScenesIfUserWantsTo. If the intention is to not save the scene, then the scene can just be closed without calling a save method