Automating Salesforce CPQ Testing

Automating Salesforce CPQ Testing

Salesforce CPQ(Configure-Price-Quote) solution from Salesforce is based on the Lightning experience. It has some of the elements that account for a challenge – that of standard automation methods, of the likes of using Selenium.

CPQ is native for Sales Cloud or Service Cloud orgs. We need to come down to the brass stacks of “Why automate Salesforce CPQ testing?”.

Why automate Salesforce CPQ testing?

As we all know that Salesforce comes up with three automatic upgrades in a year and the same applies for CPQ too. So, it is quite a difficult proposition for the testers to test the CPQ features manually. It becomes a tedious and uphill task for the testing team.

Moreover, the CPQ is a complex product and it is indeed a time-consuming task for the testing team. So, here is where enters the automated tests. They serve the best way to achieve predictable and repeatable assessment of the quality of the custom code, in question. If you need to know “How helpful are the automated tests?”.

Then without any hesitation, we must state that the automated tests quicken the process of getting feedback. This feedback is on the quality of the custom code.

We would also like to highlight some of the challenges of Salesforce CPQ. Let us discuss some of these challenges.

Salesforce CPQ Field locators

It is difficult to handle Salesforce CPQ testing, while used with the traditional automation methods of the likes of Selenium. The Salesforce CPQ pages are said to make heavy use of shadow DOM. This is made accessible with CSS  locators – not with Xpaths or even Field IDs. However, the CSS locators are unable to match with texts. So, it becomes difficult to locate shadow DOM elements.

Salesforce CPQ tabs and tables

The Salesforce CPQ pages have yet another issue. This pertains to the internal tab, controlling the fields and tables, visible under the tab. Since it requires an awareness of “active tabs”, it is difficult to control by Selenium.

The right fields are not to be found, on selecting the wrong tab. This leads to test failures.

Quote Line Editor Drawers

The Quote Line Editor Drawers can be used in quote line editors. This allows to better handle a large field set. The fields which are placed in the collapsible drawer below the line item can be accessible by clicking on the arrow, appearing at the end of the quote line. The arrow must be at the end of expanding settings, for accessing the fields below. Otherwise, it becomes difficult to handle this situation.

In this post, we will provide insights on the different types of automated tests for Salesforce CPQ and will throw some light on the guidelines for writing automated tests.

What are the Different Types of Automated Tests for Salesforce CPQ?

The various types of automated tests for Salesforce CPQ are:

  • Apex Tests
  • CPQ API Tests
  • Selenium Webdriver UI Tests
  • Lighting Component Tests

Apex Tests

Apex tests run automatically, before and after the upgrades. There are many ways by means of which Apex tests can be used in Salesforce CPQ. Some of the examples to cite are – ordering, contracting, amending and renewal flows. In addition to this, it covers any functionality related to SObjects. However, CRUD, UI and REST services are out of the scope of Apex.

Here is a code snippet on a sample Apex test.

CPQ API Tests

The API helps to test the REST-based services on Heroku. The CPQ API tests are useful to test:

  • Quote Calculator Plugins
  • Quote Calculate Functionality
  • Document Generation

Here is a code snippet on a sample Apex test.

Webdriver UI Tests with Selenium

Browser actions can be automated by writing tests with the Selenium framework. However, Selenium tests are only to be recommended for the complex workflows, because these are expensive to run or maintain.

These tests can be specifically recommended for client-side features an end-to-end workflow. The tests also get modified with changes in UI.

Finally, the Page Object patterns encapsulate the locators and operations – all in a single class. This is used to reduce maintenance cost and enhance readability.

Here is a code snippet on Selenium Webdriver for the CPQ QuoteLineEditor.

Lighting Component Tests

In the case of Lightning components, Lightning Testing Services(LTS) can be used to create test suites for the LIghtning components. This uses standard Javascript frameworks such as Jasmine and Mocha. The built-in features of LTS are extremely beneficial to write these tests.

Salesforce CPQ is built on a Lightning platform and seamlessly integrates with many of the Sales Cloud features. The automation strategy evolved must have layers to map the layers in the CPQ. Here are some of the best practices on writing the automated tests.

Best Practices on Writing the Automated Tests

Test at the Right Layer

The tests must be written in the right layer. A CPQ REST API test is written if you need to write a test on a calculation. Otherwise, simply write a component test for a custom UI component.

Carry Out Mutually Exclusive Tests

The tests must set up the applications specific to the needs and has to be cleaned up, once completed. The test results produced must be the same – irrespective of the size of the test- a small or a large set of suites. However, the set up is varied, when it is complex or cost-prohibitive for automation.

Follow Single Level of Abstraction Policy(SLAP)

The test case must have the ability to do everything that is required,  whatever it might be – data set up, helper methods and utility.

Limit to a Few Assertions

A test has only one thing to evaluate, so assertions must be limited to one or more only. When running tests that are expensive, it is important to remember that tests need to be split and a threshold used for the same purpose. Usually, three assertions is a good threshold. This is more so for a Black Box.

