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
JerryhncJerryhnc 

Test Coverage

When I run the test below, I get a message that the List has no rows for assignment.  When I manually run the query I get a single row returned.  

@isTest
private class AssetItemTriggerHandlerTest {

 static testMethod void AssetItemTriggerTest() {

  //getting any valid Asset
        Asset testAsset = [select Id, SD_Account_Number__c, Name, Status, PurchaseDate, Renewal_Date__c,
         AccountId 
        from Asset where Status='Regular' limit 1];    
        
        test.startTest();
        update testAsset;  
        test.stopTest();
        
 }
}


pconpcon
You need to insert the test data before you run that query.  Because you are running an API version greater than 24.  You can get around this by enabling SeeAllData for your test, but that is the wrong way to do it.