Unity Testing - zzragida/UnityDocs GitHub Wiki
Reference
Unit Testing
- TDD์ ๋ํ ์ดํด๊ฐ ํ์ํจ
- TDD์ ๋ฌธํ์ ๋ํ ์ดํด๊ฐ ํ์ํจ
- TDD์์ ์ฌ์ฉ๋๋ ์ฉ์ด์ ์ฉ์ด๋ค์ด ์? ์ฌ์ฉ๋๋์ง ์ดํดํด์ผ ํจ
- Arrange/Act/Assert. Mock, Fake, Stub ๋ฑ...
- ์์คํ
์ค๊ณ ๋ํ TDD์ ์ ํฉํ ํํ๋ก ์ค๊ณ๋์ด์ผ ํจ
- Visual Studio์ ์ฐ๋ํด์ Unit Test๋ฅผ ์คํํ ์ ์๋ ๋ฐฉ๋ฒ์ ์์๊น? Unity๋ VS ์๋ค ๊ฐ๋คํ๊ธฐ ์งฑ๋จ
- UnitTestRunner ์ค์ ์ "Run on Recompile"๋ก ๋ณ๊ฒฝํด ๋์ผ๋ฉด ์ ๋ํฐ ์ปดํ์ผ ์์ ๋ง๋ค ํ
์คํธ๋ฅผ ์งํํจ
- ์ ์ค์ ๋๋ก ํ๋ฉด ์กฐ๊ธ์ ์ฌ์ฉํ๊ธฐ ํธ๋ฆฌํด ์ง
- ๋น๋์์ ํ
์คํธ ๋ฆฌ์์ค(์์ค)๋ค์ ๋ถ๋ฆฌํ ์ ์๋์ง?
- ํ
์คํธ ์ฝ๋๋ค์ Editor ํด๋๋ฐ์ ์์ฑ๋์ด์ผ ํ๊ธฐ ๋๋ฌธ์ ๋น๋์์๋ ํฌํจ๋์ง ์์
- ๋จ์ ํ
์คํธ์ ํ์ํ ๋๊ตฌ๋ค
- Unity Test Tools์์๋ NUnit, NSubstitute ๋๊ตฌ๋ฅผ ์ฌ์ฉํจ
- NSubstitue๋ก Mock, Fake, Stub ๊ฐ์ฒด๋ฅผ ์์ฑํ ์ ์์
- Headless running (batch mode)
- resultFilePath
- filter
- categories
- ex) Unity.exe -batchmode -nographics -executeMethod UnityTest.Batch.RunUnitTests -resultFilePath=C:\temp\results.xml -quit
Assertion component
- ์ ๋ํฐ ์๋ํฐ๋ง์ ์ด์ฉํด์ ๊ฒ์์ค๋ธ์ ํธ์ ์ ๋ณด๋ฅผ ๋น๊ตํ๋ ํ
์คํธ
Integration Test
- https://bitbucket.org/Unity-Technologies/unitytesttools/wiki/IntegrationTestsRunner
- ๊ฐ ์ค๋ธ์ ํธ๋ฅผ ํ
์คํธ ์กฐ๊ฑด์ ๋ง์ถฐ์ ๊ฒ์ฆ
- ํ
์คํธ ๋ก๋ฉ์๊ฐ์ด ๊ธธ๊ธฐ ๋๋ฌธ์ ์ ์ฉ์ฌ๋ถ๋ ์กฐ๊ธ ์๊ฐํด ๋ณด์
- ํ์ฉํ ๋์
- UI ์๋ฎฌ๋ ์ด์
ํ
์คํธ
- UI๋ฅผ ์๋ฎฌ๋ ์ด์
ํ๋ฉด์ ๊ฐ ์ค๋ธ์ ํธ๊ฐ ์ ์์ ์ผ๋ก ๋ก๋ฉ๋๋์ง ํ์ธ
- Headless running (batch mode)
- testscenes
- pattern : "*Test[s].unity"
- targetPlatform
- resultsFileDirectory
- ex) Unity.exe -batchmode -executeMethod UnityTest.Batch.RunIntegrationTests -testscenes=TestScene1,TestScene2 -targetPlatform=StandaloneWindows -resultsFileDirectory=C:\temp\