0
\$\begingroup\$

I have been reading about Edit Mode vs Play Mode testing and I'm not seeing any real reasons of why I would use Play mode testing over Edit mode testing. My assumption is that edit mode is better for writing tests and play mode is more for when testing is finalized.

What might sway someone to use one mode over the other?

\$\endgroup\$
0

1 Answer 1

0
\$\begingroup\$

I'm finding out that

  • UnityEngine.SceneManagement only works in Play Mode
  • Edit Mode tests seem to only run from the Test Runner directly

Biggest take-aways

  • Play Mode testing seems most beneficial and accurate to UX
  • Edit Mode seems to be for pre-commit style testing eg. run smoke tests whenever the editor is modified

My favorite article on Unity game testing is by Ray Wenderlich

Better Answer

Use EditMode tests for Unit tests.

  • Unit Testing
  • Integration Testing
  • Functional Testing

Edit Mode is out-of-game so it works great for quick testing. Especially if your game is really big then edit mode keeps you from losing compile time over and over again while still being able to make sure your building blocks are intact.

Use PlayMode tests for

  • End-to-End Testing
  • Acceptance Testing
  • Performance Testing
  • Smoke Testing

With Play Mode you're in game and are really capturing the user's experience in your tests. On a small interactive you really could put all your tests here.

All in all, learn the various testing types then mix-and-match to what works best for your specific application.

My favorite "quick" article on various testing types

Additionally

If your unity project is part of a continuous integration project (cicd) then you can use headless unity with unlocked fps as part of your validation.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .