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
- Foldout arrow indent is misaligned in the Inspector when used in Custom Type
- [Android] The Player screen turns black when playing a video under certain conditions
- Search window icons at the bottom are cut off when Search window is resized vertically
- "Try something else?" text label is cut off when searching for a long text in the Search window
- Rendering Debugger window sections do not have a minimum width set when resizing with the slider in the middle of the window
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