redux-android-sample
An Android sample that implements Redux architecture (using Fluxxan and Anvil) and NoSQL (using SnappyDB)
Architecture
#App State Example
{
hasMoreGifs: true,
gifs: [{
path: "path",
url: "url",
title: "string",
watched: false,
status: PAUSED //PAUSED, LOOPING, DOWNLOADING, DOWNLOADED, NOT_DOWNLOADED, DOWNLOAD_FAILED
}
]
}
#Tests
- Testing fundamentals
- Tests The Android Way
- Espresso Test Life Cycle
- Tests with Espresso, Mockito, Dagger 2
- Espresso Tutorial
- Roboeletric vs Android Test Framework
###Integration tests
- The integration tests are running on top of espresso framework, and using mockito to handle mocks.
To setup a CI or run tests in command line use this command:
adb shell am instrument -w br.com.catbag.gifreduxsample.test/android.support.test.runner.AndroidJUnitRunner
###Unit tests
- The unit tests are running with roboeletric, that is a android test framework with builtin mock capabilities of android sdk. The roboeletric give us the power to run some unit tests with functions from android SDK without the requirement of an emulator running, what results in very fast tests.
To run unit tests through a CI or command line:
./gradlew clean test --daemon --continue
Drone CI
Running drone build locally
-
Install drone CLI
curl http://downloads.drone.io/drone-cli/drone_linux_amd64.tar.gz | tar zx sudo install -t /usr/local/bin drone
-
Run drone build inside project dir
drone exec --trusted
CI last build reports
- Instrumentation tests
- Unit tests
- Coverage
- PMD
- Findbugs
- Checkstyle (without errors, no page generated)
- Artifacts history
#Good Practices
###Actions Creators
- Pay attention on action creation UI calls that do something async and dispatch action, the main action has to be dispatched before other async created actions, and its not a good practice dispatch two actions on the same synchronous cycle.
CODE INSPECT
How to use
-
Run check task on Gradle Tasks -> verification
-
After this attention on Android Studio Run console or on gradle output if you run on terminal.
-
The reports are inside app/build/reports/tool_name folders. eg. flux-android-sample/app/build/reports/lint
-
The inspect tools custom configurations are inside app/inspect/ folder.
-
Problems found by inspect tools stops the check task.