public void ShouldFindExecutableIfToolPathNotProvided() { // Given var fixture = new NewmanFixture(); // When var result = fixture.Run(); // Then result.Path.FullPath.Should().Be("/Working/tools/newman"); }
public void ShouldThrowIfProcessWasNotStarted() { // Given var fixture = new NewmanFixture(); fixture.GivenProcessCannotStart(); var action = new Action(() => fixture.Run()); action.ShouldThrow <CakeException>().WithMessage("Newman: Process was not started."); }
public void ShouldSpecifyBailWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.ExitOnFirstFailure()); // When var result = fixture.Run(); // Then result.Args().Should().Be("--bail"); }
public void ShouldSetTimeoutWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.SetRequestTimeout(25)); // When var result = fixture.Run(); // Then result.Args().Should().Be("--timeout-request 25"); }
public void ShouldSetDelayWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.SetRequestDelay(50)); // When var result = fixture.Run(); // Then result.Args().Should().Be("--delay-request 50"); }
public void ShouldSpecifyInsecureWhenAliasInvoked() { // Given var fixture = new NewmanFixture(s => s.DisableStrictSSL()); // When var result = fixture.Run(); // Then result.Args().Should().Be("--insecure"); }
public void ShouldSpecifyIgnoreRedirectsWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.IgnoreRedirects()); // When var result = fixture.Run(); // Then result.Args().Should().Be("--ignore-redirects"); }
public void ShouldSetEnvironmentFilePathWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.WithEnvironment("./environments.json")); // When var result = fixture.Run(); // Then result.Args().Should().Be("--environment \"environments.json\""); }
public void ShouldSetGlobalsPathWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.WithGlobals("./globals.json")); // When var result = fixture.Run(); // Then result.Args().Should().Be("--globals \"globals.json\""); }
public void ShouldSetCollectionExportWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.ExportCollectionTo("./export.json")); // When var result = fixture.Run(); // Then result.Args().Should().Be("--export-collection \"export.json\""); }
public void ShouldSetEnvironmentsExportWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.ExportEnvironmentTo("./environment.json")); // When var result = fixture.Run(); // Then result.Args().Should().Be("--export-environment \"environment.json\""); }
public void ShouldSetGlobalsExportWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.ExportGlobalsTo("./globals.json")); // When var result = fixture.Run(); // Then result.Args().Should().Be("--export-globals \"globals.json\""); }
public void ShouldSetFolderWhenInvoked() { // Given var fixture = new NewmanFixture(s => s.RunOnlyFolder("Services")); // When var result = fixture.Run(); // Then result.Args().Should().Be("--folder \"Services\""); }
public void ShouldThrowIfExecutableWasNotFound() { // Given var fixture = new NewmanFixture(); fixture.GivenDefaultToolDoNotExist(); // When var action = new Action(() => fixture.Run()); // Then action.ShouldThrow <CakeException>().WithMessage("Newman: Could not locate executable."); }
public void ShouldIncludeIgnoreRedirectsWhenSet() { var fixture = new NewmanFixture(); fixture.Settings.IgnoreRedirects = true; // When var result = fixture.Run(); // Then result.Args().Should().Be("--ignore-redirects"); }
public void ShouldIncludeBailWhenSet() { var fixture = new NewmanFixture(); fixture.Settings.ExitOnFirstFailure = true; // When var result = fixture.Run(); // Then result.Args().Should().Be("--bail"); }
public void ShouldSetRequestDelayWhenSet(int delay) { // Given var fixture = new NewmanFixture(); fixture.Settings.RequestDelay = delay; // When var result = fixture.Run(); // Then result.Args().Should().Be($"--delay-request {delay}"); }
public void ShouldSpecifyEnvironmentsFile() { // Given var fixture = new NewmanFixture(); fixture.Settings.EnvironmentFile = "./collection.json"; // When var result = fixture.Run(); // Then result.Args().Should().Be("--environment \"collection.json\"", "file paths are quoted and trimmed"); }
public void ShouldSpecifyGlobalsFile() { // Given var fixture = new NewmanFixture(); fixture.Settings.GlobalVariablesFile = "./vars/globals.json"; // When var result = fixture.Run(); // Then result.Args().Should().Be("--globals \"vars/globals.json\"", "file paths are quoted and trimmed"); }
public void ShouldSpecifyGlobalsPath() { // Given var fixture = new NewmanFixture(); fixture.Settings.ExportGlobalsPath = "./export/globals.json"; // When var result = fixture.Run(); // Then result.Args().Should().Be("--export-globals \"export/globals.json\"", "file paths are quoted and trimmed"); }
public void ShouldSpecifyEnvironmentExportPath() { // Given var fixture = new NewmanFixture(); fixture.Settings.ExportEnvironmentPath = "./export/environment.json"; // When var result = fixture.Run(); // Then result.Args().Should().Be("--export-environment \"export/environment.json\"", "file paths are quoted and trimmed"); }
public void ShouldIncludeInsecureWhenSet() { // Given var fixture = new NewmanFixture(); fixture.Settings.DisableStrictSSL = true; // When var result = fixture.Run(); // Then result.Args().Should().Be("--insecure"); }
public void ShouldThrowOnNullCollectionFile() { // Given var fixture = new NewmanFixture { InputFile = null }; // When Action action = () => fixture.Run(); // Then action.Should().Throw <ArgumentNullException>().WhereMessageContains("collectionFile", "null collection file provided"); }
public void ShouldSpecifyRequestTimeoutWhenSet(int timeout) { // Given var fixture = new NewmanFixture(); fixture.Settings.RequestTimeout = timeout; // When var result = fixture.Run(); // Then result.Args().Should().Be($"--timeout-request {timeout}"); }
public void ShouldSpecifyFolderWhenSet() { // Given var fixture = new NewmanFixture(); fixture.Settings.Folder = "Api Service"; // When var result = fixture.Run(); // Then result.Args().Should().Be("--folder \"Api Service\"", "Cake should have quoted this argument"); }
public void ShouldSpecifyIterationCountWhenSet(int iterationCount) { // Given var fixture = new NewmanFixture { Settings = { IterationCount = iterationCount } }; // When var result = fixture.Run(); // Then result.Args().Should().Be($"--iteration-count {iterationCount}"); }
public void ShouldSpecifyDataFile() { // Given var fixture = new NewmanFixture { Settings = { DataFile = "./vars/data.json" } }; // When var result = fixture.Run(); // Then result.Args().Should().Be("-d \"vars/data.json\"", "file paths are quoted and trimmed"); }
public void ShouldSpecifyScriptTimeoutWhenSet(int timeout) { // Given var fixture = new NewmanFixture { Settings = { ScriptTimeout = timeout } }; // When var result = fixture.Run(); // Then result.Args().Should().Be($"--timeout-script {timeout}"); }
public void ShouldThrowIfFileDoesNotExist() { // Given var fixture = new NewmanFixture(); fixture.InputFile = "./nonexistent.json"; // When Action action = () => fixture.Run(); // Then action.ShouldThrow <FileNotFoundException>().WithMessage("nonexistent.json", "input file doesn't exist"); }
public void ShouldThrowOnNullSettings() { // Given var fixture = new NewmanFixture { Settings = null }; // When Action action = () => fixture.Run(); // Then action.Should().Throw <ArgumentNullException>().WhereMessageContains("settings", "null settings object provided"); }