Coder Social home page Coder Social logo

cake-contrib / cake.newman Goto Github PK

View Code? Open in Web Editor NEW
4.0 6.0 11.0 418 KB

Cake Addin that exends Cake with ability to execute the Newman CLI tool

Home Page: https://cakebuild.net/extensions/cake-newman

License: MIT License

C# 88.93% PowerShell 7.48% Shell 3.60%

cake.newman's Introduction

Cake.Newman

A simple Cake addin powered by Newman to run (and test) Postman Collections.

You can find documentation either on Cake's site or here on GitHub. This should be enough to get started with Newman even if you're not familiar with the CLI.

You may find Newman's documentation helpful as well, which can also be found on GitHub.

Build and Release status

Status master develop
Build master Build develop Build
Release NuGet NuGet Pre Release

cake.newman's People

Contributors

agc93 avatar devlead avatar gep13 avatar gimmedakitty avatar vkbishnoi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cake.newman's Issues

Add docs to explain tool installation

Continuation of #15


Should probably add something to the code to cover the requirement of the tool being installed, like how GemAliases does it, or just add a <see> to point to the docs or something.

The full docs include the info so just need to add reference somewhere.

Newman: Could not locate executable.

I want to run Postman tests as a part of our CI pipeline. We use Bamboo for our CI Below is the cake file

#addin nuget:?package=Cake.Newman
#addin Cake.Npm

var InstallPostman = "Install-Postman";

Task(InstallPostman)
	.Does(()=> {
	var settings = new NpmInstallSettings();
	settings.Global = true;
	settings.LogLevel = NpmLogLevel.Silent;
	settings.AddPackage("newman");
	NpmInstall(settings);
	});

var RunPostmanTests = "Run-Postman-Tests";

Task(RunPostmanTests)
    .Description("Run postman tests for a given collection and environment file")
    .IsDependentOn(UnzipTestPackage)
    .IsDependentOn(RequiredPostmanFolders)
    .IsDependentOn(InstallPostman)
    .Does(() =>{
        RunCollection (postmanIntegrationTestsFile, s=>
        s.WithEnvironment(postmanEnvironmentFile)
            .UseCLIReporter()
            .UseJUnitReporter(postmanAcesTestResults)  
        );
    });    

RunTarget(RunPostmanTests);```

I am getting the following

========================================
Clean-Unzip-Folder

Executing task: Clean-Unzip-Folder
Cleaning directory C:/build/ACES-DEVSLN1683-INT/Aces.Tests.Integration
Finished executing task: Clean-Unzip-Folder

========================================
Unzip-Test-Package

Executing task: Unzip-Test-Package
Unzipping file C:/build/ACES-DEVSLN1683-INT/Aces.Tests.Integration.zip to C:/build/ACES-DEVSLN1683-INT/Aces.Tests.Integr
ation
Finished executing task: Unzip-Test-Package

========================================
Required-Postman-Folders

Executing task: Required-Postman-Folders
Finished executing task: Required-Postman-Folders

========================================
Install-Postman

Executing task: Install-Postman
Using addin: Cake.Npm v0.12.1.0 (0.12.1+Branch.master.Sha.9481fc976a2403a9c47abe3f54bd855068fd845d)
npm arguments: install --silent newman --global
c:\Users\packer\AppData\Roaming\npm\newman -> c:\Users\packer\AppData\Roaming\npm\node_modules\newman\bin\newman.js
[email protected] c:\Users\packer\AppData\Roaming\npm\node_modules\newman
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], uuid@3.
1.0, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], tunne
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], form-
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], har-validator@
5.0.3)
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], loda
[email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], h
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
Finished executing task: Install-Postman

========================================
Run-Postman-Tests

Executing task: Run-Postman-Tests
An error occurred when executing task 'Run-Postman-Tests'.
Error: One or more errors occurred.
Newman: Could not locate executable.```

Support white-space in the filename of a collection

What You Are Seeing?
When trying to run a collection file with white-space in the name I receive a unable to read data from file "postman" error. It appears that the filepath provided to the newman run command is not being enclosed in quotes.

What is Expected?
I would expect the filepath to be enclosed in quotes to ensure it will support white-space in filepath.

What version of Cake are you using?
0.29.0
Cake.Newman - 0.3.1

Are you running on a 32 or 64 bit system?
64

What environment are you running on? Windows? Linux? Mac?
Windows 7

How Did You Get This To Happen? (Steps to Reproduce)
The following example highlights the inability to run collection files with white-space in the name.

Given a collection file named "postman collection.json"

#addin Cake.Newman&version=0.3.1

Task("Whitespace-Test")
  .Does(() =>
  {
    RunCollection("./postman collection.json");
  });

RunTarget("Whitespace-Test");

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.28.1. Please upgrade to 0.33.0
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.

This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1

.NET Framework 4.5

Hi!

Is there any reason why .NET 4.5 is not supported?

When building my cake script, I'm getting the following error:

Could not find any assemblies compatible with .NETFramework,Version=v4.5.
Error: Cake.Core.CakeException: Failed to install addin 'Cake.Newman'.
   at Cake.Core.Scripting.ScriptProcessor.InstallAddins(ScriptAnalyzerResult analyzerResult, DirectoryPath installPath)
   at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
   at Cake.Commands.BuildCommand.Execute(CakeOptions options)
   at Cake.CakeApplication.Run(CakeOptions options)
   at Cake.Program.Main()
Process terminated with code 1.

I've followed your blog post here and added the following to my cake.script:

// Top of file
#addin "Cake.Npm"
#addin "Cake.Newman"

// inside Setup
Npm.Install(settings => settings.Package("newman").Globally());

// inside Task
RunCollection("./collection.json");

Any suggestions? :)

Thanks!

I don't see how to set -x or --suppress-exit-code

We are calling from Jenkins, and we don't want a test failure to fail the build, but there doesn't seem to be a way to make a test failure not return 1, or to pass in newman cli parameters directly. Am I missing something, or is this just a missing feature?

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.26.1. Please upgrade to 0.28.0
  • Your addin should target netstandard2.0. Please note that there is no need to multi-target, netstandard2.0 is sufficient.
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.org and in the project on github.

Would it be possible to use the Cake Contrib Icon for your NuGet Package?

Thanks again for creating this Cake Addin, we really appreciate the effort that you have put in to creating it.

We, the Cake Team, recently announced a new Cake Contrib Icon, details of which can be found here:

http://cakebuild.net/blog/2017/06/new-cake-contrib-icon

Would you consider changing the nuspec file for your NuGet Package to use this new Cake Contrib Icon? If so, the recommended URL to use is:

https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png

Details of the above URL can be found in the repository here:

https://github.com/cake-contrib/graphics

Please let me know if you have any questions.

Update to Cake.Core 0.26?

I just tried to use this addin and my Cake tells me:
Error: The assembly 'Cake.Newman, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is referencing an older version of Cake.Core (0.17.0). This assembly need to reference at least Cake.Core version 0.26.0.

Does this mean that this addin needs to be updated? I'd like to use it and downgrading my Cake version to 0.17 isn't an option for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.