static void Main(string[] args) { if (args.Length > 0) { RunHelper.StartTimedTestRun(suite => { var loader = new TestLoader(); foreach (var arg in args) { Debug.WriteLine(arg); if (Directory.Exists(arg)) { suite.Add(loader.LoadFromDirectory(arg)); } else if (File.Exists(arg)) { suite.Add(loader.LoadFromFile(arg)); } } }); } else { Console.WriteLine("No arguments."); } }
public void SetUp() { NUnitRegistry.TestMode = true; NUnitRegistry.ClearTestKeys(); loader = new TestLoader(Console.Out, Console.Error); catcher = new TestEventCatcher(loader.Events); }
private static IEnumerable <AbiTest> LoadBasicAbiTests() { IEnumerable <AbiTest> tests = TestLoader.LoadFromFile <Dictionary <string, AbiTestJson>, AbiTest>( "basic_abi_tests.json", allTests => allTests.Select(namedTest => Convert(namedTest.Key, namedTest.Value))); return(tests); }
private static IEnumerable <TrieTest> LoadAnyOrderTests() { IEnumerable <TrieTest> tests = TestLoader.LoadFromFile <Dictionary <string, TrieTestJson>, TrieTest>( "trieanyorder.json", dwj => dwj.Select(p => new TrieTest(p.Key, p.Value.In.ToList(), p.Value.Root))); return(GetTestPermutations(tests)); }
public void TestDelayedLoad() { AddStep("begin loading", () => LoadScreen(loader = new TestLoader())); AddUntilStep("wait for logo visible", () => loader.Logo?.Alpha > 0); AddStep("finish loading", () => loader.AllowLoad.Set()); AddUntilStep("loaded", () => loader.Logo != null && loader.ScreenLoaded); AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0); }
public override void ApplySettings() { TestLoader loader = Services.TestLoader; settings.SaveSetting( "Options.TestLoader.ReloadOnChange", loader.ReloadOnChange = reloadOnChangeCheckBox.Checked ); settings.SaveSetting( "Options.TestLoader.RerunOnChange", loader.RerunOnChange = rerunOnChangeCheckBox.Checked ); settings.SaveSetting( "Options.TestLoader.ReloadOnRun", loader.ReloadOnRun = reloadOnRunCheckBox.Checked ); }
private static IEnumerable <TrieTest> LoadHexEncodedSecureTests() { IEnumerable <TrieTest> tests = TestLoader.LoadFromFile <Dictionary <string, TrieTestJson>, TrieTest>( "hex_encoded_securetrie_test.json", dwj => dwj.Select(p => new TrieTest(p.Key, p.Value.In.ToList(), p.Value.Root))); return(GetTestPermutations(tests)); }
public void Initialize(TestLoader loader) { this.tests.Initialize(loader, loader.Events); this.loader = loader; loader.Events.TestLoaded += new NUnit.Util.TestEventHandler(events_TestLoaded); loader.Events.TestReloaded += new NUnit.Util.TestEventHandler(events_TestReloaded); loader.Events.TestUnloaded += new NUnit.Util.TestEventHandler(events_TestUnloaded); }
public override void ApplySettings() { TestLoader loader = Services.TestLoader; settings.SaveSetting("Options.TestLoader.MultiDomain", loader.MultiDomain = multiDomainRadioButton.Checked); settings.SaveSetting("Options.TestLoader.MergeAssemblies", loader.MergeAssemblies = mergeAssembliesCheckBox.Checked); settings.SaveSetting("Options.TestLoader.AutoNamespaceSuites", loader.AutoNamespaceSuites = autoNamespaceSuites.Checked); }
public void SetUp() { loader = new TestLoader( ); loader.MergeAssemblies = false; loader.AutoNamespaceSuites = true; loader.MultiDomain = false; catcher = new TestEventCatcher(loader.Events); }
public void TestDelayedLoad() { AddStep("begin loading", () => LoadScreen(loader = new TestLoader())); AddUntilStep("wait for spinner visible", () => loader.LoadingSpinner?.Alpha > 0); AddStep("finish loading", () => loader.AllowLoad.Set()); AddUntilStep("spinner gone", () => loader.LoadingSpinner?.Alpha == 0); AddUntilStep("loaded", () => loader.ScreenLoaded); AddUntilStep("not current", () => !loader.IsCurrentScreen()); }
public void CanLoadSuiteFromAssembly() { Assembly thisAssembly = Assembly.GetExecutingAssembly(); ITest suite = TestLoader.Load(thisAssembly); Assert.That(suite.TestCaseCount, Is.GreaterThan(100)); Assert.That(suite.Name, Is.EqualTo(thisAssembly.GetName().Name)); // Don't run! It would recurse infinitely on this test. }
public void Add(Assembly assembly) { if (assembly == null) { throw new ArgumentNullException("assembly"); } // TestLoader.Load always return a TestSuite so we can avoid casting many times suites.Add(TestLoader.Load(assembly) as TestSuite); }
public static IEnumerable <DifficultyTests> LoadHex(string fileName) { Stopwatch watch = new Stopwatch(); IEnumerable <DifficultyTests> tests = TestLoader.LoadFromFile <Dictionary <string, DifficultyTestHexJson>, DifficultyTests>( fileName, t => t.Select(dtj => ToTest(fileName, dtj.Key, dtj.Value))).ToList(); watch.Stop(); return(tests); }
public TestManipulator(UnswerManipalatorI unswerManipalator, GoTestQueryConfiguratorI goTestQueryConfigurator, QuestionManipulatorI questionManipulator) { testloader = new TestLoader(unswerManipalator, goTestQueryConfigurator, questionManipulator); testUpdater = new TestUpdater(unswerManipalator, goTestQueryConfigurator, questionManipulator); testCreator = new TestCreator(unswerManipalator, goTestQueryConfigurator, questionManipulator); }
public void CanLoadAndRunSuiteFromSuiteProperty() { ITest suite = TestLoader.LoadAsSuite(typeof(MyTests)); Assert.That(suite, Is.Not.Null, "Could not get suite"); Assert.That(suite.TestCaseCount, Is.EqualTo(4)); RecordingTestListener listener = new RecordingTestListener(); suite.Run(listener); Assert.That(listener.Events, Is.EqualTo( "<MyTests:<One::Success><Two::Success><TheTest::Failure><Three::Success>:Failure>")); }
public void TestInstantLoad() { // visual only, very impossible to test this using asserts. AddStep("load immediately", () => { loader = new TestLoader(); loader.AllowLoad.Set(); LoadScreen(loader); }); }
public void TestReadPerformenceComparison() { DaabRead(); DbHelperRead(); GatewayRead(); Console.WriteLine(string.Format("Daab read (Single Thread):\t\t{0}", TestLoader.GetSingleThreadSpend(REPEAT_TIME, new TestHandler1(DaabRead)))); Console.WriteLine(string.Format("DbHelper read (Single Thread):\t{0}", TestLoader.GetSingleThreadSpend(REPEAT_TIME, new TestHandler1(DbHelperRead)))); Console.WriteLine(string.Format("Gateway read (Single Thread):\t{0}", TestLoader.GetSingleThreadSpend(REPEAT_TIME, new TestHandler1(GatewayRead)))); Console.WriteLine(string.Format("Daab read (Multi Thread):\t\t{0}", TestLoader.GetMultiThreadSpend(REPEAT_TIME, new TestHandler1(DaabRead)))); Console.WriteLine(string.Format("DbHelper read (Multi Thread):\t\t{0}", TestLoader.GetMultiThreadSpend(REPEAT_TIME, new TestHandler1(DbHelperRead)))); Console.WriteLine(string.Format("Gateway read (Multi Thread):\t\t{0}", TestLoader.GetMultiThreadSpend(REPEAT_TIME, new TestHandler1(GatewayRead)))); }
public void testLoadFromFileAbsolute() { // Arrange TestSuite suite = null; TestLoader loader = new TestLoader(); string file = System.IO.Path.GetFullPath(@"..\..\..\TestLoaderTestTests\bin\Debug\TestLoaderTestTests.dll"); // Act suite = loader.LoadFromFile(file); // Assert Assert.AreEqual(1, suite.Tests.Count); }
public void testLoadFromDirectoryRelative() { // Arrange TestSuite suite = null; TestLoader loader = new TestLoader(); string directory = @"..\..\..\TestLoaderTestTests\bin\Debug\"; // Act suite = loader.LoadFromDirectory(directory); // Assert Assert.AreEqual(1, suite.Tests.Count); }
public void testLoadFromDirectoryAbsolute() { // Arrange TestSuite suite = null; TestLoader loader = new TestLoader(); string directory = System.IO.Path.GetFullPath(@"..\..\..\TestLoaderTestTests\bin\Debug\"); // Act suite = loader.LoadFromDirectory(directory); // Assert Assert.AreEqual(1, suite.Tests.Count); }
public static void Init(Form ownerForm, TextWriter outWriter, TextWriter errWriter) { AppUI.outWriter = outWriter; Console.SetOut(outWriter); AppUI.errWriter = errWriter; Console.SetError(errWriter); loader = new TestLoader(outWriter, errWriter); loader.ReloadOnRun = UserSettings.Options.ReloadOnRun; loader.ReloadOnChange = UserSettings.Options.ReloadOnChange; loaderUI = new TestLoaderUI(ownerForm, loader); }
public void Load1000TestsUsingTestLoader() { loader = new TestLoader(); int start = Environment.TickCount; loader.LoadProject("loadtest-assembly.dll"); Assert.IsTrue(loader.IsProjectLoaded); loader.LoadTest(); Assert.IsTrue(loader.IsTestLoaded); Assert.AreEqual(1000, loader.TestCount); int ms = Environment.TickCount - start; Assert.LessOrEqual(ms, 4000); }
private void OpenForm() { TestLoader tlk = new TestLoader(_fe); tlk.SetHumanID(); _humanid = tlk.HumanID; if (_humanid != 0) { _recogform = new RForm((int)_test, _humanid, _ge, _fe); _recogform.WindowState = FormWindowState.Maximized; _recogform.btn_addtobase.Click += new EventHandler(btn_addtobase_Click); _recogform.Show(); } }
public static void SaveProject(Form owner) { TestLoader loader = Services.TestLoader; if (Path.IsPathRooted(loader.TestProject.ProjectPath) && NUnitProject.IsNUnitProjectFile(loader.TestProject.ProjectPath) && CanWriteProjectFile(loader.TestProject.ProjectPath)) { loader.TestProject.Save(); } else { SaveProjectAs(owner); } }
public void OnlyComplete5MinDataIsReported() { var undertest = new TestLoader(); var date = new DateTime(2014, 05, 14); undertest.Minute_Log_5s = new[]{ new Minute_Log_5 { ApplianceID = 1, LogDate = date, Usage_00 = -1, Usage_05 = -1 }, new Minute_Log_5 { ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2 }, }; var result = undertest.Get5minPlugwiseYield(date, new[] { 1, 2 } /*specific appliances*/); // We expect a single result using just Usage_05 since that is complete. var expected = new[] { new YieldAggregate(date.AddMinutes(5),3, TimeSpan.FromMinutes(5)) }; CollectionAssert.AreEquivalent(expected, result); }
public void TestLongLoad() { bool logoVisible = false; AddStep("begin loading", () => LoadScreen(loader = new TestLoader())); AddWaitStep("wait", 10); AddStep("finish loading", () => { logoVisible = loader.Logo?.Alpha > 0; loader.AllowLoad.Set(); }); AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded); AddAssert("logo was visible", () => logoVisible); AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0); }
// Start is called before the first frame update void Start() { Sessions = Database.GetSessions(); Loader = new TestLoader(); for (int i = 0; i < Sessions.Count; i++) { var button = Instantiate(Button, Panel); var text = button.GetComponentInChildren <Text>(); text.text = Sessions[i] + ""; int index = i; button.onClick.AddListener(() => Choose(Sessions[index])); } }
public void TestInstantLoad() { AddStep("load immediately", () => { loader = new TestLoader(); loader.AllowLoad.Set(); LoadScreen(loader); }); spinnerNotPresentOrHidden(); AddUntilStep("loaded", () => loader.ScreenLoaded); AddUntilStep("not current", () => !loader.IsCurrentScreen()); spinnerNotPresentOrHidden(); }
public void InComplete5MinDataIsReported() { var undertest = new TestLoader(); var date = new DateTime(2014, 05, 14); undertest.Minute_Log_5s = new[]{ new Minute_Log_5 { ApplianceID = 1, LogDate = date, Usage_00 = -1, Usage_05 = -1 }, new Minute_Log_5 { ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2 }, }; var result = undertest.Get5minPlugwiseYield(date, new int[0] /*No specific appliances*/); var expected = new[] { new YieldAggregate (date.AddMinutes(00), 1, TimeSpan.FromMinutes(5)) , new YieldAggregate (date.AddMinutes(05), 3, TimeSpan.FromMinutes(5)) , new YieldAggregate (date.AddMinutes(10), 2, TimeSpan.FromMinutes(5)) }; CollectionAssert.AreEquivalent(expected, result); }
public void Add(Assembly assembly) { if (assembly == null) { throw new ArgumentNullException("assembly"); } // this can be called many times but we only want to load them // once since we need to share them across most activities if (!Initialized) { // TestLoader.Load always return a TestSuite so we can avoid casting many times TestSuite ts = TestLoader.Load(assembly) as TestSuite; AndroidRunner.AssemblyLevel.Add(ts); Add(ts); } }
void Awake() { testLoader = GetComponent <TestLoader>(); stopWatchGui.posX = GlobalGui.listWidth; #if PLATFORM_WEBGL && !UNITY_EDITOR // Hide UI in glTF compare web showMenu = false; #endif var selectSet = GetComponent <SampleSetSelectGui>(); selectSet.onSampleSetSelected += OnSampleSetSelected; testLoader.urlChanged += UrlChanged; testLoader.loadingBegin += OnLoadingBegin; testLoader.loadingEnd += OnLoadingEnd; }
public void TestInstantLoad() { // visual only, very impossible to test this using asserts. AddStep("load immediately", () => { loader = new TestLoader(); loader.AllowLoad.Set(); LoadScreen(loader); }); AddAssert("spinner did not display", () => loader.LoadingSpinner?.Alpha == 0); AddUntilStep("loaded", () => loader.ScreenLoaded); AddUntilStep("not current", () => !loader.IsCurrentScreen()); }
public static void NewProject(Form owner) { TestLoader loader = Services.TestLoader; SaveFileDialog dlg = new SaveFileDialog(); dlg.Title = "New Test Project"; dlg.Filter = "NUnit Test Project (*.nunit)|*.nunit|All Files (*.*)|*.*"; dlg.FileName = Services.ProjectService.GenerateProjectName(); dlg.DefaultExt = "nunit"; dlg.ValidateNames = true; dlg.OverwritePrompt = true; if (dlg.ShowDialog(owner) == DialogResult.OK) { loader.NewProject(dlg.FileName); } }
/// <summary> /// Overrides <see cref="TestExtractor.Extractor.Extractor.Extractor.Extract()" /> /// </summary> protected override void Extract() { var assemblies = AppDomain.CurrentDomain.GetData(AppDataDomainExtractionAssemblyName) as IList <string>; if (assemblies == null || !assemblies.Any()) { return; } TestSuites = new List <ISuiteNode>(); TestMethods = new List <IStubNode>(); ServiceManager.Services.AddService(new SettingsService()); ServiceManager.Services.AddService(new DomainManager()); ServiceManager.Services.AddService(new ProjectService()); ServiceManager.Services.AddService(new AddinRegistry()); ServiceManager.Services.AddService(new AddinManager()); ServiceManager.Services.AddService(new TestAgency()); ServiceManager.Services.InitializeServices(); foreach (var assembly in assemblies.Distinct().Where(File.Exists)) { _assembly = assembly; var loader = new TestLoader(); loader.Events.TestLoaded += NodeLoadEvent; loader.LoadProject(assembly); loader.LoadTest(); loader.UnloadTest(); loader.UnloadProject(); loader.Events.TestLoaded -= NodeLoadEvent; _assembly = string.Empty; } var tests = TestMethods.ToList(); var testSuites = TestSuites.ToList(); AppDomain.CurrentDomain.SetData(AppDataDomainExtractionStubName, tests); AppDomain.CurrentDomain.SetData(AppDataDomainExtractionSuiteName, testSuites); ServiceManager.Services.StopAllServices(); ServiceManager.Services.ClearServices(); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); runner = new TouchRunner(window); runner.Filter = new NotFilter(new CategoryExpression("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter); // register every tests included in the main application/assembly runner.Add(System.Reflection.Assembly.GetExecutingAssembly()); TestLoader.AddTestAssemblies(runner); window.RootViewController = new UINavigationController(runner.GetViewController()); // make the window visible window.MakeKeyAndVisible(); return(true); }
public void testLoadFromDirectoryFail() { // Arrange TestSuite suite = null; TestLoader loader = new TestLoader(); string directory = "x"; try { // Act suite = loader.LoadFromDirectory(directory); Assert.Fail(); } catch (ArgumentException actual) { // Assert Assert.AreEqual("Directory does not exist\r\nParameter name: directory", actual.Message); } }
public void SetUp() { loader = new TestLoader( ); loader.MergeAssemblies = false; loader.AutoNamespaceSuites = true; loader.MultiDomain = false; catcher = new TestEventCatcher( loader.Events ); }
public void SetUp() { loader = new TestLoader( ); catcher = new TestEventCatcher( loader.Events ); }
public void testLoadFromFileFail() { // Arrange TestSuite suite = null; TestLoader loader = new TestLoader(); string file = "x"; try { // Act suite = loader.LoadFromFile(file); Assert.Fail(); } catch (ArgumentException actual) { // Assert Assert.AreEqual("File does not exist\r\nParameter name: file", actual.Message); } }
public void testLoadFromFileRelative() { // Arrange TestSuite suite = null; TestLoader loader = new TestLoader(); string file = @"..\..\..\TestLoaderTestTests\bin\Debug\TestLoaderTestTests.dll"; // Act suite = loader.LoadFromFile(file); // Assert Assert.AreEqual(1, suite.Tests.Count); }