Postman-Newman
postmanlabs / newman
Newman is a command-line collection runner for Postman
I have been writing Postman-Newman tests for a couple of years now.
A new carrier move for a software developer will give new challenges to solve. But most of these new challenges could be resolved using a solution/framework/process which he/she is familiar with.
In my case when I moved to FREE NOW
(earlier mytaxi
), there were projects being migrated to Spring Cloud Config. There is documentation on Steps to migrate
and clearly mentioned do's and dont's.
There were mistakes during past migrations and projects are being misconfigured. However, software engineers learn from mistakes and we thought of some process in place for some kind of identification, later notification and finally rectification.
This is when we came up with The Hero
(Postman-Newman).
The test or collection of tests includes some bunch of API tests that check whether the configurations are correct or not.
jango89 / postman-test-validate-spring-cloud-configuration
Docker image for validating ConnectionFactory created are not overriden for spring cloud projects.
What
Postman Tests for validating
1. ConnectionFactory created for spring cloud projects.
2. Test webhook is created in the configuration project.
Base image is - newman-postman.
Why
-
By default spring cloud migrated projects should have property as follows to notify the application about configuration changes
spring.rabbitmq.host=configbus.mgmt.mytaxi.com
This docker image has POSTMAN TESTS which runs and validates the prelive and live environment has not overriden this property Overriding this property will create issues with notifying config changes to app. -
Spring cloud also needs a webhook in the configuration repository for listening to config file changes. The test also checks min 1 webhook is present in the configuration repository.
How
Create a task and add to DefaultPlan in bamboo spec in case missing.
private static DockerRunContainerTask getCloudConfigurationPostmanTest()
{
return new DockerRunContainerTask()
.description("Check spring.rabbitmq.host mapped to config server")
.imageName("docker.intapps.it/configservertest:latest")
.serviceURLPattern("http://localhost:${docker.port}")
.containerCommand("run api.json --global-var \"servicename=bookingoptionsservice\"")
.containerWorkingDirectory("/etc/newman")
.clearVolumeMappings()
}
private static Stage getDefaultStage()
{
โฆWhy am I so in favor
- Only need to know Request URI to test.
- No basic knowledge is required to write assertions. Of course, we write assertions using javascript however, with an effective documentation there is a very less knowledge curve.
- Easy to plugin the tests to various environments (automated build platforms, docker, linux, mac).
Top comments (0)