/// <summary>
        /// Creates a test run, uploads the load test sources and starts the run.
        /// </summary>
        /// <param name="localDirectory">the directory containing the test sources</param>
        /// <param name="loadTestFileName">the loadtest file name of the loadtest</param>
        /// <returns></returns>
        public static TestRun CreateAndStartRun(string localDirectory, string loadTestFileName)
        {
            //check for extension
            if (!Path.HasExtension(loadTestFileName))
            {
                loadTestFileName = string.Concat(loadTestFileName, ".loadtest");
                Logger.LogMessage("Appending .loadtest to the given loadtest name");
            }
            //check if load test file exists in test drop
            if (!File.Exists(Path.Combine(localDirectory, loadTestFileName)))
            {
                Logger.LogMessage(string.Format(CultureInfo.CurrentCulture, "LoadTest file not found in the test drop. Please ensure that the loadtest file is present in the drop and the correct name is provided. Also please ensure the test drop has all binaries and other files needed to run your test."));
                return(null);
            }
            // Create test drop
            Logger.LogMessage("Creating TestDrop....");
            var testDrop = CltWebApi.CreateTestDrop();

            Logger.LogMessage("Done. TestDropId = {0}", testDrop.Id);

            // Upload test files
            Logger.LogMessage("Uploading test sources....");
            CltUploadDownloadHelper.Upload(localDirectory, testDrop);
            Logger.LogMessage("Done");

            TestRun testRun     = CltObjectFactory.CreateTestRunObject(loadTestFileName);
            var     testDropRef = new TestDropRef();

            testRun.TestDrop     = testDropRef;
            testRun.TestDrop.Id  = testDrop.Id;
            testRun.TestSettings = CltObjectFactory.CreateTestSettingsObject();

            // Create testrun
            Logger.LogMessage("Creating test run....");
            var createdTestRun = CltWebApi.CreateTestRun(testRun);

            Logger.LogMessage("Done.");

            // Start test run
            Logger.LogMessage("Starting test run....");
            CltWebApi.StartTestRun(createdTestRun.Id);
            Logger.LogMessage("Done");

            // Print test run state
            return(CltWebApi.GetTestRun(createdTestRun.Id));
        }
 /// <summary>
 /// Gets the test run specified by the runid
 /// </summary>
 /// <param name="testRunId"></param>
 /// <returns></returns>
 public static TestRun GetTestRun(string testRunId)
 {
     // Get test run and show status
     return(CltWebApi.GetTestRun(testRunId));
 }