Skip to content
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
9299f56
Custom test runner, env vars, tests in demo
limbonaut Oct 30, 2025
5f2bf48
Disable hooks
limbonaut Oct 30, 2025
081d363
Bump gdUnit4 to specific commit
limbonaut Oct 31, 2025
325503c
Use in CI
limbonaut Oct 31, 2025
dce009e
Explain status codes
limbonaut Oct 31, 2025
e8d3015
Handle warnings
limbonaut Oct 31, 2025
38b64ee
Extract formatting functions into Fmt class
limbonaut Oct 31, 2025
0222ed3
Remove mobile basic tests
limbonaut Oct 31, 2025
0325390
Tests: Unset broken context
limbonaut Oct 31, 2025
a89e7d0
Deeper stack as example
limbonaut Oct 31, 2025
b0b526f
Better suite color
limbonaut Oct 31, 2025
88a1060
Use threads interface on Android, same as Native and Cocoa
limbonaut Nov 4, 2025
2ff5e48
Use threads interface on Android, same as Native and Cocoa
limbonaut Nov 4, 2025
5ab9003
Clean up
limbonaut Nov 4, 2025
d531767
Remove debug print
limbonaut Nov 4, 2025
1cd182d
Rename eventAddStackTrace to eventAddThreadStackTrace
limbonaut Nov 4, 2025
65c7052
Fix adding thread twice
limbonaut Nov 4, 2025
6a51669
Fix crashed flag
limbonaut Nov 4, 2025
5f0547c
Simplify exception handling
limbonaut Nov 4, 2025
c7b8df8
Remove unnecessary toLongOrNull conversion
limbonaut Nov 4, 2025
47c9a73
Style fix
limbonaut Nov 4, 2025
dcb1c37
Read test params from Android intent extras
limbonaut Nov 4, 2025
c32df3a
Add script to run tests on Android locally
limbonaut Nov 4, 2025
77f58d0
Update .gitignore
limbonaut Nov 4, 2025
c122428
Fix user tests on Android
limbonaut Nov 4, 2025
505e26a
Fix event tests on Android
limbonaut Nov 4, 2025
3fa272d
Fix breadcrumbs test on Android
limbonaut Nov 4, 2025
38f22bb
Merge branch 'ref/threads-android' into sentry-godot-mobile-testing
limbonaut Nov 4, 2025
2109c14
Update .gitignore
limbonaut Nov 4, 2025
2d546d2
Merge branch 'main' into sentry-godot-mobile-testing
limbonaut Nov 5, 2025
9b65eac
Clarify env vars in doc comments
limbonaut Nov 5, 2025
ccdc837
Include default tests if specs not provided
limbonaut Nov 5, 2025
c6a5faa
Clarify print statement
limbonaut Nov 5, 2025
ac83d04
Reset warning counter in test statistics
limbonaut Nov 5, 2025
d1f782f
Pretty output
limbonaut Nov 5, 2025
844b62f
Remove leftovers
limbonaut Nov 5, 2025
a2c5b93
Handle nulls in intent extras
limbonaut Nov 5, 2025
8c40c35
Add validation for Godot executable
limbonaut Nov 5, 2025
109348b
Refine script
limbonaut Nov 5, 2025
754e0d0
Update run-android-tests.sh
limbonaut Nov 5, 2025
17eb824
Add error handling and retry logic
limbonaut Nov 5, 2025
e44c07b
Fix wording in isolated test suites message
limbonaut Nov 5, 2025
7c9b8f5
Fix upper bound in event test
limbonaut Nov 5, 2025
5b27fb5
Adjust exit code
limbonaut Nov 5, 2025
29db578
Adjust test completion wording
limbonaut Nov 5, 2025
ea6f36b
Fix SentryLog.set_attribute() not working on Android
limbonaut Nov 5, 2025
d780488
Add delay in breadcrumb test for Android
limbonaut Nov 5, 2025
e92c15d
Newlines for output readability
limbonaut Nov 5, 2025
c314427
Set compat renderer to avoid emulator errors
limbonaut Nov 5, 2025
fadbd51
Fix and improve script
limbonaut Nov 5, 2025
adb289d
Don't use OS-reserved 126+ return codes
limbonaut Nov 6, 2025
482f518
Clarify comments
limbonaut Nov 6, 2025
6ec9726
Tests: Pass crashes through
limbonaut Nov 6, 2025
4bd567d
Fix crashing on exit on Android
limbonaut Nov 6, 2025
e1aa9d7
Merge branch 'main' into sentry-godot-mobile-testing
limbonaut Nov 6, 2025
954312c
Fixes and improvements to the script
limbonaut Nov 6, 2025
d8ef114
Fix crashing on exit on Android
limbonaut Nov 6, 2025
a5d14fd
Harden logger
limbonaut Nov 6, 2025
11a82cd
Update CHANGELOG.md
limbonaut Nov 6, 2025
c354130
Fix order
limbonaut Nov 6, 2025
766781c
Harden AndroidSDK in case of plugin destruction
limbonaut Nov 6, 2025
d2bd80d
Merge branch 'fix/android-crash-on-exit' into sentry-godot-mobile-tes…
limbonaut Nov 6, 2025
786dc97
Revert "Harden AndroidSDK in case of plugin destruction"
limbonaut Nov 6, 2025
84131c2
Harden AndroidSDK
limbonaut Nov 6, 2025
0796ccf
Merge branch 'fix/android-crash-on-exit' into sentry-godot-mobile-tes…
limbonaut Nov 6, 2025
17ab4ed
Remove --debug flag from Godot test runs
limbonaut Nov 6, 2025
54758a9
Tweaks
limbonaut Nov 6, 2025
80c18b0
Merge branch 'main' into sentry-godot-mobile-testing
limbonaut Nov 6, 2025
1451d33
Merge branch 'main' into sentry-godot-mobile-testing
limbonaut Nov 7, 2025
d6f3c87
WIP android CI setup
limbonaut Oct 31, 2025
57e5f5e
Update .gitignore
limbonaut Nov 7, 2025
e747261
Create build version file for gradle project
limbonaut Nov 7, 2025
423a27a
Simplify unzipping
limbonaut Nov 7, 2025
6a3fa80
Simplify CI script
limbonaut Nov 7, 2025
0c1909d
Fix Android export template extraction path
limbonaut Nov 7, 2025
6053032
Create deploy-android-template.sh
limbonaut Nov 7, 2025
fc4f62c
Fix variables in deploy script
limbonaut Nov 7, 2025
6a6af24
Update test_android.yml
limbonaut Nov 7, 2025
0ca9114
Verbose flag
limbonaut Nov 7, 2025
dc4e093
adb install with -r
limbonaut Nov 7, 2025
8ee160f
Add validation for isolated test suite discovery
limbonaut Nov 7, 2025
93cdca3
Script: Kill app if hanging
limbonaut Nov 7, 2025
98d572b
Allow Android export to fail in CI workflow
limbonaut Nov 7, 2025
3094e3d
enable KVM
limbonaut Nov 7, 2025
ff5cad2
Update deploy-android-template.sh
limbonaut Nov 7, 2025
77a9324
Update test_android.yml
limbonaut Nov 7, 2025
cdb7070
x86_64
limbonaut Nov 7, 2025
a824909
Fix missing export config
limbonaut Nov 7, 2025
719d86d
Try something
limbonaut Nov 7, 2025
49545a9
Re-add Java step
limbonaut Nov 8, 2025
4897a4d
Add retry logic for getting app PID
limbonaut Nov 8, 2025
b518fe6
Move Android testing setup into prepare action
limbonaut Nov 8, 2025
10fc159
Change test summary heading to "Final Results"
limbonaut Nov 8, 2025
e79122e
Inline Android template deployment script
limbonaut Nov 8, 2025
ff0f6ed
Stylistic changes
limbonaut Nov 8, 2025
746ba09
Replace newline escapes with echo in test script
limbonaut Nov 9, 2025
549e826
Corrections
limbonaut Nov 9, 2025
f3ded3c
Normalize indentation to spaces in run-android-tests.sh
limbonaut Nov 9, 2025
1be9a28
Improve test script reliability and performance
limbonaut Nov 9, 2025
f965520
Update run-android-tests.sh
limbonaut Nov 9, 2025
718535d
Update run-android-tests.sh
limbonaut Nov 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ jobs:
- name: Run tests
shell: bash
timeout-minutes: 5
env:
SENTRY_TEST: 1
SENTRY_TEST_INCLUDE: "res://test/suites/"
run: |
# Exit status codes: 0 - success, 100 - ends with test failures, 101 - ends with test warnings.
${GODOT} --headless --debug --path project/ \
--script "res://addons/gdUnit4/bin/GdUnitCmdTool.gd" \
--ignoreHeadlessMode \
--continue \
--add test/suites/
# Exit status codes: 0 - success, 100 - failures, 101 - warnings, 200 - didn't run, 204 - tests not found.
${GODOT} --headless --debug --path project/

