Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Polyglot Automation
@yashaka
Preface…
@yashaka
What Language?
Automation
=
Automating manual routine work
Automation
=>
QA 

???
Effective Automation
=>
QA
Polyglot Automation
=
Using Any Language to make it Effective
Effective Automation
*=
with Backend Language
Web UI
Why?
Developers can help with implementation
Easier for devs to use and support tests
Smaller Tech Stack. No Zoo at project :)
...
Allows to use fast & efficient test data pre-setup!
Demo
Full coverage for TodoMVC:
Without “backend” preconditions: 24s
With “backend” preconditions: 16s
=> optimised for 30%
A remark
TodoMVC is very simple app with small lightweight
“preconditions” in tests
Real app will usually have much more “...
But it’s hard,
no?
Hard to:
learn new language…
use statically typed Java/C# over dynamic Python/
Ruby…
?
No:p
No:p
if you use “easy tools” ;)
Examples
Tests
public class TodoMVCTest {



@Test

public void testFilterTasks(){

Tasks.visit();



Tasks.add("a", "b", "c");

Tasks.sh...
[TestFixture ()]

public class Test : BaseTest

{

[Test ()]

public void FilterTasks ()

{

Tasks.Visit ();



Tasks.Add ...
class TestTodoMVC(BaseTest):



def test_filter_tasks(self):



tasks.visit()



tasks.add("a", "b", "c")

tasks.should_be...
describe "todomvc" do


it "filters tasks" do

Tasks.open

Tasks.add "a", "b", "c"

Tasks.should_be "a", "b", "c"



Tasks...
Helpers
simpler
public class Tasks {



...

public static void visit() {


open("https://todomvc4tasj.herokuapp.com/");

}



public stat...
public static class Tasks

{

... 

public static void Visit()

{

Open ("https://todomvc4tasj.herokuapp.com/");

}



pub...
…
def visit():



tools.visit("https://todomvc4tasj.herokuapp.com/")





def filter_active():



s(by_link_text(”Active”)...
module Tasks

extend Capybara::DSL

def self.open


visit 'https://todomvc4tasj.herokuapp.com'

end


def self.filter_acti...
Helpers
a bit harder
public class Tasks {



public static ElementsCollection tasks = $$("#todo-list>li");



...


public static void toggle(S...
public static class Tasks

{

public static SCollection List = SS ("#todo-list>li"); 



...



public static void Toggle ...
tasks = ss("#todo-list>li")



...
def toggle(task_text):



tasks.findBy(exact_text(task_text)).find(".toggle").click()

...
module Tasks

extend Capybara::DSL



def self.tasks

all "#todo-list>li"

end


...

def self.toggle task_text


(tasks.f...
Easy?
Easy Tools?
Java: Selenide
Python: Selene is coming…
C#: NSelene is coming…
Ruby: Capybara
? JavaScript: Protractor
? PHP: Codeception
No ready Easy Tool for your
language?
Lack of knowledge?
=> ask project’s developers to write it for you
Brave?
=> impleme...
How to become polyglot
automation engineer?
Just learn ONE Language perfectly.
Then
Don’t be afraid to switch to other whe...
Learn next language
learnxinyminutes.com
+

koans
+
practice solving common tasks
+
google.com
Afterwords
There are good practices in context,
but there are no best practices.
(c) Cem Kaner, James Bach
Q&A
github.com/yashaka
youtube.com/c/ItlabsNetUa
gitter.im/yashaka/better-selenium
yashaka@gmail.com@yashaka
www.itlabs.net.ua
contact@itlabs.net
+38 (073) 467-61-12
Thank you!
QA Fest 2015. Яков Крамаренко. Polyglot automation
QA Fest 2015. Яков Крамаренко. Polyglot automation
Upcoming SlideShare
Loading in …5
×

QA Fest 2015. Яков Крамаренко. Polyglot automation

430 views

Published on

Есть множество замечательных и удобных языков программирования. Но автоматизация тестирования обычно достаточно проста, чтобы мощность языка не играла роли для ее построения. Но сам выбор языка автоматизации под проект значение имеет. Почему автоматизация веб приложений это просто, и что нужно чтобы она такой была? Какой язык выбрать и почему? Как быстро выучить новый язык? Как выбрать простой инструмент автоматизации или как и построить его самому? На эти вопросы мы и попробуем ответить.

Published in: Education
  • Be the first to comment

QA Fest 2015. Яков Крамаренко. Polyglot automation

  1. 1. Polyglot Automation @yashaka
  2. 2. Preface… @yashaka
  3. 3. What Language?
  4. 4. Automation = Automating manual routine work
  5. 5. Automation => QA 
 ???
  6. 6. Effective Automation => QA
  7. 7. Polyglot Automation = Using Any Language to make it Effective
  8. 8. Effective Automation *= with Backend Language Web UI
  9. 9. Why?
  10. 10. Developers can help with implementation Easier for devs to use and support tests Smaller Tech Stack. No Zoo at project :) And…
  11. 11. Allows to use fast & efficient test data pre-setup!
  12. 12. Demo
  13. 13. Full coverage for TodoMVC: Without “backend” preconditions: 24s With “backend” preconditions: 16s => optimised for 30%
  14. 14. A remark TodoMVC is very simple app with small lightweight “preconditions” in tests Real app will usually have much more “hardweight” preconditions So the optimisation may be much bigger
  15. 15. But it’s hard, no?
  16. 16. Hard to: learn new language… use statically typed Java/C# over dynamic Python/ Ruby… ?
  17. 17. No:p
  18. 18. No:p if you use “easy tools” ;)
  19. 19. Examples
  20. 20. Tests
  21. 21. public class TodoMVCTest {
 
 @Test
 public void testFilterTasks(){
 Tasks.visit();
 
 Tasks.add("a", "b", "c");
 Tasks.shouldBe("a", "b", "c");
 
 Tasks.toggle("b");
 
 Tasks.filterActive ();
 Tasks.shouldBe("a", "c");
 
 Tasks.filterCompleted ();
 Tasks.shouldBe("b");
 }
 }
  22. 22. [TestFixture ()]
 public class Test : BaseTest
 {
 [Test ()]
 public void FilterTasks ()
 {
 Tasks.Visit ();
 
 Tasks.Add ("a", "b", "c");
 Tasks.ShouldBe ("a", "b", "c");
 
 Tasks.Toggle ("b"); 
 
 Tasks.FilterActive ();
 Tasks.ShouldBe ("a", "c");
 
 Tasks.FilterCompleted ();
 Tasks.ShouldBe ("b");
 }
 }
  23. 23. class TestTodoMVC(BaseTest):
 
 def test_filter_tasks(self):
 
 tasks.visit()
 
 tasks.add("a", "b", "c")
 tasks.should_be("a", "b", "c")
 
 tasks.toggle("b")
 
 tasks.filter_active ()
 tasks.should_be("a", "c")
 
 tasks.filter_completed ()
 tasks.should_be("b")
  24. 24. describe "todomvc" do 
 it "filters tasks" do
 Tasks.open
 Tasks.add "a", "b", "c"
 Tasks.should_be "a", "b", "c"
 
 Tasks.toggle "b"
 
 Tasks.filter_active
 Tasks.should_be "a", "c"
 
 Tasks.filter_completed
 Tasks.should_be "b"
 end
 end
  25. 25. Helpers simpler
  26. 26. public class Tasks {
 
 ...
 public static void visit() { 
 open("https://todomvc4tasj.herokuapp.com/");
 }
 
 public static void filterActive(){ 
 $(By.linkText("Active")).click();
 }
 
 public static void filterCompleted(){ 
 $(By.linkText("Completed")).click();
 }
 
 public static void add(String... taskTexts) { 
 for(String text: taskTexts){ 
 $("#new-todo").setValue(text).pressEnter();
 }
 } ...
 }
  27. 27. public static class Tasks
 {
 ... 
 public static void Visit()
 {
 Open ("https://todomvc4tasj.herokuapp.com/");
 }
 
 public static void FilterActive ()
 {
 S (By.LinkText ("Active")).Click ();
 }
 
 public static void FilterCompleted ()
 {
 S (By.LinkText ("Completed")).Click ();
 }
 
 public static void Add(params string[] taskTexts)
 {
 foreach (var text in taskTexts) 
 {
 S ("#new-todo").SetValue (text).PressEnter ();
 }
 } ...
 }
  28. 28. … def visit():
 
 tools.visit("https://todomvc4tasj.herokuapp.com/")
 
 
 def filter_active():
 
 s(by_link_text(”Active”)).click()
 
 
 def filter_completed():
 
 s(by_link_text(”Completed”)).click()
 
 
 def add(*task_texts):
 
 for text in task_texts: 
 s("#new-todo").set_value(text).press_enter()
  29. 29. module Tasks
 extend Capybara::DSL
 def self.open 
 visit 'https://todomvc4tasj.herokuapp.com'
 end 
 def self.filter_active 
 find("a", text:"Active").click
 end
 
 def self.filter_completed 
 find("a", text:"Completed").click
 end
 
 def self.add *task_texts 
 task_texts.each do |text| 
 find("#new-todo").send_keys(text, :enter)
 end
 end
 
 ...

  30. 30. Helpers a bit harder
  31. 31. public class Tasks {
 
 public static ElementsCollection tasks = $$("#todo-list>li");
 
 ... 
 public static void toggle(String taskText) { 
 tasks.findBy(exactText(taskText)).find(".toggle").click();
 }
 
 public static void shouldBe(String... taskTexts) { 
 tasks.filterBy(visible).shouldHave(exactTexts(taskTexts));
 }
 }
  32. 32. public static class Tasks
 {
 public static SCollection List = SS ("#todo-list>li"); 
 
 ...
 
 public static void Toggle (string taskText)
 {
 List.FindBy (Have.ExactText(taskText)).Find (".toggle").Click();
 }
 
 public static void ShouldBe(params string[] names) {
 List.FilterBy (Be.Visible).Should (Have.Texts (names));
 }
 }
  33. 33. tasks = ss("#todo-list>li")
 
 ... def toggle(task_text):
 
 tasks.findBy(exact_text(task_text)).find(".toggle").click()
 
 
 def should_be(*task_texts):
 
 tasks.filterBy(visible).should_have(exact_texts(*task_texts))
  34. 34. module Tasks
 extend Capybara::DSL
 
 def self.tasks
 all "#todo-list>li"
 end 
 ...
 def self.toggle task_text 
 (tasks.findBy {|task| task.text == task_text}).find(".toggle").click
 end
 
 def self.should_be *task_texts 
 tasks.texts.should == task_texts
 end
 end
  35. 35. Easy?
  36. 36. Easy Tools?
  37. 37. Java: Selenide Python: Selene is coming… C#: NSelene is coming… Ruby: Capybara ? JavaScript: Protractor ? PHP: Codeception
  38. 38. No ready Easy Tool for your language? Lack of knowledge? => ask project’s developers to write it for you Brave? => implement it by your own
  39. 39. How to become polyglot automation engineer? Just learn ONE Language perfectly. Then Don’t be afraid to switch to other when it fits better
  40. 40. Learn next language learnxinyminutes.com +
 koans + practice solving common tasks + google.com
  41. 41. Afterwords There are good practices in context, but there are no best practices. (c) Cem Kaner, James Bach
  42. 42. Q&A
  43. 43. github.com/yashaka youtube.com/c/ItlabsNetUa gitter.im/yashaka/better-selenium yashaka@gmail.com@yashaka
  44. 44. www.itlabs.net.ua contact@itlabs.net +38 (073) 467-61-12 Thank you!

×