I am working on a project in which the test folders were removed and I want to do a unit test. Is there a way to create the test folders again for this project?
For those who have already created folders with test classes, you can mark its directory as "Test Sources Root". Just click Right-Mouse-Button on the directory, then Mark Directory as/Test Sources Root.

Below are the steps to add your test folders on Android Studio 3.1.2 on Macbook :
Right click on app > New > Folder > Java Folder

On Configure Component window check Change Folder Location checkbox

Change the location to src/test

Your test folder will be created under src folder i.e. same place where previous test folder was
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With