LazyDuchess / OpenTS2

Open source re-implementation of The Sims 2 in Unity
Mozilla Public License 2.0
221 stars 17 forks source link

Add unit tests through unity test runner #8

Closed ammaraskar closed 1 year ago

ammaraskar commented 1 year ago

As per the unity guide, this requires creating an assembly that depends on the nunit.framework.dll reference. In order to allow this testing assembly to access the code under the OpenTS2 folder, we create a ScriptsAssembly assembly that the Tests assembly can depend on.

Unfortunately these tests can only be run through unity or the Rider IDE but unless we want to do a clean separation of all the Unity bits from the C# code this will likely be the easiest option.

If this looks good and we want to go with this for testing, I'll go ahead and add a github workflow so these tests run on CI.

Tests running in Unity

image

Tests in the Rider IDE

image

LazyDuchess commented 1 year ago

Looks good to me, I imagine we can replace it eventually without that much trouble as I'd like to go through with abstracting the Unity-specific code as much as possible.

ammaraskar commented 1 year ago

Yeah, the nice thing is unity just uses nunit so it's pretty easy to move off it and just use nunit from a visual studio solution directly in the future.