Skip to main content

Posts

How to Check the CSS of an Object by Capybara with jQuery

Testing the CSS of an object is sometimes needed. If you want to check the background-color, size, clip, ... of the objects, you must control the CSS code of the element. Capybara let you check it very easily with executing javascript from console by sending command to console of the browser. There are two function that can be used for sending command to console as follows: page.evaluate_script() page.execute_script() You can send your code as below. It tries to creates members object and then adds new profiles to members . With this way we can check if metrics of is shown as described format. # from javascript add 10 more user to the community and totally there should be 11 members # check the boundary, more button should be still not exit page.execute_script("window.members = App.Communities.models[0].attributes._members") for i in 1..number.to_i page.execute_script("members.add(new App.Models.Profile({_res:'profiles.#{i}'}))") end In th

Deterministic Way of Test Automation

Test automation scripts should be simple. This doesn't mean that software product code should be complex. Actually,when everything is simple then the life will be simpler. However sometimes we need to explain something in a complex way. Most of the time, simple is difficult. There may be different reasons behind the complexity but it is clear that if we knew it clearly, we would explain it simply. Let's look at what Albert Einstein says:  "If you can't explain it simply, you don't understand it well enough." As the subject is how simplicity can be applied to test automation, I will focus on simple but efficient test scripts. To enable to write simple test scripts, we must clarify undefined, non-clear, dependent factors on every case/stories. This kind of approach is called as determinism in philosophy. According to the Princeton University dictionary, determinism means as:  " determinism ((philosophy) a philosophical theory holding that al

Capybara: How to Control from Terminal

When you write test scripts, you may want to get quick result if the entered command is working as what it is expected. The easiest way of controlling the command is to try it on simultaneously from your terminal. Using Capybara via terminal is very easy and fast.  Just copy and paste what is written in your env.rb file and see the result. However basically you can type the following lines after typing irb for Ruby execution window.  require 'capybara/dsl' include Capybara::DSL Capybara.default_driver = :selenium And then you can type your commands like as below, actually you can do what you are doing in your Ruby file:  irb(main):004:0> visit "http://www.amazon.com" irb(main):005:0> fill_in "twotabsearchtextbox", :with => "nexus 5" irb(main):006:0> find(:xpath, "//*[@class='nav-submit-input']").click()

Creating Test Data: How to call Python Function from Java

For my testing purposes, I need to create an e-mail before running automated test cases so that it should used it for new registration and a new one for sending invitation to unregistered e-mail and there are some other test cases which use new e-mail for testing. I have create Python function which produce a new e-mail address in this format: gunesmess+1@gmail.com and next run it will create gunesmes+2@gmail.com and for every run, it creates a new one just increasing the last used e-mail number. You can use this file for your testing too. Just create numberRun.txt file in you directory. For my recent project, I need to write my automated test cases in Java so I have learnt some Java but not as professional. For this project again I need to create new unregistered e-mail address for using almost the same scenarios. Therefore I needed to call Python function in my Java code, instead of writing it in Java. The following code is used for calling: What you need is that you m

Using Examples Table in Cucumber

Using Examples in Cucumber is a great thing for testing world! Examples is a keyword and you can define a set of variable to repeat your case with the whole set of data in the examples block.  We can re-write the examples which checks the login page of amazon.com with Examples feature of Cucumber. Check the following code: In the  amazon_login.feature file we are reading <username> , <password> and <message> variables from the Examples. This means that the scenario which has the steps used these variables will run 2 times, which is the number of row in the examples. There should some changing in the Capybara, Ruby file.  "(.*?)" this means the function takes a string parameter but we are sending table variable so we need to change  (.*) for string variable in table and  (\d+) for integer variable in table.     As you can see from the result there are  3 scenarios ( 3 passed) and 9 steps ( 9 passed) . This means that " Scen

Test Automation with Cucumber - Capybara - Selenium in Ruby

For a company which uses agile development methodology, test automation is very critical. However meaning of test automation in agile is little bit different from the automation activities in waterfall or V-model development methodology. In agile a user story should be automated before the feature is developed and when it is ready then automated test cases can be run to test user stories. For agile test automation, using only selenium is not enough or is not the best approach because of the written test cases. There should be another tool used for writing test cases which automation script can understand and perform what test cases/user stories explain. Cucumber is the tool what I want to explain. With Cucumber we can write test cases and with language called Gherkin which is very easy and understandable for everyone. So we just need to learn the keywords like " Given, When, Then, Examples, Scenario, Scenario Outline , ..." they are not too many, for more information a

Good QA Assignment: You may Want to Ask in Your Interviews

QA position is not like development or analysis position so finding a good QA engineer is not as easy as development engineer. You may ask some technical questions to your QA candidate but half of the QA responsible is related to social ability, and the rest part is related to knowledge about testing domain and practices. I want to share a good review question and a related answers below. Question: Before you start- some directions: You need a computer, it can be a Windows XP/Vista/Windows 7, or a Mac OSX/Linux machine, of course   Download the  KeePass  installer and install it on your machine you intend to test with, install the Classic Edition Version 1.17 from:  http:// keepass .info/download.html The problem: KeePass  Password Safe is a free, open source, light-weight and easy-to-use password manager for Windows. You can store your passwords in a highly-encrypted database, which is locked with one master password or key file. Part 1: Use your s

Basics of Continuous Integration (CI)

Almost every methodological approach in software development aims to reduce development time and produce more qualified products. Continuous Integration (CI) also aims to reduce development time. Basically, CI is software development practice that developers need to check-out their codes in their local development environment and than integrate them to shared repository. According to Martin Fowler who known by his studies about CI, there should be at least one integration to shared repository done everyday, but the frequency of integration is expected to be more than one integration. By this way, test activities are performed during every integration and problems caused by the integration can be minimized. As it is emphasized in this blog , CI says us as "pay me now, or pay me more later" . If we look at the history of CI, it goes back to extreme programming (XP) which advocates that there should be frequently code merged to master to cover unstable requirements of customer

Report: The State of Mobile App Development and Testing 2014

Mobile is in everywhere. If you want to be successful in your domain you need to put your business to mobile world too. Because the trend of mobile device usage is still and is going to be increased, people want to continue to use web application with their mobile devices while they are mobile. According to Flurry , leading domain in this trend is social media like facebook, twitter, foursquare and many others; and  the other popular domains are respectively utilities, entertainment,  e-commerce, games.  By SmartBear , a report about the mobile application development and testing is published. Let's look at what SmartBear does and how to benefit from this research the we can analyze the situation. SmartBear is software company, mainly focus on software development, software quality and system management tools. They have more than 10 famous products on the market. For software quality and testing, SoapUI, LoadUI and TestComplete are well-known tools. Based on my own exper

Selenium Chromedriver Error Message: u'unknown error: unable to discover open pages

If you use selenium webdriver to automate regression test cases, you may have got the following error. Because a bug in chromedriver version 2.3 causes this error. According to Google Dev ., this problem had fixed in version 2.6.  Assigning the chrome driver to driver leads to this error by the line 38, which is self.driver = webdriver.Chrome() . To solve the problem, you need to change the chromedriver version 2.3 in your execution path, like C:\Windows\System32 under Windows, with newer version. You can download chrome driver from googleapis .   Error message may like this: Traceback (most recent call last):   File "D:\workspace\automation_project\run.py", line 32, in <module>     m = Project(browser, server)   File "D:\workspace\automation_project\test_case_imps.py", line 38, in __init__     self.driver = webdriver.Chrome()   File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line