Skip to content

Conversation

@tustanivsky
Copy link
Collaborator

@tustanivsky tustanivsky commented Nov 12, 2025

This PR adds Android integration tests for the Sentry Unreal SDK using PowerShell's Pester framework. The tests validate end-to-end functionality by running the SentryPlayground sample application on mobile devices and verifying that events are properly captured and sent to Sentry.

It includes the necessary CI workflows and test scripts for both local (adb) and cloud (SauceLabs) execution.

The motivation for using SauceLabs Real Device Cloud to run tests in CI pipeline is the current limitation of Android emulators which do not support the rendering backends required by Unreal applications.

Changes

Related to:

Closes #964

#skip-changelog

@tustanivsky tustanivsky force-pushed the chore/android-tests branch 4 times, most recently from 41221d6 to 3bc3f33 Compare November 20, 2025 13:00
Fix artifact download

Shell

Fix

Fix

Fix

Fix

Set config

Fix syntax

Sauce skip run

Update appium

Test

test

test

apk name

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

tets

Test

Test

Poll session status

Test

Test

Test 2 runs

Test

Test

Try fix redirect

Test

Test

fix id

Test

app status poll

Test

Clean up
@tustanivsky tustanivsky marked this pull request as ready for review November 21, 2025 14:31
const TCHAR* CommandLine = FCommandLine::Get();
FString CommandLine = FCommandLine::Get();

UE_LOG(LogSentrySample, Display, TEXT("Startin app with commandline: %s\n"), *CommandLine);
Copy link

Choose a reason for hiding this comment

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

Bug: Typo in logging statement: "Startin" misspelled

The log message contains a typo: "Startin app with commandline" should be "Starting app with commandline". While this doesn't affect functionality, it's a spelling error that should be corrected before merging.

Fix in Cursor Fix in Web

Comment on lines +30 to +32
- name: Install Pester
shell: pwsh
run: Install-Module -Name Pester -Force -SkipPublisherCheck
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pester: 5.7.1 is already installed in GH, have you had issues without this step?

https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#powershell-modules

Comment on lines +34 to +46
- name: Run integration tests
id: run-integration-tests
shell: pwsh
env:
SENTRY_UNREAL_TEST_DSN: ${{ secrets.SENTRY_UNREAL_TEST_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }}
SENTRY_UNREAL_TEST_APP_PATH: ${{ github.workspace }}/sample-build/SentryPlayground-arm64.apk
UNREAL_VERSION: ${{ inputs.unreal-version }}
run: |
cd integration-test
mkdir build
cmake -B build -S .
Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe a bit cleaner (move working dir to param and remove unnecessary mkdir)

Suggested change
- name: Run integration tests
id: run-integration-tests
shell: pwsh
env:
SENTRY_UNREAL_TEST_DSN: ${{ secrets.SENTRY_UNREAL_TEST_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }}
SENTRY_UNREAL_TEST_APP_PATH: ${{ github.workspace }}/sample-build/SentryPlayground-arm64.apk
UNREAL_VERSION: ${{ inputs.unreal-version }}
run: |
cd integration-test
mkdir build
cmake -B build -S .
Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI
- name: Run integration tests
id: run-integration-tests
shell: pwsh
working-directory: integration-test
env:
SENTRY_UNREAL_TEST_DSN: ${{ secrets.SENTRY_UNREAL_TEST_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }}
SENTRY_UNREAL_TEST_APP_PATH: ${{ github.workspace }}/sample-build/SentryPlayground-arm64.apk
UNREAL_VERSION: ${{ inputs.unreal-version }}
run: |
cmake -B build -S .
Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI

@@ -0,0 +1,418 @@
# Integration tests for Sentry Unreal SDK on Android
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume this would be moved to app-runner as a new provider, in which case both android integration test files would be merged to a single one, right?

cd integration-test
mkdir build
cmake -B build -S .
Invoke-Pester Integration.Tests.Android.SauceLabs.ps1 -CI
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, invoke-pester assumes files are named "*.Tests.ps1" so the filename should be Android.Adb.Tests.ps1 or similar. In this case it doesn't matter because you're specifying the exact path, but if you wanted to run all integration tests locally, calling invoke-pester integration-test would only pick up files ending with ".Tests.ps1"

try {
if ($IsMultipart) {
# Use curl for multipart uploads (PowerShell's Invoke-WebRequest struggles with this)
$curlCmd = "curl -u `"$username`:$accessKey`" -X $Method `"$Uri`" -F `"payload=@$FilePath`" -F `"name=$(Split-Path $FilePath -Leaf)`""
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should ideally use Invoke-Webrequest to be cross-platform. I've noticed the comment but have you tried the Form param? https://stackoverflow.com/a/60323436

$params['ContentType'] = $ContentType
}

$response = Invoke-RestMethod @params
Copy link
Collaborator

Choose a reason for hiding this comment

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

Invoke-Restmethod should be avoided - it will just return plain string and swallow parsing error. see app-runner which uses invoke-webrequest and convertfrom-json

}

Write-Host "Uploading APK to SauceLabs Storage..." -ForegroundColor Yellow
$uploadUri = "https://api.${Region}.saucelabs.com/v1/storage/upload"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe worth checking if the file exists somehow, e.g. by using a hash-based filename. But I don't really know - if it's always rebuilt then not worth the trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automation to test Android e2e

3 participants