I would like to add a test stage in the IBM Bluemix DevOps "Build Deploy" function to test APIs using Postman and Newman but I don't see how to do that. Any advice on where to look?
In the Build and Deploy pipeline, if you select the Add Stage you can add a new Test job to be ran after each update to the source code repository.
When configuring the stage, you can add a "Test" job with the "Simple" tester type. This lets you give shell commands to be executed in the project directory.
Using Newman can be achieved using NPM to manage the package. Providing you have the newman package listed in your project dependencies, you could set up an NPM script command to run the tests as below.
"scripts": {
"test": "newman -c tests.json"
},
This would allow you to run the following test stage to execute your tests.
#!/bin/bash
# invoke tests here
npm install
npm test
Related
Do we need jenkins to integrate jmeter for Azure pipeline tests? Or Without Jenkins, can we upload scripts to GitHub and run pipeline tests?
You don't need Jenkins, Azure Pipelines is Microsoft's continuous integration solution
So you can run JMeter as:
Simple Shell Script task (but in that case you need to install JMeter on the machine which will be running the task beforehand). JMeter command-line execution is pretty straightforward
Maven task, in this case you need to come up with a Maven pom.xml file and Maven will download and install JMeter for you
At the moment I am trying to integrate the npm backstopjs into my VSTS build pipeline. To do this, I have to run it on an npm live server to get a screenshot of the actual build of the app and compare it to the reference screenshot. I tried to start this live server with a PowerShell script. This script cannot find the path to the npm root path so I cannot run the tests.
My question is: Is there a way to run BackstopJS tests with VSTS?
Edit
For the better understanding, here are some screenshots of my project:
Since Hosted VS2017 agent is the build machine provided by VSTS server, you should build VSTS with the privarte agent which located in the same machine of your live-server, so that the the build project can be searched.
And more details about deploying a private agent, you can refer the document Deploy an agent on Windows.
I have a Groovy repository which contains my Jenkins pipeline's Groovy code.
Currently, I am making changes in an IDE, commiting them to the repository, going to the Jenkins instance, manually triggering a Jenkins job, and checking to see if all of the changes all working. This is taking a lot of time.
Is there a way to do all of this from the IDE itself?
I would suggest to treat your pipeline code like some other code in IT. What are you doing now could be called "manual integration tests" because you are making your code changes and check how that code integrate with other components (like shell commands, jenkins plugins, etc.) on jenkins - this development loop is long and not efficient. So my proposition for you is to write simple unit tests using this framework:
https://github.com/jenkinsci/JenkinsPipelineUnit
So you can test your pipelines on your machine without any interaction with jenkins.
If you think that it's not proper way for you I would suggest to mix using this plugin for running jobs directly from IntelliJ: https://github.com/programisci/jenkins-control-plugin/
and of course IntelliJ git integration to commit your changes to repository.
For executing from the IDE, an option is to create some automation around using the Jenkins CLI. You should be able to see the CLI commands at http://your-jenkins-url/cli.
java -jar jenkins-cli.jar -s https://jenkins.physiq.zone/ replay-pipeline JOB [-n (--number) BUILD#] [-s (--script) SCRIPT]
Replay a Pipeline build with edited script taken from standard input
JOB : Name of the job to replay.
-n (--number) BUILD# : Build to replay, if not the last.
-s (--script) SCRIPT : Name of script to edit, such as Script3, if not the main Jenkinsfile.
For example, in IntelliJ you could use a Run Configuration that:
Downloads the CLI JAR
Executes it with the path to the local file with certain parameters
You can also write a script, Gradle build, or something else that wires into the IDE to pull the CLI JAR and execute a job with your local pipeline code.
For testing you may want to use https://github.com/jenkinsci/JenkinsPipelineUnit as already brought up, or a Gradle plugin that I maintain at https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin which uses the previously mentioned library for unit testing and the jenkinsci/jenkins-test-harness for integration testing.
I'm using AWS Codestar. It integrates a number of AWS services so that I can go from git push to deployment.
It uses cloudformation. I have a lambda function that depends on the uuid npm.
How do I include this node dependency in the Codestar build pipeline? Cloudformation SAM use a zip file, and uploads everything to S3:
https://github.com/awslabs/serverless-application-model/blob/master/examples/2016-10-31/inline_swagger/template.yaml#L32
I don't want to build a zip file and put it into the code repo.
My next plan is to attempt running npm install in Codebuild:
http://docs.aws.amazon.com/codebuild/latest/userguide/sample-nodejs-hw.html#sample-nodejs-hw-files
Next plan works. Needed to add the npm in Codebuild. Works great.
Is there a way to add a custom powershell script into the appveyor build script to publish a module to powershellgallery? - The module source would be in the github repo.
If not, maybe it's possible within the appveyor web config itself?
I believe you can create script based Publish-Module command and insert it into right stage of build pipeline. For example if you decide to publish after test stage, it will look like this in YAML:
after_test:
- ps: Publish-Module -Name "MyDscModule" -NuGetApiKey "11e4b435-6cb4-4bf7-8611-5162ed75eb73"
Or in UI you need to go to Settings > Test > Auto > After tests script > PS and enter publish script.