0
Vote

Add a way of launching a test from VS

description

I'm not a fan of the original idea. While it's an ok work around, it requires the tester to add a Main() to their assembly plus make it runnable. I prefer the idea of integrating directly with VS to open Alpaca, if not open already, and finding the assembly in the current session (load it if it doesn't exist) and run the test that way. Getting it to work wouldn't be an easy task as it would require some integration issues with VS and win APIs to send messages to a process.
 
Here's the original notes for this task as suggested by Sebastian:
- Allow specifying a ChessBoardLauncher.Launch in a test dll's main() that will
  use the Win32 API for bringing a window to the foreground if chessboard already is open
  or spawns a new chessboard process
If we implement a way of adding a project to Alpaca (rather than just a dll or testlist) we can detect whether the project
is already loaded into Alpaca and find the test that way. Then just automate the running of a test in that way.
  - Look into importing the assembly (but only if it doesn't already exist in the session)
  - If already in the session, auto-refresh it.
  Code Snippet from Sebastian:
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
public static extern Int32 SetForegroundWindow(int hWnd);
[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
private static void BringToFront(string className, string CaptionName)
{
    SetForegroundWindow(FindWindow(className,CaptionName));
}
public static void Main(string[] args)
{
    BringToFront(null, "ChessBoard");
}

comments