You need to sign in to do that
Don't have an account?

code coverage | test class | query + for
Hello,
I have written a test class, for code coverage.
the code coverage is not proper for a fucntion.
it accepts no paramenters.
but it stop inside for loop.
i am making query inside for loop and it doesnt not enter this loop,whe i execute the query it is passing

Any suggestion
I have written a test class, for code coverage.
the code coverage is not proper for a fucntion.
it accepts no paramenters.
but it stop inside for loop.
i am making query inside for loop and it doesnt not enter this loop,whe i execute the query it is passing
Any suggestion
Testing Best Practices
1) Always avoid to use SeeAllData = true
2) Create your test data in your test class. Never depend on your organization data
3) Always try to use assert in test classes
http://amitsalesforce.blogspot.in/2015/06/best-practice-for-test-classes-sample.html
Let us know if this will help you
All Answers
If no records are available, it won't enter into the for loop.
------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
Maybe you need to create test data(Accounts or others) inside test method.
Thanks, Alex
In code you quering on account and before calling this function you need to create account in test class as "Alexander Tsitsura" define but created account fields values must be matching with query.
Thanks.
Testing Best Practices
1) Always avoid to use SeeAllData = true
2) Create your test data in your test class. Never depend on your organization data
3) Always try to use assert in test classes
http://amitsalesforce.blogspot.in/2015/06/best-practice-for-test-classes-sample.html
Let us know if this will help you