Repository navigation
[TRACKER] Unit tests to add or improve #43440
Description
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.
- AnimationPlayer Add tests for
AnimationPlayer#92649 - AudioStreamInteractive (and AudioStreamPlaybackInteractive, AudioStreamPlaylist, AudioStreamSynchronized) Add unit tests for
AudioStreamInteractive#105490 - BaseButton (and Button) Add button unit test #93381
- Control: Test sizing, anchors and container logic by checking control position and size after creating an UI layout. Test focus neighbor behavior using simulated input events (
ui_focus_actions). This class is complex, so tests for it can be split in multiple pull requests. - Decal Add unit tests for
Decal#93463 - ENetConnection (and ENetPacketPeer) Enet connection and packet peer unit tests #112984
- FontFile Add basic tests for Fontfile #99131
- FontVariation
AddFontVariationunit test #99687Add unit tests forFontVariation#112846 - GLTFDocument Add test for GLTFDocument #101136
- HeightMapShape3D Add unit tests for
HeightMapShape3D#95123 - HTTPRequest Add a unit test for
HTTPRequest#95224 - ImageTexture3D Add unit test cases for ImageTexture3D #91233
- Node2D Add unit tests for Node2D helper methods #91654
- Node3D Add unit test for
Node3D#97143 - Occluder3D (and ArrayOccluder3D, BoxOccluder3D, PolygonOccluder3D, QuadOccluder3D, and SphereOccluder3D) Add Unit tests for Occluder shapes #108891
- OccluderInstance3D Add unit tests for OccluderInstance3D #116234
- OptimizedTranslation Expand testing for
OptimizedTranslationClass #91092 - OptionButton Add unit tests for
OptionButton#93824 - PacketPeer Add unit tests for
PacketPeer#95931 - Parallax2D Add unit tests for
Parallax2D#95650 - PhysicsMaterial Add unit tests for PhysicsMaterial #97227
- ReflectionProbe Add unit tests for
ReflectionProbe#97818 Add unit test for reflection_probe #97870 - Sky Add unit tests for Sky #99886 Add Unit Test cases for
Sky#97512 - StandardMaterial3D (and ORMMaterial3D) Add unit tests for
StandardMaterial3DandORMMaterial3D#105341 - StreamPeerTCP Add unit tests for
StreamPeerTCP#102064 - StreamPeerTLS Add tests for
StreamPeerTLS#102961 Add Unit Tests for StreamPeerTLS #111784 - StreamPeerGZIP
Add unit tests for StreamPeerGzip #101438FixStreamPeerGZIP::finish()internal buffer size usage #98043 - StreamPeerBuffer Add unit tests for StreamPeer, StreamPeerBuffer and StreamPeerExtension #100871 Add unit tests for
StreamPeerandStreamPeerBuffer#95784 - StyleBoxFlat Add tests for
StyleBoxFlat#106009 - StyleBoxLine (and StyleBoxEmpty) Add unit tests for
StyleBoxEmptyandStyleBoxLine#105296 - StyleBoxTexture Add unit tests for
StyleBoxTexture#95218 - Timer Add new test cases for
Timerautostart and paused behavior #97794 - WebSocketPeer Add unit test for WebSocketPeer default state #105386
- PlaceholderScriptInstance (see Core: Add some tests for
PlaceholderScriptInstance#121408 for initial boilerplate, still not fully covered by that PR though) - Link Button Add unit tests for
LinkButton#119350 - Item List Add unit tests for
ItemList#119327 - Line Edit Add unit tests for
LineEdit#119293
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.
Details
- AABB Add a test suite for AABB #43727
- Animation Add a unit test suite for Animation #57490
- Array Add a test suite for Array #46227
- ArrayMesh
- AudioStreamWAV Add test cases for AudioStreamWAV #60736
- BitMap
- Camera2D Add unit tests for Camera2D #88614
- Camera3D: May not be testable in headless mode, but it's worth trying. Test
is_position_behind()and theproject_/unproject_methods in particular - CryptoKey Add unit tests for CryptoKey #89021
- Curve Add a test suite for Curve #43516
- Curve2D Add unit tests for Curve2D #71308
- Curve3D Add unit tests for Curve3D #76812
- Dictionary Add a test suite for Dictionary #47511
- FastNoiseLite
- Font Add getter tests for dynamic fonts #81503
- GDScript Add a unit test suite for GDScript #48657
- Geometry2D Add extra unit tests for Geometry2D #59643
- Geometry3D Initial tests for geometry3D #44974
- GradientTexture Add unit tests for GradientTexture1D and GradientTexture2D #90501
- HashingContext Add unit tests for HashingContext #43459
- HTTPClient Add HTTPClient unit tests #76636
- Image Add a test suite for the Image class #45737
- ImageTexture Add
ImageTextureunit tests #88044 - InputEvent Add a test suite to InputEvent #79444
- InputEventKey Add Unit Tests for InputEventKey #59193
- JSON Add a test suite for JSON #43517
- JSONRPC: Add unit tests for JSONRPC #89124
- Math
Add a test suite forAdd a test suite forMath::namespace functions #48721Math::namespace functions (new) #68196 - Marshalls Marshall core unit tests #44797
- Node: Initial tests for node #70152 More
Nodetests #71367 - NodePath Add a test suite for NodePath #43578
- NoiseTexture Add tests for FastNoiseLite/NoiseTexture #70919
- Object Add a test suite for Object #43583 (completed by
More object unit tests #44387) Unit tests for Object creation and property getter/setter #45411 - OS Add a test suite for OS #42069
- PackedScene Add unit tests for PackedScene #79440 Improve PackedScene unit test for complex scene #80423 Improve PackedScene unit test by covering more methods #80819
- Path2D Unit tests for Path2D class #66927
- PathFollow2D PathFollow2D unit test #46277
- Path3D
- PathFollow3D add PathFollow3D unit test #46341
- PCKPacker Add a test suite for PCKPacker #43572
- Plane Added a test suite for the Plane object. #44492
- PrimitiveMesh (CapsuleMesh, CubeMesh, …)
- Projection
Add a test suite for Projection #77275Add tests forProjection#99125 - Quaternion Add tests file for Quaternion unit tests, with initial UTs #50907
- RandomNumberGenerator Add unit tests for
RandomNumberGenerator#44560 - Rect2: Not covered in the legacy math test. Add a test suite for Rect2 and Rect2i #43514
- Rect2i: Not covered in the legacy math test. Add a test suite for Rect2 and Rect2i #43514
- RegEx Adds additional tests for RegEx class #82225
- RID Add unit tests for RID class. #54325
- Resource Add a test suite for Resource #43731
- Shortcut Add unit tests for Shortcut #58712
- SpriteFrames unit tests for all public methods in the sprite frame class #57742
- Transform
- Transform2D
- Translation Add a test suite for Translation #48778
- TranslationServer Add a test suite for TranslationServer #79331
- Variant Add unit tests for Variant for operator overloading #76244
- Vector Add a test suite for Vector #48821
- Vector2/Vector2i
Add test suite for Vector2 #47202Add more tests for Vector* types #66261 - Vector3/Vector3i
Add test suite for Vector3 #48063Add more tests for Vector* types #66261 - Vector4/Vector4i
Vector4/Vector4i: Add missing methods and tests #64027 - VisualShader Add unit test for VisualShader #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.
Details
-
CubeMap:Not testable without RenderingServer access. -
Shader:Not testable without RenderingServer access. -
VisibleOnScreenNotifier2D:Not testable without RenderingServer access. -
VisibleOnScreenNotifier3D:Not testable without RenderingServer access.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
Calinou commentedon Nov 10, 2020
@singher Thanks for your interest in contributing! I recommend joining the
#godotengine-develIRC channel on Freenode so you can ask development-related questions if needed.I also recommend writing a comment here when you're starting to write tests for one class. This way, we can avoid stepping on each other's toes.
Xrayez commentedon Nov 11, 2020
@vinayakmtiwari
RandomNumberGeneratorinitial test suite is written in #43103 and #43343 for new (not yet merged) functionality, so I guess you could take it as a base.maxmutant commentedon Nov 11, 2020
I would like to tackle some of the test cases too and would start with the classes
HashingContextandRegEx.Do you prefer separate PRs for each class, or should I aggregate them?
Ps.: First time contributor here!
Xrayez commentedon Nov 11, 2020
@MaxMutantMayer it's better to create separate PRs for each class, this eases the review process → potentially speeds up the merging process. 😉
Also, I'd focus on one thing at a time.
maxmutant commentedon Nov 11, 2020
@Xrayez Alright, makes sense. Thanks for clarification☺️
jonbonazza commentedon Nov 13, 2020
Noting for posterity that @Calinou found several issues with the JSON facilities not conforming to the spec. He purposely left these unit tests out of the PR to not confuse people, but I created a proposal to address this: godotengine/godot-proposals#1833
Gorgonx7 commentedon Nov 16, 2020
Hey if you don't mind I'm gonna take a crack at testing geometry 3D, it's also my first time contributing too :D
Xrayez commentedon Dec 8, 2020
I had to write initial test suite for
RandomNumberGeneratorin #44089 with test cases for reproducibility, but not all public methods are currently tested.rmarco3e8 commentedon Dec 12, 2020
Hello, I'm also looking to start contributing and am writing tests for
Path2D. If someone has already been working on that class, let me know. Thanks for the resources dropped earlier. I'll be sure to ask any questions in the Freenode channel.403 remaining items
Add unit tests for StreamPeer and StreamPeerBuffer
Add unit tests for PacketPeer
Add unit tests for `SceneMultiplayer`
Add unit tests for UDPServer
Add unit tests for TCPServer
Add `MultiplayerSpawner` unit tests
anr1996 commentedon Sep 12, 2026
Hello, I am a new contributor. This will be my first time! I was interested in writing unit tests. I thought it would be a good start. I'm somewhat new to C++. I was looking at StyleBoxFlat . However, I noticed that it is already being worked on. Would OptimizedTranslation be a good place to start writing unit tests?
Merge pull request godotengine#67800 from jbcolli2/ArrayMesh-UnitTests
Add unit tests for StreamPeer and StreamPeerBuffer
Add unit tests for PacketPeer
Add unit tests for `SceneMultiplayer`
Add unit tests for UDPServer
Add unit tests for TCPServer
Add `MultiplayerSpawner` unit tests