godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.88k stars 20.15k forks source link

[TRACKER] Unit tests to add or improve #43440

Open Calinou opened 3 years ago

Calinou commented 3 years ago

Our unit test coverage is currently fairly low. We'd like to increase our unit test coverage; any help is welcome.

Interested in writing new unit tests? See the unit tests documentation and compiling instructions. If you have further questions, join the Godot Contributors Chat.

When opening a pull request, please link back to this issue (#43440) in the PR description so that we can keep track of it more easily.

If you have the appropriate permissions, feel free to edit this issue to add new items or check items for which a PR has been opened.

Classes to test

These classes are currently lacking in test coverage, and are therefore highest-priority for receiving unit tests. Deprecated classes are not listed.

[!NOTE]

When a class is listed with "and" along a given list item, it should be submitted in the same pull request whenever possible. Tests for these classes can be in the same file or a different file depending on the size and complexity of the test suite. If in doubt, follow the file organization used in the original class implementation.

Completed classes

These classes currently have good test coverage. Further improvements may be possible by testing methods that were added after the tests were merged.

- [x] **AABB** https://github.com/godotengine/godot/pull/43727 - [x] **Animation** https://github.com/godotengine/godot/pull/57490 - [x] **Array** https://github.com/godotengine/godot/pull/46227 - [x] **ArrayMesh** - [x] **AudioStreamWAV** https://github.com/godotengine/godot/pull/60736 - [x] **BitMap** - [x] **Camera2D** https://github.com/godotengine/godot/pull/88614 - [x] **Camera3D:** May not be testable in headless mode, but it's worth trying. Test `is_position_behind()` and the `project_`/`unproject_` methods in particular - [x] **CryptoKey** https://github.com/godotengine/godot/pull/89021 - [x] **Curve** https://github.com/godotengine/godot/pull/43516 - [x] **Curve2D** https://github.com/godotengine/godot/pull/71308 - [x] **Curve3D** #76812 - [x] **Dictionary** https://github.com/godotengine/godot/pull/47511 - [x] **FastNoiseLite** - [x] **Font** https://github.com/godotengine/godot/pull/81503 - [x] **GDScript** https://github.com/godotengine/godot/pull/48657 - [x] **Geometry2D** https://github.com/godotengine/godot/pull/59643 - [x] **Geometry3D** https://github.com/godotengine/godot/pull/44974 - [x] **GradientTexture** https://github.com/godotengine/godot/pull/90501 - [x] **HashingContext** https://github.com/godotengine/godot/pull/43459 - [x] **HTTPClient** https://github.com/godotengine/godot/pull/76636 - [x] **Image** https://github.com/godotengine/godot/pull/45737 - [x] **ImageTexture** https://github.com/godotengine/godot/pull/88044 - [x] **InputEvent** https://github.com/godotengine/godot/pull/79444 - [x] **InputEventKey** https://github.com/godotengine/godot/pull/59193 - [x] **JSON** https://github.com/godotengine/godot/pull/43517 - [x] **JSONRPC**: https://github.com/godotengine/godot/pull/89124 - [x] **Math** https://github.com/godotengine/godot/pull/48721 - [x] **Marshalls** https://github.com/godotengine/godot/pull/44797 - [x] **Node**: https://github.com/godotengine/godot/pull/70152 https://github.com/godotengine/godot/pull/71367 - [x] **NodePath** https://github.com/godotengine/godot/pull/43578 - [x] **NoiseTexture** https://github.com/godotengine/godot/pull/70919 - [x] **Object** https://github.com/godotengine/godot/pull/43583 (completed by https://github.com/godotengine/godot/pull/44387) - [x] **OS** https://github.com/godotengine/godot/pull/42069 - [x] **PackedScene** https://github.com/godotengine/godot/pull/79440 https://github.com/godotengine/godot/pull/80423 https://github.com/godotengine/godot/pull/80819 - [x] **Path2D** https://github.com/godotengine/godot/pull/66927 - [x] **PathFollow2D** https://github.com/godotengine/godot/pull/46277 - [x] **Path3D** - [x] **PathFollow3D** https://github.com/godotengine/godot/pull/46341 - [x] **PCKPacker** https://github.com/godotengine/godot/pull/43572 - [x] **Plane** https://github.com/godotengine/godot/pull/44492 - [x] **PrimitiveMesh** (CapsuleMesh, CubeMesh, …) - [x] **Projection** https://github.com/godotengine/godot/pull/77275 - [x] **Quaternion** https://github.com/godotengine/godot/pull/50907 - [x] **RandomNumberGenerator** https://github.com/godotengine/godot/pull/44560 - [x] **Rect2:** Not covered in the legacy math test. https://github.com/godotengine/godot/pull/43514 - [x] **Rect2i:** Not covered in the legacy math test. https://github.com/godotengine/godot/pull/43514 - [x] **RegEx** https://github.com/godotengine/godot/pull/82225 - [x] **RID** https://github.com/godotengine/godot/pull/54325 - [x] **Resource** https://github.com/godotengine/godot/pull/43731 - [x] **Shortcut** https://github.com/godotengine/godot/pull/58712 - [x] **SpriteFrames** https://github.com/godotengine/godot/pull/57742 - [x] **Transform** - [x] **Transform2D** - [x] **Translation** https://github.com/godotengine/godot/pull/48778 - [x] **TranslationServer** https://github.com/godotengine/godot/pull/79331 - [x] **Variant** https://github.com/godotengine/godot/pull/76244 - [x] **Vector** https://github.com/godotengine/godot/pull/48821 - [x] **Vector2/Vector2i** https://github.com/godotengine/godot/pull/47202 - [x] **Vector3/Vector3i** https://github.com/godotengine/godot/pull/48063 - [x] **Vector4/Vector4i** https://github.com/godotengine/godot/pull/64027 - [x] **VisualShader** https://github.com/godotengine/godot/pull/70396

Non-testable classes

These classes can't be unit-tested for technical reasons. Unit tests always run in headless mode, so they can't do things such as rendering scenes and checking the visual result.

- [x] ~~**CubeMap:**~~ Not testable without RenderingServer access. - [x] ~~**Shader:**~~ Not testable without RenderingServer access.
JustSascha commented 7 months ago

Hi, a classmate and I would like to work on making tests for OptimizedTranslation for a class project and our first contribution. I don't see it mentioned in this thread but I might as well ask just in case: is anyone already taking care of this?

atlas-wheatear commented 6 months ago

Good day! I've written some (hopefully sound 😅) unit tests for CryptoKey. Should I now make an MR to the master branch?

I saw a comment about not treading on toes, and may have taken it rather too literally.

It's on this branch. 😌

wheatear-dev commented 6 months ago

Hi @Calinou 👋

A few things:

  1. CryptoKey was addressed in #89021 . I can't update the issue, would you please be able to?
  2. I've got a load of free time this weekend, and wanted to look at another unit-testing contribution.
  3. OptimizedTranslation looks like a good candidate for my skillset, but I am unsure where @JustSascha got to with it.

EDIT @JustSascha how's the OptimizedTranslation work going? If you need any assistance, just shout! 😄

wheatear-dev commented 6 months ago

Hi all 😃

I'm working on a few tests for JSONRPC now.

Calinou commented 6 months ago
  1. CryptoKey was addressed in https://github.com/godotengine/godot/pull/89021 . I can't update the issue, would you please be able to?

Done.

fabricerenard12 commented 6 months ago

Hello, as a new contributor I would like to try adding some unit tests to Godot. Is there a class to test that would be a good fit for a new contributor?

Magiccarpet00 commented 5 months ago

Hi, I'm @JustSascha 's classmate, and we're working on OptimizedTranslation. I don't understand why in the file test_translation.h there is this method:

TEST_CASE("[OptimizedTranslation] Generate from Translation and read messages")

It only tests against French. But above all, I don't understand what else needs to be done, apart from adding other languages to the test?

kosta777 commented 5 months ago

Hi, I'd like to add tests for FontFile, if nobody began working on it already. I see a message from @andrewargyrakis mentioning that they would do it, but it is from several months ago. Did you already start working on it or is it available?

JustSascha commented 5 months ago

Hi @wheatear-dev, sorry for not answering, I haven't been able to work much the past few weeks so me and my classmate have not made too much progress on the unit test, but we're gonna work on that on the next few days.

If we get stuck we'll call for your help, thanks for offering!

JonasSeerveld commented 5 months ago

Hi, I'm a new contributor and currently a college student. I would like to take a shot at writing tests for the FontVariation class, if it is still available.

BalmundSM commented 5 months ago

Hello! I'm a new contributor and a college student like the guy above me. I'm gonna take AnimatedTexture, that is, if it's not already taken.

Edit: Nevermind, after reading documentation it seems that there is a high possibility that AnimatedTexture will be removed in future release. I'm gonna take PacketPeer then.

gavenerickson commented 5 months ago

Hey! I'm a new contributor and also a college student. I would like to try and write unit tests for GradientTexture.

Calinou commented 5 months ago

Hey! I'm a new contributor and also a college student. I would like to try and write unit tests for GradientTexture.

There is already an open pull request for GradientTexture unit tests: https://github.com/godotengine/godot/pull/90501

If you're interested in adding tests for other Image/Texture-derived clases, we don't appear to have any tests for ImageTexture3D yet, so that would be a welcome contribution. See the existing ImageTexture tests for something you could use as a base.

gavenerickson commented 5 months ago

Hi @Calinou, I will take a look at ImageTexture3D and thanks for linking the base cases for me to look at.

SommAid commented 5 months ago

Hello! I am a new contributor and was wondering if any tests OptimizedTranslation have been written?

Calinou commented 4 months ago

Hello! I am a new contributor and was wondering if any tests OptimizedTranslation have been written?

I don't think anyone is writing tests for that class currently, so feel free to take a look :slightly_smiling_face:

SommAid commented 4 months ago

Hello! I am a new contributor and was wondering if any tests OptimizedTranslation have been written?

I don't think anyone is writing tests for that class currently, so feel free to take a look 🙂

I started to look into the OptimizedTranslation class, and testing and it appears that there is already a test suite for get_message. Looking at the other methods some of them are missing support:

Question: I can write a test for get_translated_message_list() or is there something else I should direct my attention towards?

Calinou commented 4 months ago

I can write a test for get_translated_message_list() or is there something else I should direct my attention towards?

I missed that there were already some OptimizedTranslation tests in test_translation.h. I think you can write a new test for this method in the existing test_translation.h.

2nafish117 commented 4 months ago

Hello, I am interested to write test cases for the Timer node. From looking at the timer class, im guessing i need to write cases for the get/set functions?

Calinou commented 4 months ago

Hello, I am interested to write test cases for the Timer node. From looking at the timer class, im guessing i need to write cases for the get/set functions?

Yes, I think this is mostly all we can test in the Timer class (unless there's a way to test the timeout signal).

2nafish117 commented 4 months ago

Hello, is anyone working on the Node2D tests? (Test the various exposed helper methods such as look_at() and move_local_x())

Calinou commented 4 months ago

Hello, is anyone working on the Node2D tests? (Test the various exposed helper methods such as look_at() and move_local_x())

Not to my knowledge, so feel free to tackle these :slightly_smiling_face:

mshojatalab commented 4 months ago

Hi, I'm gonna be adding some tests for StyleBoxFlat.

Magiccarpet00 commented 4 months ago

Hi, is anyone working on the AnimationPlayer tests ?

rcooper47 commented 4 months ago

I plan to look into StyleBoxLine (and StyleBoxEmpty) tests. Would it be a good idea to leave a link on the checklist above to people's forks when they start working on tests?

Calinou commented 4 months ago

@mshojatalab @rcooper47 I've added you to the list in OP.

Hi, is anyone working on the AnimationPlayer tests ?

@Magiccarpet00 There doesn't appear to be anyone working on tests for AnimationPlayer currently, so go ahead :slightly_smiling_face:

sandarm-1 commented 3 months ago

Hello, @Calinou , I would like to contribute some unit tests here if that helps, what would be a good thing to do as a first time contributor? Thanks

wheatear-dev commented 3 months ago

Just working on a test file for OptionButton 😌

OneBogdan01 commented 2 months ago

Hi, I have started working on the unit tests for the Decal node.

lewyche commented 2 months ago

I'm going to write some unit tests for Sky.

WyattArnsdorf commented 1 month ago

Hi @Calinou, I am looking to make my first contribution for a class project, so if there's a unit test that you'd like to get worked on a bit I'd really appreciate it!

zedzee37 commented 1 month ago

Hello, is anyone here working on the unit tests needed for Node2D?

Calinou commented 1 month ago

Hi @Calinou, I am looking to make my first contribution for a class project, so if there's a unit test that you'd like to get worked on a bit I'd really appreciate it!

You can pick any unit test you want that is not currently being worked on by someone else. I suggest picking a class you are already familiar with when developing Godot projects (other classes may be harder to test if you have no prior knowledge).

LeonStansfield commented 1 month ago

Hi, has anyone worked on the tests for the height_map_shape_3D? I am willing to work on them as a good first project!

2nafish117 commented 1 month ago

Hello, is anyone here working on the unit tests needed for Node2D?

yep, i have tests written for the Node2D #91654.

@Calinou or other contributors, could you please review it once more and merge if it looks good. Thanks.

LeonStansfield commented 4 weeks ago

I would like to spend some time doing parallax_2d if thats okay?

AidanPohl commented 4 weeks ago

I'd like to throw my hat in on FontFile

pafuent commented 4 weeks ago

Hi @Calinou. Seems that the PR description should be updated to reflect that this PR implemented test for Timer

pafuent commented 3 weeks ago

I'm adding tests for StreamPeer and StreamPeerBuffer while I'm trying to fix a bug on StreamPeer here #95784

JayTropper commented 1 week ago

I am going to write a test for Node3D.

tetrapod00 commented 6 days ago

I'll be adding some unit tests for Control.

ghildim commented 2 hours ago

Hey Guys, new to Open-Source stuff. How do I get started and contribute?

tetrapod00 commented 2 hours ago

@ghildim this issue isn't the right place to ask (though it is a good first issue). You should take a look at the official docs and join the contributors chat. There's a new contributors channel there where you can ask questions.

Specifically for this issue, you should take a look at the docs for compiling and for unit tests that are linked in the first post. If you need more specific help I would recommend asking in the contributors chat.