Cucumber to generate HTML report

The Problem:

For test automation we use cucumber testing tools and besides selenium web driver to run the functional test process as we follow BDD (Behaviour Driven Development). Now, at the end we have very some results in terminal: As follows:

  • Passed scenario
  • Failed scenario
  • Number of scenario ran
  • Number of steps ran
  • Total run time of scripts.

But, you know client or the business people want more then that.


Cucumber has some build it features. You can simply run this

cucumber features --format html --out reports -

it will run all the features and execute a detailed reports

You can have two types of reports:

If everything passed: we have green and you can expand to see details

Screen Shot 2015-10-25 at 9.13.03 PM

If we got issues: we have red report and details shown where the problem is.

Screen Shot 2015-10-25 at 9.12.03 PM

Testing Browser Pop-up: Basic Auth with Capybara

The Problem:

In our company most of the server is port blocked, thus only inside developer, tester, project manager and product owner and client (spefici) can access the system. And besides we block normal or anonmous users registration and blocks google crawling.

Screen Shot 2015-10-25 at 8.56.43 PM

A Solution:

As we run test automation and we were preparing simple setup and configuration. And we could have hold javascript and give the input with valid information to pass on. So, we needed faster solution and we don’t want to see the popup – just pass us and get into project login system and execute rest of the services.

#pop_up_auth.rb under steps_definitions

When /^Given Enable port access$/ do
visit "<a href=""></a>"

#In feature block, I mentioned simply,

Given Enable port access

Cucumber: Upload file to system

I’m working on a project to practice test automation. So, I’ve choose framework and integrated cucumber + selenium web driver.

New Media Feature:

Feature Screenshot:

Screen Shot 2015-01-26 at 10.27.52 PM

Html Source Code:

&lt;&lt;span class=&quot;pl-ent&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;async-upload-wrap&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&gt;&lt;/div&gt;
&lt;div id=&quot;file-upload-html-LC2&quot; class=&quot;line&quot;&gt;&lt;&lt;span class=&quot;pl-ent&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;for&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;async-upload&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;screen-reader-text&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&gt;Upload&lt;/&lt;span class=&quot;pl-ent&quot;&gt;label&lt;/span&gt;&gt;&lt;/div&gt;
&lt;div id=&quot;file-upload-html-LC3&quot; class=&quot;line&quot;&gt;&lt;&lt;span class=&quot;pl-ent&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;file&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;async-upload&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;async-upload&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&gt;&lt;/div&gt;
&lt;div id=&quot;file-upload-html-LC4&quot; class=&quot;line&quot;&gt;&lt;&lt;span class=&quot;pl-ent&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;submit&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;Upload&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;button&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;html-upload&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;html-upload&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&gt;&lt;/div&gt;
&lt;div id=&quot;file-upload-html-LC5&quot; class=&quot;line&quot;&gt;&lt;&lt;span class=&quot;pl-ent&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;onclick&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;try{top.tb_remove();}catch(e){}; return false;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;href&lt;/span&gt;=&lt;span class=&quot;pl-s1&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;#&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&gt;Cancel&lt;/&lt;span class=&quot;pl-ent&quot;&gt;a&lt;/span&gt;&gt;&lt;/div&gt;
&lt;div id=&quot;file-upload-html-LC6&quot; class=&quot;line&quot;&gt;&lt;/&lt;span class=&quot;pl-ent&quot;&gt;p&lt;/span&gt;&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;file-upload-html-LC7&quot; class=&quot;line&quot;&gt;

Now, in step definitions I can write this – to directly show the local file (images, pdf, locations)


&lt;div class=&quot;line&quot;&gt;When &quot;I upload a file&quot; do&lt;/div&gt;
&lt;div id=&quot;file-upload_steps-LC2&quot; class=&quot;line&quot;&gt;attach_file('file','features/upload_files/theme-unit-test-data.xml')&lt;/div&gt;
&lt;div id=&quot;file-upload_steps-LC3&quot; class=&quot;line&quot;&gt;end&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;
&lt;div class=&quot;line&quot;&gt;When I upload a file&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;

It works as we have type=”file” and finds and system uploads file to system

Now if we go that way, sometimes it will not work. If we look that source code

Importing XML File:

Screen Shot 2015-01-26 at 10.35.32 PM

Source Code Html:

&lt;label for=&quot;upload&quot;&gt;Choose a file from your computer:&lt;/label&gt; (Maximum size: 32 MB)
&lt;input type=&quot;file&quot; size=&quot;25&quot; name=&quot;import&quot; id=&quot;upload&quot;&gt;
&lt;input type=&quot;hidden&quot; value=&quot;save&quot; name=&quot;action&quot;&gt;
&lt;input type=&quot;hidden&quot; value=&quot;33554432&quot; name=&quot;max_file_size&quot;&gt;

Now, in that case, I found it go confused and I needed generic solution to test.

Step definitions:

When /^I upload a &quot;(.+)&quot; file with &quot;(.+)&quot; and located at &quot;(.+)&quot;$/ do |file_name, name_selector, path|
attach_file(name_selector, &quot;#{path}/#{file_name}&quot;)


And I upload a &quot;theme-unit-test-data.xml&quot; file with &quot;file&quot; and located at &quot;/Users/sakib/Documents/projects/wp-automation/features/upload_files&quot;


  • (Configured and execute on local server)
  • Cucumber
  • Capybara

Close range idea of Product Price – From Google Engine

As you know, people were looking for product price in several prices. Now google has algorithm which gets the product price (possibly close to) range and if you type “Sharp AQUOS Crystal price”, it will tell you the price of the product.

Screen Shot 2014-09-01 at 10.35.23 PM

With that feature, I’m sure they will kill some mid-level web services traffic so fast. Just like, now we are used to with 2+2 = 4 in google calculation. Similar way, we will not visit to gsmarena or verge to find the prices (maybe we will go for review to get product inside out) but I would prefer to get directly from google engine – even without browsing those official pages 🙂

Trello has flaws too

Trello is amazing tools and I do use it everyday and I found a bug 🙂

Let me explain the steps:

  1. Forget password page
  2. Input valid / registered email address
  3. Trello will let you know – “Help is on the way”
  4. Email – You will have email with reset password link
  5. Click to reset password link
  6. You will have seen two (2) fields to set “new password”
  7. Give ABCD and submit
  8. You will have success message
  9. Now use Back Button of browser and go back to the previous shown (2) field page.
  10. Give another password XYZ
  11. And submit – second (2nd) attempts to change the password
  12. You will have messages – you’ve already set the password (means, ABCD – the first one)
  13. Now, try login with username and password ABCD – system won’t allow you
  14. This time, try to login with surname and password XYZ – system will allow you to log into system.

See, if you forget to close the browser. And someone little bit naughty and tricky and the guy can replace your account with his own password 🙂 Isn’t interesting!

Green Cucumber (Test Automation) is fun, errors are challenges

I was doing some work on a portal project, Moteel Portal. A client side solution. It works seamlessly in between several parties and make a sync data distribution for a online booking reservation.

  1. Moteel – Core platform, which stores all the branches, available, unavailable, occupied rooms
  2. Moteel Portal
    1. Corporate Users – Those are already signed with us, they will have special discount rate with us and rate will be shown to them, if they are logged into the portal
    2. Guest Users – They are just normal users/guest, those will who will take booking to our system. We will reserve room for them into the moteel core and branches will be informed, transaction will be made
    3. Registered Portal Users – Guest can be registered to our system with mobile verification and booking online rooms and moteel core will reserve the room and let to know other parties.

Testing the contact form with multiple scenarios