Summary

Salesforce comes up with three upgrades in a year, so the testers find it an uphill task to manually test the features of CPQ. Since CPQ is a complex product, so the testers will find it time-consuming. The automated tests quicken the process of providing feedback on the quality of the custom code, written for the purpose. There are various types of automated tests for Salesforce CPQ and testers need to adhere to some of the best practices on testing the Salesforce CPQ.  

Differences between Flutter and React Native

Differences between Flutter and React Native

On leading app stores such as Google Play stores, several apps are being developed and deployed almost on a daily basis. Today, cross-platform app development, hybrid app development, and native app development have become prominent among business professionals and app developers.

Each of these frameworks has a unique architecture to build apps. While cross-platform and hybrid frameworks save time and cost, native apps offer superior user experience. The cross-platform and hybrid framework also provides a faster time to market.

In this blog, we will discuss the two cross-platform app development tools, React Native and Flutter.

Flutter

Flutter is used for creating superior-quality apps using a single code base. It is an open-source Google’s open-source SDK for Android and iOS. This can be used to create applications for a capability-based operating system from Google, i.e. Google Fuchsia. Flutter is based on Dart language and provides a captivating graphics’ library.

It is backed by Google and used to develop applications for Android and iOS.

Flutter uses Dart

Dart was developed by Google in 2011. It uses modern features of several languages to code beautiful native apps. It is quite new to the developers. It is easy-to-use for people who have experience developing apps in OOP languages such as C++ and Java. It is a general-purpose programming language with features aimed at client-side development and is a great fit for both mobile and web apps. Dart is used for creating high-quality, mission-critical apps for iOS, Android, and the web.

Architecture of Flutter

A Dart application architecture is inspired by RefluxJS and Facebook’s Flux. It has a library of unidirectional data flow. Flutter-flux implements a unidirectional data flow pattern comprising of StoreWatchers, Actions, and Stores.

Features of Flutter

  • It offers Native performance.
  • It has a Stateful Hot Reload feature for faster app development.
  • It offers a fully customized environment.
  • It is a Platform-specific SDK.
  • It has design-specific widgets.

Users of Flutter

  • Abbey Road Studios app is built with Flutter.
  • Alibaba used Flutter to create a beautiful experience on their Xianyu app.
  • Google internal customer management app, Called GreenTea, uses Flutter in its development environment.
  • The official app of Broadway Musical, called Hamilton Musical, is created using the Flutter framework.
  • Leading FinTech company JD Finance makes use of Flutter.

React Native

React Native, created by Facebook, is an open-source mobile application framework It is used to develop applications for Android, iOS, and UWP by enabling developers to use React along with native platform capabilities.

React Native Uses Javascript

It allows developers to build an app using only JavaScript. JavaScript has received enormous popularity: be it a mobile, web, or server-specific code. JavaScript compiles its dynamic code for native view at runtime. The remaining code runs in addition to a virtual machine that is packaged inside the app.

React Native Architecture

React Native application architecture is Called Flux. Most frameworks follow the MVC framework. Facebook uses Flux to build client-side web applications. The main concept of Flux is its unidirectional data flow. Here, React takes care of the view part and Flux, a programming pattern takes care of the Model in the MVC.

Features of React Native

  • It offers strong performance for mobile environments.
  • It is highly cost saving.
  • It has a modular and intuitive architecture.
  • It is a community-driven platform.
  • It offers Maximum code reuse.

Users of React Native

  • Facebook Ads Manager, a cross-platform app, is the first fully built on React Native framework application.
  • The Instagram app uses a React Native framework for easy maintenance of both Android and iOS platforms.
  • The Bloomberg app adopted React Native for their mobile app development.
  • The Airbnb app is built with React Native.
  • Myntra an online shopping portal app is built on React Native.

Similarities Between Flutter and React Native

  • Both offer rapid, superior, and high-quality app performances on multiple platforms, including iOS and Android. Both React Native and Flutter, Are Designed For Cross-Platform App Development.
  • Both have strong developers’ communities and both are backed By Giant Tech Communities. Flutter is Google’s open-source SDK for mobile app development and React Native is offered by Facebook.
  • Both are open-Source, free, and fast platforms that allow developers to create amazing apps quickly due to their native performances.
  • Both of these frameworks are keeping their documentation up-to-date with API references and comprehensive resources.
  • Both frameworks offer excellent UI support and native experience. Flutter uses rich widgets to provide remarkable native experience on Android and iOS platforms. React Native also uses fundamental UI building elements as you use in Android/iOS to deliver the native experience.

Conclusion

React Native is useful for delivering excellent user experiences. But Flutter wins over its performance because of its simple interface. Flutter also has the advantage of reusing the code and using the JavaScript layer to make communication with the native components easier. React Native is less suitable because of its architecture.

Pin It on Pinterest