Skip to content

Instantly share code, notes, and snippets.

View gunesmes's full-sized avatar
🎯
Focusing

Mesut Güneş gunesmes

🎯
Focusing
View GitHub Profile
@gunesmes
gunesmes / udemy.rb
Created November 10, 2015 17:22
screen shot of udemy
# run it: ruby udemy.rb
require 'capybara/dsl';
require 'capybara/poltergeist'
include Capybara::DSL;
Capybara.register_driver :poltergeist do |app|
options = {
:js_errors => false ,
:js => true,
@gunesmes
gunesmes / capybara.rb
Last active April 7, 2017 18:47
Alias for Capybara and Selenium to work on interactive console.
require 'capybara/dsl';
require 'capybara/poltergeist'
include Capybara::DSL;
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
Capybara.register_driver :poltergeist do |app|
options = {
@gunesmes
gunesmes / dec_step_definition.rb
Last active August 29, 2015 14:26
Imperative vs Declarative
When(/^user submits the registration form with valid user information$/) do
enter_text IDs.items["Name"], "John"
enter_text IDs.items["Surname"], "Doe"
enter_text IDs.items["Email"], "[email protected]"
enter_text IDs.items["Password"], "Password1213"
touch IDs.items["Male"]
select_from_list IDs.items["Birt"], "1990"
touch IDs.items["Terms and Condition"]
touch IDs.items["Register"]
end
@gunesmes
gunesmes / homepage.rb
Last active August 29, 2015 14:20
One of the biggest challange in test automation is updating existing codes. Because of the update in the development, it is very prone to have some changes for the attributes of ui elements and less likely to have some change in behaivour in actions. The second option is most of the time called as bug, otherwise if the business is changed, it co…
# ------- GIVEN --------
Given(/^I go to a brand page$/) do
find_by(IDs.container["Brand List"]).click()
end
# ------- WHEN --------
When(/^user clicks link of "([^"]*)"$/) do |item|
find_by(IDs.header[item]).click()
end
@gunesmes
gunesmes / result.sh
Last active March 13, 2022 16:30
Testing SOAP services, I used Python requests library to test the SOAP services. What I did is just creating a form variable within a triple-double quotes for Python docstring, like """this is triple-double quotes with V1: %s and V2: %s""" %(variable-1, variable-2) . At the end I am just calling requests.post method with sending url, headers, da…
~/P/m/h/services python run.py
test_get_session (__main__.SoapServices) ... ok
test_get_token (__main__.SoapServices) ... ok
test_CompleteReturnRequest (__main__.SoapServices) ... ok
test_ReturnTransactionRequest (__main__.SoapServices) ... ok
test_UserInfoRequest (__main__.SoapServices) ... ok
test_RefundRequest (__main__.SoapServices) ... ok
test_StartTransactionRequest (__main__.SoapServices) ... ok
test_ReturnTransactionRequest (__main__.SoapServices) ... ok
@gunesmes
gunesmes / base.py
Last active November 22, 2018 17:33
Page-object model is a pattern that you can apply it to develop efficient automation framework. With page-model, it is possible to minimize maintanecy cost. Basically page-object means that your every page is inhereted from a base class which includes basic functionality for every page.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
# this Base class is serving basic attributes for every single page inherited from Page class
class Page(object):
def __init__(self, driver, base_url='http://www.app.com/'):
self.base_url = base_url
self.driver = driver
@gunesmes
gunesmes / appium_android.py
Created February 11, 2015 16:15
Appium is a tool for mobile test automation
import os
from appium import webdriver
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.2'
desired_caps['deviceName'] = 'Samsung Galaxy S5'
desired_caps['app'] = os.path.join('<project-path>/calabash_android_automation/sampleAndroidProjectToAutomate.apk')
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
@gunesmes
gunesmes / calabash_instrumentation_failed
Last active August 29, 2015 14:12
calabash-android run gives INSTRUMENTATION_FAILED exception. This is a solution for this exception.
~/P/m/android-automation (master ⚡=) calabash-android run latest.apk features ADB_DEVICE_ARG=192.168.56.101:5555
Feature: Splash Screen
As A user
I Want to see splash screen
So That I can have an idea about the app in advance.
Background: User should open the application # features/M001_splash_screen.feature:6
android.util.AndroidException: INSTRUMENTATION_FAILED: com.arkony.maidan.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner
at com.android.commands.am.Am.runInstrument(Am.java:865)
at com.android.commands.am.Am.onRun(Am.java:282)
@gunesmes
gunesmes / huxley_record.json
Last active August 29, 2015 14:11
Huxley is a screenshots comparison tool developed by Facebook development teams. It is a open source tool and written by Python. It uses Selenium standalone server so you must download and run it before recording and executing your cases. Good thing for the Huxley is that you can record a case with the parameter --record so you can execute some …
{
"py/object":"huxley.run.Test",
"screen_size":{
"py/tuple":[
1024,
768
]
},
"steps":[
{
@gunesmes
gunesmes / ab_result.sh
Created December 12, 2014 15:25
Apache AB for server performance testing
~ ab -n 5000 -c 100 http://10.0.2.85:8080/id/540dae3162c7744fbb000004
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.0.2.85 (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests