Logs are not generated when running tests in Async

Issue #608 resolved
Gustavo Tandeciarz created an issue

Looks like when running tests in Async mode from intelliJ, no log files are generated (or they are generated, and then deleted - it's unclear).

Steps to repro: 1. Run unit test with default setting of synchronous testing 2. Check Log Viewer 3. You will see the log for the test 4. Change setting to run tests in Async 5. Run unit test 6. Check Log Viewer 7. Log will not appear

If you log into dev console and run tests in sync or async, logs appear in the log panel.

Comments (18)

  1. Scott Wells repo owner

    Thanks for reporting. Let's gather some logs to see what's going on. Do you mind adding the following under Help>Debug Log Settings, reproducing the issue, and shooting me the log?

    #com.illuminatedcloud.intellij.unittest.ApexUnitTestRunProcessHandler
    #com.illuminatedcloud.client.ApexLogUtil
    

    Hopefully that will clearly show what's happening (or more likely, what's not happening!).

  2. Gustavo Tandeciarz reporter

    Sending to your email rather than posting to the ticket.

    I will mention that running the tests with Debug does generate a log, but my hunch is that those tests are not running in Async mode.

  3. Scott Wells repo owner

    Got it. Thanks! So here's what I see in the log that's relevant (nothing sensitive in this):

    2017-05-12 15:27:56,626 [ 314655]  DEBUG - .ApexUnitTestRunProcessHandler - Querying test results for TestClassName. 
    2017-05-12 15:27:56,694 [ 314723]  DEBUG - .ApexUnitTestRunProcessHandler -   1 test results returned. 
    2017-05-12 15:27:56,694 [ 314723]  DEBUG - .ApexUnitTestRunProcessHandler - Querying Apex logs for tests. 
    2017-05-12 15:27:57,916 [ 315945]  DEBUG - .ApexUnitTestRunProcessHandler -   1 logs found. 
    2017-05-12 15:27:57,916 [ 315945]  DEBUG - .ApexUnitTestRunProcessHandler - No class-level log found. 
    2017-05-12 15:27:57,916 [ 315945]  DEBUG - .ApexUnitTestRunProcessHandler - Processing results for test method TestClassName.testMethodName. 
    2017-05-12 15:27:57,916 [ 315945]  DEBUG - .ApexUnitTestRunProcessHandler -   Method-level log found. 
    2017-05-12 15:27:57,916 [ 315945]  DEBUG - .ApexUnitTestRunProcessHandler -   Test TestClassName.testMethodName finished with outcome PASS. 
    

    The method-level log should have been written to the console when you select the node for that method in the execution tree. Because the test method passed, it may be filtered out, though:

    ShowPassedTests.png

    Can you verify whether the log is actually present but just filtered out? Please let me know either way.

  4. Gustavo Tandeciarz reporter

    So, I see the test results, but I'm actually referring to the log viewer, to be able to view the debug logs (system.debug calls in the tests).

    That one ApexTestHandler log entry was run from Dev Console, not from IntelliJ.  The tests run Async from dev console appear fine in IntelliJ.  The ones run from IntelliJ don’t.

  5. Scott Wells repo owner

    Ah, okay. Hmmm...I'll need to try to reproduce. My laptop is just about out of juice and I don't have access to a plug right now. I'll take a look this weekend and see if I can reproduce it/diagnose it. I'll keep you posted.

  6. Gustavo Tandeciarz reporter

    Oh, this might be useful info:  I'm running this on a sandbox that was upgraded to Summer '17 Preview.

  7. Scott Wells repo owner

    Ah, okay. I have a Summer '17 org handy. I'll see if I can reproduce it there. Do you see the same behavior against a Spring '17 org (if you have convenient access to one)?

  8. Gustavo Tandeciarz reporter

    I actually don't have access to one at the moment.  Waiting for a full refresh to complete right now.  After that, I can give it a try to see if I see similar behavior.

  9. Gustavo Tandeciarz reporter

    I'm not sure this was resolved with 1.7.9.3 (updated this morning). I'm running tests and still don't see the logs when run from IDEA. I do see the logs in the Test Results, but not in the Log Viewer tab.

  10. Scott Wells repo owner

    Yeah, I didn't include a fix in 1.7.9.3. Sorry if that wasn't clear. I'll bump it to 1.7.9.4 and see if I can figure out what's going on for the next build.

  11. Gustavo Tandeciarz reporter

    Ah, I saw version as 1.7.9.3 - sorry, I thought that meant the version were it was fixed. No worries!

  12. Scott Wells repo owner

    Yeah, unfortunately BitBucket's "JIRA Lite" doesn't have separate Found In vs. Fixed In version fields, so I have to get creative moving the one field around. I haven't kicked the ones that I intend to fix in 1.7.9.4 to that version yet.

  13. Log in to comment