Wednesday, August 19, 2015

Internet of Things - Part 2 - Web of Things

Introduction to Web of Things Architecture:
                To develop any solution or a product which should last for a longer time and be adaptable, a solid "Architecture" is necessary. Architecture, by definition, is a style or method of building any structure. Similarly, an Internet of Things solution needs an architecture. 


This architecture should address the following needs:
1. Enable solution developers to build things rapidly and reduce the entry barrier
2. Users should be able to access IoT or Smart things with no additional softwares and promote using the existing platforms eg: Browsers
3. There should be a lightweight access to the data generated by Smart things as this data is going to be consumed by smart phones or other smart things which are resource constrained.

Web of Things(WoT) is one such architecture which is able to address these. 
The Web of Things (WoT) is a term used to describe approaches, software architectural styles and programming patterns that allow real-world objects to be part of the World Wide Web. Similarly to what the Web (Application Layer) is to the Internet (Network Layer), the Web of Things provides an Application Layer that simplifies the creation of Internet of Things applications.

Rather than re-inventing completely new standards, the Web of Things reuses existing and well-known Web standards used in the programmable Web (e.g., REST, HTTP, JSON), semantic Web (e.g., JSON-LD, Microdata, etc.), the real-time Web (e.g., Websockets) and the social Web (e.g., oauth or social networks).

Source: wikipedia.org

WoT has 5 layers:
1. Accessibility
2. Findability
3. Sharing
4. Composition
5. Applications



Below is a block diagram showing how the above layers are connected to one another.

Source: Dessertation submitted by Dominique Guinard
IoT Architecture from dissertation written by Dominique Guinard


Details of every layer:

1. Accessibility layer:
This layer deals with the seamless access and connectivity to smart things. To achieve this purpose we apply REST architectural style to the smart things(devices).

Why REST?
RESTful architecture, proposed by Roy Fielding, is an architectural style that was used as a set of guidelines to implement the second wave of Web standards.
Prior to REST, web was used as a way of transferring static documents(HTTP 0.9). With the advent of REST, web became HTTP 1.1 a full fledged Application layer. 


REST ensures the following:
Scalability of component interactions, generality of interfaces, the independent deployment of components as well as intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems.

REST can be implemented with Web or any other systems as it is independent of either of them.

REST - Web implementation:

The idea of REST revolves around 'Resource' and 'Service'
Resource can be - Physical device(Any type of sensors attached to Micro-controllers), Collection of Objects(virtual), Server-side state or Transaction
Service: Functionality offered by the Resources such as : Adjust Temperature, Report Temperature etc..

Following are features that make REST a best fit for IoT.
Resource Identification - Each resource and its services are given unique URI for identification   
Uniform Interface: HTTP protocol is the RESTful interface provides uniform access to various services via the methods - GET, PUT, DELETE and POST
Self describing Messages: Light weight technologies such as JSON or XML used for data transport among smart things
Hypermedia Driving Application State: All the services offered by IOT devices should have sufficient links to other services and resources so that clients can browse and access them.



2. Findability layer:
Coming soon...

3. Sharing layer:
Coming soon...4. Composition layer:Coming soon...5. Applications layer:Coming soon...

Tuesday, August 18, 2015

Internet Of Things - Part 1 - Introduction

Internet of things(IoT) or Internet of Everything is basically an Eco-system consisting of various interconnected hardware and software components  such as - Sensors, Controllers, Actuators, BigData Analytics, Cloud systems, Gateway Communication, RESTful Webservices and Reporting system - to solve a specific business problem.

Some examples:
Smart GRID
Smart Parking Management System
Smart Water management System
Home automation system etc.,

The origin of this networked devices technology dates back to 1982 when a group of people at Carnegie Mellon University(USA) modified a Coke machine to check the newly loaded drink cans are cold enough and report the inventory without human intervention. There after followed many inventions like above and the explosive growth of smart phones and tablet computers further fueled the uses of these IoT-devices to a completely new level.

According to CISCO IBSG report on April 2011, following is the table showing the current and future projections of the internet connected devices.

CISCO IBSG projections of IoT devices

Not just the number of IoT devices but the applications of the same are enormous too. Almost every industry - HealthCare, Retail, Energy, Media & Entertainment, Automobile etc - needs networked devices to monitor, control and analyze various business functions and data to reduce costs, increase productivity and provide improved quality services to the end-users. As businesses are increasingly dependent on new technologies and realized the potential of Automation, the amounts of investments flowing into this IoT are rapidly growing. Below is a report form BI Intelligence Estimates.


I believe that's sufficient information for now to go further on in-detail of the various things involved in IoT ecosystem and learn various technologies involved to build IoT solutions.


Note: If anyone still wants to read further, there are plenty of sources available on the internet.

Thursday, August 6, 2015

Element Identification Strategy using Selenium-WebDriver

One of the fundamental challenges in Test Automation is Element Identification. Almost every tool-QTP, Selenium etc - has its own mechanism in identifying the elements. Here, I would like to focus mainly on Selenium locators.

Selenium employs different methods to identify elements - ID,Name, CSS, XPath, LinkText, PartialLinkText etc. Though all these methods are equally important while designing the Automation framework, it is necessary for the test-developer to know what to use and what order to go for locating elements. The reason is that some locators may work faster than others but may not be accurate. Below is table showing the brief information about each locator based on my experience.

Selenium Locators

Order to be followed in choosing the locators:
ID -> Name -> LinkText -> Partial LinkText -> CSS Locator -> XPATH Locator

Always try to use ID or Name as your first choice. If not available, see if the development team can help you in assigning the ID/Name attributes. LinkText and PartialLinkText are for Links. If the above are not working, then go for CSS locator. Since this works fine with IE, the tests will be multi-browser compatible. If none of the above and other mechanisms work, Xpath can be used as a last option.
Both Xpath and CSS more or less use similar technique(DOM) to identify the elements, CSS is preferred to Xpath as CSS does not pose issues with IE where Xpath might do sometimes.

***Having said the above, Automation developers have to acknowledge the fact that CSS and Xpath are most likely going to fail the moment HTML-DOM structure of the page-elements change.

How J2EE components work together in any Container - Spring or Application Server

In a Spring+Jersey+Hibernate RESTful webapplication, we can spot various J2EE components - JTA, JPA, Java Bean Validation, JSON-B API for B...