+ Start a Discussion
LVSLVS 

Test class failing in target sandbox but successful during deployment

I seem to be having an unique problem. For our development, we have a sandbox called Dev and another sandbox Model for UAT before we go on to Production.

 

I just moved a bunch of pages, controllers, classes, triggers + test class for all functionality covered in these from Dev to Model. The test class was successful when run individually in Dev. The deployment to Model was successful. The test class is in ver 25.0 in Dev and Model and has @SeeAllData explicitly set to false

 

However, when I run the test class individually in Model, it fails. It seems a few User records were not returned which is why the test failed. When I ran the piece of code querying and using a bunch of users through Developer Console, it returned the expected rows. Baffling!

 

I've double checked the usually overlooked items like checking against a wrong Org or missing a WHERE claus etc. Any ideas why I might be facing this issue? My Dev Org is in Summer 12 and Model in Winter 13. But I fail to see why that might be a problem!


Thanks in advance.

 

~LVS

Best Answer chosen by Admin (Salesforce Developers) 
LVSLVS

Re-deployed the test class to target sandbox and it was resolved :-/

All Answers

Mayank_JoshiMayank_Joshi

Might be API version i.e. 25 of your classes causing this issue .As you are saying, one of your org is not upgraded to Winter 13 release . 

 

Or let us know if there is any other reason .(If you have already firgure it out ) .

LVSLVS

The @SeeAllData annotation was introduced in 24.0 AND User records should still be available irrespective of @SeeAllData

 

If I do find out the proble, I'll surely update here...

crop1645crop1645

Are your testmethods in Model failing when you run tests in Eclipse IDE or via Run tests from the force.com UI?

 

If the former, there were some issues where Eclipse on Winter 13 did not yield the same results as running the identical tests in the Force.com UI.  I should know, I reported them - http://boards.developerforce.com/t5/Apex-Code-Development/Winter-13-anomaly-Test-runs-using-Force-com-Run-Tests-UI-but/m-p/499331/highlight/true#M92363.

 

They seem to have been fixed though in my Winter 13 sandbox as of 2 days ago though so this might be a red herring.

LVSLVS

It was failing in the UI. After reading your post, I ran it from IDE and it gave the same results..

LVSLVS

Bump!

Mayank_JoshiMayank_Joshi

Waiting for some more concrete update :) !! 

LVSLVS

Re-deployed the test class to target sandbox and it was resolved :-/

This was selected as the best answer
Mayank_JoshiMayank_Joshi

LOL !!

 

Also , Is your Dev Org is now upgrated to Winter 13 ? I guess , Answer is YES .