public void RunTestsWithReplacement() { var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName)); var result = testRunner.ExecuteTestAndOutputResult(1); Assert.True(result.OK, result.ResultAsString); }
public void TestsHaveConstantGetNow() { var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName)); var result = testRunner.ExecuteTestAndOutputResult(3); Assert.True(result.OK, result.ResultAsString); }
public void LoadAndRunTests() { int retVal = ConsoleTestRunner.RunAllTests(Assembly.GetExecutingAssembly(), new string[] { "--NoHalt", "--Namespace", "TestingTestSuite.TestRunner.ConsoleRunner.TestNamespace" }); Assert.AreEqual(0, retVal); }
static int Main(string[] args) { if (args.Length == 0) { #if DEBUG if (RunTests()) { return(0); } #endif ConsoleTestRunner.Usage(); return(0); } cl = CommandLine.Parse(args); if (cl == null) { Console.WriteLine("Unable to parse command line."); return(-1); } ConsoleTestRunner.cl = cl; if (cl.HasOption("help", "?")) { ConsoleTestRunner.Usage(); return(0); } MainCore(); return(0); }
private async Task CheckConfigdirectoryAsync(string directory) { Assert.True(Directory.Exists(directory), $"Directory {directory} does not exist"); var endpointCollection = EndpointCollectionReader.ReadFromDirectory(directory); Assert.True(endpointCollection.Endpoints.Count() > 0, $"No endpoints defined in {directory}"); output.WriteLine(directory); if (!TestRunner.HasTestSuite(directory)) { output.WriteLine($"No tests in {directory}"); return; } var tests = new ConsoleTestRunner(endpointCollection); foreach (var test in tests.Tests) { output.WriteLine(test.Name); var result = await test.ExecuteAsync(endpointCollection, now : tests.Now); output.WriteLine(result.ResultAsString); Assert.True(result.OK, $"Test case {result.TestCase.Name}, message '{result.Message}'"); } }
static void Main(string[] args) { Xwt.Application.Initialize(Xwt.ToolkitType.Wpf); ConsoleTestRunner t = new ConsoleTestRunner(); t.Run(args); }
public void TestsCanHaveDynamicNow() { dc.DeleteFile("tests\\now.txt"); var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName)); var result = testRunner.ExecuteTestAndOutputResult(3); Assert.True(result.Error, result.ResultAsString); Assert.Null(result.Exception); }
public Console(string [] args) { InitializeComponent(); DatabasePath = args[0]; _result = new ConsoleTestRunner(CFCompatibilityTests()).Run(); Close(); }
async public void CanExecuteTest() { var endpointCollection = EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName); var testRunner = new ConsoleTestRunner(endpointCollection); var test = testRunner.Tests.ElementAt(0); var result = await test.ExecuteAsync(endpointCollection, handleErrors : false); Assert.True(result.OK); }
public IDotnetTestRunner Create(int? port) { IDotnetTestRunner dotnetTestRunner = new ConsoleTestRunner(); if (port.HasValue) { dotnetTestRunner = new DesignTimeRunner(); } return dotnetTestRunner; }
public IDotnetTestRunner Create(int?port) { IDotnetTestRunner dotnetTestRunner = new ConsoleTestRunner(); if (port.HasValue) { dotnetTestRunner = new DesignTimeRunner(); } return(dotnetTestRunner); }
async public void CanReadExpectedResponseBodyFromFile() { var endpointCollection = EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName); var testRunner = new ConsoleTestRunner(endpointCollection); var test = testRunner.Tests.ElementAt(2); var result = await test.ExecuteAsync(endpointCollection, handleErrors : false); Assert.True(result.OK, result.Message); }
static void Main(string [] args) { Xwt.Application.Initialize(Xwt.ToolkitType.Cocoa); var baseDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); ReferenceImageManager.ProjectCustomReferenceImageDir = baseDir + "/../../../../../ReferenceImages"; ConsoleTestRunner t = new ConsoleTestRunner(); t.Run(new string[0]); }
public async Task TrackTestConverageByResponseRule() { var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName)); await testRunner.TestAllAsync(false, false); var coverageInfo = testRunner.GetCoverageInfo(); Assert.NotNull(coverageInfo); Assert.Equal(new[] { "foo#0", "GetNow#0" }, coverageInfo.ResponseRulesCovered); Assert.Equal(new[] { "foo#1", "foo#2" }, coverageInfo.ResponseRulesNotCovered); }
public async Task TestRunnerKeepsTrackOfCoverageWhenRunningSingleTest() { var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName)); await testRunner.ExecuteTestAndOutputResultAsync(0); var coverageInfo = testRunner.GetCoverageInfo(); Assert.NotNull(coverageInfo); Assert.Equal(new[] { "foo" }, coverageInfo.EndpointsCovered); Assert.Equal(new[] { "GetNow" }, coverageInfo.EndpointsNotCovered); }
public async Task TestRunnerKeepsTrackOfTestCoverage() { var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(dc.DirectoryName)); await testRunner.TestAllAsync(false, true); var coverageInfo = testRunner.GetCoverageInfo(); Assert.NotNull(coverageInfo); Assert.Equal(new[] { "foo", "GetNow" }, coverageInfo.EndpointsCovered); Assert.Equal(0, coverageInfo.EndpointsNotCovered.Length); }
public void LoadAndRunWithXmlOutputTests() { int retVal = ConsoleTestRunner.RunAllTests(Assembly.GetExecutingAssembly(), new string[] { "--NoHalt", "--XmlOutput", "--OutputfileName", TestFilename, "--Namespace", "TestingTestSuite.TestRunner.ConsoleRunner.TestNamespace" }); Assert.AreEqual(0, retVal); XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationType = ValidationType.Schema; settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings; settings.Schemas.Add(XmlSchema.Read(Assembly.GetExecutingAssembly().GetManifestResourceStream( "TestingTestSuite.TestRunner.ConsoleRunner.Results.xsd"), null)); XmlReader validator = XmlReader.Create(TestFilename, settings); while (validator.Read()) { } }
private async Task CheckOutputAsync(string directory, int index) { var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(directory)); await testRunner.ShowResponseAsync(index); }
static void MainCore() { ConsoleTestRunner.Run(cl); }
public void CheckOutput(string directory, int index) { var testRunner = new ConsoleTestRunner(EndpointCollectionReader.ReadFromDirectory(directory)); testRunner.ShowResponse(index); }
static void Main(string[] args) { Environment.Exit(ConsoleTestRunner.RunAllTests(Assembly.GetExecutingAssembly(), args)); }