Blog

Latest Posts

Automated API testing with Postman

API

Hello everyone!! If your company maintains API for their products and you are a person who is responsible for testing the API endpoints then this blog is for you. This blog will be explaining how to get started with API testing using Postman. First we need to know a bit about API and Postman.

What is API?

API stands for Application Programming Interface.Its a set of blocks of code which are connected with different protocols to communicate with each other to make a connection between the Database and the GUI which makes a successful software.

There will be several endpoints which will access data from the database. The endpoints should be secured to make them fetch the right data for the right user. This is a tricky part for API. If any endpoint returns wrong data to the end users and the wrong data is something that end should never get access to, that can be a mess! So its really important to make it work correctly and tested properly.

Get started with API testing with Postman

To get started with API testing first you will need a tool. Postman is a good tool for this job. Download postman from here and install it to your machine. After the installation you will be asked to sign in. Use your google account or just register to postman. And you are ready to start the testing. 

This is a view from postman. 

1 –> Select the request type
2 –> Insert the request URL of your API endpoint
3 –> Its optional. If your API endpoint have parameters, add them here

Once you are done with these 3 points add value to header and body. Then hit Send button and the response will be seen here in the Response box. Check out the desired responses. If wrong/error response then the endpoint needs to be fixed.

This is how you work manually. To save your time its important to make your tests automated. For this its important to have all the endpoints available and documented properly. Make a Collection with the endpoints and sort them sequentially.

Now how to sort endpoints to a collection? Lets consider a login scenario. If you try to login to your mail, Postman generates a token with your username and password. With the token you can check your mails. there will be one endpoint to generate token with your login information and the other endpoint will use the token to fetch your mails to you. So the login endpoint must be the first one and then the endpoint which fetches the mails will be sorted next to it.

How do you make it automated? Here you will need to set up Environment for your tests.

Lets say you have generated a token with your login information:

postman token

 

And you will be using this token to check your mails with another endpoint. So what you do, you copy your token paste to the header of the next endpoint. This is the manual style. To make it automated you have to create an environment variable through Test Scripts:

save token to environment

 

Then the token gets saved in your environment. Now each time you need the token to check your mails and visit your profile you just call the variable with your endpoint and you get the response.

postman environment

Once you complete setting up your environment save it for the tests. Now go to the collection runner. There select a collection and corresponding environment. Click on Run Collection and the responses will be shown in the box at right side:

collection runner

Once its done the result will be saved automatically and the result can be imported for analysis. if any endpoint fails to fetch the correct information or gives any error response that result is marked as red and the successful one marked as green.

How to install ubuntu server and configure network

This blog will show how to install Ubuntu server on your machine and configure static network and finally how to install OpenSSH on your machine. This blog is divided into three parts:

1.Install Ubuntu server

2.Configure network

3.Install OpenSSH

Ubuntu server installation:

Requirements:
-You must have at least 2GB of free storage space.
-You must have either a DVD or a USB flash drive containing the version of Ubuntu Server you want to install.

Boot from DVD:
-Insert DVD in DVD drive should take you to the installation.

Boot from USB flash drive:
-Go to https://www.ubuntu.com/download/server to download latest Ubuntu server.
-Download Ubuntu server.
-You can use Rufus to make your USB flash drive bootable. (https://rufus.akeo.ie/)

Installation:
-Select your language:

-Select ‘Install Ubuntu Server’ on the next menu:
ubuntu installation

-Select your keyboard layout:

-Type your desired hostname. In terminal it will show username@hostname:~$

-Select your timezone and location:

-Select partition disk option.The simplest one is the, ‘Guided – use entire disk and set up LVM’.But you can do it manually, if you are installing alongside another operating system:

-For configuring tasksel choose ‘No automatic update’:

-Setup your username and password:

-Select whether you want to encrypt the hard drive or not. Selecting no is recommended.

-If you are using a proxy server, enter the details or leave it as blank:

-Select the softwares you want to install on your server. Press the space bar to select software, when finished press enter to continue. You can continue without installing any software and install it later if you wish:

-Ubuntu Server will now be installed. When complete, one final question asks for permission to install the GRUB boot loader. You should answer ‘Yes’:

-Congratulations! Installation is completed. You can now remove your DVD or USB flash drive:

-Restart your machine and begin enjoying Ubuntu Server.

 

 

Configure Networking:

-Login to your terminal and type ifconfig

username@hostname:~$ ifconfig

-Find your network interface card. Here red signed part is network interface card:

-To change ip address type sudo nano /etc/network/interfaces & edit this file and save:

username@hostname:~$ sudo nano /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eno16777736
iface eno16777736 inet static
address <your ip address>
netmask 255.255.255.0
network <your network>
broadcast <your broadcast address>
gateway <your gateway address>
dns-nameservers <your dns-nameserver addresses>

-Restart your network by typing sudo ifdown eno16777736 & then type sudo ifup eno16777736

username@hostname:~$ sudo ifdown eno16777736
username@hostname:~$ sudo ifup eno16777736

-If you want to check network state, you can use sudo ethtool eno16777736

username@hostname:~$ sudo ethtool eno16777736

 

 

 

Install OpenSSH:

-To install the OpenSSH client type: sudo apt install openssh-client

username@hostname:~$ sudo apt install openssh-client

 

-To install the OpenSSH server type: sudo apt install openssh-server

username@hostname:~$ sudo apt install openssh-server

Continue reading

Green datacenter by Microsoft

Under the research project, Microsoft has built datacenter under the sea water. It will naturally maintain server temperate. Also the ocean current can produce enough power by rotating turbine to run the data center. This turbine will be ship in the next phase of research.  One of the interesting idea behind this project is that, most of the people live behind the sea, so it will give speed in data access. The first time launch of the datacenter was successful and the datacenter was running 75 days under the water.

The project running with the name Natick.

Azure end point seup and SSH with VM

After creating a new VM in Azure, all ports are blocked by the Azure system. Setup up Azure End point will allow the user to give access to the application port. For example, if you installed Apache web server in you Linux OS, and want to use 80 port for the external users to browse your site, you need to create an end point for port 80. This is a very simple task, can we call it firewall ? i am not sure.

Use the following steps to connect to you Linux OS installed in Azure VM

1. Create a VM in your Azure portal
2. Go to Virtual Machine (Classic)
3. Create one End Point for the port 22, which is used for SSH and SFTP
4. Download any ssh client. e.g. Putty
5. Connect with the server. Enjoy!