forked from celador/ForceCode
-
Notifications
You must be signed in to change notification settings - Fork 11
Code coverage is not updated when running individual tests. #94
Copy link
Copy link
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
v 3.8.6
When I run individual tests from the VS Code UI, the coverage in the corresponding APEX class is not updated. Running all tests in the test class resolves this issue.
Steps to reproduce the behavior:
- Create an APEX method with a conditional statement.
- Create two test classes, one to test each outcome.
The Controller
public with sharing class MyController {
{
@AuraEnabled
public static Integer TestConditional(Boolean condition)
{
Integer result = 0;
if(condition)
{
result = 5;
}
else
{
result = 10;
}
return result;
}
}
The Test Class
@isTest(isParallel=true)
public with sharing class MyControllerTest {
@isTest
public static void testCondition_True()
{
Test.startTest();
Integer result = MyController.TestConditional(true);
Test.stopTest();
System.assertEquals(5, result);
}
@isTest
public static void testCondition_False()
{
Test.startTest();
Integer result = MyController.TestConditional(false);
Test.stopTest();
System.assertEquals(10, result);
}
Expected Result: When running either test in isolation, the coverage for that part of the class is updated.
Actual Result: No coverage information is updated unless all tests are run.
The desired behaviour can also be achieved by running the tests individually in the SFDC developer console. When checking the 'All Tests' coverage on the tested class, coverage shows for tests that have been run, without the need to run all tests for the class.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on