Target for running Selenium tests RRS feed

  • Question

  • In order to run selenium tests I need to start selenium server (which is console application), I used Exec target for this, but the problem is that selenium server starts synchronously and  does't return control preventing other targets from being executed. Is there a way to run console app in separate context?
    Tuesday, April 7, 2009 6:17 AM


  • Hi, Kilonet

    As I know, all the targets in MSBuild are run synchronously, if you want the console app being run asynchronously, in my idea, we need to specify a asynchronous task for it:
    namespace ClassLibrary3
        public class MyTask : Task
            static BackgroundWorker _worker = new BackgroundWorker();
            public override bool Execute()
                _worker.DoWork += new DoWorkEventHandler(_worker_DoWork);
                return true;
            static void _worker_DoWork(object sender, DoWorkEventArgs e)
                System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo();
                ps.FileName = @"ConsoleApp.exe";
    And then use it in our MSBuild file:
    <Project ToolsVersion="3.5" xmlns="">
        <UsingTask TaskName="ClassLibrary3.MyTask"
                  AssemblyFile="C:\Users\v-wesyao\Documents\Visual Studio 2008
    \Projects\ClassLibrary3\ClassLibrary3\bin\Debug\ClassLibrary3.dll" />
        <Target Name="Test">
    About this line: System.Threading.Thread.Sleep(1000);, please take a look at my previou post: Asynchronous Task, and this is the only way for asynchronous task in MSBuild as I know.

    Hope it can solve your problem, anything unclear please feel free to let me know.

    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Wesley Yao Monday, April 13, 2009 2:18 AM
    Thursday, April 9, 2009 9:32 AM