Skip to content

Instantly share code, notes, and snippets.

@fatorx
Created October 8, 2015 15:31
Show Gist options
  • Save fatorx/794b0fefa79d9a8998cd to your computer and use it in GitHub Desktop.
Save fatorx/794b0fefa79d9a8998cd to your computer and use it in GitHub Desktop.
Configurar Unit Tests no Android Studio
Configurar Unit Tests no Android Studio
Adicionar, em dependencies no arquivo build.gralde do projeto, a lib Junit:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
}
Para configurar um modo Run, é necessário seguir esses passos:
Run -> Edit Configurations,
Seta Verde (Add New Configuration) -> Junit
Dê um nome para a configuração
Em Test Kind, selecione "All in package"
Em Search for tests: selecione "In single module"
Em Working directory: $MODULE_DIR$
Em Use classpath of module, selecione "app"
tip: no último item da tela, Before launch, selecione Make e clique na seta vermelha (menos).
Clique na seta verde (mais) e adicione Gradle-aware Make
Para finalizar
Apply e depois OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment