-
-
Notifications
You must be signed in to change notification settings - Fork 427
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
Tests/android UI tests absolute #2077
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
476af3f
added benchmark ui tests
stefanosiano d62a03c
big cleanup of BaseUiTest
stefanosiano 9243a93
Merge branch '6.x.x' into tests/android-ui-tests
stefanosiano c6dc27f
changed benchmark to manual init
stefanosiano a580cc3
started with javadoc and cleanup of benchmark test
stefanosiano 368290e
Merge branch '6.x.x' into tests/android-ui-tests
stefanosiano 9850396
cleaned everything
stefanosiano fc4ce1d
fixed spotless issues
stefanosiano 2601afb
Renamed modules:
stefanosiano ae00661
Merge branch '6.x.x' into tests/android-ui-tests
stefanosiano 51a1827
Merge branch '6.x.x' into tests/android-ui-tests
stefanosiano 7a9c217
updated some gradle config to try to fix github build
stefanosiano 45b3669
updated some gradle config to try to fix github build
stefanosiano 4177c93
updated some gradle config to fix github build
stefanosiano d477a59
changed ui tests module to application modules, to have an apk to upl…
stefanosiano 862819d
added detekt and errorprone to uitests modules
stefanosiano a30ecdc
added detekt and errorprone to uitests modules
stefanosiano f73b940
added saucelabs config files
stefanosiano 2e5215b
refactored benchmark tests with a BaseBenchmarkTest
stefanosiano dd38ed4
fixed proguard rules (disabled shrinking) and enabled proguard
stefanosiano 5e1b1b8
Merge branch 'tests/android-ui-tests' into tests/android-ui-tests-abs…
stefanosiano 4bf5b0e
pass a Choreographer object instead of the Runner to the BenchmarkOpe…
stefanosiano 8f62a8c
reverted profiling comparison rages from -1..5 to 0..5
stefanosiano 3e87945
Merge branch 'tests/android-ui-tests' into tests/android-ui-tests-abs…
stefanosiano 6811071
added idling resource to know when the activity has started
stefanosiano 2a9f83b
removed sentry providers through manifest instead of disabling the sdk
stefanosiano a9a163f
Format code
getsentry-bot ba41b1e
renamed sentry-uitest folder to sentry-android-integration-tests
stefanosiano 04cd4ea
Merge remote-tracking branch 'origin/tests/android-ui-tests' into tes…
stefanosiano 6af1f1c
moved EnvelopeAsserter.assertItem to assertions.kt as assertEnvelopeItem
stefanosiano 5107224
Merge branch 'tests/android-ui-tests' into tests/android-ui-tests-abs…
stefanosiano 695eb2f
moved few prints to comments in BenchmarkOperationResult
stefanosiano b3ae6f6
sentry-uitest-android-benchmark now depends on sentry-uitest-android
stefanosiano 6094db8
Merge branch 'tests/android-ui-tests' into tests/android-ui-tests-abs…
stefanosiano f4a7998
merge uitest branch
stefanosiano b815ee4
final (?) cleanups
stefanosiano 1d51f62
added SauceLabs configuration with several devices for each Android a…
stefanosiano 37ecc3a
added SauceLabs configuration with several devices for each Android a…
stefanosiano 2b67d83
Merge branch '6.x.x' into tests/android-ui-tests-absolute
stefanosiano 4c523e4
sdk init increase is in millis, not nanos
stefanosiano f5d39a4
added first github action (secrets are still to be confirmed)
stefanosiano 860ace5
added first github action (secrets are still to be confirmed)
stefanosiano 1f54262
added first github action (secrets are still to be confirmed)
stefanosiano 67b6bd3
removed the build task from benchmarks, as it will be included in ano…
stefanosiano 1727ce9
added ui tests gh action config file
stefanosiano b72594a
updated the github actions for running benchmarks and ui tests on sau…
stefanosiano c635337
updated the github actions for running benchmarks and ui tests on sau…
stefanosiano 0c982d9
updated the github actions for running benchmarks and ui tests on sau…
stefanosiano ff1ba13
moved choreographer to BaseBenchmarkTest
stefanosiano 6120cd8
Merge branch 'main' into tests/android-ui-tests-absolute
marandaneto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: "Integration Tests - Benchmarks" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Benchmarks | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Set up Java: 11" | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: "11" | ||
distribution: "adopt" | ||
|
||
# Clean, build and release a test apk | ||
- name: Make assembleBenchmarks | ||
run: make assembleBenchmarks | ||
|
||
# We stop gradle at the end to make sure the cache folders | ||
# don't contain any lock files and are free to be cached. | ||
- name: Make stop | ||
run: make stop | ||
|
||
- name: Run Tests in SauceLab | ||
uses: saucelabs/saucectl-run-action@v1 | ||
with: | ||
sauce-username: ${{ secrets.SAUCE_USERNAME }} | ||
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} | ||
config-file: .sauce/sentry-uitest-android-benchmark.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: "Integration Tests - Ui tests" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Ui tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Set up Java: 11" | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: "11" | ||
distribution: "adopt" | ||
|
||
# Clean, build and release a test apk | ||
- name: Make assembleUiTests | ||
run: make assembleUiTests | ||
|
||
# We stop gradle at the end to make sure the cache folders | ||
# don't contain any lock files and are free to be cached. | ||
- name: Make stop | ||
run: make stop | ||
|
||
- name: Run Tests in SauceLab | ||
uses: saucelabs/saucectl-run-action@v1 | ||
with: | ||
sauce-username: ${{ secrets.SAUCE_USERNAME }} | ||
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} | ||
config-file: .sauce/sentry-uitest-android-ui.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...id-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/BaseBenchmarkTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.sentry.uitest.android.benchmark | ||
|
||
import android.content.Context | ||
import android.view.Choreographer | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.runner.AndroidJUnitRunner | ||
import kotlin.test.BeforeTest | ||
|
||
abstract class BaseBenchmarkTest { | ||
|
||
protected lateinit var runner: AndroidJUnitRunner | ||
protected lateinit var context: Context | ||
protected lateinit var choreographer: Choreographer | ||
|
||
@BeforeTest | ||
fun baseSetUp() { | ||
runner = InstrumentationRegistry.getInstrumentation() as AndroidJUnitRunner | ||
context = ApplicationProvider.getApplicationContext() | ||
context.cacheDir.deleteRecursively() | ||
// Must run on the main thread to get the main thread choreographer. | ||
runner.runOnMainSync { | ||
choreographer = Choreographer.getInstance() | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...oid-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SdkBenchmarkTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package io.sentry.uitest.android.benchmark | ||
|
||
import androidx.lifecycle.Lifecycle | ||
import androidx.test.core.app.launchActivity | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import io.sentry.Sentry | ||
import io.sentry.android.core.SentryAndroid | ||
import io.sentry.uitest.android.benchmark.util.BenchmarkOperation | ||
import org.junit.runner.RunWith | ||
import java.util.concurrent.TimeUnit | ||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class SdkBenchmarkTest : BaseBenchmarkTest() { | ||
|
||
@Test | ||
fun benchmarkSdkInit() { | ||
|
||
// We compare starting an activity with and without the sdk init, to measure its impact on startup time. | ||
val opNoSdk = getOperation() | ||
val opSimpleSdk = getOperation { | ||
SentryAndroid.init(context) { | ||
it.dsn = "https://key@host/proj" | ||
} | ||
} | ||
val opNoSdk2 = getOperation() | ||
val opPerfProfilingSdk = getOperation { | ||
SentryAndroid.init(context) { | ||
it.dsn = "https://key@host/proj" | ||
it.isProfilingEnabled = true | ||
it.tracesSampleRate = 1.0 | ||
} | ||
} | ||
val simpleSdkResult = BenchmarkOperation.compare(opNoSdk, "No Sdk", opSimpleSdk, "Simple Sdk") | ||
val perfProfilingSdkResult = BenchmarkOperation.compare(opNoSdk2, "No Sdk", opPerfProfilingSdk, "Sdk with perf and profiling") | ||
|
||
val maxDurationThreshold = TimeUnit.MILLISECONDS.toNanos(100) | ||
assertTrue(simpleSdkResult.durationIncreaseNanos in 0..maxDurationThreshold) | ||
assertTrue(simpleSdkResult.cpuTimeIncreaseMillis in 0..100) | ||
assertTrue(perfProfilingSdkResult.durationIncreaseNanos in simpleSdkResult.durationIncreaseNanos..maxDurationThreshold) | ||
assertTrue(perfProfilingSdkResult.cpuTimeIncreaseMillis in simpleSdkResult.cpuTimeIncreaseMillis..100) | ||
} | ||
|
||
private fun getOperation(init: (() -> Unit)? = null) = BenchmarkOperation( | ||
choreographer, | ||
op = { | ||
runner.runOnMainSync { | ||
init?.invoke() | ||
} | ||
val benchmarkScenario = launchActivity<BenchmarkActivity>() | ||
benchmarkScenario.moveToState(Lifecycle.State.DESTROYED) | ||
}, | ||
after = { | ||
Sentry.close() | ||
} | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we get this error? Should we fix or remove the comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The errors are related to an issue with Android test orchestrator on old versions.
I will fix the issue, but in another pr, so we can understand how the sauce labs runs work with the other commits (adding devices would make the tests take longer)