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 github.com/golang/example/hello
 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\github.com\golang\example\hello.

Going to this directory in command prompt and running below command, I will see,
d:\go_workspace\src\github.com\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