- name: Run isolated tests
if: success() || failure()
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ project/reports/
project/android/
project/.godot/

# Export related
exports/

# Source tree
src/gen/

Expand Down
2 changes: 1 addition & 1 deletion modules/gdUnit4
Submodule gdUnit4 updated 173 files
2 changes: 2 additions & 0 deletions project/main.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
extends Node

func _ready() -> void:
if OS.get_environment("SENTRY_TEST") == "1":
return
if OS.get_name() in ["Android", "iOS"]:
get_tree().change_scene_to_file.call_deferred("res://mobile.tscn")
else:
Expand Down
56 changes: 0 additions & 56 deletions project/mobile.gd
Original file line number Diff line number Diff line change
@@ -1,64 +1,8 @@
extends CanvasLayer

const MOBILE_TESTS_FILE := "res://test/mobile_tests.gd"


Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactoring: Moved toolbox code from this file into tools.gd.

func _ready() -> void:
get_viewport().size = Vector2(810, 1530) # simulate mobile screen on desktop
get_viewport().get_window().content_scale_factor = 3.0
get_viewport().get_window().content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
get_viewport().get_window().content_scale_aspect = Window.CONTENT_SCALE_ASPECT_EXPAND

%RunTestsButton.visible = FileAccess.file_exists(MOBILE_TESTS_FILE)


