Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/contributing/how-to-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

Unit and Integration tests for Unity can be found under `src/tests/`.

## Testing requirements
Tests currently run with NUnit 2.6.4.

## Running tests
Tests can be run after building the Unity project. To run the tests execute `test.cmd` on Windows or `test.sh` on Mac.

We use [Appveyor](https://ci.appveyor.com/project/github-windows/unity/build/tests) as the CI for this project to run tests, but it is also necessary to run tests locally when making code changes.
24 changes: 24 additions & 0 deletions test.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo off
setlocal

set Config=Debug
if not %1.==. (
set Config=%1
)

set Exclude=''
if not %2.==. (
set Exclude=%2
)

:: make sure at Unity project root directory
set NunitDirectory=packages\NUnit.Runners.2.6.4\tools
echo %NunitDirectory%
set ConsoleRunner=%NunitDirectory%\nunit-console.exe
echo %ConsoleRunner%

:: run tests
echo Running "build\IntegrationTests\IntegrationTests.dll" "build\IntegrationTests\TestUtils.dll" "build\TaskSystemIntegrationTests\TaskSystemIntegrationTests.dll" "build\UnitTests\TestUtils.dll" "build\UnitTests\UnitTests.dll" "src\tests\TestUtils\bin\%Config%\TestUtils.dll" /exclude=%Exclude%
call %ConsoleRunner% "build\IntegrationTests\IntegrationTests.dll" "build\IntegrationTests\TestUtils.dll" "build\TaskSystemIntegrationTests\TaskSystemIntegrationTests.dll" "build\UnitTests\TestUtils.dll" "build\UnitTests\UnitTests.dll" "src\tests\TestUtils\bin\%Config%\TestUtils.dll" /exclude=%Exclude%

endlocal
15 changes: 15 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh -eu
Configuration="Debug"
if [ $# -gt 0 ]; then
Configuration=$1
fi

Exclude=""
if [ $# -gt 1 ]; then
Exclude="/exclude=$2"
fi

NunitDirectory="packages\NUnit.Runners.2.6.4\tools"
ConsoleRunner="$NunitDirectory\nunit-console.exe"

$ConsoleRunner "build\IntegrationTests\IntegrationTests.dll" "build\IntegrationTests\TestUtils.dll" "build\TaskSystemIntegrationTests\TaskSystemIntegrationTests.dll" "build\UnitTests\TestUtils.dll" "build\UnitTests\UnitTests.dll" "src\tests\TestUtils\bin\\$Configuration\TestUtils.dll" $Exclude