static bool CategoriesValid(List <string> categories) { var areValid = true; if (categories.Count < 1) { return(false); } foreach (var category in categories) { if (!loaderActions.ValidateCategory(category)) { return(false); } } return(areValid); }
static int Main(string[] args) { loaderActions = new LoaderActions(); var categories = new List <string>(); var excludeCategories = new List <string>(); string series = null; var platform = DeviceSet.Platform.None; DeviceSet deviceSet = null; var validate = false; string outputFile = null; var account = ""; var user = ""; OptionSet optionSet = null; optionSet = new OptionSet { { "p|platform=", "specify the test platform, iOS or Android", s => platform = (DeviceSet.Platform)Enum.Parse(typeof(DeviceSet.Platform), s) }, { "d|deviceset=", "the device set to use for the test run", s => deviceSet = StringToDeviceSet(s) }, { "c|category=", "add a category to the test run [deprecated, use include]", str => categories.Add(str) }, { "s|series=", "specify the series when uploaded to Test Cloud", s => series = s }, { "l|list", "list categories available in test suite", ListCategories }, { "sets", "list available device sets", ListDeviceSets }, { "i|interactive", "start uploader in interactive mode", InteractiveMode }, { "h|help", "show this message and exit", s => ShowHelp(optionSet) }, { "v|validate", "validate all tests or a specified category", s => validate = true }, { "o|output=", "output destination for NUnit XML", s => outputFile = s }, { "a|account=", "Test Cloud key", s => account = s }, { "u|user="******"Test Cloud user", s => user = s }, { "n|include=", "add a category to the test run", str => categories.Add(str) }, { "e|exclude=", "exclude a category from the test run", str => excludeCategories.Add(str) } }; List <string> extra; try { extra = optionSet.Parse(args); } catch (OptionException ex) { Console.Write("Uploader:"); Console.WriteLine(ex.Message); Console.WriteLine("Try --help for more informaiton"); } if (args.Length == 0) { ShowHelp(optionSet); } if (validate) { var category = categories.FirstOrDefault(); return(loaderActions.ValidateCategory(category) ? 0 : 1); } if (platform == DeviceSet.Platform.None) { Console.WriteLine("Platform must be specified"); return(1); } if (deviceSet != null && !deviceSet.DeviceSetPlatform.Contains(platform)) { Console.WriteLine("DeviceSet platform does not match specified platform"); return(1); } if (deviceSet == null) { if (platform == DeviceSet.Platform.Android) { deviceSet = DeviceSets.AndroidFastParallel; } else { deviceSet = DeviceSets.IOsFastParallel; } } var execString = BuildExecutionString(platform, deviceSet, categories, series, account, user, outputFile, excludeCategories); Console.WriteLine(execString); var processStatus = TestCloudUtils.UploadApp(execString); Console.WriteLine("test-cloud.exe status: " + processStatus); return(processStatus); }
static int Main(string[] args) { loaderActions = new LoaderActions(); var categories = new List<string>(); string series = null; var platform = DeviceSet.Platform.None; DeviceSet deviceSet = null; var validate = false; string outputFile = null; var account = ""; var user = ""; OptionSet optionSet = null; optionSet = new OptionSet { { "p|platform=", "specify the test platform, iOS or Android", s => platform = (DeviceSet.Platform)Enum.Parse(typeof (DeviceSet.Platform), s) }, { "d|deviceset=", "the device set to use for the test run", s => deviceSet = StringToDeviceSet(s) }, { "c|category=", "add a category to the test run", s => categories.Add(s) }, { "s|series=", "specify the series when uploaded to Test Cloud", s => series = s }, { "l|list", "list categories available in test suite", ListCategories }, { "sets", "list available device sets", ListDeviceSets }, { "i|interactive", "start uploader in interactive mode", InteractiveMode }, { "h|help", "show this message and exit", s => ShowHelp(optionSet) }, { "v|validate", "validate all tests or a specified category", s => validate = true }, { "o|output=", "output destination for NUnit XML", s => outputFile = s }, { "a|account=", "Test Cloud key", s => account = s }, { "u|user="******"Test Cloud user", s => user = s } }; List<string> extra; try { extra = optionSet.Parse(args); } catch (OptionException ex) { Console.Write("Uploader:"); Console.WriteLine(ex.Message); Console.WriteLine("Try --help for more informaiton"); } if (args.Length == 0) ShowHelp(optionSet); if (validate) { var category = categories.FirstOrDefault(); return loaderActions.ValidateCategory(category) ? 0 : 1; } if (platform == DeviceSet.Platform.None) { Console.WriteLine("Platform must be specified"); return 1; } if (deviceSet != null && !deviceSet.DeviceSetPlatform.Contains(platform)) { Console.WriteLine("DeviceSet platform does not match specified platform"); return 1; } if (deviceSet == null) { if (platform == DeviceSet.Platform.Android) deviceSet = DeviceSets.AndroidFastParallel; else deviceSet = DeviceSets.IOsFastParallel; } var execString = BuildExecutionString(platform, deviceSet, categories, series, account, user, outputFile); Console.WriteLine(execString); var processStatus = TestCloudUtils.UploadApp(execString); Console.WriteLine("test-cloud.exe status: " + processStatus); return processStatus; }