Sunday, October 16, 2016

Configuring for Go Programming in Windows OS

In this post, I share how to configure for the 'Go' so I can use the environment for helping the testing of me.  The way tester did her/his testing a decade back is still applicable in a way, say, but technology has evolved and changing every day.  Moving along with the technology and being smart and quick in testing is expected today.

In one such regard, configuring the 'Go' for setup can be confusing to a tester most times.  I share how to configure the Go setup. So a tester will be ready to make use of it to compile and run the libraries to boost the testing based on where the context needs it. This post illustrate how to configure the Go on Windows OS.

While I'm writing this post, the link is valid and available. I can download the Go's MSI file from this page. Following the installation instructions in installer and on successful installation, I need to configure and save the environment variables in Windows OS for 
  • GOROOT -- pointing the path where the Go is installed on the Windows OS
  • GOPATH -- pointing the path where workspace is setup for Go

For the workspace of Go, I need to make sure it has got three directories -- bin, src, and pkg under the root directory. Example, if the path is d:\go_workspace, then under the directory go_workspace three directories will be available i.e. bin, src and pkg.

I assume that Go is installed and configured as said till here. Now, open the command prompt and provide this command.
go version
Doing this, should be able to see the version of installed Go.  At this time of writing, I see as below.
C:\Users\Pc-Ravisuriya>go version
go version go1.7.1 windows/amd64
Get the sample program from the Git of Go by providing below command in the command prompt.
go get
 Now I can execute the hello program from where I'm (but I have to provide the path of program file for running it) or I have to go for the folder where the hello.go program is available. In the above said workspace path example, it will be under, d:\go_workspace\src\\golang\example\hello.

Going to this directory in command prompt and running below command, I will see,
d:\go_workspace\src\\golang\example\hello>go run hello.go
Hello, Go examples!

Sunday, October 9, 2016

API Testing -- A Web API transforming to be the RESTful API and Web Services

After knowing lines behind in birth of the REST, I will move on to know more about the Web API and what does the REST architectural style have to contribute for it.

What is a Web API ?

I keep it simple as this -- The application programming interface available to facilitate the service to the needed client (also server) over the Web. It provides the interface to data and service methods for who are in need of it.

Note: Refer this comment to have short briefing about what is an API.

Here is what MDN (Mozilla Developer Network) says and Micrsoft Developer Network say about it.

What is a Web Service ?

Web services are web servers built on specific purpose which supports the needs of a site or other applications.  The client program will use the APIs to communicate with the web services.  The API will expose data and functions to facilitate communication between the applications by allowing them to exchange the information. For example, the payment gateway page opening to Net Banking channel and taking to the login page of the chosen bank, is via API offered by that banking web service. So the credit card payment and debit card payment too.

Here is how, the client, API and web services placement look in general.
{ Client } < - - -  request and response - - - > { ( Web API ) <---->( Web Services ) }

REST API - Is this right way of calling it ?

The design of Web APIs adhering to the REST architectural style for having the access to the web services and it's technologies, is called to be REST API.  But the question is, should I call the REST as an API ?  

No, the REST is the architectural style for the Web and a concept; it is not an API.  An API having these essence of REST is called by name REST API.  

Personally, I feel, the right way of calling it being a Software Testing practitioner is,

  • REST conforming APIs
  • or, APIs conforming to REST architectural style

What is RESTful API ?

An API is beneficial and usable, when there is a web service in back which is reliable and accurate to it's purpose.  If there is no web service as this, then API is still a gateway but not serving the actual purpose for which the API is used.

The web service becomes more powerful with the APIs conforming to the REST architectural style. When this happens, it will be RESTful Web Services.  In other view, the APIs having this efficiency is also RESTful by conforming to it's standards and practice.

Next in this blog series
  1. Usually in the Web API testing !?
  2. The "not thought about" in RESTful API testing

Monday, October 3, 2016

API Testing - From knowing what's an API to the time that saw birth of REST

It seems to be uncommon if said I do not know what is a function, library, class, protocol and binaries in the Computer Science & Engineering.  Extending to this, it is more likely and usual to hear the word, the API - Application Programming Interface.

Have you read this which is so common if you are building and testing the APIs?

What is an API ?

Before walking into this discussion, let me try to understand what is an interface! Yes, an interface. Let me split this word and see what I see.

I see, "inter" and "face".  That is, there is a face between the inter -- which can be one or more.  A face as a property and attributes, isn't it?  So when I have an option to inter look in the face and take what's available there, I say, -- "I need it or I need some of these which can help me in ....."

From an API, I need it or I need some of these which can help me in doing what I want to do in the software system environment.  Further learning what is -- Application Programming, it is the programming of an application what is put in the environment to do the expected on purpose.

