0

I'm using Android Studio.

My code base is located in app/src/main/java, unit tests in app/src/test/java and instrumented tests in app/src/androidTest/java.

For a class named Foo I can create a unit test FooTest but as I create an instrumented test FooTest I get a duplicate class error.

Is there any way I can resolve this, or should I change one of test classes?

Creos
  • 2,445
  • 3
  • 27
  • 45
Mehrdad Shokri
  • 1,974
  • 2
  • 29
  • 45

1 Answers1

-3

It is odd that you need the same class tested under instrumented and vanilla unit tests since if you've followed MVC (or one of its many, many variations) you shouldn't need to worry about instrumentation for the vast majority of your testing. I've never experienced this but I think that yes - you would need to keep the test names distinct.

Creos
  • 2,445
  • 3
  • 27
  • 45
  • I think it's completely viable that a class has methods that have android framework dependency and some methods don't. So you use difference type of tests. – Mehrdad Shokri Jun 26 '16 at 21:50
  • not if you've created the right separation TBH. but i don't want to launch into a discussion of unit vs integration testing or MVC paradigms. If you do find a compelling reason to do this -- yes, you would need to name the classes differently – Creos Jun 26 '16 at 21:53