function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC 2017SFDC 2017 

Test class assertion is passing in QA but validating in Prod is failing

Hi All,
I have a test class which is having some assertion statement .When we are deploying to QA it successfully passed but when validating the same with PROD the assertion Statement is failing.
Code where assertion is failing
 private static testMethod void LeadUtil() {
        insert testLead;
            Database.executeBatch(new testbatch(), 200);
        Lead Lead = [SELECT Id, OwnerId FROM Lead WHERE ID =: testLead.Id LIMIT 1];
        //system.assertEquals(Lead.OwnerId, standardUser.Id);
    }system.runAs(new User(Id=UserInfo.getUserId())) {
            standardUser = Test.createUser('12', STANDARDUSER, false);
            standardUser.IsActive = true;
            standardUser.Phone = '123871287';
            insert standardUser;
        system.runAs(new User(Id = UserInfo.getUserId())) {
            territory1 = Test.createTerritory('Test_Territory1', models.get(0).Id,CHILD, true);
            ota = Test.createOTA(acc.Id, territory1.Id, true);
            uta = Test.createUTA(standardUser.Id,, Territoryrole);
        //test lead creation
        testLead = Test.createLead('Test LEad', false);
        testLead.Account__c = acc.Id;
        testLead.Contact__c =;
How to reslove this?Batch will not complete execution in test class or not ?WHy thi sassertion is failing in PROD.
Thanks in advance
Shruti SShruti S
I think that you havent pasted the entire code here. I will only be able to make out something if I could see the entire code.