private async void RunSauceTest(object sender, RoutedEventArgs e)
 {
     var saucelabFeature = new SaucelabFeature();
     if (!saucelabFeature.FeatureEnabled)
     {
         MessageBox.Show("This feature is not enabled.");
         return;
     }
     //get workflowid from project tree
     var selected = ProjectTreeView.SelectedItem as TreeViewItem;
     if (selected == null)
     {
         MessageBox.Show("Please select a test suite from the project tree!");
         return;
     }
     var selectedItem = selected.DataContext as XElement;
     if (selectedItem == null) return;
     var workflowId = selectedItem.GetAttributeValue(Constants._ID);
     var type = selectedItem.GetAttributeValue(Constants._TYPE);
     var scriptType = selectedItem.GetAttributeValue(Constants.SCRIPT_TYPE);
     if (!type.Equals(Constants.SCRIPT) || !scriptType.Equals("TestSuite"))
     {
         MessageBox.Show("Selected Item MUST be a Test Script!");
         return;
     }
     //popup a dialog to get the browser os version
     PopupBrowsersDialogSetDefaultConfig();
     _config.Set("HostType", "Sauce");
     _autoClient = new AutoClient(_config);
     await Task.Factory.StartNew(() => RunWorkflowById(workflowId));
     //when finished, show a message
     MessageBox.Show("Your Test finished.");
 }
Exemplo n.º 2
0
 private void StartClient()
 {
     var hostType = Configuration.Settings("HostType", "Sauce");
     if (hostType.Equals("Sauce"))
     {
         var concurrency = int.Parse(Configuration.Settings("HostConcurrentInstances", "3"));
         for (var i = 0; i < concurrency - _instances.Count; i++)
         {
             var instance = new AutoClient();
             _instances.Add(instance);
             instance.Start();
         }
     }
     else
         _defaultClientInstance.Start();
 }
Exemplo n.º 3
0
        //private static void RemoveResults()
        //{
        //    //find root element
        //    var xRoot = DBFactory.GetData().Read(Constants._TYPE, "Root");
        //    var resultId = xRoot.GetAttributeValue(Constants.RESULT);
        //    var results = DBFactory.GetData().GetChildren(resultId);
        //    foreach (var kids in results.Descendants())
        //    {
        //        DBFactory.GetData().Delete(kids.GetAttributeValue(Constants._ID));
        //    }
        //}
        //private static void CleanProject()
        //{
        //    //find root element
        //    var xRoot = DBFactory.GetData().Read(Constants._TYPE, "Root");
        //    var root = DBFactory.GetData().GetChildren(xRoot.GetAttributeValue(Constants._ID));
        //    foreach (var kid in root.Descendants())
        //    {
        //        var id = kid.GetAttributeValue(Constants._ID);
        //        if (id.Equals(xRoot.GetAttributeValue(Constants._ID)))
        //            continue;
        //        foreach (var grandKid in DBFactory.GetData().GetChildren(id).Descendants())
        //        {
        //            DBFactory.GetData().Delete(grandKid.GetAttributeValue(Constants._ID));
        //        }
        //    }
        //}
        private static void TestWorkflow()
        {
            var auto = new AutoClient();
            var workflowInstance = new WorkflowInstance(Guid.NewGuid().ToString(),
                "7fdcbd7a-b30e-4c36-aa46-58ba74b02401", Configuration.Clone().GetList());
            var xCommand = workflowInstance.GetCommand();

            Console.WriteLine(xCommand.ToString());
            var xResult = auto.Execute(xCommand);
            Console.WriteLine(xResult);
            workflowInstance.SetResult(xResult);
        }