Choosing the right Azure Service

Microsoft Azure has a blend of services. Have you ever got questions like the below, when building a brand new application that is cloud-ready or migrating your workloads to Cloud? There are so many services, which service would be the best for you? or how should I choose the Azure Service for my new application? How should I decide whether to use Azure Functions or Azure App Service or Azure Kubernetes Service? Can I migrate my workloads as is to Azure? Should I create VM or use App Service? Can I host JAVA-based apps on Azure ... and so on If you have similar questions in your mind and you want to decide on which service you should be using that fits your needs, I want to share that here is a wonderful infographic to help you make decisions. Here is the link I have also given an overview of the infographic in a video here:

Using Newman Client for API Testing - Part 1

Hello Friends,

In this post, I am going to share with you how you can use newman client to test your API(s). I am writing this blog in two parts.
Part 1 Objective:
To be able to use newman client to test API(s)
For this we'll do:
  1. Create an API. You can create the API in any language like .Net, .Net core, php, nodejs. For this sample, I have created an API using NodeJS and express and I have used only the GET API(s) to keep it simple
  2. Test that API(s) once in postman.
  3. Setup Asserts
  4. Export the collection. 
  5. Create a nodejs project or use this github repo
  6. Setup newman. Checkout package.json in the repo.
  7. Test the collection using newman
Part 2 Objective:
To integrate newman in Azure DevOps CI\CD so that our API(s) can be tested automatically as part of CI\CD. We'll discuss the steps in next post.

So, let's get started with our first objective. 
Here is the github repo.
Here are the steps you can follow:
  1. Clone the github repo
  2. Ensure that you have nodejs installed.
  3. In the folder, which contains package.json, run the following command:
    npm install
  4. Install npx globally, so that you can access local node modules using npx:
    npm install -g npx
  5. Open Terminal and run:
    npm run start
  6. You should have an api running at port 3000.

    So, here basically npm reads the package.json and checks out the 'start' in scripts section. This will further read main.js and will have an express js server running at port 3000. Also, you can see the following code which is nothing but an API endpoint.
  7. So, we have a working API running which can be tested in postman or even directly as this is a get only api.
  8. Adding Tests/Asserts. You can do this in Tests Section of each API:
  9. Next, let's talk about the postman collection. I am having a collection added already with name mycollection.json. You can export a collection as shown in the picture below:
  10. Let's try understanding the collection. So, we can see that postman collection is easily readable
  11. To add more tests, you can add in the Postman and can re-export the collection
  12. Open another terminal so that the API is running and run the following command
    npm run test
    So, if you checkout package.json, I have installed newman and when we run npm run test it is running the newman collection. Checkout the 'test' in package.json under scripts section
  13. Yay! The tests-report.txt will be generated which will look like this:
This was easy huh! :) We'll do the CI\CD setup in the next post.