/// ------------------------------------------------------------------- /// <summary>Return whether the attribute is set to Stable</summary> /// ------------------------------------------------------------------- internal static bool Stable(string methodName, TestLab testLab) { Type type = typeof(StressTests); MethodInfo method = type.GetMethod(methodName); StressBuckets testAttribute = (StressBuckets)method.GetCustomAttributes(true)[0]; return(testAttribute.TestWorks == TestWorks.Stable && testAttribute.BugNumber == 0); //&& (testAttribute.TestLab & testLab) == testLab; }
/// ------------------------------------------------------------------- /// <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); } } } } } }