$30 off During Our Annual Pro Sale. View Details »

FinancialForce DevTalks: Siesta Testing

FinancialForce DevTalks: Siesta Testing

Chris Peterson

January 14, 2015
Tweet

More Decks by Chris Peterson

Other Decks in Programming

Transcript

  1. Siesta on
    Force.com
    Making your pages testable
    Chris Peterson
    Sr. Software Engineer
    FinancialForce.com

    View Slide

  2. Shrink Resource
    Siesta download is >5MB (static resource limit)

    View Slide

  3. Requires ExtJs
    ● from CDN (use cachefly for HTTPS support)
    ○ Sencha CDN is HTTP only, won't load right on
    modern browsers inside HTTPS-only visualforce
    ○ Use cachefly - same URL structure but with HTTPS
    ● from static resource
    ○ Size limits issues? Only requires
    ■ /resources
    ■ ext-all.js

    View Slide

  4. Test Harness
    ● Load tests from localhost or static resources
    ● Siesta is bound by same-origin, like all js
    ○ So make sure the harness is a visualforce page

    View Slide

  5. Working with Visualforce
    ● Use apex:actionStatus with
    waitForElementNotVisible
    ● Set separateContext : true in test definition
    ○ Prevents page rerenders breaking your test chains
    ○ Or use well-scoped rerender on all actions
    ● [Soon] AJAX toolkit for test setup/teardown

    View Slide

  6. Visualforce element ids aren't reliable
    If you don't specify an Id
    If you do

    View Slide

  7. data-tid used as a target for tests instead of id
    If you use siesta's recorder set it to use these instead of Id:
    This passes through to the generated HTML as:
    data-tid="input-accountName"

    View Slide

  8. ● Visualforce doesn't give you an index inside repeat and
    table elements.
    ● data-tid really needs to be unique for our tests
    ● Old pages can be apex:variable as a counter, but that
    broke in Sprint '12 (or somewhere around there)
    ● There's a trick that's not too disruptive: make an array of
    array indexes and iterate on that
    Visualforce Iteration

    View Slide

  9. Iterate a what now?
    More details:bit.ly/vf-table-index

    View Slide

  10. What just doesn't work
    ● *.salesforce.com pages all contain anti-
    iframe code and won't run in siesta
    ● Clickjack protection option for visualforce
    can be problematic.
    ● Cross-namespace testing won't work:
    different subdomains

    View Slide

  11. Coming Soon
    Once a bug is fixed: invoke the salesforce
    AJAX toolkit for test setup.
    Once I write the feature request: invoke the
    AJAX toolkit for test cleanup.

    View Slide

  12. Sample test data setup
    Running anonymous apex for test setup

    View Slide

  13. FAQ
    Where can I see your code?
    https://github.com/capeterson/Siesta-DevTalk
    Where can I get these slides?
    https://speakerdeck.com/ca_peterson

    View Slide