public AddTestAssembly ( |
||
testAssembly | The test assembly. | |
return | void |
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); // This will load all tests within the current project App nunit = new NUnit.Runner.App(); // If you want to add tests in another assembly nunit.AddTestAssembly(typeof(Common.UnitTests.ExampleTests).Assembly); // Available options for testing nunit.Options = new TestOptions { // If True, the tests will run automatically when the app starts // otherwise you must run them manually. AutoRun = true, // If True, the application will terminate automatically after running the tests. ////TerminateAfterExecution = true, // Information about the tcp listener host and port. // For now, send result as XML to the listening server. ////TcpWriterParameters = new TcpWriterInfo("192.168.0.108", 13000), // Creates a NUnit Xml result file on the host file system using PCLStorage library. //// CreateXmlResultFile = true, // Choose a different path for the xml result file //// ResultFilePath = Path.Combine(Environment.ExternalStorageDirectory.Path, Environment.DirectoryDownloads, "Nunit", "Results.xml") }; this.LoadApplication(nunit); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); // This will load all tests within the current project var nunit = new NUnit.Runner.App(); // If you want to add tests in another assembly //nunit.AddTestAssembly(typeof(SomeTests).Assembly); //var anassembly = typeof(global::Lucene.Net.Util.Test2BPagedBytes).Assembly; nunit.AddTestAssembly(Settings.TargetAssembly); // Available options for testing nunit.Options = new TestOptions { // If True, the tests will run automatically when the app starts // otherwise you must run them manually. //AutoRun = true, // If True, the application will terminate automatically after running the tests. //TerminateAfterExecution = true, // Information about the tcp listener host and port. // For now, send result as XML to the listening server. //TcpWriterParameters = new TcpWriterInfo("192.168.0.108", 13000), // Creates a NUnit Xml result file on the host file system using PCLStorage library. CreateXmlResultFile = true, // Choose a different path for the xml result file ResultFilePath = Path.Combine(Application.Context.GetExternalFilesDir("").AbsolutePath, Settings.TestResultFileName) }; LoadApplication(nunit); //// Use the runner directly with BlameListener to detect which tests crash the runner //string blameFilePath = Path.Combine(Application.Context.GetExternalFilesDir("").AbsolutePath, Settings.BlameFileName); //using (var blameWriter = new StreamWriter(blameFilePath, append: false, encoding: System.Text.Encoding.UTF8)) //{ // NUnitTestAssemblyRunner runner = new NUnitTestAssemblyRunner(new DefaultTestAssemblyBuilder()); // runner.Load(Settings.TargetAssembly, new Dictionary<string, object>()); // var filter = new MyFilter(); // //var filter = TestFilter.Empty; // ITestResult result = runner.Run(new BlameListener(TestListener.NULL, blameWriter), filter); // var startTime = DateTime.Now; // var resultsXml = new NUnit3XmlOutputWriter(startTime); // resultsXml.WriteResultFile(result, nunit.Options.ResultFilePath); //} }
public MainPage() { InitializeComponent(); // Windows Universal will not load all tests within the current project, // you must do it explicitly below var nunit = new Runner.App(); // If you want to add tests in another assembly, add a reference and // duplicate the following line with a type from the referenced assembly nunit.AddTestAssembly(typeof(MainPage).GetTypeInfo().Assembly); // Do you want to automatically run tests when the app starts? nunit.AutoRun = true; LoadApplication(nunit); }