Exemplo n.º 1
0
		private static void ConvertCase()
		{
			Console.WriteLine("");
			Console.WriteLine("-------------------- Converting selenium test case to C# --------------------");
			Console.WriteLine("");
			
			string testCasePath = ResolvePath(Arguments["testcase"]);
			
			string outputPath = String.Empty;
			if (Arguments.Contains("output"))
				outputPath = ResolvePath(Arguments["output"]);
			
			Console.WriteLine("Test case path: " + testCasePath);
			Console.WriteLine("Output path: " + outputPath);
			
			TestCaseConverter converter = new TestCaseConverter();
			
			if (Arguments.Contains("namespace"))
				converter.Namespace = Arguments["namespace"];
			
			if (Arguments.Contains("basetype"))
				converter.BaseFixtureType = Arguments["basetype"];
			
			if (Arguments.Contains("baseurl"))
				converter.BaseUrl = Arguments["baseurl"];
			
			if (Arguments.Contains("browser"))
				converter.Browser = Arguments["browser"];
			
			
			converter.LoadFile(testCasePath);
			
			converter.Convert(outputPath);
		}
		public void Convert(string outputPath)
		{
			HtmlNodeCollection nodes = new TestSuiteReader(TestSuiteHtml).ReadCases();
			
			foreach (HtmlNode node in nodes)
			{
				string title = node.InnerText;
				string file = node.Attributes["href"].Value;
				
				string filePath = Path.GetFullPath(file);
				
				if (testSuitePath != String.Empty)
					filePath = Path.Combine(Path.GetDirectoryName(testSuitePath), file);
				
				TestCaseConverter converter = new TestCaseConverter();
				
				converter.BaseFixtureType = BaseFixtureType;
				converter.Browser = Browser;
				converter.Namespace = Namespace;
				converter.BaseUrl = BaseUrl;
				
				converter.LoadFile(Path.GetFullPath(filePath));
				converter.Convert(outputPath);
			}
		
		}