public void EndTest (TestMethod test) { string output = this.testLog.ToString(); BeginInvokeOnMainThread (() => { var element = new StyledStringElement (test.Name, () => NavigationController.PushViewController (new TestViewController (test, output), true)); if (!test.Passed) element.TextColor = UIColor.Red; this.testsSection.Add (element); }); }
public TestViewController (TestMethod test, string log) : base (UITableViewStyle.Grouped, null, pushing: true) { var section = new Section(); if (!String.IsNullOrWhiteSpace (test.Description)) section.Add (new StyledMultilineElement ("Description:", test.Description)); section.Add (new StyledMultilineElement ("Output:", log, UITableViewCellStyle.Subtitle)); Root = new RootElement (test.Name) { section }; }
private static TestMethod CreateMethod(Type type, object instance, MethodInfo method) { TestMethod test = new TestMethod(); test.Name = method.Name; if (method.GetCustomAttributes<AsyncTestMethodAttribute>().Any()) { test.Test = new AsyncTestMethodAsyncAction(instance, method); } else { test.Test = new TestMethodAsyncAction(instance, method); } ExcludeTestAttribute excluded = method.GetCustomAttribute<ExcludeTestAttribute>(); if (excluded != null) { test.Exclude(excluded.Reason); } if (method.GetCustomAttributes<FunctionalTestAttribute>().Any()) { test.Tags.Add("Functional"); } test.Tags.Add(type.FullName + "." + method.Name); test.Tags.Add(type.Name + "." + method.Name); foreach (TagAttribute attr in method.GetCustomAttributes<TagAttribute>()) { test.Tags.Add(attr.Tag); } return test; }
public async void EndTest(TestMethod method) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (method.Excluded) { _currentTest.Color = Color.FromArgb(0xFF, 0x66, 0x66, 0x66); } else if (!method.Passed) { _currentTest.Color = Color.FromArgb(0xFF, 0xFF, 0x00, 0x6E); } else { _currentTest.Color = Color.FromArgb(0xFF, 0x2A, 0x9E, 0x39); } _currentTest = null; }); }
public async void StartTest(TestMethod test) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () => { _currentTest = new TestDescription { Name = test.Name }; _currentGroup.Add(_currentTest); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { lstTests.ScrollIntoView(_currentTest); }); }); }
void ITestReporter.EndTest (TestMethod test) { var description = new TestDescription (test, this.logBuilder.ToString()); this.currentGroup.Tests.Add (description); }
public TestDescription (TestMethod test, string log) { Test = test; Log = log; }
public void StartTest(TestMethod test) { Dispatcher.BeginInvoke(() => { TestDescription testDescription = new TestDescription { Name = test.Name }; _currentTest = testDescription; _currentGroup.Add(_currentTest); Dispatcher.BeginInvoke(() => { unitTests.ScrollTo(testDescription); }); }); }
public async void StartTest(TestMethod test) { this.bytesStart = this.traffic.GetBytesSent() + this.traffic.GetBytesReceived(); this.stopwatch.Reset(); this.stopwatch.Start(); await Dispatcher.InvokeAsync(async () => { currentTest = new TestDescription { Name = test.Name }; currentGroup.Add(currentTest); tests.Add(currentTest); await Dispatcher.InvokeAsync(() => { lstTests.ScrollIntoView(currentTest); }); }); }
public async void EndTest(TestMethod method) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (method.Excluded) { _currentTest.Color = SkippedColor; } else if (!method.Passed) { _currentTest.Color = FailedColor; } else { _currentTest.Color = PassedColor; } _currentTest = null; }); }
public async void EndTest(TestMethod method) { await Dispatcher.InvokeAsync(() => { if (method.Excluded) { _currentTest.Color = Color.FromArgb(0xFF, 0x66, 0x66, 0x66); ConsoleHelper.WriteLine("Skipped"); } else if (!method.Passed) { _currentTest.Color = Color.FromArgb(0xFF, 0xFF, 0x00, 0x6E); ConsoleHelper.WriteLine("Failed"); } else { _currentTest.Color = Color.FromArgb(0xFF, 0x2A, 0x9E, 0x39); ConsoleHelper.WriteLine("Passed"); } _currentTest = null; }); }
public async void StartTest(TestMethod test) { await Dispatcher.InvokeAsync(async () => { ConsoleHelper.Write("{0}...", test.Name); _currentTest = new TestDescription { Name = test.Name }; _currentGroup.Add(_currentTest); _tests.Add(_currentTest); await Dispatcher.InvokeAsync(() => { lstTests.ScrollIntoView(_currentTest); }); }); }
public void EndTest(TestMethod method) { Dispatcher.BeginInvoke(() => { if (method.Excluded) { _currentTest.Color = SkippedColor; } else if (!method.Passed) { _currentTest.Color = FailedColor; } else { _currentTest.Color = PassedColor; } _currentTest = null; }); }
public async void EndTest(TestMethod method) { await Dispatcher.InvokeAsync(() => { if (method.Excluded) { _currentTest.Color = SkippedColor; ConsoleHelper.WriteLine("Skipped"); } else if (!method.Passed) { _currentTest.Color = FailedColor; ConsoleHelper.WriteLine("Failed: " + method.ErrorInfo); } else { _currentTest.Color = PassedColor; ConsoleHelper.WriteLine("Passed"); } _currentTest = null; }); }
private static TestMethod CreateMethod(TypeInfo type, object instance, MethodInfo method) { TestMethod test = new TestMethod(); test.Name = method.Name; if (method.GetCustomAttributes(true).Where(a => a.GetType() == typeof(AsyncTestMethodAttribute)).Any()) { test.Test = new AsyncTestMethodAsyncAction(instance, method); } else { test.Test = new TestMethodAsyncAction(instance, method); } ExcludeTestAttribute excluded = (ExcludeTestAttribute)method.GetCustomAttributes(true).Where(a => a.GetType() == typeof(ExcludeTestAttribute)).FirstOrDefault(); if (excluded != null) { test.Exclude(excluded.Reason); } if (method.GetCustomAttributes(true).Where(a => a.GetType() == typeof(FunctionalTestAttribute)).Any()) { test.Tags.Add("Functional"); } test.Tags.Add(type.FullName + "." + method.Name); test.Tags.Add(type.Name + "." + method.Name); foreach (TagAttribute attr in method.GetCustomAttributes(true).Where(a => a.GetType() == typeof(TagAttribute))) { test.Tags.Add(attr.Tag); } return test; }
public void StartTest (TestMethod test) { this.testLog = new StringBuilder(); }
public async void EndTest(TestMethod test) { long bytesEnd = this.traffic.GetBytesSent() + this.traffic.GetBytesReceived() - bytesStart; this.stopwatch.Stop(); TimeSpan time = this.stopwatch.Elapsed; await Dispatcher.InvokeAsync(() => { currentTest.Duration = time; currentTest.Bytes = bytesEnd; if (test.Excluded) { currentTest.Brush = new SolidColorBrush(Color.FromArgb(0xFF, 0x66, 0x66, 0x66)); } else if (!test.Passed) { currentTest.Brush = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0x6E)); } else { currentTest.Brush = new SolidColorBrush(Color.FromArgb(0xFF, 0x2A, 0x9E, 0x39)); } currentTest = null; }); }
void ITestReporter.StartTest (TestMethod test) { this.logBuilder = new StringBuilder(); }
public void EndTest(TestMethod method) { Dispatcher.BeginInvoke(() => { if (method.Excluded) { _currentTest.Color = Color.FromArgb(0xFF, 0x66, 0x66, 0x66); } else if (!method.Passed) { _currentTest.Color = Color.FromArgb(0xFF, 0xFF, 0x00, 0x6E); } else { _currentTest.Color = Color.FromArgb(0xFF, 0x2A, 0x9E, 0x39); } _currentTest = null; }); }
/// <summary> /// Reflect, read and prepare the tags for the method metadata. /// Performs the work if this is the first time the metadata has been /// seen. /// </summary> /// <param name="method">The method metadata.</param> private void CreateMethodTags(TestMethod method) { // 1. All the tags from the group Tags tags = new Tags(_groupTags); // 2. Method.Name tags.AddTag(method.Name); // 3. Type.FullName + Method.Name //tags.AddTag(m.ReflectedType.FullName + "." + method.Name); // 4. Type.Name + Method.Name //tags.AddTag(method.ReflectedType.Name + "." + method.Name); // 5. Implicit Inherited tag //if (method.ReflectedType != method.DeclaringType) //{ // tags.AddTag("Inherited"); //} // 6. All [Tag] attributes on the method foreach (string tag in method.Tags) { tags.AddTag(tag); } // 7. Add priority as a tag //if (method.Priority != null) //{ // tags.AddTag(PriorityTagPrefix + method.Priority.ToString()); //} _methodTags.Add(method, tags); // Populate the inverted index foreach (string tag in tags) { List<TestMethod> methods; if (!_tagsToMethods.TryGetValue(tag, out methods)) { methods = new List<TestMethod>(); _tagsToMethods[tag] = methods; } methods.Add(method); } }