Friday, October 4, 2019

Cypress - Automation tool

Cypress.io - Automation tool
------------------------------------

How to install cypress: https://docs.cypress.io/guides/getting-started/installing-cypress.html
---------------------------------------------------------------------------------------------------------------
1. install Homebrew (if not already installed)
- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. install node:
- brew install node
- brew upgrade node
- check node -v

2. install npm:
- npm is the world's largest Software Library (Registry)
- npm is also a software Package Manager and Installer)
- check if npm is already installed by checking npm -v
- if not, type install npm
- check npm -v

3. install cypress:
- npm install cypress --save-dev

4. install supporting libraries:
- npm install --save-dev @testing-library/dom
- npm install --save-dev @testing-library/react
- npm install --save-dev @testing-library/jest-dom
- npm install --save-dev cypress @testing-library/cypress
- npm install -g eslint
- npm install -g node-modules

More info here:
1. https://github.com/cypress-io/cypress
2. https://docs.cypress.io/guides/getting-started/installing-cypress.html

Cypress FAQ:
-----------------
1. how to open cypress(once installed)
./node_modules/.bin/cypress open
or, npx cypress open (prefer)
or, yarn run cypress open

2. how to create a file
- open terminal and create a file e.g. test1.js inside folder: /Users/rakesh/cypress/integration

3. how to run the above file using cypress - test runner
- in the testrunner, under integration , look for above file(test1.js) and click on it
- it will launch in chrome (url: http://localhost:51636/__/#/tests/integration/test1.js) and
shows the result

4. how to run cypress in headless mode:
https://snipcart.com/blog/frontend-testing-cypress

$ cypress run

5. how to run a js code locally in the terminal:
node file.js

Cypress Pros and Cons:
-----------------------------

Pros:
1. its built for front end/automation developers
2. it uses JS language, which front end webpages are also written in
3. it uses Mocha testing framework

Cons:
1. Cypress does not support cross browser testing:
- latest update: https://github.com/cypress-io/cypress/issues/310
2. Cypress supports only JS

Cypress Best practises:
-----------------------------
1. how to select elements properly:
https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements

2. assertions:
https://docs.cypress.io/guides/references/assertions.html#Chai

Monday, June 16, 2014

API Testing

Q&As
-------------
What is an API?
Application Programming Interface. It is an interface to make HTTP calls with REST or SOAP methods. Both methods can use JSON or XML as their input.

What involves API testing?
API Testing involves testing the response after making a API request. The request and response can be either support JSON or XML format.
It is different than GUI testing in the sense that you test for business logic here rather than concentrating on look and feel of the application.

What tools to be used for API testing?

For API testing, there are several free tools:
in chrome browser:
a) Postman extension: https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en
b) Advance RESTClient extension: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

in firefox browser:
a) Poster add on: https://addons.mozilla.org/en-US/firefox/addon/poster/
b) RESTClient add on: https://addons.mozilla.org/en-US/firefox/addon/restclient/

from CLI(command line interface)
curl -v "http://[API call URL]"


What includes a proper API testing?
a) Planning your test cases meticulously - to include below points
b) Each parameters in a API request should be tested for boundary value analysis, null values, negative scenarios.
c) Every error code should be checked so that API code is smart enough to throw an error when encounters something un-expected in an API request.

What are the limitations of API testing?
a) No GUI to help testers with input values
b) A tester should have some coding knowledge
c) Request, response paramaters including error codes should be known to a tester
d) Validation of expected outputs and actual outputs are difficult for a tester to understand

How can API testing be automated?
You can use Jmeter to automate the API testing. Jmeter uses Java.

Sunday, June 16, 2013

Load Testing - Jmeter Vs Siege

- Jmeter comes with a GUI to create/run load tests, while Siege is command line tool
- Jmeter has tons for features that can be used while testing an entire website - with muliple pages, while Siege has limited options to be used
- Siege is fast to setup and run while Jmeter takes time to setup as it involves multiple steps
- Jmeter is faster to run for n concurrent users than Seige
- Jmeter has broad set of options for results analysis while Siege has one summary of results
- Seige is good for a quick load testing of a webpage while Jmeter is good for a wide variety of tests to be run at a single time
- Jmeter has several plugins to enhance its load testing features and analysis while Siege lacks in plugins
- Sometimes, Siege can give false results thinking better performance while Jmeter is quite accurate in its results

Hence, I prefer Jmeter in most of the load testing requirements, while I use Siege for a quick load test.

Saturday, June 15, 2013

Automation testing using TestComplete

For more than a year, I've been working on automation of functional testing, regression testing using TestComplete(http://smartbear.com/products/qa-tools/automated-testing-tools). It's a paid automation tool.

It's an little tricky to learn and use but quite similar to Selenium. You can use xpath, record and play to script test cases.

Pros:
- similar to Selenium IDE, you can record and play test scripts
- similar to Selenium RC, you can create test scripts in VBScript, JScript, DelphiScript, C++Script or C#Script. (personally, I liked VBScript)
- Test results logs helps in finding precisely the issue where test failed
- tests can be recorded in keywork driven or screen capture modes
- tests can be created for regression, functional, DDT (data driven testing), ODT(object driven testing), and so on
- can easily do cross-browser testing

Cons:
- automated tests can not be run on Mac OSX
- no support for mobile testing automation (though there is a package  'seetest' which can be integrated with TC)
- it can not read xpath values for browsers other than IE, Firefox, chrome, Safari.

Please read this book on TestComplete(reviewed by me): http://www.packtpub.com/testcomplete-cookbook/book 

Tuesday, June 5, 2012

Browser cookies and its contents

Are you cookied? Tips to look for your cookies:

in chrome browser: chrome://settings/cookies, click on individual cookies to know its contents

in Firefox browser: options -> privacy -> remove individual cookies, click on individual cookies to know its contents

in IE 9: tools->internet options->general->settings->view files -> all files starting with cookie:

Tuesday, March 13, 2012

GooglePlay and its bugs

I found these bugs with Google Play:

1. Google Support page link from the Google Play has this JavaScript error(and the support page comes blank in Internet Explorer 8):


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Tue, 13 Mar 2012 20:00:17 UTC


Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Line: 0
Char: 0
Code: 0
URI: http://support.google.com/googleplay/bin/answer.py?hl=en&answer=1229970

2. In Google play, I see that while its uploading my music from Itunes, the music file number being uploaded is different from the one I see in the taskbar(screenshot shows file #88 while taskbar Googleplay icon says#92):




Friday, March 9, 2012

Time to say 'Goodbye USA'

It has been almost 8 yrs since I came to study in US. Now, after this long time, I'm excited because I'm going back to my home country- India on 23rd March.

It is time to say 'Goodbye USA' as I don't know if I will be back or not. Right now, I can only think of good memories of this country. It has been a long journey here as I got my MS degree, good job in NYC, my better half  and visited many beautiful places here. I learnt a lot of good things from this country and will always remember them and use them in India.

India has become a land of opportunity now with its booming economy with billion+ people and its billion possibilities in any field. Specially in the field of new businesses, its a hot market. A lot of startups are coming up everyday and indian market is so big that it can digest even more of them in future.

I see a lot of opportunity to work, invest, start something of my own soon in India.

Thanks to USA and I'm coming back, India!!




Friday, February 17, 2012

Mobile Testing on DeviceAnywhere and Gmail bug

These days I am testing some softwares on mobile phones/tablets/smartphones. I'm using DeviceAnywhere tool for this purpose.  DA is good tool to test softwares on mobile but it has several limitations. Like it has poor keyboard interaction and some keys don't work. Sometimes, you type something and something else gets written on mobile.

Other issue is bad graphics of mobile phones. Sometimes phone screens look blurry. Another issue is trying to navigate to the web browser on mobile phones. There is no step by step process or guide. It assumes you know the phone that you are testing on. This is ridiculous as nobody can know 2500+ models in the US market.

One more issue with DA is slow response time of its website or acquiring any mobile device. Slow response time is also evident during device's interaction.

In short, you got to have lot of patience to play with different devices on DA.

Today, I found a bug in Gmail on mobile phone. Try this:

1. Open gmail in iphone in safari browser with cookies enabled for it
2. Disable cookie in settings for Safari
3. Try logout from gmail, you will see that it does not let you, it takes you back to inbox page.


Wednesday, February 1, 2012

Superbowl Ads 2012

Check out some cool Superbowl ads for 2012(found on youtube): 1. Official 2012 Honda CR-V Game Day Commercial - "Matthew's Day Off":
2. 2012 Acura NSX Super Bowl Commercial:

Wednesday, December 28, 2011

Patna Marathon 2012

Bihar is rising and to showcase this phenomenon we are organizing Patna Marathon 2012. This event will be held in Patna on 26th Feb 2012. It is being organized by several NRBs(Non-Resident Biharis) from across the world with the help of several NGOs like Bihar Society, Karma Society and individual volunteers. This event will bring Bihar to the worldmap of growth and show the unlimited potential in Bihar and its people. More details are available at its website: wwww.patnamarathon.com Facebook: http://www.facebook.com/groups/patnamarathon/ Twitter: https://twitter.com/#!/patnamarathon We invite you to be a part of this event by funding, volunteering, sharing your ideas! We also invite companies, NGOs to sponsor or partner with Patna Marathon!

Tuesday, December 13, 2011

About Bootstrap - Twitter's new HTML, CSS magic

Twitter launched a new toolkit for HTML and CSS layout - Bootstrap and so far, it's amazing! More info about Bootstrap at Github page: http://twitter.github.com/bootstrap/ Take a look at this HTML page with almost insignificant CSS:
After inserting Bootstrap CSS, it looks like this(with better page layout): Magic, huh?

Friday, December 2, 2011

Diwali Mela 2011 in Jersey City, NJ, USA

Enjoy these links to see Diwali Mela 2011 in Jersey City, NJ, USA: http://youtu.be/m2rjeci__kg http://youtu.be/pFlFoCPnvdA http://youtu.be/YktbOGAAYxc

Saturday, April 16, 2011

NYC4ANNA movement in Times Square, NY

We couple of volunteers organized NYC4ANNA event in Times square, NYC on 9th Apr 2011 from 12-3pm. We rose to show our silent solidarity to Anna Hazare who was doing fast to protest against corruption rampant in India. There were some 400 people gathered to support and sign the petition against corruption.

Some media people covered our events and one such link to coverage of this event is at Rediff: http://www.rediff.com/news/slide-show/slide-show-1-harzares-anti-corruption-wave-sweeps-new-york/20110412.htm. It was successful event with a lot of Indian people talking about corruption and showing banners to support Anna and remove corruption.

Link to video of our event: http://www.youtube.com/watch?v=PGbNIzR3nGA .

I ask everyone to stand against corruption in India, whether it is done by some bureaucrat or any politician. If we have to make India free of corruption then we have to start at our home. We have to promise ourselves that we will rise to the occasion and free our country of corruption.

Tuesday, April 5, 2011

We are World Cup Cricket Champions..2011!!

It's celebration time in India and everywhere for Indians!! We have won ICC cricket world cup 2011 and with a thumping victory over Sri Lanka in Final match on 2nd Apr 2011. Its the proudest moment for all of us as India has won this cup after a gap of 28 years..long time..

This victory has again proved that perseverance and hard work always pays..we have a amazing cricket team with Dhoni at its helm. Including Sachin, known as God of the cricketing world!! He has smashed or created new ODI and test cricket recrords..and he speaks with his bat..and I guess other team members have also learned this unique technique from him..

Critics should always be silenced by your hard work not by your words..as always, work is more powerful than words!! Kudos to Indian cricket team, who gave us a chance to celebrate any victory in a long time!!

Tuesday, March 22, 2011

Happy Bihar Day!!

Happy Bihar Day to every Bihari!!

I celebrated Bihar Day last weekend on Sunday with some of my Bihar Society friends..watched some online videos of Bihar Day celebrations at http://www.ustream.tv/channel/bihar-divas.

Webdriver - Automated testing tool

Last week, I attended a seminar on Webdriver in Google New York office. It was presented by Simon Stewart on wednesday, March 16th 2011. Webdriver is an automation tool used to test codes written in Java, Python. It does not support PHP, which was a disappointment.

Webdriver is based on Selenium 2 with better GUI and features. More on Selenium at selenium.googlecode.com.

Wednesday, February 2, 2011

PHP NY Unit Testing seminar slides - Jan 25,2011

Check out this SlideShare Presentation:
Clean code
View more presentations from Bulat Shakirzyanov.

Wednesday, January 26, 2011

Snow pics- NYC - 26th Jan 2011





Sunday, January 16, 2011

Bihar and Andriod Phones

Today I read an interesting news which re-affirmed my faith in Nitish Kumar. This is about (Link: http://www.zeenews.com/news680910.html) Bihar road construction department using Android phones to monitor the progress of road making. Bihar, once said, can not change. But people of Bihar, led by great leader Nitish Kumar has shown that not only Bihari can change but also make use of new and advanced technology in infrastructure development. Kudos to Nitish Govt.!!

Wednesday, January 12, 2011

New York & Bihar

Very snowy night yesterday..Jersey city got almost a feet of snow..trains are late and so, I worked from home. Better to stay home warm than travel for an hour or two commuting in this cold weather to New York City..

Read a very inspiring story about use of Husk technology for electricity generation going on in Bihar(Link - http://www.ndtv.com/article/india/in-bihar-turning-rice-husk-into-electricity-78639). Bihar really needs such kind of cheap and useful technology. Millions of people still live in darkness in 21st century. Nitish govt. is doing what it can. But I suppose time has come for educated people like the one in the article to do something for Bihar.

Thousands of business, IT people from Bihar are all over India and world, who can contribute so much for the upliftment of the poor people. I, myself, have a lot of plans about doing business in Bihar. Lets hope I implement them in near future because Bihar needs us!