internal static IList<TestCase> GetTests(IEnumerable<string> sources, ITestCaseDiscoverySink discoverySink = null, ITestContainer testContainer = null) { IList<TestCase> tests = new List<TestCase>(); foreach (var assemblyFileName in sources) { Assembly assembly = Assembly.LoadFrom(assemblyFileName); var methodsWithMoyaAttributes = assembly.GetTypes() .SelectMany(t => t.GetMethods()) .Where(Reflection.MethodInfoHasMoyaAttribute) .ToArray(); foreach (MethodInfo methodWithMoyaAttributes in methodsWithMoyaAttributes) { var testCase = new TestCase(methodWithMoyaAttributes.Name, Constants.ExecutorUri, assemblyFileName) { Id = Guid.NewGuid() }; tests.Add(testCase); if (discoverySink != null) { discoverySink.SendTestCase(testCase); } if (testContainer != null) { testContainer.AddTestCaseAndMethod(testCase, methodWithMoyaAttributes); } } } return tests; }
protected void createIssue(ITestContainer tc) { try { var createdIssue = JiraReporter.CreateIssue(tc.Name, true); Report.Info("Jira issue created -- IssueKey: " + createdIssue.Key + "; IssueID: " + createdIssue.Id); Report.LogHtml(ReportLevel.Info, "<a href=\"" + JiraReporter.ServerURL + "browse/" + createdIssue.Id + "\">" + createdIssue.Id + "</a>"); } catch (Exception e) { var inner = e.InnerException; string str = ""; if (inner != null) { var prop = inner.GetType().GetProperty("ErrorResponse"); if (prop != null) { str = (string)prop.GetValue(e.InnerException, null); } } Report.Error(e.Message + " (InnerException: " + e.InnerException + " -- " + str + ")"); } }
public void Run() { JiraConfiguration config = JiraConfiguration.Instance; if (!config.enabled) { Report.Debug("Jira integration disabled in config!"); return; } ITestContainer tc = checkTestCase(); if (tc.Status == Ranorex.Core.Reporting.ActivityStatus.Failed) { string rxField = config.RxAutomationFieldName; string query = config.jqlQueryToConnectIssues; config.RxAutomationFieldName = ""; config.jqlQueryToConnectIssues = ""; AutoHandleJiraIntegration ah = new AutoHandleJiraIntegration(); ah.Run(); config.RxAutomationFieldName = rxField; config.jqlQueryToConnectIssues = query; } }
/// <see cref="ITestContainer.CompareTo"/> public int CompareTo(ITestContainer other) { var testContainer = other as PowerShellTestContainer; if (testContainer == null) { return(-1); } var sourcesEqual = String.Compare(Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); if (sourcesEqual != 0) { return(sourcesEqual); } var projectsEqual = String.Compare(_projectFile.FullName, testContainer._projectFile.FullName, StringComparison.Ordinal); if (projectsEqual != 0) { return(projectsEqual); } return(_timestamp.CompareTo(testContainer._timestamp)); }
public void EvaluateTests(ITestContainer testsToRunContainer) { if (testsToRunContainer == null) { throw new ArgumentNullException("testsToRun"); } this.WarmUp(testsToRunContainer.NumberOfRuns); this.CreateNewHeaderLogEntry(testsToRunContainer.TestsContainerName); var numberOfRuns = testsToRunContainer.NumberOfRuns; foreach (var test in testsToRunContainer.Tests) { var testName = test.Method.Name; try { var totalTimeElapsedInMs = this.MeasureTestExecutionTime(test, numberOfRuns); this.CreateNewLogEntry(testName, totalTimeElapsedInMs, numberOfRuns); } catch (RuntimeBinderException ex) { this.CreateErrorLogEntry(testName, ex.Message); } catch (NullReferenceException ex) { this.CreateErrorLogEntry(testName, ex.Message); } } this.CreateNewEmptyLogEntry(); }
/// <summary> /// Compares this instance to another. /// </summary> /// <param name="other">The other.</param> /// <returns>System.Int32.</returns> public int CompareTo(ITestContainer other) { TestContainer testContainer = other as TestContainer; var num = testContainer != null?this.lastKnownChange.CompareTo(testContainer.lastKnownChange) : -1; return(num); }
public void CreateElement_FromBaseTypeIPrintable_ShouldReturnDefaultValueNull() { MarkdownElementFactory factory = new MarkdownElementFactory(); ITestContainer element = factory.CreateMarkdownContainer <ITestContainer>("Test"); Assert.IsNull(element); }
public int CompareTo(ITestContainer other) { var otherContainer = other as TestContainer; if (otherContainer == null) return -1; if (this.Source != otherContainer.Source) return this.Source.CompareTo(otherContainer.Source); return this.CreatedTime.CompareTo(otherContainer.CreatedTime); }
public int CompareTo(ITestContainer other) { var testContainer = other as TestContainer; if (testContainer == null) { return -1; } var result = String.Compare(this.Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); return result; }
public int CompareTo(ITestContainer other_) { var other = other_ as CTestContainer; if (other == null) return -1; var result = string.Compare(this.Source, other.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) return result; return object.ReferenceEquals(this, other) ? 0 : -1; }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> public void Run() { ITestContainer tc = checkTestCase(); JiraConfiguration config = JiraConfiguration.Instance; IEnumerable issues = null; if ((config.jqlQueryToConnectIssues == null || config.jqlQueryToConnectIssues.Length == 0) && (config.RxAutomationFieldName == null || config.RxAutomationFieldName.Length == 0)) { issues = Enumerable.Empty <Issue>(); } else if (config.jqlQueryToConnectIssues.Length > 0) { issues = JiraReporter.getJiraIssues(config.jqlQueryToConnectIssues); } else { issues = JiraReporter.getJiraIssues("'" + config.RxAutomationFieldName + "' ~ '" + tc.Name + "'"); } if (tc.Status == Ranorex.Core.Reporting.ActivityStatus.Failed) { bool isEmpty = true; foreach (Issue issue in issues) { if (!issue.Status.Name.Contains(config.StateReopen)) { reopenIssue(issue.Key.ToString(), config.StateReopen); } else { Report.Info("Jira issue is already open -- IssueKey: " + issue.Key.ToString() + "; IssueID: " + issue.Key.ToString()); Report.LogHtml(ReportLevel.Info, "<a href=\"" + JiraReporter.ServerURL + "browse/" + issue.Key.ToString() + "\">" + issue.Key.ToString() + "</a>"); } isEmpty = false; } if (isEmpty) { createIssue(tc); } } else if (tc.Status == Ranorex.Core.Reporting.ActivityStatus.Success) { foreach (Issue issue in issues) { if (!issue.Status.Name.Contains(config.StateClosed)) { resolveIssue(issue.Key.ToString(), config.StateClosed); } } } }
public void ChildInheritsParentsConfiguration_RegisterTypeResolve() { UnityContainer parent = new UnityContainer(); parent.RegisterType <ITestContainer, TestContainer>(new ContainerControlledLifetimeManager()); IUnityContainer child = parent.CreateChildContainer(); ITestContainer objtest = child.Resolve <ITestContainer>(); Assert.IsNotNull(objtest); Assert.IsInstanceOfType(objtest, typeof(TestContainer)); }
public void ChildInheritsParentsConfiguration_RegisterInstanceResolve() { UnityContainer parent = new UnityContainer(); ITestContainer obj = new TestContainer(); parent.RegisterInstance <ITestContainer>("InParent", obj); IUnityContainer child = parent.CreateChildContainer(); ITestContainer objtest = child.Resolve <ITestContainer>("InParent"); Assert.IsNotNull(objtest); Assert.AreSame(objtest, obj); }
public int CompareTo(ITestContainer other) { var container = other as TestContainer; if (container == null) { return -1; } var result = String.Compare(Source, container.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return result; } return _timeStamp.CompareTo(container._timeStamp); }
public int CompareTo(ITestContainer other) { var testContainer = other as TestContainer; if (testContainer == null) { return(-1); } var result = string.Compare(Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); return(result != 0 ? result : _timestamp.CompareTo(testContainer._timestamp)); }
public void RegisterSameTypeInChildAndParentOverriden() { UnityContainer parent = new UnityContainer(); parent.RegisterType <ITestContainer, TestContainer>(); IUnityContainer child = parent.CreateChildContainer() .RegisterType <ITestContainer, TestContainer1>(); ITestContainer parentregister = parent.Resolve <ITestContainer>(); ITestContainer childregister = child.Resolve <ITestContainer>(); Assert.IsInstanceOfType(parentregister, typeof(TestContainer)); Assert.IsInstanceOfType(childregister, typeof(TestContainer1)); }
public int CompareTo(ITestContainer other2) { var other = other2 as CTestContainer; if (other == null) { return -1; } var result = string.Compare(Source, other.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return result; } return ReferenceEquals(this, other) ? 0 : -1; }
public void ChangeInParentConfigurationIsReflectedInChild() { UnityContainer parent = new UnityContainer(); parent.RegisterType <ITestContainer, TestContainer>(); IUnityContainer child = parent.CreateChildContainer(); ITestContainer first = child.Resolve <ITestContainer>(); parent.RegisterType <ITestContainer, TestContainer1>(); ITestContainer second = child.Resolve <ITestContainer>(); Assert.IsInstanceOfType(first, typeof(TestContainer)); Assert.IsInstanceOfType(second, typeof(TestContainer1)); }
public int CompareTo(ITestContainer other) { Debug.Assert(other is PackageJsonTestContainer, "Only test containers based on package.json are expected."); var testContainer = (PackageJsonTestContainer)other; if (this.version != testContainer.version) { return(this.version - testContainer.version); } var sourceCompare = StringComparer.OrdinalIgnoreCase.Compare(this.Source, testContainer.Source); return(sourceCompare != 0 ? sourceCompare : StringComparer.OrdinalIgnoreCase.Compare(this.TestRoot, testContainer.TestRoot)); }
void writeBatchFile(string batFileName, string reportFileName, string testcaseName) { ITestContainer tc = TestSuite.CurrentTestContainer; JiraConfiguration config = JiraConfiguration.Instance; var file = File.CreateText(batFileName); string chageDirectory = String.Format("CD \"{0}\"", JiraCLIFileLocation.Substring(0, JiraCLIFileLocation.LastIndexOf('\\') + 1)); // Jira WebService calls for CLI environment string jiraCall = String.Format("CALL \"{0}\" {1} {2} {3} {4} ", JiraCLIFileLocation.Substring(JiraCLIFileLocation.LastIndexOf('\\') + 1), config.ServerUrl, config.UserName, config.Password, tc.Name); string actionCreateIssue = String.Format("{0} \"{1}\" \"{2}\" \"{3}\" ", config.JiraProjectKey, config.JiraIssueType, config.JiraSummary, getDescriptionString(config)); if (!string.IsNullOrEmpty(config.JiraLabels)) { actionCreateIssue = actionCreateIssue + String.Format(" \"{0}\" ", config.JiraLabels); } actionCreateIssue += String.Format("\"{0}\" ", System.IO.Path.Combine(Ranorex.Core.Reporting.TestReport.ReportEnvironment.ReportFileDirectory, reportFileName)); actionCreateIssue += String.Format("\"{0}\" ", attachments); file.WriteLine("@ECHO off"); file.WriteLine(chageDirectory); file.WriteLine(String.Format("{0} {1} %* > return_string_{2}.txt", jiraCall, actionCreateIssue, testcaseName)); file.WriteLine(String.Format("type return_string_{0}.txt", testcaseName)); //parse return string from Jira WebService call to get issue ID file.WriteLine(String.Format("FOR /F \"tokens=2,6,8 delims== \" %%I IN (return_string_{0}.txt) DO ( set KEY=%%I & set ID=%%J & set URL=%%K)", testcaseName)); file.WriteLine("set ID=%ID:~0,-1%"); //prompt if user wants to review the created issue in the default browser file.WriteLine("if %errorlevel% neq 0 echo ERROR: Something went wrong uploading the issue! & pause"); file.WriteLine("if %errorlevel% neq 0 exit /b %errorlevel%"); file.WriteLine("echo Issue created and report uploaded"); file.WriteLine("set /p answer=Do you want to open the issue in your default browser (Y/[N])?"); file.WriteLine("if /i \"%answer:~,1%\" EQU \"Y\" start %URL%"); file.WriteLine("else exit /b"); file.WriteLine("echo Please type Y for Yes or N for No"); file.Close(); file.Dispose(); }
public int CompareTo(ITestContainer other2) { var other = other2 as CTestContainer; if (other == null) { return(-1); } var result = string.Compare(Source, other.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return(result); } return(ReferenceEquals(this, other) ? 0 : -1); }
public int CompareTo(ITestContainer other) { var testContainer = other as ProtractorTestContainer; if (testContainer == null) { return -1; } var result = String.Compare(this.Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return result; } return this.timeStamp.CompareTo(testContainer.timeStamp); }
public int CompareTo(ITestContainer other) { var otherContainer = other as TestContainer; if (otherContainer == null) { return(-1); } if (this.Source != otherContainer.Source) { return(this.Source.CompareTo(otherContainer.Source)); } return(this.CreatedTime.CompareTo(otherContainer.CreatedTime)); }
public static void updateSummary() { ITestContainer tc = TestSuite.CurrentTestContainer; string testCaseName = tc.Name; Ranorex.Core.Reporting.ActivityStack.Instance.VisitAll(activity => { if ((activity.GetType().Name.Equals("TestContainerActivity") && activity.Status == ActivityStatus.Failed && (activity as ITestContainerActivity).ContainerName.Equals(testCaseName)) ) { JiraConfiguration config = JiraConfiguration.Instance; config.JiraSummary = getFailedAction(activity); } return(true); }); }
public TileCache([NotNull] IList <ITable> cachedTables, [NotNull] IBox testRunBox, [NotNull] ITestContainer container, [NotNull] IDictionary <ITable, IList <ContainerTest> > testsPerTable) { _cachedTables = cachedTables; _testRunBox = testRunBox; _container = container; _testsPerTable = testsPerTable; _cachedTableCount = cachedTables.Count; _rowBoxTrees = new RowBoxTree[_cachedTables.Count]; _xyToleranceByTableIndex = GetXYTolerancePerTable(_testsPerTable.Keys); IgnoredRowsByTableAndTest = new List <IList <BaseRow> > [_cachedTableCount]; OverlappingFeatures = new OverlappingFeatures(_container.MaxCachedPointCount); CollectSearchTolerances(); }
public int CompareTo(ITestContainer other) { var testContainer = other as PowerShellTestContainer; if (testContainer == null) { return -1; } int result = String.Compare(Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return result; } int ts = _timeStamp.CompareTo(testContainer._timeStamp); return ts; }
public int CompareTo(ITestContainer other) { var container = other as TestContainer; if (container == null) { return(-1); } var result = String.Compare(Source, container.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return(result); } return(_timeStamp.CompareTo(container._timeStamp)); }
public int CompareTo(ITestContainer other) { var testContainer = other as tSQLtTestContainer; if (testContainer == null) { return(-1); } var result = String.Compare(this.Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return(result); } return(-1); // return this.timeStamp.CompareTo(testContainer.timeStamp); }
public int CompareTo(ITestContainer other) { var container = other as TestContainer; if (container == null) { return(-1); } if (_isWorkspace != container._isWorkspace) { return(-1); } var result = String.Compare(Source, container.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return(result); } result = String.Compare(this.Project, container.Project, StringComparison.Ordinal); if (result != 0) { return(result); } result = String.Compare(this.ProjectName, container.ProjectName, StringComparison.Ordinal); if (result != 0) { return(result); } result = _cachedTime.CompareTo(container._cachedTime); if (result != 0) { return(result); } result = _lastWriteTime.CompareTo(container._lastWriteTime); return(result); }
public static void updateDescriptionWithAllStepsMade() { IList <JiraDescriptionItem> items = JiraConfiguration.Instance.JiraDescription; items.Clear(); ITestContainer tc = TestSuite.CurrentTestContainer; string testCaseName = tc.Name; Ranorex.Core.Reporting.ActivityStack.Instance.VisitAll(activity => { if ((activity.GetType().Name.Equals("TestContainerActivity") && activity.Status == ActivityStatus.Failed && (activity as ITestContainerActivity).ContainerName.Equals(testCaseName)) ) { fillDescription(activity); } return(true); }); }
public int CompareTo(ITestContainer other) { var testContainer = other as PowerShellTestContainer; if (testContainer == null) { return(-1); } int result = String.Compare(Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return(result); } int ts = _timeStamp.CompareTo(testContainer._timeStamp); return(ts); }
/// <summary> /// Comapre this test container to another one /// They are the same if same source and timestamp /// </summary> /// <param name="other"></param> /// <returns></returns> public int CompareTo(ITestContainer other) { var testContainer = other as JsTestContainer; if (testContainer == null) { return(-1); } var result = String.Compare(this.Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return(result); } ChutzpahTracer.TraceInformation("Test container comparision {0} vs {1} for {2}", this.timeStamp, testContainer.timeStamp, this.Source); return(this.timeStamp.CompareTo(testContainer.timeStamp)); }
public int CompareTo(ITestContainer other) { const int isSmaller = -1; const int isEqual = 0; NSpecTestContainer otherContainer = other as NSpecTestContainer; if (otherContainer == null) { return(isSmaller); } int sourceCompare = String.Compare(sourcePath, otherContainer.Source, StringComparison.OrdinalIgnoreCase); if (sourceCompare != isEqual) { return(isSmaller); } return(timeStamp.CompareTo(otherContainer.timeStamp)); }
public void FixChildren() { foreach (Element el in Children) { if (el.Parent != Parent) { el.Parent = Parent; } if (!this.TreeNode.Nodes.Contains(el.TreeNode)) { this.TreeNode.Nodes.Add(el.TreeNode); } ITestContainer c = el as ITestContainer; if (c != null) { c.FixChildren(); } } }
public int CompareTo(ITestContainer other) { var container = other as TestContainer; if (container == null) { return(-1); } if (_isWorkspace != container._isWorkspace) { return(-1); } var result = String.Compare(Source, container.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return(result); } if (Version.CompareTo(container.Version) != 0) { return(-1); } result = String.Compare(this.Project, container.Project, StringComparison.Ordinal); if (result != 0) { return(result); } result = String.Compare(this.ProjectName, container.ProjectName, StringComparison.Ordinal); if (result != 0) { return(result); } return(_timeStamp.CompareTo(container._timeStamp)); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; String sTestCaseName = TestSuite.CurrentTestContainer.Name; //ITestCase iCase = TestSuite.Current.GetTestCase(sTestCaseName); // The name of your Test Case ITestContainer iCase = TestSuite.Current.GetTestContainer(sTestCaseName); if (iCase.Status == Ranorex.Core.Reporting.ActivityStatus.Failed) { Report.Info(string.Format("TestCase1 {0} Failed!", sTestCaseName)); System.IO.File.AppendAllText("c:\\RanorexStandAlone\\log\\log.txt", string.Format("{0} had failed.", sTestCaseName) + Environment.NewLine); } }
internal static IList <TestCase> GetTests(IEnumerable <string> sources, ITestCaseDiscoverySink discoverySink = null, ITestContainer testContainer = null) { IList <TestCase> tests = new List <TestCase>(); foreach (var assemblyFileName in sources) { Assembly assembly = Assembly.LoadFrom(assemblyFileName); var methodsWithMoyaAttributes = assembly.GetTypes() .SelectMany(t => t.GetMethods()) .Where(Reflection.MethodInfoHasMoyaAttribute) .ToArray(); foreach (MethodInfo methodWithMoyaAttributes in methodsWithMoyaAttributes) { var testCase = new TestCase(methodWithMoyaAttributes.Name, Constants.ExecutorUri, assemblyFileName) { Id = Guid.NewGuid() }; tests.Add(testCase); if (discoverySink != null) { discoverySink.SendTestCase(testCase); } if (testContainer != null) { testContainer.AddTestCaseAndMethod(testCase, methodWithMoyaAttributes); } } } return(tests); }
/// <summary> /// Comapre this test container to another one /// They are the same if same source and timestamp /// </summary> /// <param name="other"></param> /// <returns></returns> public int CompareTo(ITestContainer other) { var testContainer = other as JsTestContainer; if (testContainer == null) { return -1; } var result = String.Compare(this.Source, testContainer.Source, StringComparison.OrdinalIgnoreCase); if (result != 0) { return result; } ChutzpahTracer.TraceInformation("Test container comparision {0} vs {1} for {2}", this.timeStamp, testContainer.timeStamp, this.Source); return this.timeStamp.CompareTo(testContainer.timeStamp); }
public int CompareTo(ITestContainer other) { throw new DummyTestException(); }
public TestSuite() { TestContainers = new ITestContainer[] {}; }