Why is the Android test runner reporting Empty test suite?
You need to provide default constructor for your test class, for example:
package nilzor.myapp.tests;
public class NilzorSomeTest extends ActivityUnitTestCase<ActivityYouWantToTest>{
public NilzorSomeTest(){
super(ActivityYouWantToTest.class);
}
@SmallTest
public void testBlah(){
assertEquals(1,1);
}
}
about your other questions:
No. My tests still run without any annotations, but I guess it's a good practice to have them. It allows you to specify size of tests to run. See What is the purpose of @SmallTest, @MediumTest, and @LargeTest annotations in Android? for more detail.
Yes, you need "test" prefix. InteliJ gives "method never used" warning when there's no "test" prefix, and skips that method during test run.
Yes. I have my tests organized into subpackages and it seems to be working well.
Class not found: Empty test suite when running unit tests in Android Studio
I had a similar problem and it was because I first created an Unit Test with the same class name. When I created the Instrumented Unit Test I got the error.
To solve it, I went to Edit Configurations, on the left of the run icon. Then below Unit Test, it was the 'conflicting' class, which I deleted. Click on Apply/Ok. Then I right click on the class name, click on run and voilà, it works.
Why is the Android test runner reporting Empty test suite?
You need to provide default constructor for your test class, for example:
package nilzor.myapp.tests;
public class NilzorSomeTest extends ActivityUnitTestCase<ActivityYouWantToTest>{
public NilzorSomeTest(){
super(ActivityYouWantToTest.class);
}
@SmallTest
public void testBlah(){
assertEquals(1,1);
}
}
about your other questions:
No. My tests still run without any annotations, but I guess it's a good practice to have them. It allows you to specify size of tests to run. See What is the purpose of @SmallTest, @MediumTest, and @LargeTest annotations in Android? for more detail.
Yes, you need "test" prefix. InteliJ gives "method never used" warning when there's no "test" prefix, and skips that method during test run.
Yes. I have my tests organized into subpackages and it seems to be working well.
Why is the Android test runner reporting Empty test suite?
You need to provide default constructor for your test class, for example:
package nilzor.myapp.tests;
public class NilzorSomeTest extends ActivityUnitTestCase<ActivityYouWantToTest>{
public NilzorSomeTest(){
super(ActivityYouWantToTest.class);
}
@SmallTest
public void testBlah(){
assertEquals(1,1);
}
}
about your other questions:
No. My tests still run without any annotations, but I guess it's a good practice to have them. It allows you to specify size of tests to run. See What is the purpose of @SmallTest, @MediumTest, and @LargeTest annotations in Android? for more detail.
Yes, you need "test" prefix. InteliJ gives "method never used" warning when there's no "test" prefix, and skips that method during test run.
Yes. I have my tests organized into subpackages and it seems to be working well.
Android JUnitRunner Empty Test Suite: No Test Results
I got it to work using this:
@RunWith(AndroidJUnit4.class)
@LargeTest
public class NetworkAndDBInstrumentationTest {
//use the following annotation and declare an ActivityTestRule for your activity under test
@Rule
public ActivityTestRule<RealmActivity> mActivityRule = new ActivityTestRule(RealmActivity.class);
//use @Before to setup your test fixture
@Before
public void setUp() { }
//annotate all test methods with
@Test
public void testGetCrowd() {
Assert.assertEquals(1, 1);
}
@After
public void tearDown() { }
}
Where RealmActivity is the Activity I want to test. Build.gradle and everything else is as in the question post. Now, a follow-up question: What does it matter that I make the @Rule with RealmActivity? Can't I use other Activities in that test? Can I make a Activity-independent test?
Android Studio 3.2 empty test suite
Looking at this bug report, I think it should be fixed in 3.2.1: https://issuetracker.google.com/issues/115708445#comment12
Empty test suite error when running unit test case in intellij
Since you're trying to debug Cassandra. You can reference https://wiki.apache.org/cassandra/RunningCassandraInIDEA. They have already set up a ant target to generate required configurations.
Class Not Found: Empty Test Suite in IntelliJ
So, my issue here was with folder names. I had called my code folder Classes 2016/2017, which IntelliJ didn't like. Simply remove the slash (or other offending character in path), re-import the project, and you'll be good to go!
Related Topics
How to Animate Marker in Android Map API V2
How to Do Circular Scrolling on Viewpager
Immersive Mode Navigation Becomes Sticky After Volume Press or Minimise-Restore
Alternatives to Preferencefragment with Android-Support-V4
How to Test If a Fragment View Is Visible to the User
Libz.So.1: Cannot Open Shared Object File
Android Appcompat-V7:21.0.0 Change Material Checkbox Colors
Update Text of Notification, Not Entire Notification
How to Use Dimens.Xml in Android
Android - Multi-Line Linear Layout
Android Viewpager Get the Current View
Textinputlayout :How to Give Padding or Margin to Hint
Two Textviews Side by Side, Only One to Ellipsize
Could Not Access the Package Manager. Is the System Running While Installing Android Application
Cordova Android Requirements Failed: "Could Not Find an Installed Version of Gradle"
How to Pop Fragment Off Backstack