How to make AndroidTest in android studio when it has deleted?

Viewed 3700

I have deleted AndroidTest in my project, but now I need that to test my project, how to create that?

2 Answers

If your androidTest package has been deleted/not being shown, then do the following:

The best and easy way is to open your Android project in File Explorer (My Computer/Windows explorer in Windows OS )

Then go to app-->src

(There you will already find your main folder)

Now, create a new package/folder in app-->src and name it as androidTest

NOTE: the name is case sensitive. Type as shown above.

Now in you app-->src-->main folder, copy the java folder and paste it in app-->src-->androidTest folder.

Now in androidTest folder, open all the folder inside till the end and delete the existing java files.

Now in your Android Studio, you can clearly see the folder/package of androidTest made. Just add new Java file and write all the test code stuff there and its done.

Related