Unable to run tests in namespaced package scratch org.

Issue #1754 resolved
Justin Julicher created an issue

Getting the following error in the run test dialog:

Error 403/Forbidden - INVALID_INPUT: This class name's value is invalid: qic.TriggerContext_Test. Provide the name of an Apex class that has test methods.

I can run all the tests fine using:

sfdx force:apex:test:run --targetusername=TriggerFramework --wait 10

namespace: qic

any idea?

Comments (7)

  1. Justin Julicher reporter

    Looks like it is related to #1306

    Here is part of the debug log:

    2020-11-10 15:22:52,309 [13836845]  DEBUG - .ApexUnitTestRunProcessHandler - Creating a trace flag.
    2020-11-10 15:22:53,537 [13838073]   INFO - .ApexUnitTestRunProcessHandler - Running unit tests asynchronously.
    2020-11-10 15:22:53,537 [13838073]  DEBUG - .ApexUnitTestRunProcessHandler - Queueing the test run skipping coverage.
    2020-11-10 15:22:53,537 [13838073]  DEBUG - .ApexUnitTestRunProcessHandler - Posting the following to runTestsAsynchronous:
    2020-11-10 15:22:53,537 [13838073]  DEBUG - .ApexUnitTestRunProcessHandler -   {"tests":[{"className":"qic.TriggerContext_Test","testMethods":["testMethods"]},{"className":"qic.TriggerHandlerSelector_Test","testMethods":["selectShouldNotFail"]},{"className":"qic.TriggerHandler_Test","testMethods":["testBeforeInsert","testBeforeUpdate","testBeforeDelete","testAfterInsert","testAfterUpdate","testAfterDelete","testAfterUndelete","testNonTriggerContext","testBypassAPI","testGetHandlerName","testVirtualMethods"]},{"className":"qic.TriggerManager_Test","testMethods":["shouldCallActiveTriggerHandler","enabledBeforeShouldNotRun"]},{"className":"qic.Triggers_Test","testMethods":["setHasRunTest"]}],"skipCodeCoverage":true}
    2020-11-10 15:22:53,797 [13838333]   WARN - .ApexUnitTestRunProcessHandler - Unexpected status code 403 returned.
    2020-11-10 15:22:53,797 [13838333]  DEBUG - .ApexUnitTestRunProcessHandler - Finishing test run.
    2020-11-10 15:22:53,797 [13838333]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerContext_Test.testMethods was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandlerSelector_Test.selectShouldNotFail was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testBeforeInsert was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testBeforeUpdate was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testBeforeDelete was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testAfterInsert was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testAfterUpdate was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testAfterDelete was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testAfterUndelete was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testNonTriggerContext was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testBypassAPI was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testGetHandlerName was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerHandler_Test.testVirtualMethods was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerManager_Test.shouldCallActiveTriggerHandler was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method TriggerManager_Test.enabledBeforeShouldNotRun was never reported as completed. Setting to ignored.
    2020-11-10 15:22:53,798 [13838334]  DEBUG - .ApexUnitTestRunProcessHandler - Test method Triggers_Test.setHasRunTest was never reported as completed. Setting to ignored.
    

  2. Scott Wells repo owner

    Justin, the 403 typically means that something in the posted request could not be found on the server. Do you have any test classes/methods locally that have not been successfully deployed to the server?

  3. Justin Julicher reporter

    Hi Scott

    Thanks that pointed me in the right direction.

    I use WSL2 & Webstorm in Windows and sync the .sfdx dir from WSL2 and somehow they had become out of sync.

    It is now working and this can be closed.

    Sorry about the confusion.

  4. Scott Wells repo owner

    Okay, glad to hear. I really wish this API would return a partial success based on the classes/methods that it found and not a monolithic failure when you specify a class/method name in the request payload that isn't on the server.

  5. Log in to comment