I am trying to complete the challenge number#5 on the Advanced Apex Specialist Super badge and I am stuck with an error. I am getting an error stating that the test method doesn't have proper declaration or access modifier but the test method does have all of that. Not sure how to proceed here.

Error Message: enter image description here

Test class signature that I have tried with and all have resulted in the same error:


@isTest static void OrderUpdate_UnitTest() { ... }


@isTest private static void OrderUpdate_UnitTest() { ... }


@isTest(seeAllData=false) private static void OrderUpdate_UnitTest() { ... }


static testMethod void OrderUpdate_UnitTest() { ... }


private static testMethod void OrderUpdate_UnitTest() { ... }



public static void VerifyQuantityOrdered(Product2 originalProduct, Product2 updatedProduct, Integer qtyOrdered) {
       system.assert(updatedProduct.Quantity_Ordered__c == originalProduct.Quantity_Ordered__c+qtyOrdered);
| improve this question | | | | |
  • try using @IsTest – Caspar Harmer Jul 29 '19 at 1:59
  • @CasparHarmer, I have tried that but that didn't help out either. – Sam Jul 29 '19 at 3:34
  • 1
    Open your debugger console and run the verify again. Often you'll see what they want in the debug output. – Caspar Harmer Jul 29 '19 at 6:38

Have you tried making the Test Class public or the methods themselves public or global?

Not sure how they verify these tests, but assume its a mixture of Metadata API and actually running the tests themselves, and could be the latter not being possible if they are all private. If you have already had tests validated by Trailhead in earlier challenge steps without having to use public though, this answer is probably on the wrong track.

| improve this answer | | | | |
  • Yes, I have tried all possible combination of making the method and class public. But the error clearly states to follow 'Best Practices' and the best practices indicate to use private as the modifer and have @isTest instead of testMethod. – Sam Jul 29 '19 at 3:34
  • Yeah, agree with you on that. Ideally it should be @isTest private static void. Out of interest, what happens if you remove whitespace between () and { so: OrderUpdate_UnitTest(){ – aidan Jul 29 '19 at 4:17
  • yup, I tried that as well.. But no luck. – Sam Jul 29 '19 at 4:29
  • I would recommend logging a support ticket, there is a trailhead support team that are supposed to assist with troubleshooting badges, although in my experience you can wait up to 3 weeks for a response depending on how busy they are. Other avenues of exploration are: -create a new trailhead playground and paste the code back in -turn on logging and inspect in detail whether there is an error payload returned when you check the challenge – aidan Jul 29 '19 at 4:39

There are 3 things that helped in passing this challenge

  1. Created another trailhead playground and moved the code to that org.
  2. Added the private modifier to the testSetup method.
  3. Added the dummy OrderExtension_UnitTest() method.
| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.