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 / 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 / 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 / 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 / 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 / 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 / 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 / locust_check_result_file.py
Last active February 25, 2019 13:14
Integration of Locust and Jenkins.
import re, sys
import os
MIN_RESPONSE_TIME = int(os.environ['min_response_time'])
MAX_RESPONSE_TIME = int(os.environ['max_response_time'])
AVG_RESPONSE_TIME = int(os.environ['avg_response_time'])
print("\n---- Test Parameters -----\n")
print("MIN_RESPONSE_TIME: %d" % MIN_RESPONSE_TIME)
print("MAX_RESPONSE_TIME: %d" % MAX_RESPONSE_TIME)
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "MOTO G 2");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity","com.google.android.apps.chrome.ChromeTabbedActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
n = 15
chr = ' +'
for i in xrange(n):
line = ''
if i == 0 or i == n - 1 or i == (n / 2):
line = n * chr
else:
if i < n / 2:
middle = i * 2 - 1
n = 15
chr = ' +'
for i in xrange(n):
line = ''
if i == 0 or i == n - 1 or i == (n / 2):
line = n * chr
else:
if i < n / 2:
middle = i * 2 - 1