Skip to content

Commit

Permalink
Merge pull request #113 from backtrace-labs/bugfix/fix-classifier-value
Browse files Browse the repository at this point in the history
Fix classifier value, use value from report
  • Loading branch information
BartoszLitwiniuk authored Nov 28, 2023
2 parents 57faca7 + a863421 commit aa3ec64
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ jobs:
run: |
saucectl configure --username ${{ secrets.SAUCE_USERNAME }} --accessKey ${{ secrets.SAUCE_ACCESS_KEY }}
# recent real device
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --device name="Samsung_Galaxy_S20_FE_5G_backtrace_us"
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --device name="Samsung_Galaxy_S20_FE_5G_backtrace_us" --region us-west-1
# newest Android version
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --emulator name="Android GoogleApi Emulator,platformVersion=12.0"
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --emulator name="Android GoogleApi Emulator,platformVersion=12.0" --region us-west-1
# oldest Android version
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --emulator name="Android GoogleApi Emulator,platformVersion=5.1"
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --emulator name="Android GoogleApi Emulator,platformVersion=5.1" --region us-west-1
# oldest real device (aiming for armv7 / 32bit)
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --device name=".*,platformVersion=6.0.1"
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --device name=".*,platformVersion=6.0.1" --region us-west-1
# --device name=".*,platformVersion=6.0.1"
# --device name="Samsung_Galaxy_S20_FE_5G_backtrace_us"
# --device name="Samsung_Galaxy_S22_Ultra_5G_backtrace_us"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package backtraceio.library.models;

import static org.junit.Assert.assertEquals;

import android.content.Context;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.HashMap;

import backtraceio.library.models.json.BacktraceReport;

@RunWith(AndroidJUnit4.class)
public class BacktraceDataTest {
private Context context;

@Before
public void setUp() {
context = InstrumentationRegistry.getInstrumentation().getContext();
}

@Test
public void createBacktraceDataTest() {
// GIVEN
BacktraceReport report = new BacktraceReport(new IllegalAccessException("test-message"));

// WHEN
BacktraceData backtraceData = new BacktraceData(context, report, new HashMap<>());

// THEN
assertEquals(backtraceData.classifiers, new String[]{"java.lang.IllegalAccessException"});
assertEquals(backtraceData.report, report);
assertEquals(backtraceData.attributes.get("classifier"), "java.lang.IllegalAccessException");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void setExceptionAttributes(BacktraceReport report) {
this.attributes.put("error.message", report.message);
return;
}
this.attributes.put("classifier", report.exception.getClass().getName());
this.attributes.put("classifier", report.classifier);
this.attributes.put("error.message", report.exception.getMessage());
}

Expand Down

0 comments on commit aa3ec64

Please sign in to comment.