//list tests public static IList <Test> GetTestsSystemLevel(Machine TargetName, MachinePool testPool, Project project) { IList <Test> Test_List = new List <Test> { }; try { OSPlatform platform = testPool.GetMachines().First().OSPlatform; ProductInstance pi = project.CreateProductInstance(project.Name, testPool, platform); TargetData data = pi.FindTargetFromSystem(TargetName); if (data == null) { Log("Error! No target data found in system " + TargetName.Name); Console.ReadLine(); return(Test_List); } pi.CreateTarget(data); IList <Test> tests = project.GetTests(); if (tests.Count == 0) { Log("Warning! Test list count is 0"); Console.ReadLine(); return(Test_List); } Test_List = tests; } catch (Exception e) { Console.WriteLine("Exception :- {0}", e.ToString()); } return(Test_List); }
//list tests public static IList <Test> GetTestsDeviceLevel(Machine TargetName, MachinePool testPool, Project project) { IList <Test> Test_List = new List <Test> { }; try { OSPlatform platform = testPool.GetMachines().First().OSPlatform; ProductInstance pi = project.CreateProductInstance(project.Name, testPool, platform); //Device Level ReadOnlyCollection <TargetData> devices = testPool.GetMachines().First().GetTestTargets(); TargetData device_tpm = null; //Find TPM device foreach (TargetData device in devices) { if (device.Name.Contains("Trusted Platform Module 2.0")) { Console.WriteLine(device.Name); device_tpm = device; } } pi.CreateTarget(device_tpm); IList <Test> tests_tpm = project.GetTests(); if (tests_tpm.Count == 0) { Log("Warning! Device Level Test list count is 0"); Console.ReadLine(); return(tests_tpm); } Test_List = tests_tpm; } catch (Exception e) { Console.WriteLine("Exception :- {0}", e.ToString()); } return(Test_List); }