Skip to main content

Hi all.

 

I followed the Trail up to the last module without any issues.

 

It asked my in the previous module to setup an Apex Class AccountServiceTest

 

Here is the Code copied from the Trailhead:

@IsTest

private class AccountServiceTest {

  @IsTest

  static void should_create_account() {

    String acctName = 'Salesforce';

    String acctNumber = 'SFDC';

    String tickerSymbol = 'CRM';

    Test.startTest();

      AccountService service = new AccountService();

      Account newAcct = service.createAccount( acctName, acctNumber, tickerSymbol );

      insert newAcct;

    Test.stopTest();

    List<Account> accts = [ SELECT Id, Name, AccountNumber, TickerSymbol FROM Account WHERE Id = :newAcct.Id ];

    System.assertEquals( 1, accts.size(), 'should have found new account' );

    System.assertEquals( acctName, accts[0].Name, 'incorrect name' );

    System.assertEquals( acctNumber, accts[0].AccountNumber, 'incorrect account number' );

    System.assertEquals( tickerSymbol, accts[0].TickerSymbol, 'incorrect ticker symbol' );

  }

}

 

When I run the Test however I get the following error message:

 

This class name's value is invalid: AccountServiceTest. Provide the name of an Apex class that has test methods.

 

Error nessage in VS when try to complete Set Up Apex Replay Debugger

3 件の回答
  1. 2024年1月25日 15:29

    Thanks, everybody. Not sure what the problem was. After creating a new Playground, I put the same code in VS and Deployed it to the Org. All was fine this time and I could complete the challenge

0/9000