Search Unity

EditMode Unit Test passes in Editor, fails during Cloud Build

Discussion in 'Unity Build Automation' started by vinnie-vivace, Apr 24, 2019.

  1. vinnie-vivace

    vinnie-vivace

    Joined:
    Jan 12, 2010
    Posts:
    40
    Greetings everyone. I have a very simple UnitTest that checks if an object exists in the main scene of a project. This test passes fine in the Editor, but fails during Cloud Build.

    Code (CSharp):
    1.  
    2. [Test]
    3. public void GameModeMatchesPlatform()
    4. {
    5.       var gameManager = Object.FindObjectOfType<GameManager>();
    6.  
    7.       Assert.NotNull(gameManager);
    8. }
    9.  
    Can anyone shed light on this please?
     
  2. mylastggColto

    mylastggColto

    Joined:
    Feb 28, 2017
    Posts:
    28
    we are experiencing the same issue with our project. as soon as AT are activated in the CB, the CB hangs for 3 to 4 hours and then gets 'cancelled' automatically.
    Locally the AT works fine
     
  3. vinnie-vivace

    vinnie-vivace

    Joined:
    Jan 12, 2010
    Posts:
    40
  4. mylastggColto

    mylastggColto

    Joined:
    Feb 28, 2017
    Posts:
    28
    thanks for the update!
    what do you mean by 'reworking my tests to be runtime tests'?

    edit: we've found what's causing the CB to hang forever: some tests are trying to connect to the apple sandbox environment to check receipts and stuff, and this seems to break the tests in the CB. we removed such tests and everything seems to be working just fine. I'll report updates here if I have more to share
     
    Last edited: Jun 12, 2019
  5. vinnie-vivace

    vinnie-vivace

    Joined:
    Jan 12, 2010
    Posts:
    40
    sorry, when i say runtime, I meant Playmode. So refactored the tests from EditorMode to PlayMode, but then also had issues for 24 hours, and now those same tests pass both locally AND on the cloud. So still no clue why they sometimes fail on the Cloud.