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
- [VFX Graph] ArcTorus Transform changes in blackboard not reflected in Graph
- Text deletion works incorrectly in an input field when the Chinese language is used and the "Event System" Component is turned off
- Typed text doesn't appear in an input field when the Chinese language is used and the "Event System" Component is turned off
- Script associated with "GlobalVolumeFeature" is missing when inspecting "Mobile Renderer" Asset
- Clearable "RenderingCommandBuffer" errors are thrown in the Console when creating project using Universal 3D Template
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