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

FinancialForce DevTalks: Siesta Testing

FinancialForce DevTalks: Siesta Testing

3cf3d4d85fad3d196c1127018a370418?s=128

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
  2. Shrink Resource Siesta download is >5MB (static resource limit)

  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
  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
  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
  6. Visualforce element ids aren't reliable If you don't specify an

    Id If you do
  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"
  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
  9. Iterate a what now? More details:bit.ly/vf-table-index

  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
  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.
  12. Sample test data setup Running anonymous apex for test setup

  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