Skip to content

Commit 428b9d4

Browse files
committed
test(event) error options end to end tests
1 parent f1c4417 commit 428b9d4

File tree

6 files changed

+55
-6
lines changed

6 files changed

+55
-6
lines changed

bugsnag-android-core/src/main/java/com/bugsnag/android/ErrorOptions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class CaptureOptions(
2121
/**
2222
* Controls which custom metadata tabs are included.
2323
* - null: all metadata tabs captured
24-
* - empty set: only app and device tabs captured
24+
* - empty set: no custom metadata captured
2525
* - set of names: app, device, and specified tabs captured
2626
*
2727
* Note: app and device tabs are always captured.
2828
*/
29-
var metadata: Set<String>? = null,
29+
var metadata: MutableSet<String>? = null,
3030

3131
/** Whether to capture stacktrace. Defaults to true. */
3232
var stacktrace: Boolean = true,
@@ -60,7 +60,7 @@ class CaptureOptions(
6060
*/
6161
@JvmStatic
6262
@JvmOverloads
63-
fun captureOnly(fields: Int, metadata: Set<String>? = null): CaptureOptions {
63+
fun captureOnly(fields: Int, metadata: MutableSet<String>? = null): CaptureOptions {
6464
return captureNothing().apply {
6565
stacktrace = (fields and CAPTURE_STACKTRACE) != 0
6666
breadcrumbs = (fields and CAPTURE_BREADCRUMBS) != 0

examples/sdk-app-example/app/src/main/java/com/example/bugsnag/android/ExampleApplication.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class ExampleApplication : Application() {
3636
config.setUser("123456", "[email protected]", "Joe Bloggs")
3737
config.addMetadata("user", "age", 31)
3838
config.addPlugin(bugsnagOkHttpPlugin)
39-
config.isAttemptDeliveryOnCrash = true
4039

4140
// Configure the persistence directory when running MultiProcessActivity in a separate
4241
// process to ensure the two Bugsnag clients are independent
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.bugsnag.android.mazerunner.scenarios
2+
3+
import android.content.Context
4+
import com.bugsnag.android.Bugsnag
5+
import com.bugsnag.android.CaptureOptions
6+
import com.bugsnag.android.Configuration
7+
import com.bugsnag.android.ErrorOptions
8+
9+
class ErrorOptionsScenario(
10+
config: Configuration,
11+
context: Context,
12+
eventMetadata: String?
13+
) : Scenario(config, context, eventMetadata) {
14+
private val errorOptions = ErrorOptions(CaptureOptions())
15+
16+
override fun startScenario() {
17+
super.startScenario()
18+
Bugsnag.notify(generateException(), errorOptions, null)
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.bugsnag.android.mazerunner.scenarios
2+
3+
import android.content.Context
4+
import com.bugsnag.android.Bugsnag
5+
import com.bugsnag.android.Configuration
6+
7+
class NullErrorOptionsScenario(
8+
config: Configuration,
9+
context: Context,
10+
eventMetadata: String?
11+
) : Scenario(config, context, eventMetadata) {
12+
13+
override fun startScenario() {
14+
super.startScenario()
15+
Bugsnag.notify(generateException(), null, null)
16+
}
17+
}

features/full_tests/auto_notify.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,3 @@ Feature: Switching automatic error detection on/off for Unity
4343
And the event "severity" equals "error"
4444
And the event "severityReason.type" equals "signal"
4545
And the event "severityReason.unhandledOverridden" is false
46-
47-
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Feature: Error options notify scenarios
2+
3+
Background:
4+
Given I clear all persistent data
5+
6+
Scenario: Handled exceptions with null error options
7+
When I run "NullErrorOptionsScenario"
8+
Then I wait to receive an error
9+
And the error is valid for the error reporting API version "4.0" for the "Android Bugsnag Notifier" notifier
10+
11+
12+
Scenario: Handled exceptions with negative options
13+
When I run "ErrorOptionsScenario"
14+
Then I wait to receive an error
15+
And the error is valid for the error reporting API version "4.0" for the "Android Bugsnag Notifier" notifier

0 commit comments

Comments
 (0)