Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UI Testing for GeneXus SD apps

UI Testing for GeneXus SD apps

Nowadays automated testing has taken a major role as part of most development processes. In this regard, GeneXus 16 brings several improvements in this area.

In this session, you'll get a sneak peak of what's coming up in GeneXus 16. You'll also get to learn about how we use UI Testing in our own development process in order to provide quality releases.

Juan Andrés Diana

September 25, 2018
Tweet

More Decks by Juan Andrés Diana

Other Decks in Technology

Transcript

  1. Types of automated tests Context Unit Tests 
 Integration
 Tests

    UI
 Tests The Test Pyramid slower faster more integration more isolation
  2. Types of automated tests Context Unit Tests 
 Integration
 Tests

    UI
 Tests Slower than Unit tests Several components
  3. Types of automated tests Context Unit Tests 
 Integration
 Tests

    UI
 Tests Much Slower More faithful to reality
  4. As the project grew… Current Solution SmartDevices Generator Google Maps

    Gaode Maps Baidu Maps Apple Maps Maps Live Editing Ads Notifications AdMob MobFox SmartAd OneSignal JPush Firebase Grids APIs Horizontal Grid Flex Layout
 Grid Smart Grid Paged Grid Web Sockets App Lifecycle Logging Device Auth PhotoLibrary Audio Lottie Animations China Support Social Facebook Twitter WeChat AliPay
  5. Our test cases also grew… Current Solution Today we have

    more than 80 KBs of UI tests cases Basic controls Maps Actions … … … … … … Grids
  6. Quality of our releases Current Solution Automated UI Tests let

    us run tests: Much faster Much more often
  7. Solution since GeneXus 15 Current Solution Android UI Testing API

    (Java) iOS UI Testing API (Swift) GeneXus Domain
  8. Quick overview Current Solution Using the LightCRM Sample Available at

    http://samples.genexusserver.com/v16/home.aspx?LightCRM
  9. Basic Sample - Android Current Solution onMenu(withMenuItemTitle(“Companies”)).perform(click()); onControl(withContentDescription(“Insert")).perform(click()); onControl(withName(“CompanyName”)).perform(replaceText(“Company01")); onControl(withName(“CompanyAddress”)).perform(replaceText("123th

    Street")); onControl(withName(“CompanyPhone”)).perform(replaceText("123456789")); onControl(withContentDescription(“Save")).perform(click()); onGrid(withTextInRow(“Company01")).perform(click()); onControl(withName(“CompanyName”)).check(matches(withText(“Company01"))); onControl(withName(“CompanyAddress”)).check(matches(withText(“123th Street"))); onControl(withName(“CompanyPhone”)).check(matches(hasDescendant(withText(“123456789”)))); onControl(withContentDescription("Delete")).perform(click()); onControl(withContentDescription("Delete")).perform(click()); Java
  10. Basic Sample - Android Current Solution onMenu(withMenuItemTitle(“Companies”)).perform(click()); onControl(withContentDescription(“Insert")).perform(click()); onControl(withName(“CompanyName”)).perform(replaceText(“Company01")); onControl(withName(“CompanyAddress”)).perform(replaceText("123th

    Street")); onControl(withName(“CompanyPhone”)).perform(replaceText("123456789")); onControl(withContentDescription(“Save")).perform(click()); onGrid(withTextInRow(“Company01")).perform(click()); onControl(withName(“CompanyName”)).check(matches(withText(“Company01"))); onControl(withName(“CompanyAddress”)).check(matches(withText(“123th Street"))); onControl(withName(“CompanyPhone”)).check(matches(hasDescendant(withText(“123456789”)))); onControl(withContentDescription("Delete")).perform(click()); onControl(withContentDescription("Delete")).perform(click()); Java
  11. Basic Sample - iOS Current Solution tabBar().tap(button: "Companies") navigationBar().tap(button: "Add")

    mainTable().fill(edit: "Companyname", value: "Company01") mainTable().fill(edit: "Companyaddress", value: "123th Street") mainTable().fill(edit: "Companyphone", value: "123456789") navigationBar().tap(button: "Save") mainTable().tap(text: "Company01") validateEquals(expression1: mainTable().read(text: "Companyname"), expression2: "Company01", message: "El nombre deberia ser Company01") validateEquals(expression1: mainTable().read(text: "Companyaddress"), expression2: "123th Street", message: "La direccion deberia ser 123th Street") validateEquals(expression1: mainTable().read(text: "Companyphone"), expression2: "123456789", message: "El telefono deberia ser 123456789") navigationBar().tap(button: "Edit") mainTable().tap(button: "Delete") tap(alert: "Delete", button: "Delete") Swift
  12. Advanced Sample - Android onMenu(withMenuItemTitle(“Meetings")).perform(click()); onControl(withContentDescription("Insert")).perform(click()); onControl(withName(“MeetingTitle")).perform(replaceText(“Talk with Dave")); onControl(withName("CompanyName")).perform(click());

    onGrid(withTextInRow("Genexus")).perform(click()); onControl(withName("ContactName")).perform(click()); onGrid(withTextInRow("Anibal Gonda")).perform(click()); pickDate(withName("MeetingDate"), 2018, 11, 1); pickTime(withName("MeetingDate"), 15, 30); onControl(withContentDescription("Save")).perform(click()); onGrid(withTextInRow("Talk with Dave")).perform(click()); onControl(withContentDescription("Delete")).perform(click()); onControl(withContentDescription(“Delete")).perform(click()); Current Solution Java
  13. Advanced Sample - iOS Current Solution tabBar().tap(button: "Meetings") navigationBar().tap(button: "Add")

    mainTable().fill(edit: "Meetingtitle", value: "Talk with Dave") mainTable().tap(text: "Companyname") mainTable().tap(text: "Genexus") mainTable().tap(text: "Contactname") mainTable().tap(text: "Anibal Gonda") mainTable().editDateTime(datetime: “Meetingdate", month: “November”, day: “11”, year: “2018", hour: “1”, min: “30”, am: "PM") navigationBar().tap(button: "Save") mainTable().tap(text: "Talk with Dave") navigationBar().tap(button: "Edit") mainTable().tap(button: "Delete") tap(alert: "Delete", button: "Delete") Swift
  14. Solution since GeneXus 15 Current Solution Enable Test Mode HowTo:

    Create my first UI Test of a GeneXus Android application HowTo: Create my first UI Test of a GeneXus iOS application Documentation
  15. What problems we wanted to solve? Upcoming Solution Write once,

    run on all platforms Stay within GeneXus
  16. Underneath… Upcoming Solution Android UI Testing API (Java) iOS UI

    Testing API (Swift) GeneXus Test Language 1 0 0 1 0 1 0
 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 1 0 1 1 1 0 0 1 0 1 0
 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 1 0 1 1
  17. Test 'Companies Insertion’ tap(“Companies”) tap(“Add”) fill(“CompanyName”, “Company01”) fill(“CompanyAddress”, “123th Street”)

    fill(“CompanyPhone”, “123456789”) tap(“Save”) tapGridByText(“Grid1”, “Company01") verifyControlText(“CompanyName”, “Company01”) verifyControlText(“CompanyAddress”, “123th Street”) verifyControlText(“CompanyPhone”, “123456789”) tap(“Delete”) tap(“Delete”) EndTest Basic Sample - GeneXus Test Language Upcoming Solution
  18. Test 'Companies Insertion’ tap(“Companies”) tap(“Add”) fill(“CompanyName”, “Company01”) fill(“CompanyAddress”, “123th Street”)

    fill(“CompanyPhone”, “123456789”) tap(“Save”) tapGridByText(“Grid1”, “Company01") verifyControlText(“CompanyName”, “Company01”) verifyControlText(“CompanyAddress”, “123th Street”) verifyControlText(“CompanyPhone”, “123456789”) tap(“Delete”) tap(“Delete”) EndTest Basic Sample - GeneXus Test Language Upcoming Solution onMenu(withMenuItemTitle(“Companies”)).perform(click()); onControl(withContentDescription(“Insert")).perform(click()); onControl(withName(“CompanyName”)).perform(replaceText(“Company01")); onControl(withName(“CompanyAddress”)).perform(replaceText("123th Street")); onControl(withName(“CompanyPhone”)).perform(replaceText("123456789")); onControl(withContentDescription(“Save")).perform(click()); onGrid(withTextInRow(“Company01")).perform(click()); onControl(withName(“CompanyName”)).check(matches(withText(“Company01"))); onControl(withName(“CompanyAddress”)).check(matches(withText(“123th Street"))); onControl(withName(“CompanyPhone”)).check(matches(hasDescendant(withText(“123456789”)))); onControl(withContentDescription("Delete")).perform(click()); onControl(withContentDescription("Delete")).perform(click()); .perform(click()); tabBar().tap(button: "Companies") navigationBar().tap(button: "Add") mainTable().fill(edit: "Companyname", value: "Company01") mainTable().fill(edit: "Companyaddress", value: "123th Street") mainTable().fill(edit: "Companyphone", value: "123456789") navigationBar().tap(button: "Save") mainTable().tap(text: "Company01") validateEquals(expression1: mainTable().read(text: "Companyname"), expression2: "Company01", message: "El nombre deberia ser Company01") validateEquals(expression1: mainTable().read(text: "Companyaddress"), expression2: "123th Street", message: "La direccion deberia ser 123th Street") validateEquals(expression1: mainTable().read(text: "Companyphone"), expression2: "123456789", message: "El telefono deberia ser 123456789") navigationBar().tap(button: "Edit") mainTable().tap(button: "Delete") tap(alert: "Delete", button: "Delete") Android iOS
  19. Where we’ll write a UI test? Upcoming Solution Inside the

    KB! Write Run Results It’ll be versioned in GXServer as well
  20. Where we’ll run a UI test? Upcoming Solution Write Run

    Results Inside Genexus IDE! Or in your CI server
  21. Where we’ll see a UI test’s result? Upcoming Solution Write

    Run Results Inside Genexus IDE as well! Similar UI to the Unit Test results