How to use newman command to run 1 postman collection with different folder? - jenkins-pipeline

Postman collection and it's folder arrangement
I want to run this ITEM-API postman collection in jenkins. I have exported it with github repo. I have also done configuration. But here when will I run test, it will give result for all ITEM-API collection. But inside ITEM-API collection, there are different folders of API, for eg. CHARTS, IAMGES, SYNDICATION, INTEREST, etc. SO how can use newman command to run test for particular api. Let's say, I want to run test for CHARTS api, then how can I use newman command for that in jenkins or groovy file in github repo.
please please help.

Related

Active Tag in Cucumber Java

Is there anyway to identify which is the current running cucumber tag in Cucumber-Java for API testing?
I am using Cucumber-Java, along with TestNG. For grouping and executing in different environments, I am using cucumber tags.
The tags are given in feature level. Multiple tags have been specified for same feature. Like:
#regression-staging #regression-production
Feature: Add to cart
Scenario:
.
.
.
Same code is using for staging and production. And as build took I am using Maven. Since TestNG is used, the test is triggered from RunTestNGTest class that I wrote. Inside the RunTestNGTest, I have #BeforeSuite and #AfterSuite methods.
The test is run using mvn command
mvn test -Dcucumber.filter.tags=#regression-staging
or
mvn test -Dcucumber.filter.tags=#regression-production
Is there anyway I can get which tag is currently running? (In my case, either one will be active at a time). I want to log which tag is currently using, and also want to use the same in the HTML report. I tried scenario.getSourceTagNames();, but that returns all the tags for the scenario, not the currently running one.
You can simply access cucumber.filter.tags from your code like you would access any other system property:
String myCurrentTag = System.getProperty("cucumber.filter.tags");
Now you can parse the value (split by commas or additionally remove # symbol, etc.)

Is there a way to publish protractor test results in confluence and have an overview?

We run our protractor regression tests in gitlab CI and we have jasmine HTML reports. Right now it is only the QA team that monitors and checks failure if any.
But we would like to make it more visible. The devs have also asked us if we can make it visible in a single place instead of having to go to gitlab job and browse for artifacts.Also would it be possible to have an overview of pass/fail tests over time.
I'm not sure how and where to start. Any pointers would be appreciated.
You're looking for the expose_as keyword for artifacts. The full docs are here: https://docs.gitlab.com/ee/ci/yaml/#artifactsexpose_as.
If you use expose_as with your artifacts, Gitlab CI will link them to any application Merge Request with the name you give in this field.
For example (from the docs):
test:
script: ["echo 'test' > file.txt"]
artifacts:
expose_as: 'artifact 1'
paths: ['file.txt']
In this example, a Merge Request for this pipeline will have a link called "artifact 1" that opens the file "file.txt".
This also works for directories, but if there's more than one file it will open in the job's artifacts browser (like you currently do).
There are some caveats, like:
If you use a variable in the artifacts path field, expose_as won't work
Max of 10 artifacts can be exposed
Glob patters won't work
If Gitlab Pages is enabled, some file extensions will be automatically rendered using Pages (html, xml, txt, etc.).

Passing code from CodePipeline to PythonFunction

I'm trying to create a CDK app that will deploy a pipeline-stack and a lambda-stack. Similar to the tutorial here. I'm trying to implement a basic CI/CD application that is triggered with every push to a Github Enterprise Repo.
I chose to use PythonFunction from (#aws-cdk/aws-lambda-python) instead of function from #aws-cdk/aws-lambda because PythonFunction builds the dependencies from requirements.txt. I have various lambdas that use different packages (like awswrangler, pandas, requests, etc.).
But, PythonFunction does not support CfnParametersCode (Where the code is passed through CDK instead of being read from an asset).
What other option do I have to pass my code from GithubEnterprise to
the PythonFunction?
If function from #aws-cdk/aws-lambda is the only option I have, how
can I include the packages from requirements.txt
This does seem like an option for #aws-cdl/aws-lambda, but how would I pass my code from Github? This example relates to building from asset code.
I apologize if I'm missing something obvious, I just started working with AWS CDK last week.
First of all I would recommend to take a look at pipelines.CdkPipeline which is able to deal with Assets. That means you can directly use lambda.Code.from_asset instead of overriding CfnParametersCode in the Pipeline.
Regarding your other question, you can deal with the requirements by installing them into your lambda folder during the build step with: pip install -r requirements.txt -t .
CfnParametersCode gives you the ability to upload your code from an S3 file.
You can do the same via lambda.Code.fromBucket.
Taking your link from the third point (https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/aws-lambda#bundling-asset-code) You just need to use lambda.Code.fromBucket instead of code: lambda.Code.fromAsset. Docs can be found here: https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/aws-lambda

How to download excel (.xls) file from API in postman for suite run?

For Single request,I can able to download the response output in excel format by chose an option 'Send and Download'. Can anyone help me to download the same using collection runner in postman.
This feature is not available in Postman Collection Runner yet! However, there is a workaround if you would like to do it in Newman.
As Newman is built on Node.js, you can extend it in a Node.js code as you can see in the below example.
https://github.com/postmanlabs/newman/issues/413#issuecomment-316116450
Running the script above essentially does the same thing as newman run ... and also saves the responses to files

Using TeamCity build number in Buildmaster

Is it possible to grab the build number from TeamCity and use that as a build number in BuildMaster?
This could be done by triggering the BuildMaster API's Builds_CreateBuild method from TeamCity which accepts a numeric build number. It should be fairly straightforward to make a GET request to the BuildMaster JSON API from TeamCity, see this question for a simple way to do so: TeamCity Call Url Build Step
In order to create a new build including the build number you need to firstly enable the api under settings. There is no 'enable' button as such, you just need to provide an arbitrary key for the api authentication (any literal will do, but presumably make it complex for best security!).
The JSON syntax for the creating a build is as follows:
http://buildmaster-server/api/json/Builds_CreateBuild?API_Key=abcde12345&Build_Number=123&Release_Number=0.0
This will actually create a new build on your build master server. This can then be triggered via Team City using Powershell with the powershell script inline such as:
Invoke-WebRequest "http://buildmaster-server/api/json/Builds_CreateBuild?API_Key=abcde12345&Build_Number=%build.number%&Release_Number=0.0&Application_Id=2" -UseBasicParsing
You can add further variables and call hundreds of BuildMaster API's using the above method. Full API documentation can be found here: http://inedo.com/support/documentation/buildmaster/reference/api-methods

Resources