Problem running unit tests by class

Issue #2020 resolved
Vic Ricker created an issue

I have certain test classes where, running them via ALT-SHIFT-F6, or by pressing the Run button in the gutter next to the class name, only runs one or some of the test methods.

Run Configurations shows a configuration for that class where not all of the methods are selected. If I select all methods, then run the test, it will work.

If I delete the Run Configuration, and run the class test again, it only runs some of the tests. It seems like it might always be the same ones, but I’m not sure. It doesn’t happen on all classes, but I don’t see a pattern.

Additionally, Run ‘All APEX tests’ is broken. “Error 500/Server Error - UNKNOWN_EXCEPTION: An unknown exception occurred.” I’m not sure if that’s related. I’ve seen similar reports of this error, but no resolution. I suspect that this may be caused by exceeding some limit in Salesforce, but that’s just speculation. (We have ~700 tests.) I worked around it by creating a run configuration with fewer tests. We have some third party stuff that doesn’t need to be tested.

Comments (29)

  1. Scott Wells repo owner

    Hi. When you see an Error 500/Server Error in the logs, it's difficult to pin down exactly what's going on given that it's happening inside the Salesforce servers. The most common cause I've seen is just an issue with synchronous test execution with a workaround of forcing execution as asynchronous, but synchronous only applies to execution of a single class and you're seeing this when trying to execute multiple test classes. Unfortunately my best recommendation would be to try to pin it down to whichever test classes seem to raise the error when included in the test run...obviously a very tedious exercise.

    With regard to the other issue with not all test methods in a class executing, do you perhaps have a stub/skeletal copy of that test class in your project's offline symbol table? If so, please regenerate the OST which will omit any classes which are present locally and remove that ambiguity. That's an IC2 bug if it's happening, but let's see whether that's the case or not.

    If you want to reproduce either/both of these with debug logging enabled for unit test execution, I'll be happy to review the resulting idea.log* file(s). You can either attach them here or email them to me.

  2. Scott Wells repo owner

    Thanks, Vic. And just so I can digest this log efficiently, can you please tell me the expected outcome vs. the actual outcome? In other words, which test class/methods did you try to execute which did not execute successfully and/or completely? That will help me to focus on the relevant log portions.

  3. Vic Ricker reporter

    Sorry, I tried to send just the end of the log, but I noticed that I missed some stack traces, so thought it better to just send the whole log.

    I tried running OrderManagerTest. It has seven test methods. Intellij only ran testQuantityDoesNotMatch(). I expected it to run all seven methods.

    I tried regenerating the offline symbol table prior. It doesn’t seem to have helped.

  4. Scott Wells repo owner

    Thanks, Vic. I think I may know what's happening here. Please use Run>Edit Configuration to show the existing run configurations, then look at the Apex Unit Tests run configuration for OrderManagerTest. Are all of the test methods for that class checked? If not, that's the issue. Go ahead and delete that run configuration and try executing tests for that class again. Please let me know either way whether that helps as if the context run config isn't being updated properly, that's a bug I'll need to fix.

  5. Vic Ricker reporter

    Yes… that is the issue, however, deleting the run configuration, and running the test for the class again, results in the same run configuration with only one method selected.

  6. Scott Wells repo owner

    Hmmmm....that's very strange. Here's the relevant extract from the original log:

    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler - Finding test methods in OrderManagerTest. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   setup is not a test method. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   testOrderGetsMatchedToOpportunity is a test method. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasOpportunityExactMatch is a test method. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch is a test method. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch_with_greater_quantity is a test method. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   testExactMatch_with_extra_products is a test method. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   testNotExactMatch_product_not_purchased is a test method. 
    2021-12-07 09:58:52,621 [6022481]  DEBUG - .ApexUnitTestRunProcessHandler -   testQuantityDoesNotMatch is a test method. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   Found the following test methods for OrderManagerTest: { OrderManagerTest.testOrderGetsMatchedToOpportunity(), OrderManagerTest.testHasOpportunityExactMatch(), OrderManagerTest.testHasQuoteExactMatch(), OrderManagerTest.testHasQuoteExactMatch_with_greater_quantity(), OrderManagerTest.testExactMatch_with_extra_products(), OrderManagerTest.testNotExactMatch_product_not_purchased(), OrderManagerTest.testQuantityDoesNotMatch() }. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   Filtering by the configured test methods based on simple class name OrderManagerTest: { testOrderAndQuoteNumberDoesNotMatch, testNotExactMatchBetweenSkus2, testNotExactMatchBetweenSkus3, testQuantityDoesNotMatch, testNotExactMatchBetweenSkus, testPriceDoesNotMatch, testExactMatch }. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   testOrderGetsMatchedToOpportunity is not a configured test method in test class OrderManagerTest. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasOpportunityExactMatch is not a configured test method in test class OrderManagerTest. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch is not a configured test method in test class OrderManagerTest. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch_with_greater_quantity is not a configured test method in test class OrderManagerTest. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   testExactMatch_with_extra_products is not a configured test method in test class OrderManagerTest. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   testNotExactMatch_product_not_purchased is not a configured test method in test class OrderManagerTest. 
    2021-12-07 09:58:52,622 [6022482]  DEBUG - .ApexUnitTestRunProcessHandler -   testQuantityDoesNotMatch is a configured test method in test class OrderManagerTest. 
    

    Those last few lines that say "...is not a configured test method..." basically mean that it found a test method in the class that's not selected in the run configuration that was selected for execution.

    Just to clarify, if you completely remove that run configuration and recreate it by executing tests contextually based on the OrderManagerTest class and not a specific method, it results in that exact same run configuration? If so, that sounds like it's picking up something stale from cache or something. I'd like to see a log of that if you don't mind.

  7. Vic Ricker reporter

    At 10:31

    I deleted the run configuration.

    Ran the test via the run button in the gutter:

    It only ran one test:

  8. Scott Wells repo owner

    Okay, I can now see what's happening, though I don't understand why. Here's what I see in the log:

    2021-12-07 10:32:31,252 [8041112]  DEBUG - .ApexUnitTestRunProcessHandler - Configured: Setting test class/method map to:
    {
      ...
      "OrderManagerTest": [
        "testOrderAndQuoteNumberDoesNotMatch",
        "testNotExactMatchBetweenSkus2",
        "testNotExactMatchBetweenSkus3",
        "testQuantityDoesNotMatch",
        "testNotExactMatchBetweenSkus",
        "testPriceDoesNotMatch",
        "testExactMatch"
      ],
      ...
    } 
    ...
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler - Finding class declaration for OrderManagerTest. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler - Finding test methods in OrderManagerTest. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   setup is not a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   testOrderGetsMatchedToOpportunity is a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasOpportunityExactMatch is a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch is a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch_with_greater_quantity is a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   testExactMatch_with_extra_products is a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   testNotExactMatch_product_not_purchased is a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   testQuantityDoesNotMatch is a test method. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   Found the following test methods for OrderManagerTest: { OrderManagerTest.testOrderGetsMatchedToOpportunity(), OrderManagerTest.testHasOpportunityExactMatch(), OrderManagerTest.testHasQuoteExactMatch(), OrderManagerTest.testHasQuoteExactMatch_with_greater_quantity(), OrderManagerTest.testExactMatch_with_extra_products(), OrderManagerTest.testNotExactMatch_product_not_purchased(), OrderManagerTest.testQuantityDoesNotMatch() }. 
    2021-12-07 10:32:31,313 [8041173]  DEBUG - .ApexUnitTestRunProcessHandler -   Filtering by the configured test methods based on simple class name OrderManagerTest: { testOrderAndQuoteNumberDoesNotMatch, testNotExactMatchBetweenSkus2, testNotExactMatchBetweenSkus3, testQuantityDoesNotMatch, testNotExactMatchBetweenSkus, testPriceDoesNotMatch, testExactMatch }. 
    2021-12-07 10:32:31,314 [8041174]  DEBUG - .ApexUnitTestRunProcessHandler -   testOrderGetsMatchedToOpportunity is not a configured test method in test class OrderManagerTest. 
    2021-12-07 10:32:31,314 [8041174]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasOpportunityExactMatch is not a configured test method in test class OrderManagerTest. 
    2021-12-07 10:32:31,314 [8041174]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch is not a configured test method in test class OrderManagerTest. 
    2021-12-07 10:32:31,314 [8041174]  DEBUG - .ApexUnitTestRunProcessHandler -   testHasQuoteExactMatch_with_greater_quantity is not a configured test method in test class OrderManagerTest. 
    2021-12-07 10:32:31,314 [8041174]  DEBUG - .ApexUnitTestRunProcessHandler -   testExactMatch_with_extra_products is not a configured test method in test class OrderManagerTest. 
    2021-12-07 10:32:31,314 [8041174]  DEBUG - .ApexUnitTestRunProcessHandler -   testNotExactMatch_product_not_purchased is not a configured test method in test class OrderManagerTest. 
    2021-12-07 10:32:31,314 [8041174]  DEBUG - .ApexUnitTestRunProcessHandler -   testQuantityDoesNotMatch is a configured test method in test class OrderManagerTest. 
    

    Notice that the OrderManagerTest methods in the first log entry do not match those in the actual class. Only testQuantityDoesNotMatch exists in both sets, so that explains why it's the only one executing.

    That configuration is being handed to IC2 by the host JetBrains IDE. I'm not sure where it's getting it, though. I'd be curious to know whether it's getting picked up from a persisted cache or an in-memory cache. Do you mind restarting the IDE process to see whether the problem is "magically" resolved or not?

    I'm also going to debug this a bit and see where the IDE gets the configuration that it's passing into the test executor since it appears that it can be based on stale information.

  9. Vic Ricker reporter

    The list of methods at the top is definitely stale. Some of them have been gone for a long time.

    Restarting the IDE has no effect. Incidentally, I have been experiencing this problem for some time. I just hadn’t had time to report it until today.

    I also tried “File/Invalidate Caches…” and restarting. It had no effect.

  10. Scott Wells repo owner

    Okay. Can you please send me your .idea/workspace.xml for review? Feel free to redact anything you'd don't want included before attaching/emailing it. My guess is that the "stuck" config is in there, and I'd like to see how it's represented.

  11. Vic Ricker reporter

    This looks odd.

        <configuration name="OrderManagerTest" type="com.illuminatedcloud.intellij" factoryName="Apex Unit Tests" temporary="true" show_console_on_std_err="false" show_console_on_std_out="false">
          <option name="allTests" value="false" />
          <option name="allowRunningInParallel" value="false" />
          <option name="apexLogLevel" value="DEBUG" />
          <option name="calloutsLogLevel" value="INFO" />
          <option name="connectionName" value="NewPigDev" />
          <option name="connectionType" value="OAUTH" />
          <option name="contextConfiguration" value="true" />
          <option name="databaseLogLevel" value="INFO" />
          <option name="logLevelsInitialized" value="false" />
          <option name="moduleToTestClassNames">
            <map>
              <entry key="salesforce-sales">
                <value>
                  <set>
                    <option value="OrderManagerTest" />
                  </set>
                </value>
              </entry>
            </map>
          </option>
          <option name="nbaLogLevel" value="INFO" />
          <option name="profilingLogLevel" value="INFO" />
          <option name="projectPathOnTarget" />
          <option name="selectedOptions">
            <list />
          </option>
          <option name="systemLogLevel" value="DEBUG" />
          <option name="testClassToTestMethodNames">
            <map>
              <entry key="AccountControllerTest">
                <value>
                  <set>
                    <option value="testGetAccountsWithNoResult" />
                    <option value="testGetAccountsWithResult" />
                    <option value="testGetAccountsWithResultAccountName" />
                    <option value="testGetAccountsWithResultContactEmail" />
                    <option value="testGetAccountsWithResultContactName" />
                    <option value="testGetDefaultAccountRecordType" />
                    <option value="testUpdateAccountWithANINumber" />
                  </set>
                </value>
              </entry>
              <entry key="AccountServiceTest">
                <value>
                  <set>
                    <option value="testCreateAccount" />
                    <option value="testCreateAccount_should_not_create_if_ERP_ID_present" />
                    <option value="testDeleteAccount" />
                    <option value="testGetAccountsToIntegrate" />
                    <option value="testGetAccountsToIntegrate_with_no_oldAccounts" />
                    <option value="testGetMergeMessages" />
                    <option value="testHasErpChanges_with_changes_to_Erp_fields" />
                    <option value="testHasErpChanges_with_changes_to_non_Erp_fields" />
                    <option value="testMerge" />
                    <option value="testUpdateAccount" />
                  </set>
                </value>
              </entry>
              <entry key="BaseServiceTest">
                <value>
                  <set>
                    <option value="testConfigureRequest" />
                    <option value="testDoDelete" />
                    <option value="testDoPost" />
                    <option value="testExecuteRequest_with_body" />
                    <option value="testExecuteRequest_without_body" />
                    <option value="testGetUrl" />
                    <option value="testSendDeletes" />
                    <option value="testSetParameter" />
                    <option value="testSetParameter_with_null_parameter" />
                  </set>
                </value>
              </entry>
              <entry key="CommercialTermMapperTest">
                <value>
                  <set>
                    <option value="testGetFieldMappers" />
                  </set>
                </value>
              </entry>
              <entry key="ContactControllerTest">
                <value>
                  <set>
                    <option value="testFindContactsByPhoneNumber" />
                  </set>
                </value>
              </entry>
              <entry key="ContactServiceTest">
                <value>
                  <set>
                    <option value="testCreateContact" />
                    <option value="testCreateContact_should_not_create_if_ERP_ID_present" />
                    <option value="testDeleteContact" />
                    <option value="testGetContactsToIntegrate" />
                    <option value="testGetContactsToIntegrate_with_no_oldContacts" />
                    <option value="testGetMergeMessages" />
                    <option value="testHasErpChanges_with_changes_to_Erp_fields" />
                    <option value="testHasErpChanges_with_changes_to_first_source" />
                    <option value="testHasErpChanges_with_changes_to_non_Erp_fields" />
                    <option value="testMergeContacts" />
                    <option value="testSetDefaultsNoCampaignCode" />
                    <option value="testSetDefaultsWithCampaignCode" />
                    <option value="testUpdateContact" />
                  </set>
                </value>
              </entry>
              <entry key="DirectIndicatorControllerTest">
                <value>
                  <set>
                    <option value="testGetIndicator" />
                    <option value="testGetIndicator_with_null_parameter" />
                  </set>
                </value>
              </entry>
              <entry key="ErpUtilsTest">
                <value>
                  <set>
                    <option value="testExtractErpIdFromList" />
                    <option value="testGetAccountIdFromExternalId" />
                    <option value="testGetContactIdFromExternalId" />
                    <option value="testGetOne" />
                    <option value="testGetOne_with_empty_list" />
                    <option value="testGetOne_with_multiple_entries" />
                    <option value="testGetOrderIdFromExternalId" />
                    <option value="testGetShipToIdFromExternalId" />
                  </set>
                </value>
              </entry>
              <entry key="FieldMapFactoryTest">
                <value>
                  <set>
                    <option value="testGetAccountFieldMap" />
                    <option value="testGetContactFieldMap" />
                  </set>
                </value>
              </entry>
              <entry key="IntegrationJsonMapperTest">
                <value>
                  <set>
                    <option value="testMapAccount" />
                    <option value="testMapAccount_maps_US_to_blank" />
                    <option value="testMapAccount_update" />
                    <option value="testMapContact" />
                    <option value="testMapPriceDip" />
                  </set>
                </value>
              </entry>
              <entry key="JsonUtilsTest">
                <value>
                  <set>
                    <option value="testGetAsBoolean_with_string_value" />
                    <option value="testGetAsDecimal_with_null_value" />
                    <option value="testGetAsDecimal_with_string_value" />
                    <option value="testGetAsString" />
                    <option value="testGetAsString_with_non_string_value" />
                    <option value="testGetAsString_with_null_value" />
                  </set>
                </value>
              </entry>
              <entry key="MapperTest">
                <value>
                  <set>
                    <option value="testAccountLookupMapper_getId" />
                    <option value="testAccountLookupMapper_getValue_should_always_return_null" />
                    <option value="testAccountLookupMapper_mapField" />
                    <option value="testAccountLookupMapper_mapField_should_throw_MappingException_if_not_found" />
                    <option value="testAccountLookupMapper_mapField_should_throw_MappingException_if_required_but_not_present" />
                    <option value="testBooleanFieldMapper_getValue" />
                    <option value="testDecimalFieldMapper_getValue" />
                    <option value="testPaymentTermsLookupMapper_getId" />
                    <option value="testPriceTypeLookupMapper_getId" />
                    <option value="testStringFieldMapper_getValue" />
                    <option value="testStringFieldMapper_mapField" />
                    <option value="testStringFieldMapper_mapField_should_throw_MappingException_if_property_is_required_but_not_present" />
                  </set>
                </value>
              </entry>
              <entry key="OpportunityLineItemHandlerTest">
                <value>
                  <set>
                    <option value="testCalculateOrderTotals" />
                  </set>
                </value>
              </entry>
              <entry key="OrderManagerTest">
                <value>
                  <set>
                    <option value="testExactMatch" />
                    <option value="testNotExactMatchBetweenSkus" />
                    <option value="testNotExactMatchBetweenSkus2" />
                    <option value="testNotExactMatchBetweenSkus3" />
                    <option value="testOrderAndQuoteNumberDoesNotMatch" />
                    <option value="testPriceDoesNotMatch" />
                    <option value="testQuantityDoesNotMatch" />
                  </set>
                </value>
              </entry>
              <entry key="OrderTriggerTest">
                <value>
                  <set>
                    <option value="orderWithQuote" />
                    <option value="orderWithoutQuote" />
                  </set>
                </value>
              </entry>
              <entry key="PriceBookServiceTest">
                <value>
                  <set>
                    <option value="opportunityLineItemTest" />
                    <option value="orderItemTest" />
                    <option value="quoteLineItemTest" />
                  </set>
                </value>
              </entry>
              <entry key="QuoteTriggerTest">
                <value>
                  <set>
                    <option value="quoteWithOpportunityId" />
                    <option value="quoteWithoutOpportunityId" />
                  </set>
                </value>
              </entry>
              <entry key="RecordTypeControllerTest">
                <value>
                  <set>
                    <option value="testFetchRecordTypeValues" />
                    <option value="testGetANIForCreation_with_ani_number" />
                    <option value="testGetANIForCreation_with_blank_parameter" />
                    <option value="testGetRecTypeId" />
                  </set>
                </value>
              </entry>
              <entry key="RestUtilsTest">
                <value>
                  <set>
                    <option value="testBadRequest" />
                    <option value="testNotFound" />
                    <option value="testSetContentType" />
                    <option value="testSetResponse" />
                    <option value="testSetResponse_no_parameters" />
                    <option value="testSetResponse_success_with_body" />
                    <option value="testSetResponse_success_without_body" />
                  </set>
                </value>
              </entry>
              <entry key="Rest_WS_AccountLinkTest">
                <value>
                  <set>
                    <option value="testDoDelete" />
                    <option value="testDoPatch" />
                    <option value="testDoPostWithShipTo" />
                    <option value="testDoPostWithoutShipTo" />
                  </set>
                </value>
              </entry>
              <entry key="Rest_WS_AccountSearchTest">
                <value>
                  <set>
                    <option value="testDoPost" />
                  </set>
                </value>
              </entry>
              <entry key="Rest_WS_CommercialTerm_Test">
                <value>
                  <set>
                    <option value="testDoDelete" />
                    <option value="testDoDelete_should_return_404_on_not_found" />
                    <option value="testDoPatch" />
                    <option value="testDoPatch_should_return_400_on_mapping_error" />
                    <option value="testDoPatch_should_return_404_on_not_found" />
                    <option value="testDoPost" />
                    <option value="testDoPost_with_invalid_priceType" />
                    <option value="testDoPost_with_invalid_terms" />
                  </set>
                </value>
              </entry>
              <entry key="Rest_WS_ShipTo_Test">
                <value>
                  <set>
                    <option value="testDoDelete" />
                    <option value="testDoDelete_should_return_404_on_not_found" />
                    <option value="testDoPatch" />
                    <option value="testDoPatch_should_not_change_ship_to_account" />
                    <option value="testDoPatch_should_return_400_on_mapping_error" />
                    <option value="testDoPatch_should_return_404_on_not_found" />
                    <option value="testDoPost" />
                    <option value="testDoPost_with_invalid_account" />
                  </set>
                </value>
              </entry>
              <entry key="SalesforceErrorTest">
                <value>
                  <set>
                    <option value="testConstructor" />
                  </set>
                </value>
              </entry>
              <entry key="ShipToMapperTest">
                <value>
                  <set>
                    <option value="testGetFieldMappers" />
                    <option value="testGetFieldMappers_withErpAccountShipToId" />
                  </set>
                </value>
              </entry>
              <entry key="UtilsTest">
                <value>
                  <set>
                    <option value="testExtractIdFromList" />
                  </set>
                </value>
              </entry>
              <entry key="fflib_SObjectDomainTest">
                <value>
                  <set>
                    <option value="testDisableTriggerEventsBehaviour" />
                    <option value="testErrorLogging" />
                    <option value="testInsertValidationFailedWithoutDML" />
                    <option value="testObjectSecurity" />
                    <option value="testOnAfterUndeleteWithoutDML" />
                    <option value="testOnBeforeDeleteWithoutDML" />
                    <option value="testOnValidateBehaviorDefault" />
                    <option value="testOnValidateBehaviorOld" />
                    <option value="testRecursiveTriggerState" />
                    <option value="testTriggerState" />
                    <option value="testUpdateValidationFailedWithoutDML" />
                    <option value="testValidationWithoutDML" />
                  </set>
                </value>
              </entry>
            </map>
          </option>
          <option name="testSuiteName" />
          <option name="validationLogLevel" value="INFO" />
          <option name="visualforceLogLevel" value="INFO" />
          <option name="waveLogLevel" value="INFO" />
          <option name="workflowLogLevel" value="INFO" />
          <method v="2" />
        </configuration>
    

  12. Scott Wells repo owner

    Yup, that's it. That matches what I saw in the logs as well where the provided run configuration included tests for a large number of test classes and not just OrderManagerTest.

    And you don't see that one when you go into Run>Edit Configurations? If you do see it, remove it and verify that it has also been removed from the workspace.xml file (which saves lazily, so you may need to shift focus away from and back to the IDE before you'll see the change). If you don't see it in that list, I'd recommend that you close the project and remove that <configuration>...</configuration> element from the file explicitly, then reopen the project.

  13. Vic Ricker reporter

    I made a boo boo.

    Under Module Setting (F4), Platform Settings/SDKs, I removed some obsolete Illuminated Cloud entries, and only kept the current salesforce-sales entry. Now all of the classes are showing errors in the references to other classes and I can’t run the unit tests at all.

  14. Vic Ricker reporter

    I’m connected to the org, can deploy changes, compare with server, etc. The only problem seems to be that the IDE is confused about the source, showing tons on “can’t resolve symbol” errors. I tried rebuilding the OST, but that didn’t help.

  15. Scott Wells repo owner

    Did you perhaps change your content and source roots? Can you please attach your project's .iml file?

  16. Scott Wells repo owner

    I don't know if this was changed accidentally or has always been this way, but your source roots are currently configured as:

        <content url="file://$MODULE_DIR$">
          <sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
          <excludeFolder url="file://$MODULE_DIR$" />
        </content>
        <content url="file://$MODULE_DIR$/unpackaged">
          <sourceFolder url="file://$MODULE_DIR$/unpackaged/main/default" isTestSource="false" />
        </content>
    

    If you look at that first stanza, it's saying that the entire project should be considered source...but also shouldn't because it's excluded.

    I suggest you that you use either File>Project Structure... or Illuminated Cloud>Configure Module>Project Structure tab to ensure that you have a single content root...likely the project root directory...and under that only the directories that contain Salesforce metadata files marked as source roots.

    Let me know if that doesn't make sense or doesn't resolve the current issue.

  17. Scott Wells repo owner

    Here's an example of what it might look like:

    Issue_2020.png

    Obviously adjust for your project's source roots as appropriate...

  18. Vic Ricker reporter

    Thanks! it looks like . was added to source folders and excluded folders. I removed both. main/default was in there too.

    So, now back to where I was.. Tests still behave the same, so I will try surgery on workspace.xml.

  19. Scott Wells repo owner

    If you receive this before you do that, can you please show me a screenshot of the entries under Run>Edit Configurations>Apex Unit Tests?

  20. Vic Ricker reporter

    I think I might have fixed the issue via Intellij. (no surgery)

    First, here’s the screenshot that you requested:

    That was prior to running the test.

    I went into “Edit Configuration Templates…”, bottom left in the screenshot. There was a template there. I’m not sure what I did, I wasn’t paying close attention, because I didn’t expect it to help, but the OrderManager test seems to be working now. When I run it, it creates the Run Configuration with all tests selected. If I delete it and run again, it behaves correctly. I will try some others just to make sure… one moment…

    I ran several tests. It appears to be running all of the test methods now!

    Thanks for your help and patience!

    Merry Christmas!

  21. Scott Wells repo owner

    Wow...that's interesting that it was picking up a run configuration template! Kudos to you for finding that.

    In the process of debugging this I did find an issue with contextually-derived unit test run configuration being properly updated in a certain situation. I've fixed that locally, and the fix will be included in the next build. Hopefully that will put this whole thing to rest.

    Thanks for providing all of the diagnostic info that was requested! I'm glad you were able to work toward a solution.

  22. Log in to comment