Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by SantaKlaus · May 10, 2017 at 01:11 PM · testingplaymodetimeoutautomated

TestRunner playmode timeout (?)

Hi all,

Question:
Does the TestRunner feature (Unity 5.6) have a timeout setting somewhere? And if so, then where can I deactivate it?

Context:
Using the TestRunner to run tests in PlayMode (coroutine-alike) my test so far always terminate (pass) prematurely after about 30 seconds.
(I need my test runs to run considerably longer in order to test complex gameplay scenarios.)

Code:
Here is a snippet that reliably produces the phenomenon for me:

 using UnityEngine;
 using UnityEngine.TestTools;
 using NUnit.Framework;
 using System.Collections;
 public class TestingTest 
 {
     // A UnityTest behaves like a coroutine in PlayMode
     // and allows you to yield null to skip a frame in EditMode
     [UnityTest]
     public IEnumerator TestingTestWithEnumeratorPasses() 
     {
         float timeIntervalReport = 1;
         float timeReportLast = 0;
         float durationDesired = 40;
         
         float timeStart = Time.time;
         Debug.Log("timeStart " + timeStart);
         
         while(Time.time < timeStart + durationDesired){
             if(timeReportLast + timeIntervalReport < Time.time){
                 Debug.Log("time passed " + (Time.time - timeStart));
                 timeReportLast = Time.time;
             }
             yield return null;
         }        
         Debug.Log("test complete");
     }
 }

Thanks for your consideration.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by HardlyDifficultLLC · Jun 29, 2017 at 09:03 PM

Dear @SantaKlaus,

We hit the same and found that you can change the timeout by adding another attribute. e.g.

  [UnityTest]
  [Timeout(100000000)]
  public IEnumerator Test2() 
 {
    ...
 }

I don't know how to say no timeout, but big numbers work well :)

hth,

HardlyDifficult

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image abeldantas · Oct 29, 2020 at 08:55 PM 0
Share

That is almost 30 hours.

This value is in milliseconds, so if you want 5 $$anonymous$$utes you'd go with something like 300000.

avatar image
0

Answer by SantaKlaus · Jun 30, 2017 at 06:24 AM

Thanks HardlyDifficult,

Yeah, that attribute seems to do the trick. I wonder why Unity didnt mention it in their docs. Probably because not officially supported.

BR,

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by SwathiJayaraman · Mar 29, 2018 at 09:11 AM

Thanks guys, this worked for me too..

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Concurrency and editor scripts and the play mode 1 Answer

Play Mode Unit Tests prevent game build succeeding,PlayMode Unit Tests prevent my game from building 1 Answer

Automated testing webgl mouse events not working 1 Answer

PlayMode Test - Loading Scenes 1 Answer

Can we create playmode tests outside of the main build assembly? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges