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,

https://developer.salesforce.com/docs/atlas.en-us.198.0.apexcode.meta/apexcode/apex_testing_utility_classes.htm

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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -