Wednesday, September 27, 2017

Appium integration with windows platform.

Today i will talk about Appium which is automation tool and is open sourced, used to automate mobile applications. Appium is written in node.js and supports multiple languages to be implemented for iOS or Android mobile devices. We can test web/native applications using appium in mobile device.

This post is regarding how to integrate appium with Windows platform as it has many dependencies to get installed.

Dependencies of installing appium on widows -

  • JDK
  • Android SDK (adb/uiautomator)
  • Node JS
  • MS .Net Framework
  • Appium Client
  • An ide to work with code.
Installing all of the above will ensure that appium has a working environment in windows to be runnable.

After Installing the Appium client and its dependency launch the appium client. It will look like this in the below picture.


Basically it has 3 tabs Single, advanced and presets.

Single - 

You can select the host and port ip addresses here generally its kept as 0.0.0.0 and 4723 as default values.

Advanced - 

This will have some extra options like saving log path, binary path for chromedriver in android, executeAsync callback host and port in iOS. We can also save our presets or settings into a single name and run it every time with the selected settings every time we select the named preset.

Preset -

Contains a list of saved preset saved by user with required settings. User can load the preset and the saved settings will be loaded.

Start Server starts the appium server with the selected settings.

A started server will look like below picture -



Now environment is running all that is needed is a android device to connect and some code to run.
Remember to verify the developer options is turned on in your android device and as well usb debugging is turned on. After connecting the device do a adb device on the command prompt to check if device is detected by the system. If no device is shown you need to install device driver for your mobile device on your system.

If everything goes right the device can now be accessible through the appium intermediate where you can test application through code and automate user steps on mobile device.

P.S. Android setup installs adb and uiautomator which are useful tools while automating through appium.

Tuesday, September 26, 2017

Using Custom Commands to simplify process in NightwatchJS

Nightwatch js is a package which is used to test Web UI in browsers using selenium and javascript. Today i will tell you about a feature in nightwatchjs which is Custom commands which can be used to inject functionality to a method manually using dependency injection.

First we need to have it installed in the system by using the below command -

  • sudo npm install --save nightwatch
This will install the package locally. We also have to remember that node must be installed in the system to run the command node package manager i.e. npm. We need to then run the selenium server at the background. Download the jar and run the jar as a background process -
  • java -jar selenium-server-standalone-3.4.0.jar
It will also need chromedriver or geckodriver to be in system path to run them successfully.

A nightwatchjs requirement is that it should have a config file which is a conf.js or a json file that links all the resources to run the tests. Then it should have a tests folder where all the tests are suppose to reside. Something like below picture - 

Now after writing the tests one has to just run node 
  • nightwatch tests 
As we are keeping the test steps inside tests folder, on calling tests it will run all the tests inside the tests directory.

Now to come to custom commands we need to create folder called custom commands and keep the code inside which we want to run as a dependency for other tests to run something like below picture,


Now we have to link the custom command in the config file some thing like below picture,



Finally we call the login custom command inside each tests to perform the step as a prestep.


P.S. This feature is same like BeforeEach functions in other testing frameworks.

Working With Postman and Nosql Mongodb.

Today i will show you how to push data into Mongodb database using Postman which is a rest api interaction tool.

First of all mongdb must be installed on system using

  • npm install -g mongoose
  • or sudo apt-get install -g mongoose (for ubuntu/linux)
After successfully installing mongoose then we need to create a schema to make a collection in the db. 


This creates a collection with title and url fields. Now we need to install postman which is available in chrome extension as well as in exe format. After installing open the postman, it should look something like this.




We need to make a server with node js which will talk with the mongodb server and listen to port 3000 and then do the POST operations.


Now go back to terminal and switch on mongodb by  typing "mongod" in terminal and press enter.

Observe the mongo server starts running.



Now go to postman and change the type of the operation to POST and the link to localhost/movie where the database is hosted.
Here we will talk with the database and add some data into the db using postman, so now go to the x-form-urlencoded option and then add key and value of title and url which are the data we want to push into the database like this -


Now press send to do the post operation and observe body sent from the server containing the sent data.
Go to localhost and try visiting the link and observe the data is now existing in database thus confirming the post data push from postman is successful.

P.S. This is a MEAN stack project which is used as an example to show the utility of postman for data pushing into mongodb using post method.

Monday, September 25, 2017

Partitioning of Extended space in a VMWare Workstation

This post i will discuss how to extend your disk space and allocate the un-allocated memory to the current system of Ubuntu 16.04 LTS .

For the first step is to increase the total memory of the vm ware through settings(VM Settings page) by clicking on expand and increase the total memory.

This step needs to be done when the Virtual Machine is not running. Then after extending the VM run the vm. The next step is to install gparted by using apt-get command.
Open a new terminal and type the below command, this will install gparted in the system.

  • sudo apt-get install gparted






The window will look like this after installing and opening gparted.

Now follow the steps to increase your sda1 partition to unallocated partition



  • Click linux swap.
  • Click on partition from menu.
  • Select Swap off option
  • Click on extended.
  • Click on Partition and click on resize move.
  • Now drag the memory partition and fill the unallocated memory.
  • Click on resize move button.
  • click on linux -swap
  • click on partition and click on resize move.
  • drag the same size partition to the end of the memory pipe.
  • Click on resize move button.
  • Click ok.
  • click on Extended.
  • click on partition and click on resize move.
  • Decrease the block to initial extended block (2GB/511MB)
  • click on resize move button.
  • Click ok.
  • Click on ext4.
  • Click on partition and click resize move.
  • Expand to the end and increase the partition memory of ext4.
  • Click on resize move button.
  • Click ok
  • Click on Edit
  • Click Apply all operation and press apply.
  • Wait for the process to complete and at the end notice the memory is increased.

At the end it will look like below picture- 



P.S. Data loss can happen while doing this steps if anything goes wrong, so better keep a back up of your files before performing these steps. I did not face any data loss while performing these steps. 


Automation Testing : A comparison of Synchronous and Asynchronous Web driver.

To start with the first one has to know the definition of synchronous and asynchronous.


  • Synchronous - That is it will run synchronously one after another.
  • Asynchronous - That is it will run independently of another.


So here the term comes when working with automation api of selenium webdriver. Selenium Webdriver is a tool that is used to automate user interaction on browsers to create a robotic environment where a task can be performed with minimal user assistance.

Selenium Webdriver supports few languages which include java, python, javascript etc.
Now when we deal with java webdriver behaves synchronously in dealing with user test steps but when we write the same code in javascript using webdriverjs the api behaves asynchronously thus steps do not wait for each other and starts getting executed together.

Selenium Webdriver in Java, python (Synchronous) -


  • Do not needs promises to work.
  • Dependent on the previous task to complete.
  • Can not run independent of previous task.
  • Slow process

Selenium WebdriverJS in Javascript (Asynchronous) -
  • Returns a promise after every webdriver call.
  • A promise can be anything value to an object that directs to the value.
  • Is denoted by then functions. 
  • It supports other framework which can work together like jasmine and make a complete phrase like  statement - then - expect.
  • Faster than Java, Python





Working on automation for java, python is one experience where as working on javascript is fully different. Here the main difference is of asynchronous behavior of js api which needs promises to support every test steps such that the test would be performed in an order.

P.S. Javascript or Java, Selenium is the best api to automate user interaction on a browser hands down.



Automation Testing With Slimerjs and CasperJS


Today i will talk about automation testing using CasperJS and SlimerJS to automate Smoke testing or simple test scenarios for a website.

So this post is intended for readers who are well versed on testing methods and tools. If you cannot understand any of the portion just google the term and research on it.

To start about Casperjs it can be downloaded from

http://casperjs.org/

or people who want to use npm they can just do the following -


  • mkdir caspertestexample
  • cd caspertestexample
  • npm init
  • npm install --save caperjs

Using the above commands creates a directory called caspertestexample, initializes the folder as a node folder and then installs the casperjs files on the local directory.

So this was about casperjs now the next step is to install slimerjs which is a support for casperjs to perform UI automation. Casperjs basically is an open source tool to navigate through websites and perform user tasks, we need a browser to do the work thus slimerjs comes into the scene. We can use phantomjs instead of slimer but it won't show ui to user to understand that the tests are being performed.

Next we need to do install slimerjs same as caperjs -

  • npm install --save slimerjs
After installing we need to create a tests folder under caspertestexample folder.
This would be like the main folder which will have all the tests.

Basically we have to write test in a javascript file and then run it using casperjs command through command line.

A sample syntax will be like - 



Now we save this file as sample.js and try to run from command prompt.

  • casperjs --verbose --engine=slimerjs test tests

What it will do it will start testing all the files that are under the tests folder one after another using slimerjs as a browser.

P.S. Slimerjs uses the mozilla gecko driver to run the tests.


About Me

Hello i am technology savvy guy who loves to learn new technology now and then. I have back ground in testing as well as in development of software for Multi National Companies.

I did my engineering in Information Technology and passed out in 2009. After then i have been working in Testing Domain and then in Development Domain.

I started as a QA Tester testing mobile applications for 3 years straight. Then i learned Android Development and switched to developing small applications for android. After finding the job quite less challenging which was to fix bug whole day that too make small changes in Excel to fix localization issues i made up my mind to resume in Testing profile.

I got an offer from a leading testing giant company which i immediately took the job. For next 2 years i was doing manual testing and automation testing using Java and selenium. I was not happy with my job as it was getting less hard day by day. It was like in 1 hr i was able to finish whole day's work. This was making me dumb and lazy.

Then i switched to Automation Testing Working on Python and Selenium for the first time which was very challenging at first but after some time became easy. I worked in that role for nearly 1 year as an Automation Engineer supporting/scripting on python.

At last after working for 6 years in industry i thought of taking a break and do full time freelancing providing solutions in testing/ development/ blogging content writing. It was like a dream job where i could learn new things every day and challenge was never less with new clients came new work culture thus making it fun and interesting.