/// ------------------------------------------------------------------- /// <summary> /// Build up the _methods variable with all the methods associated with the patterns, /// AutomationElement, etc. buckets so we can call them. /// /// TODO: Make this a static methods so we don't build this up for each thread /// </summary> /// ------------------------------------------------------------------- private void BuildMethodsTable(TestLab testLab, TestWorks testWorks, Scenario scenario) { Type type = Type.GetType("Microsoft.Test.UIAutomation.Tests.Scenarios.StressTests"); System.Diagnostics.Debug.Assert(type != null); if (type != null) { foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)) { foreach (Attribute attr in method.GetCustomAttributes(false)) { if (attr is StressBuckets) { StressBuckets sb = (StressBuckets)attr; if (((sb.TestWorks & testWorks) == testWorks) && (((sb.TestLab & testLab) == testLab) || testLab == TestLab.PushPullData) && ((sb.Scenario & scenario) == scenario) ) { // Only create the if (!_testMethods.ContainsKey(sb.PatternName)) { ArrayList list = new ArrayList(); _testMethods.Add(sb.PatternName, list); Console.WriteLine(sb.PatternName); } _appCommands.TraceMethod("Adding: " + method.Name); ((ArrayList)_testMethods[sb.PatternName]).Add(method); } } } } } }
/// ------------------------------------------------------------------- /// <summary>Constructor for custom attribute associated with the /// UIAutomation test</summary> /// ------------------------------------------------------------------- public StressBuckets(string patternName, string methodOrPropertyName, TestLab testLab, TestWorks testWorks, int bugNumber) { _bugNumber = bugNumber; _patternName = patternName; _methodOrPropertyName = methodOrPropertyName; _testLab = testLab; _testWorks = TestWorks.NoWorking; // Override and set this }
/// ------------------------------------------------------------------- /// <summary>Constructor for custom attribute associated with the /// UIAutomation test</summary> /// ------------------------------------------------------------------- public StressBuckets(string patternName, string methodOrPropertyName, TestLab testLab, TestWorks testWorks, Scenario scenario) { _patternName = patternName; _methodOrPropertyName = methodOrPropertyName; _testLab = testLab; _testWorks = testWorks; _scenario = scenario; }