Run Coded UI test from console application

2019-03-01 07:33发布

问题:

I'm fighting running a coded ui test from a console application.

I did the following (As the internet says)

Solution with 2 Projects: ColorChanger.app / ColorChanger.test

the console application has a reference to the test project and to Microsoft.VisualStudio.TestTools.UITesting

I would like to call the test like this:

static void Main(string[] args)
    {
        Playback.Initialize();
        var test = new CodedUITest1();
        test.change();
        Playback.Cleanup();
    }

I get the error "System.IO.FileNotFoundException

Die Datei oder Assembly \"Microsoft.VisualStudio.TestTools.UITest.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.":"Microsoft.VisualStudio.TestTools.UITest.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}

I'm sorry it's in german but I'm shure you'll get it ;)

回答1:

You need to update the internal references as well.. . Try this http://blogs.microsoft.co.il/shair/2010/07/15/running-codedui-test-from-another-application/