+ Start a Discussion
Jerun JoseJerun Jose 

Test method providing unstable results

I ran into a problem today, when my test classes were not acting stable.

 

Thing is, when I ran the testmethod first, it succeeded; a few hours later it failed; a few more hours later it succeeded again. All the while nothing was changed in the org, and my test method or target classes do not have any time dependant logic. Any possible reasons for this strange behaviour?

 

Another thing I noticed was that when I click on the % value to show up the lines covered, some lines had no highlight. Can some1 tell me what they mean ?

 

 

Thanks,

 

Jerun Jose

bvramkumarbvramkumar

It seems like you are using Run Test in the Org to find the coverage instead of using an IDE to find the coverage. Isn't it ? Well, the "Run Test" in the Org. did give problems to me with inconsistent coverage. Then I prefered to rely on IDE even if it takes some time. Also, You might want to recompile the class involved before you run the Test code. Recompilation helped me in few instances. Good luck.

Jerun JoseJerun Jose

Hmm .. Strange..

 

Any idea why this thing happens?? From what I believe, the IDE calls the runtest method in the Metadata API, which should be the same thing called from the UI as well. Just wondering as to why the results would differ.

 

Any idea about the no highlight thing? What do you suppose they stand for ?

bvramkumarbvramkumar

Well Jerun...  The blue highlighting stands for the covered line and the red one indicates uncovered code..... But sometimes you would see lines not highlighted by both.... I would like to know why too. :)