ALTUNITYTESTERnotaddedasdefinevariable

2 views
Skip to first unread message

Vanessa M

unread,
Dec 22, 2021, 6:16:19 PM12/22/21
to AltUnity - UI test automation tool for Unity3D
I am trying to use AltUnity but I am not been successful so far. I wrote a very simple test (load a scene and tap a button), which sometimes passes, but sometimes doesn't, although no code has changed between the tests. I get the error ALTUNITYTESTERnotaddedasdefinevariable error, any idea what is going on? I am attaching a screenshot and a copy of the code in case it might help, really appreciate any advice, thanks!

using NUnit.Framework;
using Altom.AltUnityDriver;

public class MyFirstTest
{
    private AltUnityDriver altUnityDriver;

    [OneTimeSetUp]
    public void SetUp()
    {
        altUnityDriver = new AltUnityDriver();
    }

    [OneTimeTearDown]
    public void TearDown()
    {
        altUnityDriver.Stop();
    }


 private void TestHomeButton(string sceneName)
    {
        Log.Debug("TestHomeButton: " + sceneName);

        altUnityDriver.LoadScene(sceneName);

        altUnityDriver.WaitForCurrentSceneToBe(sceneName);

        var icon = altUnityDriver.FindObject(By.NAME, "HomeButton");

        Assert.IsTrue(icon.enabled);

        icon.Tap();

        altUnityDriver.WaitForCurrentSceneToBe(Defines.cScene_Home);
    }

    [Test]
    public void TestMenuBarIcons()
    {
        TestHomeButton(Defines.cScene_Menu);
        TestHomeButton(Defines.cScene_ModuleTableOfContents);
        TestHomeButton(Defines.cScene_MultipleChoice);
    }
}
Bildschirmfoto 2021-12-22 um 23.59.51.png

Robert Poienar

unread,
Dec 22, 2021, 7:01:59 PM12/22/21
to AltUnity - UI test automation tool for Unity3D, vanessa....@gmail.com

I think the problem is with how you instrumented the game. Make sure you follow the steps from https://altom.gitlab.io/altunity/altunitytester/pages/get-started.html#instrument-your-game-with-altunity-server or if you have custom way to build your game check https://altom.gitlab.io/altunity/altunitytester/pages/advanced-usage.html#build-games-from-the-command-line. If is still not working then you could add manually the symbol in Player setting just like in the screenshot I attached.

Screenshot_34.png
Reply all
Reply to author
Forward
0 new messages