1

Salesforce already uses both unit tests & Selenium to automate out-of-the-box features.

Our developers are covering their code with unit tests.

In order to avoid redundancy regarding the above, how shall we identify what UI tests should also be automated with our own Selenium?

Is it only custom UI elements that we should be concerned with?

How about out-of-the-box UI elements which interact with custom apex class, triggers, JS helpers, etc?

Basically I'd like to create a checklist, that I can apply to any feature of the product to determine if it is a good candidate for UI test automation.

Like, if the feature involves x, y or z - then it's probably a good idea to automate it.

5

Apex Code and Triggers should be unit tested with Apex Code. Standard components should never be tested; it would do well for you to trust that standard platform features won't break (or, if they do, they'll be fixed without your intervention).

Custom elements that rely heavily on JavaScript, including buttons, links, Visualforce pages and components, and Lightning components and apps, should all be Selenium tested. Lightweight, trivial JavaScript can probably be statically verified as correct without actual Selenium testing, which will probably be true for most buttons, links, and Visualforce pages.

Lightning will eventually have its own isolated-testing framework, in which case Selenium testing will no longer be necessary or even desirable. You may want to hold off on Selenium testing anything trivial, because we're going to have better tools soon.

| improve this answer | |
  • thanks for your help. What do you mean by lightning apps? The product my team is building/testing is an app for the exchange. – Dingredient Aug 18 '17 at 19:35
  • @PatMeeker Everything's an "app" these days. A Lightning app is an AuraDefinitionBundle that contains an application (a stand-alone component that starts off with aura:application, which may or may not be the same as the app you're thinking of. – sfdcfox Aug 18 '17 at 19:49
  • What do you mean by lightning testing framework ? Configurable automation testing for any custom app/ component , on all browsers etc ? We are currently finalizing such tool (using selenium) because we need our isv to be reliable today ... why would such vital tool become not desirable in the future ? – Nicolas Vuillamy Aug 20 '17 at 0:11
  • @NicolasVuillamy We don't know enough about what the Lightning testing framework yet, but presumably a testing framework would allow us to isolate test data from real data, something Selenium cannot do. In that case, if such a feature were released, it would be vastly superior to Selenium testing, which can cause real harm to real data. I'm not trying to dissuade people from Selenium testing in the here and now, because it's one of the best options we have, but tests should ideally not be able to affect real data. – sfdcfox Aug 20 '17 at 0:41
  • I understand your point of view but respectfully disagree with it : selenium allows to test a full application (UI,apex, integration...) and saves a lot of time to real humans who have to click manually if they don't have such automated testing tool, so telling people to not invest in such solution, to wait for a tool we know nothing about, is not a good idea. About data ... big tests must happen in a separate org than production org, where you can generate any dummy record needed for testing. – Nicolas Vuillamy Aug 21 '17 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.