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
Brian Chipman 4Brian Chipman 4 

Apply a test class to a trigger in the Developer Console

Have succesully created a test class previously.  However, now I have a trigger and a potential test class for that trigger based off some examples but I am not able to do Test | New Run.  I get a message "Add test methods to your test class" but am not sure how to do that in the case of a trigger.  Any help or sugggestions would be appreciated.

Here is the trigger:
trigger UpdateAssetFromSO on Service_Order__c (after update, after delete) {

    List<Id> idAssetList = new List<Id>();
    List<Asset> assetListToUpdate = new List<Asset>();
    if(trigger.isUpdate) {
        for (Service_Order__c so : {
            if(trigger.oldMap.get(so.Id).Total_Reimbursement_Amount__c == so.Total_Reimbursement_Amount__c) continue;
    if(trigger.isDelete) {
        for (Service_Order__c so : trigger.old) {
    if(idAssetList.isEmpty()) return;
    for(Id id : idAssetList) {
        Asset asset = new Asset(Id = id);
        asset.SOChanged__c = true;
    if(assetListToUpdate.size() > 0)

Here is the Test Class (test when the Labor field is updated and when the service order record is deleted):

public class UpdateAssetFromSO_Test {

    public void DoIt(){
        //Create Service Orer to work with
        Service_Order__c so = new Service_Order__c(
           CurrencyIsoCode='USD-U.S. Dollar',
           Charge_To__c='11 - Logan',
           Labor_Reimbursement__c = 12.00
           insert so;
        //Update Service Order Total Reimbursement Amount is a formula field so we update Labor to make it change.
        so.Labor_Reimbursement__c = 123.00;
        //Delete Service Order
        Delete so;

Best Answer chosen by Brian Chipman 4
Jayant DasJayant Das
Your test method is missing the required annotation. Refer to this link ( as how to write a test class. In your example, you need to change the signature of your test method to as below. Once you do that, then you get the option of running test in developer console.
@isTest static void DoIt() {
     ... all my code ...