diff --git a/features/app_version.feature b/features/app_version.feature new file mode 100644 index 0000000000..acf0ec2ad6 --- /dev/null +++ b/features/app_version.feature @@ -0,0 +1,9 @@ +Feature: Android support + +Scenario: Test handled Android Exception + When I run "AppVersionScenario" with the defaults + Then I should receive a request + And the request is a valid for the error reporting API + And the exception "errorClass" equals "java.lang.RuntimeException" + And the exception "message" equals "AppVersionScenario" + And the event "app.version" equals "1.2.3.abc" diff --git a/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/AppVersionScenario.kt b/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/AppVersionScenario.kt new file mode 100644 index 0000000000..854a0ae1fd --- /dev/null +++ b/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/AppVersionScenario.kt @@ -0,0 +1,19 @@ +package com.bugsnag.android.mazerunner.scenarios + +import android.content.Context +import com.bugsnag.android.Bugsnag +import com.bugsnag.android.Configuration + +/** + * Sends a handled exception to Bugsnag, which overrides the app version + */ +internal class AppVersionScenario(config: Configuration, + context: Context) : Scenario(config, context) { + + override fun run() { + super.run() + Bugsnag.setAppVersion("1.2.3.abc") + Bugsnag.notify(generateException()) + } + +}