7

I am trying to execute my Coded UI Scripts on QTP. First I created a dll for my Coded UI Project later I am able to access the methods from that dll but i am not able to access Coded UI testing methods. Example: the below script is in C# in VSTS

namespace TestProject1
{
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Input;
    using System.Windows.Forms;
    using System.CodeDom.Compiler;
    using System.Text.RegularExpressions;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;    
    using MouseButtons = System.Windows.Forms.MouseButtons;
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
    using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;
    using Microsoft.VisualStudio.TestTools.UITesting.WpfControls;

    public partial class UIMap
    {
        public int MyInteger()
        {
            return 9;
        }
        public string testDll()
        {
            return "Test DLL Factory";
        }
        public void add1()
        {
            MessageBox.Show("Sravan");

        }
        public void DeletePhoto()
        {
            WinWindow window = new WinWindow();
            window.SearchProperties[WinWindow.PropertyNames.Name] = "Cyramed";
            window.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));

            WinWindow c_window = new WinWindow(window);
            c_window.SearchProperties[WinWindow.PropertyNames.ControlName] = "PICTUREBOX1";
            c_window.WindowTitles.Add("Cyramed");
            c_window.DrawHighlight();

            WinClient c_client = new WinClient(c_window);
            c_client.WindowTitles.Add("Cyramed");
            c_client.DrawHighlight();

            Mouse.Click(c_client, MouseButtons.Right);
            Keyboard.SendKeys("{DOWN}");
            Keyboard.SendKeys("{DOWN}");
            Keyboard.SendKeys("{DOWN}");
            Keyboard.SendKeys("{ENTER}");


        }        
    }
}

I can call MyInteger and testDll methods but when I call the DeletePhoto method it throws an error: "Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

My primary concern: I want to execute Coded UI scripts on QTP too.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Sravan
  • 71
  • 2
  • Do you have `Microsoft.VisualStudio.TestTools.UITesting` assembly in the same folder as your testing dlls? Is VS or VS test agent installed on the machine with QTP? – Iarek Feb 21 '13 at 10:29

1 Answers1

0

You'll likely have to install Visual Studio Test Agents on your QTP test agents. These will drop the binaries on the machine.

VS 2010 Test Agents

VS 2010 SP1

Ryan Cromwell
  • 2,613
  • 1
  • 17
  • 33