func _on_run_tests_button_pressed() -> void:
var tests = load(MOBILE_TESTS_FILE).new()
tests.run_tests()


func _on_test_diverse_context_button_pressed() -> void:
var context := {
"null": null,
"bool": true,
"int": 42,
"float": 42.42,
"string": "hello, world!",
"Vector2": Vector2(123.45, 67.89),
"Vector2i": Vector2i(123, 45),
"Rect2": Rect2(123.45, 67.89, 98.76, 54.32),
"Rect2i": Rect2i(12, 34, 56, 78),
"Vector3": Vector3(12.34, 56.78, 90.12),
"Vector3i": Vector3i(12, 34, 56),
"Transform2D": Transform2D().translated(Vector2(12.34, 56.78)),
"Vector4": Vector4(12.34, 56.78, 90.12, 34.56),
"Vector4i": Vector4i(12, 34, 56, 78),
"Plane": Plane(Vector3(1, 2, 3), 4),
"Quaternion": Quaternion(Vector3(0, 1, 0), 4),
"AABB": AABB(Vector3(1, 2, 3), Vector3(4, 5, 6)),
"Basis": Basis(Vector3(1, 2, 3), Vector3(4, 5, 6), Vector3(7, 8, 9)),
"Transform3D": Transform3D().translated(Vector3(12.34, 56.78, 90.12)),
"Projection": Projection(Vector4(73.21, 19.47, 85.63, 73.02), Vector4(41.92, 67.38, 22.14, 59.81), Vector4(93.76, 15.49, 38.72, 84.25), Vector4(26.58, 71.93, 47.16, 62.84)),
"Color": Color(12.34, 56.78, 90.12, 34.56),
"StringName": StringName("hello, world!"),
"NodePath": NodePath("/root"),
"RID": RID(),
"Object": self,
"Callable": _on_test_diverse_context_button_pressed,
"Signal": get_tree().process_frame,
"Dictionary": {"key1": "value1", "key2": 42, "key3": self},
"Array": [1, self, {"hello": "world"}],
"PackedByteArray": PackedByteArray([1, 2, 3, 4, 5]),
"PackedInt32Array": PackedInt32Array([1, 2, 3, 4, 5]),
"PackedInt64Array": PackedInt64Array([1, 2, 3, 4, 5]),
"PackedFloat32Array": PackedFloat32Array([1.23, 4.56, 7.89]),
"PackedFloat64Array": PackedFloat64Array([1.23, 4.56, 7.89]),
"PackedStringArray": PackedStringArray(["hello", "world"]),
"PackedVector2Array": PackedVector2Array([Vector2(1, 2), Vector2(3, 4)]),
"PackedVector3Array": PackedVector3Array([Vector3(1, 2, 3), Vector3(4, 5, 6)]),
"PackedColorArray": PackedColorArray([Color(1, 2, 3, 4), Color(5, 6, 7, 8)]),
"PackedVector4Array": PackedVector4Array([Vector4(1, 2, 3, 4), Vector4(5, 6, 7, 8)]),
}
SentrySDK.set_context("diverse_context", context)
DemoOutput.print_info("Added context with diverse values.")
SentrySDK.capture_message("Test diverse context")
26 changes: 3 additions & 23 deletions project/mobile.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=6 format=3 uid="uid://dpppyaeqgrcn1"]
[gd_scene load_steps=7 format=3 uid="uid://dpppyaeqgrcn1"]

