Skip to main content

Posts

New Modern Open Source Performance Testing Tool : Locust

If you are bored with using old fashioned Java GUI to test the performance of your applications, then you should try Locust. Jmeter , which is old fashioned as I mentioned, is very  mature and used by a big community but you have create your test case with an ugly GUI as much features as allows you. For me the best part of Locust is that you can write your test case with Python which is my favourite language and it is very simple to learn. The installation is very simple, you just need to type: > pip install locustio Some feature / deficiency  of Locust:  You can write your test case in Python You can define the user time consumption on a page with min_wait and max_wait  as milliseconds in locust class so that get a real user simulation.  You can give weight for each test cases so you can simulate real user behaviours like during a specific period of time: 1 person signs up, 10 persons login, 60 persons visit pages, ...  You can make http request as you

Capybara - Cucumber: Handling iframe, Pop-ups and Facebook Login

For any automation frameworks, handling pop-ups is somehow difficult. By opening a pop-up window, the window changes so you can not control the new window with existing webdriver since it is already assigned to main windows when it was initiated.  Normally automation framework can not work if you don't switch to pop-up windows. For Capybara you can easily handle it by assigning the webdriver to new pop-up window. Then you can perform your test case as same way what you have done and when you are done with the pop-up, close the pop-up and then switch back the webdriver to the main window.      main = page.driver.browser.window_handles.first     popup = page.driver.browser.window_handles.last     page.driver.browser.switch_to.window(popup) Since iframe is a part of another source which is used to display another webpage in a webpage, you must handle it exactly same  as pop-up windows.       page.driver. browser.switch_to.frame(iframe_name) However, for iframe you must

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