Your SlideShare is downloading. ×
0
UI Testing Taras Kalapun       1
“It seems tobe working”
“Nothing isobviously broken”
Why Create Automated Tests?• Find bugs while you sleep• Repeatable regressions tests• Quickly turn around updates to your ...
4
Potential Testing Tools                 hmmm...           5
Potential Testing Tools• Frank and UISpec       hmmm...                     5
Potential Testing Tools• Frank and UISpec       hmmm...• Sikuli                     5
Potential Testing Tools• Frank and UISpec       hmmm...• Sikuli• FoneMonkey                     5
Potential Testing Tools• Frank and UISpec       hmmm...• Sikuli• FoneMonkey• iCuke                     5
Potential Testing Tools• Frank and UISpec       hmmm...• Sikuli• FoneMonkey• iCuke• UIAutomation                     5
UI Automation      6
7
8
Loggingvar testName = "My first test";UIALogger.logStart(testName); // test codeUIALogger.logPass(testName);              ...
test("Food screen", function(target, app) {    var window = app.mainWindow();     window.tabBars()[0].buttons()["Food"].ta...
11
test("User Info screen", function(target, app) {    var window = app.mainWindow();    var tabBar = window.tabBars()[0];   ...
Handling Alerts     UIATarget.onAlert = function onAlert(alert) {        var title = alert.name();        UIALogger.logWar...
Multitasking    • Deactivate application for a given time    • Reactivating the application is handled       automatically...
+                                  ?    describe("Jasmine", function() {     it("makes testing JavaScript awesome!", funct...
16
Record/playback functional testing tool   • Records high-level user actions   • Integrates with OCUnit   • Generation of O...
18
Zucchini       19
Frank and     Cucumber20
Tests             iPhone               App        21
Tests                               UISpec   Cucumber / Ruby                          ?                              iPhon...
Tests                     Frank                          Server                               UISpec   Cucumber / Ruby    ...
Tests                Frank                     Driver                                   Frank                             ...
Tests                Frank                     Driver                                               Frank                 ...
UISpecUISpec is a Behavior Driven Development frameworkfor the iPhone that provides a full automated testingsolution that ...
UIScript$(@"textField with placeholder:UsernamesetText:bkuser");$(@"textField with placeholder:PasswordsetText:bkpassword"...
Scenario: [name of the scenario]   Given [some statement]   When [some action]   Then [some expected result]   And [anothe...
Feature: Browsing catalog In order to test catalog browsing As a user I want be able to browsethrough catalog entries     ...
CucumberFeature: Buying shoes Background: The app is running  Given I launch the app Scenario: Placing an order on shoes  ...
When /^I wait ([d.]+) second(?:s)?$/ do |seconds| seconds = seconds.to_f sleep( seconds )endThen /^I should see several en...
When /^I pick "([^"]*)" item$/ do |item| steps %Q{   When I wait to see "#{item}"   And I touch the 3rd table cell }endWhe...
29
30
robotium31
32
Refs•   http://github.com/moredip/frank•   http://cuke4ninja.com•   http://cukes.info•   http://www.slideshare.net/sgleado...
Ui BDD Testing
Upcoming SlideShare
Loading in...5
×

Ui BDD Testing

2,859

Published on

Overview of UI testing tools for iOS, specially Cucumber

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,859
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
35
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Модульное тестирование — процесс в программировании, позволяющий проверить на корректность отдельные модули исходного кода программы.\nИдея состоит в том, чтобы писать тесты для каждой нетривиальной функции или метода. Это позволяет достаточно быстро проверить, не привело ли очередное изменение кода к регрессии, то есть к появлению ошибок в уже оттестированных местах программы, а также облегчает обнаружение и устранение таких ошибок.\n
  • - try it out, press a few buttons (perhaps even mail it to the user)\n- it seems to be working => nothing is obviously broken\n* not as strong a statement (try sending that to a client)\n- manual testing takes too long\n
  • - try it out, press a few buttons (perhaps even mail it to the user)\n- it seems to be working => nothing is obviously broken\n* not as strong a statement (try sending that to a client)\n- manual testing takes too long\n
  • - try it out, press a few buttons (perhaps even mail it to the user)\n- it seems to be working => nothing is obviously broken\n* not as strong a statement (try sending that to a client)\n- manual testing takes too long\n
  • \n
  • \n
  • TOOLS FOR - actually remote controlling your app (like Selenium or WebDriver)\nSikuli - uses image analysis (fragile?)\n- simulator only unless you jailbreak your phone and run a VNC server on it\nFoneMonkey - comes from a record/playback model (does have scripting now)\niCuke - very similar to Frank but uses XML/xpath\n- pushes more work to the Ruby side, very little Objective C logic\n- potentially lead to brittle tests as XML structure more likely to change?\n- more “touch at X Y” kind of tests\nUIAutomation - Instruments + javascript + jasmine-iphone\n- could not consistently run and automate in the build, no applescript\n
  • TOOLS FOR - actually remote controlling your app (like Selenium or WebDriver)\nSikuli - uses image analysis (fragile?)\n- simulator only unless you jailbreak your phone and run a VNC server on it\nFoneMonkey - comes from a record/playback model (does have scripting now)\niCuke - very similar to Frank but uses XML/xpath\n- pushes more work to the Ruby side, very little Objective C logic\n- potentially lead to brittle tests as XML structure more likely to change?\n- more “touch at X Y” kind of tests\nUIAutomation - Instruments + javascript + jasmine-iphone\n- could not consistently run and automate in the build, no applescript\n
  • TOOLS FOR - actually remote controlling your app (like Selenium or WebDriver)\nSikuli - uses image analysis (fragile?)\n- simulator only unless you jailbreak your phone and run a VNC server on it\nFoneMonkey - comes from a record/playback model (does have scripting now)\niCuke - very similar to Frank but uses XML/xpath\n- pushes more work to the Ruby side, very little Objective C logic\n- potentially lead to brittle tests as XML structure more likely to change?\n- more “touch at X Y” kind of tests\nUIAutomation - Instruments + javascript + jasmine-iphone\n- could not consistently run and automate in the build, no applescript\n
  • TOOLS FOR - actually remote controlling your app (like Selenium or WebDriver)\nSikuli - uses image analysis (fragile?)\n- simulator only unless you jailbreak your phone and run a VNC server on it\nFoneMonkey - comes from a record/playback model (does have scripting now)\niCuke - very similar to Frank but uses XML/xpath\n- pushes more work to the Ruby side, very little Objective C logic\n- potentially lead to brittle tests as XML structure more likely to change?\n- more “touch at X Y” kind of tests\nUIAutomation - Instruments + javascript + jasmine-iphone\n- could not consistently run and automate in the build, no applescript\n
  • TOOLS FOR - actually remote controlling your app (like Selenium or WebDriver)\nSikuli - uses image analysis (fragile?)\n- simulator only unless you jailbreak your phone and run a VNC server on it\nFoneMonkey - comes from a record/playback model (does have scripting now)\niCuke - very similar to Frank but uses XML/xpath\n- pushes more work to the Ruby side, very little Objective C logic\n- potentially lead to brittle tests as XML structure more likely to change?\n- more “touch at X Y” kind of tests\nUIAutomation - Instruments + javascript + jasmine-iphone\n- could not consistently run and automate in the build, no applescript\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • - linking up a handful of open source tools to create a monster\n\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • iOS testing tool that uses UISpec's UIScript to remotely drive an App\n
  • - BDD tool modelled on RSpec\n- useful tool, not a huge community about it\n- uses a query language called UIQuery\n- difficult to run as part of a CI build (Perryn)\n- output hard to read\n- not business readable\n
  • \n
  • - describe the behavior of the app in plain English\n- business readable\n-> think at a higher level\n
  • \n
  • \n
  • \n
  • \n
  • - symbiote: talk to a running app interactively\n- view DOM & accessibility label\n- flash element\n- write the most general selector possible (less brittle tests)\n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "Ui BDD Testing"

    1. 1. UI Testing Taras Kalapun 1
    2. 2. “It seems tobe working”
    3. 3. “Nothing isobviously broken”
    4. 4. Why Create Automated Tests?• Find bugs while you sleep• Repeatable regressions tests• Quickly turn around updates to your application 3
    5. 5. 4
    6. 6. Potential Testing Tools hmmm... 5
    7. 7. Potential Testing Tools• Frank and UISpec hmmm... 5
    8. 8. Potential Testing Tools• Frank and UISpec hmmm...• Sikuli 5
    9. 9. Potential Testing Tools• Frank and UISpec hmmm...• Sikuli• FoneMonkey 5
    10. 10. Potential Testing Tools• Frank and UISpec hmmm...• Sikuli• FoneMonkey• iCuke 5
    11. 11. Potential Testing Tools• Frank and UISpec hmmm...• Sikuli• FoneMonkey• iCuke• UIAutomation 5
    12. 12. UI Automation 6
    13. 13. 7
    14. 14. 8
    15. 15. Loggingvar testName = "My first test";UIALogger.logStart(testName); // test codeUIALogger.logPass(testName); 9
    16. 16. test("Food screen", function(target, app) { var window = app.mainWindow(); window.tabBars()[0].buttons()["Food"].tap(); var e; // Choose Provider e = window.tableViews()[0].cells()[0]; waitVisible(e); e.tap(); delay(1); // Choose food e = window.tableViews()[0].cells()[0]; waitVisible(e); e.tap(); delay(1); // Put in basket e = window.tableViews()[0].cells()[0]; waitVisible(e); e.tap(); 10
    17. 17. 11
    18. 18. test("User Info screen", function(target, app) { var window = app.mainWindow(); var tabBar = window.tabBars()[0]; tabBar.buttons()["Info"].tap(); var tableView = window.tableViews()[0]; // Choose User Info waitVisible(tableView.cells()["User Info"]); tableView.cells()["User Info"].tap(); //textFields()[0].setValue(name); tableView = window.tableViews()[0]; tableView.cells()["name"].textFields()[0].setValue("Vasya"); tableView.cells()["email"].textFields()[0].setValue("test@example.com"); tableView.cells()["phone"].textFields()[0].setValue("+77777"); }); 12
    19. 19. Handling Alerts UIATarget.onAlert = function onAlert(alert) { var title = alert.name(); UIALogger.logWarning("Alert with title " +title + " encountered!"); if (title == "Warning") { alert.buttons()["OK"].tap(); return true; // bypass default handler } return false; // use default handler } 13
    20. 20. Multitasking • Deactivate application for a given time • Reactivating the application is handled automaticallyUIALogger.logMessage("Deactivating app");UIATarget.localTarget().deactivateAppForDuration(10);UIALogger.logMessage("Resuming test afterdeactivation"); 14
    21. 21. + ? describe("Jasmine", function() { it("makes testing JavaScript awesome!", function() { expect(yourCode).toBeLotsBetter(); }); });• http://pivotal.github.com/jasmine/• https://github.com/dexterous/iOS-Acceptance-Testing 15
    22. 22. 16
    23. 23. Record/playback functional testing tool • Records high-level user actions • Integrates with OCUnit • Generation of OCUnit test scripts • Generation of JavaScript UIAutomation scripts • Validation commandshttp://www.gorillalogic.com/fonemonkey 17
    24. 24. 18
    25. 25. Zucchini 19
    26. 26. Frank and Cucumber20
    27. 27. Tests iPhone App 21
    28. 28. Tests UISpec Cucumber / Ruby ? iPhone App 21
    29. 29. Tests Frank Server UISpec Cucumber / Ruby iPhone App 21
    30. 30. Tests Frank Driver Frank Server UISpec Cucumber / Ruby iPhone App 21
    31. 31. Tests Frank Driver Frank Server “frankly” UISpec Cucumber / Ruby iPhone App 21
    32. 32. UISpecUISpec is a Behavior Driven Development frameworkfor the iPhone that provides a full automated testingsolution that drives the actual iPhone UI http://code.google.com/p/uispec/ 22
    33. 33. UIScript$(@"textField with placeholder:UsernamesetText:bkuser");$(@"textField with placeholder:PasswordsetText:bkpassword");$(@"navigationButton label with text:Login touch"); 23
    34. 34. Scenario: [name of the scenario] Given [some statement] When [some action] Then [some expected result] And [another expectation] 24
    35. 35. Feature: Browsing catalog In order to test catalog browsing As a user I want be able to browsethrough catalog entries 25
    36. 36. CucumberFeature: Buying shoes Background: The app is running Given I launch the app Scenario: Placing an order on shoes When I open catalog And I switch to "Categories" view And I pick "Женская обувь" category And I pick "Босоножки" subcategory And I pick "Босоножки женские Lloyd" item And I buy the item Then I should see "1049.4" price badge 26
    37. 37. When /^I wait ([d.]+) second(?:s)?$/ do |seconds| seconds = seconds.to_f sleep( seconds )endThen /^I should see several entires in the table$/ do section = 0 expected_num_rows = 2 num_rows_array = frankly_map( "tableView first","numberOfRowsInSection:", section ) raise "no table found" if num_rows_array.empty? num_rows_array.first.should > expected_num_rowsend 27
    38. 38. When /^I pick "([^"]*)" item$/ do |item| steps %Q{ When I wait to see "#{item}" And I touch the 3rd table cell }endWhen /^I buy the item$/ do frankly_map("scrollView first scrollDown:220", "") touch "view marked:Buy"end 28
    39. 39. 29
    40. 40. 30
    41. 41. robotium31
    42. 42. 32
    43. 43. Refs• http://github.com/moredip/frank• http://cuke4ninja.com• http://cukes.info• http://www.slideshare.net/sgleadow/frank-ios-testing• http://www.slideshare.net/sgleadow/agile-ios• http://stackoverflow.com/questions/4114083/ios-tests-specs- tdd-bdd-and-integration-acceptance-testing• kiwi - BDD Logick test 33
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×