Skip to content

Latest commit

 

History

History
101 lines (59 loc) · 2.89 KB

File metadata and controls

101 lines (59 loc) · 2.89 KB

Testing bugsnag-android

This documents code quality checks that are used to improve the quality of bugsnag-android. Most of these can be run all together using ./gradlew check.

Unit tests

Unit tests are implemented using Junit and can be run with the following:

./gradlew test

Unit tests run on the local JVM and cannot access Android OS classes.

Instrumentation tests

Instrumentation tests are implemented using Junit and can be run with the following:

./gradlew connectedCheck

Instrumentation tests require an Android emulator or device to run, and they can access Android OS classes.

Static analysis

Several static analysis and code style checks are run against bugsnag-android to maintain the quality of the codebase. make check runs them all at once.

Android Lint

Android Lint Runs Android-specific static analysis checks. Warnings can be suppressed by following this guide.

./gradlew lint

Ktlint

Ktlint runs style checks on Kotlin code.

./gradlew ktlintCheck

Some violations (but not all) can be automatically addressed by running the following task:

./gradlew ktlintFormat

Detekt

Detekt runs static analysis checks on Kotlin code.

./gradlew detekt

Warnings can be suppressed by running the following task:

./gradlew detektBaseline

This permanently disables all outstanding violations by writing to detekt-baseline.xml.

Checkstyle

Checkstyle runs style checks on Java code.

./gradlew checkstyle

CPP Check

CPP check runs code analysis on C++ code to detect bugs.

./scripts/run-cpp-check.sh

ClangFormat

ClangFormat formats C++ code to ensure a consistent code style.

./scripts/run-clang-format.sh

GWP-ASAN

GWP-ASAN is an address sanitizer tool which is enabled on our E2E tests that target Android 11+. It randomly samples memory and aborts the process if memory was misused.

Build scan

Gradle build scans are enabled on CI so that the project's build performance can be benchmarked when necessary.

Size reporting

The size impact of the bugsnag-android SDK is reported onto Github pull requests using this Dangerfile.

Running remote end-to-end tests

Please see the mazerunner docs for information on how to run E2E tests locally.