Android and JUnit: create a JUnit project or test source folder

It is possible to create a JUnit project for Android.

As far as I know, another way is to create a folder in the same project called a test, which contains the same package name as an existing project.

What are the differences between the two methods.

+4
source share
3 answers

When I develop in Java, I usually create a separate / test folder in the same project as my source, with the same package structure under it.

I keep two separate so that the contents of / test are not packaged or deployed with the source code. There is no point in deploying tests or third-party JARs on which they depend.

0
source

Create a separate project. There are a number of reasons for this, among other things, your tests will not be included in the final APK , you may need another AndroidManifext.xml for your main project and your tests, and because this is common practice and your project will be more understandable to others.

0
source

option1: separate test project for Android
option2: "Project inside the project", folder "tests"

option2
should provide better eclipse speed, visibility and less maintenance,
promoted by google in the documentation
BUT currently has the ADT wizard support function.

I am currently considering option1 as a valid de facto standard,
and he has good ADT support.

Keep your eyes open because ADT versions are almost released monthly
therefore option 2 may soon become actual.

0
source

Source: https://habr.com/ru/post/1303393/


All Articles