diff --git a/App.config b/App.config index 8e15646..e5ec6a2 100644 --- a/App.config +++ b/App.config @@ -3,4 +3,11 @@ + + + + + + + \ No newline at end of file diff --git a/CLAPOptions.cs b/CLAPOptions.cs index 8a7c46f..eda7dc5 100644 --- a/CLAPOptions.cs +++ b/CLAPOptions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Configuration; using System.Threading.Tasks; using CLAP; using CLAP.Validation; @@ -13,7 +14,14 @@ class CLAPOptions : ITfsCliOptions private static CLAPOptions _instance; private static IDictionary _opts = new Dictionary(); private static string _verb; - + private static Configuration configManager = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); + private KeyValueConfigurationCollection _appconf; + + private CLAPOptions() + { + _appconf = configManager.AppSettings.Settings; + //_appconf["YourKey"].Value = "YourNewKey"; + } public static CLAPOptions getOptions() { @@ -39,22 +47,7 @@ public string ProvidedVerb() { return _verb; } - /* - [Global(Description = "TFS collection url, e.g. 'https://my.visualstudio.com/DefaultCollection'")] - static void url(string value){ - _opts["url"] = value; - } - [Global(Description = "TFS project name to get tests from")] - static void project(string value){ - _opts["project"] = value; - } - [Global(Description = "TFS testplan name to get tests from")] - static void testplan(string value) - { - _opts["testplan"] = value; - } - */ [Global(Aliases = "lgn", Description = "TFS user login")] static void login(string value) { @@ -87,34 +80,22 @@ static void help() } [Verb(Aliases = "get", - Description = "Exports TFS tests from provided project and testplan.\nExample: 'g -url=\"https://ekhatko.visualstudio.com/DefaultCollection\" -p=\"cmd\" -t=\"\"bestplan\"\" -lgn=\"evgeniy.khatko@gmail.com\" -pwd=\"Qwerty14\"'" + Description = "Exports TFS tests from provided project and testplan. Please fill App.config file beforehand\nUsage: tfs_cli get" )] static void get_tests( - [RequiredAttribute, DescriptionAttribute("TFS collection url, e.g. 'https://my.visualstudio.com/DefaultCollection")] - string url, - [RequiredAttribute, DescriptionAttribute("TFS project name to get tests from")] - string project, - [RequiredAttribute, DescriptionAttribute("TFS testplan name to get tests from")] - string testplan, [DefaultValue("tests.xml"), DescriptionAttribute("Filename for tests export")] string output ) { _verb = "get_tests"; - _opts["url"] = url; - _opts["project"] = project; - _opts["testplan"] = testplan; + _opts["url"] = _instance._appconf["url"].Value; + _opts["project"] = _instance._appconf["project"].Value; ; + _opts["testplan"] = _instance._appconf["testplan"].Value; ; _opts["output"] = output; } - [Verb(Aliases = "upd", Description = "Updates TFS test with provided attributes.\nExample: ''")] + [Verb(Aliases = "upd", Description = "Updates TFS test with provided attributes. Please fill App.config file beforehand\nUsage: ''")] static void update_test( - [RequiredAttribute, DescriptionAttribute("TFS collection url, e.g. 'https://my.visualstudio.com/DefaultCollection")] - string url, - [RequiredAttribute, DescriptionAttribute("TFS project name to get tests from")] - string project, - [RequiredAttribute, DescriptionAttribute("TFS testplan name to get tests from")] - string testplan, [AliasesAttribute("rconf"), DescriptionAttribute("Run configuration"), DefaultValue("tfs_cli")] string run_config, [AliasesAttribute("rd"), RequiredAttribute, DescriptionAttribute("Run duration")] @@ -144,9 +125,9 @@ string test_attachment ) { _verb = "update_test"; - _opts["url"] = url; - _opts["project"] = project; - _opts["testplan"] = testplan; + _opts["url"] = _instance._appconf["url"].Value; + _opts["project"] = _instance._appconf["project"].Value; ; + _opts["testplan"] = _instance._appconf["testplan"].Value; ; _opts["run_config"] = run_config; _opts["duration"] = duration; _opts["run_title"] = run_title; diff --git a/XmlBuilder.cs b/XmlBuilder.cs index b33dc00..b693f42 100644 --- a/XmlBuilder.cs +++ b/XmlBuilder.cs @@ -31,7 +31,9 @@ public void Append(ITestCase test) { new XElement("is_automated", test.IsAutomated), new XElement("area", test.Area) ); + IEnumerator iterator = test.Actions.GetEnumerator(); foreach(ITestAction action in test.Actions){ + iterator.MoveNext(); XElement a = new XElement("action"); a.Add( new XAttribute("id", action.Id), diff --git a/tfs_cli.csproj b/tfs_cli.csproj index 6fd6693..0809036 100644 --- a/tfs_cli.csproj +++ b/tfs_cli.csproj @@ -52,31 +52,22 @@ - ..\packages\CLAP.4.4\lib\net35\CLAP.dll - - - False - ..\..\..\..\..\Work\Tfs-Api\Assembly\Microsoft.TeamFoundation.dll - - - False - ..\..\..\..\..\Work\Tfs-Api\Assembly\12.0\Microsoft.TeamFoundation.Client.dll - - - False - ..\..\..\..\..\Work\Tfs-Api\Assembly\12.0\Microsoft.TeamFoundation.TestManagement.Client.dll - - - False - ..\..\..\..\..\Work\Tfs-Api\Assembly\12.0\Microsoft.TeamFoundation.WorkItemTracking.Client.dll + assembly\CLAP.dll + + + + + + + @@ -116,6 +107,9 @@ false + + +