Now this Application Programming having an Interface so there can be a communication with methods or using the methods (functions) and it's associative elements. Upon communication, transfer of the messages i.e. data happens between within the system and also between the systems.

An API is (set of) programming instructions that is used to build the software application.  The context defines, what is the API there and how it will be used.  This further classifies the APIs now into types and it is briefed below.

Types of API

An API can be everywhere and to be so, it can be in the below said contextual forms.

  1. Software Library API
  2. Hardware System API
  3. Web based API
  4. Operating System API
Each of above said types further classified much more and in detail. Overall, in general these types covers most cases as I understand at this point of time in my practice. If you happen to see and using it beyond this, kindly let me know; it will help me to learn.

The API which aids to talk between two and more technologies or within the technologies, helps to pick what is needed alone and work on it. The encapsulation and interface idea of Object Oriented Programming can be seen in concept of the APIs and in the programming of it.

REST Architectural Design for the Web

All of sudden it appears like the word 'REST' is so new in the technology world, when one hears it for the first time and subsequently.  Well, the word REST in the Web exist since year 2000 and around somewhere.

Going bit more back in years, in the December of 1990, Tim Berners-Lee started a non-profit software project called World Wide Web to facilitate the sharing of knowledge. Working for a year, he had invented and implemented the below.

  1. URI - Uniform Resource Identifier
  2. HTTP - HyperText Transfer Protocol
  3. HTML - HyperText Mark-up Langauge
  4. The first web server - it is still up and running at
  5. The first web browser which Tim Berners-Lee named as "World Wide Web" and he renamed it as 'Nexus' later to avoid the confusion with the web.
  6. The first WYSIWYG HTML editor - it was built right into the browser.  WYSIWYG is an acronym for What You See Is What You Get.
In 1991, Tim Berners-Lee wrote on the Web's first page as below
The WorldWideWeb (W3) is a wide-area hypermedia information retrieval initiative aiming to give universal access to a large universe of documents.

Since then, the Web took it's growth rapidly. In 1998, as I have witnessed, the results of exam were published on the web by the education board in state Karnataka. Then the chat room asking 'ALS please' and as this.  Today while I write this, there is a Big Billion Day and Grand Annual Sale happening by the retail competitors of India where the customer purchases over the web via website and mobile app, thereby making the crores of rupees transactions in a day for business.

Getting back to 1990's, Roy Fielding, co-founder of the Apache HTTP Server Project was concerned for the Web's scalability problem in 1993. He and his fellow practitioners, observed Web's scalability constraint and came forward to improve it.

Roy Fielding grouped the constraints into six categories and he referred them as the Web's architectural style and it is as below:

  1. Client Server
  2. Uniform Interface
  3. Layered system
  4. Cache
  5. Code-on-demand
  6. Stateless
Along with Tim Berners-Lee and others, Roy Fielding worked to increase the Web's scalability and wrote the specification for the new version of HTTP 1.1.  These standards were adopted across the Web and contributed to the growth of World Wide Web.

Hey, you know, if HTTP is used in the software application you are building, the skilled practitioner says to use HTTP 1.1, so the caching techniques can be derived on using it upon mentioning it. The network attribute optimization, you see!

On avoiding the Web's scalability problem, Roy Fielding named and described the Web's architectural style in his PhD dissertation, in year 2000. He gave the name Representational State Transfer (REST) to his description of the Web's architectural style which is composed of above said constraints.

REpresentational State Transfer (REST) -- is the name of the description or derivation of the Web's architectural style.

What is in the next post? In the next post of this series, I will walk through the thought of
  1. Web API
  2. Restful API
  3. REST API -- Is this a right way of saying it ?

Sunday, October 2, 2016

API Testing -- Did you come across these questions?

Do you test API? What tools you use to test API? Hey, you also test the REST APIs? Automate and run the suite that is sufficient to APIs, isn't it? Have you asked any of these questions? Other person have asked you any of these questions? Or, you heard such conversations?

I will share my learning what I'm making by testing the APIs. Use the label "APIs"in this blog for finding related posts to it.

When I hear above said question, the first question that I ask is, "What do you want to accomplish and know by testing the APIs which you are talking about?".  I see no response coming back most times. Yes, we all use APIs! And, we will continue to use! What is that I want to know from testing the APIs?  How do I test? Why at all I have to test for APIs?

I got notification on my mobile phone from the app I have installed?  The APIs helped to receive that notification.  Did I see the stock market's number updating on my desktop or mobile app? That was with the help of APIs. Do I see anyone monitoring the health and fitness with the wearable device and then transferring that data to mobile or desktop? That happened with help of the API.

In the next post, I will be writing the below mentioned.

  • What is an API ?
  • The types of API
  • REST architectural design for the Web