Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GD-4.2.2: First time user. Tests run with many error messages #516

Closed
SamuelAsherRivello opened this issue Jun 24, 2024 · 5 comments
Closed
Assignees
Labels
Exclude from release nodes This issue is an internal fix only and do not report at release notes. help wanted Extra attention is needed infos requested Needs additional infos to reproduce

Comments

@SamuelAsherRivello
Copy link

SamuelAsherRivello commented Jun 24, 2024

The used GdUnit4 version

GdUnit4 4.3.2

The used Godot version

v4.2.2-stable-mono

Operating System

Windows 11

Describe the bug

Hiya,

Great work on a great tool. I'm experiencing some issues. I'm using the latest public windows 11, the latest public godot, the latest version of your tool (From asset lib) that then updated itself. I am using the latest public version of rider and had to follow your docs and manually edit the csjproject. All compiles. The tests run.

Something unique in my project setup is that the "RMC Mingle" and "RMC Mini Mvcs" in my addons folder are local windows simlinks to improve my addon development workflow. I doubt that causes issues per below, but thought I'd mention it.

--

I'm a game dev with over 20 years of XP, the last decade in Unity.

I have created Mvcs architectures (https://bit.ly/mvc-architecture-for-unity-on-udemy) and Unit Testing courses (https://bit.ly/unit-testing-for-unity-course) for Unity.

I'm playing with Godot and enjoying it. I'd like to do a free YouTube video on "Unit Testing in Godot" and have tried several C#-friendly Godot unit testing pathways including yours.

I'd love some help with these bugs.

-Sam!

Feel free to say hi - https://www.linkedin.com/in/samuelasherrivello/

Happy to have a video chat too.

SETUP

Here is my godot version
2024-06-24_13-05-47

My default CS Project shows errors.
2024-06-24_13-21-38

I updated to this and the errors go away. The rest of the images assume this setup
2024-06-24_13-22-05

BUGS

The tests do indeed run properly. None of the tests appear in the "GDUnit" tab on the left which I assume is unexpected.
2024-06-24_13-06-01

The output is full of errors
2024-06-24_13-06-07

And I cannot edit any shortcuts
2024-06-24_13-06-36

And I see some warnings
2024-06-24_13-18-10

Steps to Reproduce

See images

Minimal reproduction project

See images

@SamuelAsherRivello SamuelAsherRivello added the bug Something isn't working label Jun 24, 2024
@MikeSchulze
Copy link
Owner

MikeSchulze commented Jun 24, 2024

Hi and welcome to GdUnit4.

Seems to me to be a wrong project setup, please check your C# project settings.

<PropertyGroup>
    <TargetFrameworks>net8.0</TargetFrameworks>
    <LangVersion>11.0</LangVersion>
    <!--Force nullable warnings, you can disable if you want-->
    <Nullable>enable</Nullable>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    <!--Disable warning of invalid/incompatible GodotSharp version-->
    <NoWarn>NU1605</NoWarn>
  </PropertyGroup>
  <ItemGroup>
    <!--Required for GdUnit4-->
    <PackageReference Include="gdUnit4.api" Version="4.2.*" />
  </ItemGroup>

https://mikeschulze.github.io/gdUnit4/csharp_project_setup/csharp-setup/#gdunit4-c-test-setup

@MikeSchulze MikeSchulze added help wanted Extra attention is needed infos requested Needs additional infos to reproduce and removed bug Something isn't working labels Jun 24, 2024
@SamuelAsherRivello
Copy link
Author

SamuelAsherRivello commented Jun 24, 2024

Thanks!

I appreciate the help. Its improving, but my issues continue.

SETUP

I tried your csproject as is. I deleted my csproject and solution. Added your snippet. closed/opened godot. Rebuild the project. And run the testing. Issues continue.

Then I tried a custom version from the snippet below for less warnings. I deleted my csproject and solution. Added your snippet. closed/opened godot. Rebuild the project. And run the testing. Issues continue. The following images are with my snippet here.

<Project Sdk="Godot.NET.Sdk/4.2.2">
  <PropertyGroup>
    <TargetFrameworks>net8.0</TargetFrameworks>
    <LangVersion>11.0</LangVersion>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    <!--Disable warning of invalid/incompatible GodotSharp version-->
    <NoWarn>NU1605</NoWarn>

    <!--Disable warnings. SamR preferences-->
    <!-- <Nullable>enable</Nullable> -->
    <NoWarn>CS8601</NoWarn>
    <NoWarn>CS8618</NoWarn>
    <NoWarn>CS8601</NoWarn>
    <NoWarn>CS8632</NoWarn>

  </PropertyGroup>
  <ItemGroup>
    <!--Required for GdUnit4-->
    <PackageReference Include="gdUnit4.api" Version="4.2.*" />
  </ItemGroup>
</Project>

BUGS

I have one test class. Its the default from the docs. The test 'works' but does not appear in the GDUnit window in the upper left and it shows errors in the console.
2024-06-24_13-59-23

And I cannot adjust any shortuts.
2024-06-24_13-59-43

@MikeSchulze
Copy link
Owner

hm thats strange,
can you close Godot
delete the .godot folder
restart godot two time and rebuild the project

@SamuelAsherRivello
Copy link
Author

SamuelAsherRivello commented Jun 24, 2024

Thanks!

Overall, the C#-compatibility is someone unique in the unit testing space, and the API for testing (asserts) are very nice. I'd love to use this for some upcoming videos if I can get it working. Not too urgent. But this week, I'll record with whatever testing setup I find that works best.

I tried that in my main repo. Same Results.

I'm new to Godot (< 100 hours). I'm new to addons. Perhaps I'm doing something silly and incorrect.

Below is a new fresh public repo (without the complexity of simlinks I mentioned earlier) and no gitignore so you see all the files. I tried your suggestions in this new temp repo. Same Results.

Again, I can right click the *.cs and run the tests and see valuable pass/fail results. But the upper-left window seems to be broken, the output seems to be too-full of errors, and (while many non-shortcut GDUnit4 settings appear to 'work') the GDUnit4 settings for shortcuts do not appear interactive/clickable/changeable.

If you have any ideas, or find something simple I'm missing, please send a PR request with the change. I'll use it immediately. Thanks so much!

https://github.com/SamuelAsherRivello/godot-unit-test-temporary

@MikeSchulze
Copy link
Owner

MikeSchulze commented Jun 25, 2024

Hi, I'll take a look at your repository and hopefully figure out what's going wrong here.
It would help me if you give a full list of steps to reproduce, sounds like if you are having various issues.

Kind regards
Mike

Update

Ok, with your project, I'm able to see the errors now.
I still investigate what happens, first issue is the test itself is not found by the test discovery.

The test discover can't find your tests because of misleading test root folder.
The default folder is test but your tests are located under Tests
You need to change your test root folder to enable finding tests.
image
But it should work also when using the context menu to run/debug tests

When you develop with C# I guess you are using a different IDE to edit your classes.
You know about the gdunit4.test.adapter?
e.g. on Rider
image

Checkout the gdUnit4Net project and supported IDE's

You need to extend your project by the this lines.

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
    <PackageReference Include="gdUnit4.api" Version="4.2.*" />
    <PackageReference Include="gdUnit4.test.adapter" Version="1.*" />
  </ItemGroup>

issues

#517
#518

@MikeSchulze MikeSchulze added the Exclude from release nodes This issue is an internal fix only and do not report at release notes. label Jun 25, 2024
Repository owner locked and limited conversation to collaborators Jun 25, 2024
@MikeSchulze MikeSchulze converted this issue into discussion #519 Jun 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Exclude from release nodes This issue is an internal fix only and do not report at release notes. help wanted Extra attention is needed infos requested Needs additional infos to reproduce
Projects
Status: Done
Development

No branches or pull requests

2 participants