[ext_resource type="Script" uid="uid://cw2874mkwddfr" path="res://mobile.gd" id="1_bj8h8"]
[ext_resource type="PackedScene" uid="uid://bxi26vu5tlqas" path="res://views/capture_events.tscn" id="2_xux57"]
[ext_resource type="PackedScene" uid="uid://dyoaec2d7uung" path="res://views/enrich_events.tscn" id="3_p64qd"]
[ext_resource type="PackedScene" uid="uid://cywnvytpa2bec" path="res://views/tools.tscn" id="4_p64qd"]
[ext_resource type="PackedScene" uid="uid://dllqhtd731wtc" path="res://views/output_pane.tscn" id="4_xux57"]

[sub_resource type="Theme" id="Theme_bj8h8"]
Expand Down Expand Up @@ -49,35 +50,14 @@ metadata/_tab_index = 0
layout_mode = 2
metadata/_tab_index = 1

[node name="Tools" type="VBoxContainer" parent="VBoxContainer/VBoxContainer/TabContainer"]
[node name="Tools" parent="VBoxContainer/VBoxContainer/TabContainer" instance=ExtResource("4_p64qd")]
unique_name_in_owner = true
visible = false
layout_mode = 2
metadata/_tab_index = 2

[node name="Header - Actions" type="Label" parent="VBoxContainer/VBoxContainer/TabContainer/Tools"]
custom_minimum_size = Vector2(0, 40.505)
layout_mode = 2
text = "ACTIONS"
horizontal_alignment = 1
vertical_alignment = 2

[node name="RunTestsButton" type="Button" parent="VBoxContainer/VBoxContainer/TabContainer/Tools"]
unique_name_in_owner = true
layout_mode = 2
text = "Run mobile tests"

[node name="TestDiverseContextButton" type="Button" parent="VBoxContainer/VBoxContainer/TabContainer/Tools"]
unique_name_in_owner = true
layout_mode = 2
text = "Test diverse context"

[node name="OutputPane" parent="VBoxContainer/VBoxContainer" instance=ExtResource("4_xux57")]
layout_mode = 2

[node name="Spacer2" type="Control" parent="VBoxContainer"]
custom_minimum_size = Vector2(0, 20)
layout_mode = 2

[connection signal="pressed" from="VBoxContainer/VBoxContainer/TabContainer/Tools/RunTestsButton" to="." method="_on_run_tests_button_pressed"]
[connection signal="pressed" from="VBoxContainer/VBoxContainer/TabContainer/Tools/TestDiverseContextButton" to="." method="_on_test_diverse_context_button_pressed"]
4 changes: 4 additions & 0 deletions project/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ enabled=PackedStringArray("res://addons/gdUnit4/plugin.cfg")
[gdunit4]

ui/toolbar/run_overall=true
hooks/session_hooks=Dictionary[String, bool]({
"res://addons/gdUnit4/src/core/hooks/GdUnitHtmlReporterTestSessionHook.gd": false,
"res://addons/gdUnit4/src/core/hooks/GdUnitXMLReporterTestSessionHook.gd": false
})
Comment on lines +42 to +45
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation: Test runner has issues with creating reports on mobile. Since I almost never use these reports, I decided to disable them.


[rendering]

Expand Down
16 changes: 14 additions & 2 deletions project/project_main_loop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ signal before_send_log(log_entry)


func _initialize() -> void:
if _is_running_tests():
if await _run_tests_if_needed():
return

SentrySDK.init(func(options: SentryOptions) -> void:
Expand Down Expand Up @@ -51,5 +51,17 @@ func _on_before_send_log_to_sentry(entry: SentryLog) -> SentryLog:
return entry


func _is_running_tests() -> bool:
func _is_running_tests_from_editor() -> bool:
return "res://addons/gdUnit4/src/core/runners/GdUnitTestRunner.tscn" in OS.get_cmdline_args()


## Returns true if tests being executed. [i]Async.[/i]
func _run_tests_if_needed() -> bool:
if _is_running_tests_from_editor():
return true
if FileAccess.file_exists("res://test/util/test_run.gd"):
var test_run = load("res://test/util/test_run.gd").new()
if test_run.should_run():
await test_run.execute()
return true
return false
166 changes: 0 additions & 166 deletions project/test/mobile_tests.gd

This file was deleted.

1 change: 0 additions & 1 deletion project/test/mobile_tests.gd.uid

This file was deleted.

8 changes: 7 additions & 1 deletion project/test/suites/test_breadcrumbs_json.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ func test_breadcrumbs_with_minimal_breadcrumb() -> void:
.end() \

.must_not_contain("type") \
.must_not_contain("data") \

.either() \
.must_not_contain("data") \
.or_else() \
.must_contain("data", {}) \
.end() \

.exactly(1)


Expand Down
Loading
Loading