You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
Describe the bug
When i.e. integrating Salesforce to other systems. Rather than having to deal with complex data models being casted into Map<String, Object> it is much simpler to work with using the JSON.deserialize(jsonString, Wrapper.class). This causes us to create wrapper classes with no executable statements and only variables for the JSON data model to be casted into. By default, Salesforce code coverage does not count towards classes with no executables so it would be nice if the tool allowed to i.e. tag class with for example //Dx@Scale-novalidate to skip coverage requirement for certain classes.
To Reproduce
Create a class with no executable statements:
public class TestClass {
private String variable;
}
Raise pull request with change and verify that validate command fails with 0% test coverage for new class.
The text was updated successfully, but these errors were encountered:
@Stian-Schikora this is a good idea, Can we write a DR on this? Probably it would be better if we could do this without any comments at all, by doing an apex parse run on it.
Don't think this has come up before. There are a few cases you would need to think about re: 'no code', such as would that include having code in superclasses, what about property blocks, field initialisers and initialiser blocks. But mostly its just deciding what the rules are and writing some code to inspect the class after parsing to see if it fits that. There might also be some odd cases to deal with, such as a method that does nothing.
We went via a straightforward and dummy approach. In such a case, we create a private test visible method, which is empty, and a test method called coverage() calls such methods to satisfy the requirement.
Describe the bug
When i.e. integrating Salesforce to other systems. Rather than having to deal with complex data models being casted into Map<String, Object> it is much simpler to work with using the JSON.deserialize(jsonString, Wrapper.class). This causes us to create wrapper classes with no executable statements and only variables for the JSON data model to be casted into. By default, Salesforce code coverage does not count towards classes with no executables so it would be nice if the tool allowed to i.e. tag class with for example
//Dx@Scale-novalidate
to skip coverage requirement for certain classes.To Reproduce
Create a class with no executable statements:
Raise pull request with change and verify that validate command fails with 0% test coverage for new class.
The text was updated successfully, but these errors were encountered: