I have written a batch class, AbcBatch
. I created a test class AbcBatchTest
to cover the class 100%:
static testMethod void shouldNotDoXyz() {
// setup code
...
// call the batch class
Test.startTest();
AbcBatch b = new AbcBatch ();
Database.executeBatch(b);
Test.stopTest();
// asserts
...
}
When I run the tests in the Developer Console, the tests pass, but reports 0% code coverage for the Batch Class. I also verified "Store Only Aggregated Code Coverage" is unchecked under Test Execution Options.
I ran the "Clear Test Data" command and performed a run of all tests via Tests -> Run All
, but still the problem persists.
Here's the code coverage button in Developer Console for the class:
I have checked "Disable Parallel Apex Testing" under Test Execution Options as some of my tests won't pass with this option checked. However, I did run my tests with parallel testing enabled to see if that solved the problem, however it did not.
I ran the tests from the /ui/setup/apex/ApexTestQueuePage
as well, however I get the same result.
I also cleared test data, and Run All tests forcing asynchronous mode but still the problem persists.
What could be wrong?
/ui/setup/apex/ApexTestQueuePage
System.assert(!Test.isRunningTest(), 'Expected Boom!');