game-ci / unity-test-runner

Run tests for any Unity project
https://github.com/marketplace/actions/unity-test-runner
MIT License
215 stars 136 forks source link

Issue no tests found #106

Closed andrei-serguienko closed 3 years ago

andrei-serguienko commented 3 years ago

Hello, I have an issue, I have searched everywhere and I ask in Discord but nobody can find a solution.

Where I run my tests is like no tests were found I have this output :

=================
Analyze result:
✅ Test Results - 0/0 - Passed in 0.000s

I have a new Unity project with 2 simple tests: SimplePlayModeTest and SimpleEditModeTest

I can run the tests in the Unity Editor everything is working. I don't know what I have missed or misunderstood.

If you have any idea where it can come from? I will be very happy to know 😸

webbertakken commented 3 years ago

If you use the default path, then you shouldn't specify the projectPath parameters

That said it's probably related to the assembly definition not being correctly configured.

sacOO7 commented 3 years ago

No, I don't think it's an assembly definition issue. I am facing the same issue. It works well with webbertakken/unity-test-runner@v2.0-alpha-1 but doesn't work at all with gameci/unity-test-runner@v2.0. Also, not sure why this issue is closed without resolving it in the first place.

davidmfinol commented 3 years ago

gameci/unity-test-runner@v2.0.

We don't have 2.0. Did you mean gameci/unity-test-runner@v2 ?

sacOO7 commented 3 years ago

@davidmfinol yes that's the one I meant, tests are not working with that particular version.

sacOO7 commented 3 years ago

I have a public repository https://github.com/ably-fork/ably-unity, Can you please check what might be the issue with workflow defined to test the code? You can see workflow failed here with error to check number of tests passed https://github.com/ably-fork/ably-unity/runs/3920011392 for this particular commit

davidmfinol commented 3 years ago

In your logs, there is this:

Assembly 'Library/ScriptAssemblies/PlayMode.dll' will not be loaded due to errors:
Reference has errors 'IO.Ably'.
Assembly 'Library/ScriptAssemblies/EditMode.dll' will not be loaded due to errors:
Reference has errors 'IO.Ably'.
Assembly 'Assets/Ably/Plugins/IO.Ably.dll' will not be loaded due to errors:
IO.Ably references strong named Newtonsoft.Json Assembly references: 9.0.0.0 Found in project: 10.0.0.0.

Your tests aren't running because the assembly definitions aren't being loaded because of a versioning issue with Json.NET. I've found that getting a version of Json.NET that works well across all Unity versions/platforms can be tricky. I'm currently (and would recommend) using pure UPM to install this fork: https://github.com/jilleJr/Newtonsoft.Json-for-Unity

robGG1997 commented 1 year ago

@davidmfinol I've made sure to check my test assemblies .asmdef and also checked my logs and no reference to unloaded references, the project I work on is open source much like this one so you can take a look at the action https://github.com/ChainSafe/web3.unity/actions/runs/6130712963/job/16640060573, it's a package test runner, am I doing anything wrong?

robGG1997 commented 1 year ago

@davidmfinol I've made sure to check my test assemblies .asmdef and also checked my logs and no reference to unloaded references, the project I work on is open source much like this one so you can take a look at the action https://github.com/ChainSafe/web3.unity/actions/runs/6130712963/job/16640060573, it's a package test runner, am I doing anything wrong?

The tests directory is https://github.com/ChainSafe/web3.unity/tree/rob/automated-unity-tests-603/src/UnityPackages/io.chainsafe.web3-unity/Tests/Runtime runs and passes locally in the UnitySampleProject

davidmfinol commented 1 year ago

Following up on discord: https://discord.com/channels/710946343828455455/1150042726595821688