Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Mark Directory as Test Sources Root

I've done something in build.gradle to remove the green highlighting of the androidTest.java package.

I don't know how to get it back.

IntelliJ has a "Mark directory as test sources root" option in the context menu but I can't find the equivalent in Android Studio.

Is there a way to define this folder so I can start testing? (If it means anything, the test java files all have an icon of a "J" with a red circle around it)

like image 852
SalicBlu3 Avatar asked Jul 31 '15 14:07

SalicBlu3


People also ask

How do I create a test folder on Android?

Right click on src folder and select create directory and android studio will show you folder like "test/java", "test/kotlin", "androidTest/java" etc. Just select one, simple.


2 Answers

You can click on the folder and type Cmd + Shift + a to enter the action search and then by typing Mark directory as you will get the menu.

like image 178
Diego Villacis Avatar answered Oct 18 '22 04:10

Diego Villacis


For me, this option is no longer so easily available. To access it I need to double tap 'shift' and manually type "mark directory as. Then I can pick it from the list."

like image 37
Michał Powłoka Avatar answered Oct 18 '22 03:10

Michał Powłoka