testing - Salesforce/Apex, Why is TestDataFactory class included on code-coverage percentage? -
now i'm making apex test case clearing code-coverage.
used normal code following like,
testdatafactory
@istest public class testdatafactory{ public list<account> createaccounts(){ // data create... return accounts; } // data create methods... . . . }
mytestclass
@istest private class mytestclass { static testmethod void test1() { testdatafactory.createaccounts(); // run tests } // other testmethods . . . }
number of lines of testdatafactory class 100lines, , mytestclass 100lines test case logic completed code cover.
therefore, 100 lines / 200 lines. code coverage 50%.
because code coverage of testdatafactory class 0%.
how can solve it?
i'm sorry poor english. thank reading it.
it works expected. shortly,
including code other test methods in @istest annotated class cause these lines counted in overall code coverage numbers
please, check why test class evaluated part of organization’s code coverage?
i suggest, remove @istest testdatafactory class, not confuse anyone. covered 100% use methods in tests.
Comments
Post a Comment