Customizing Test Cases with Javascript

Although Functionize is a no code solution to test automation, we do support a significant amount of custom code in many areas in order to do more advanced, or unique tests.

Custom Javascript Action

An action type called CustomJS may be added either through Architect, or through the product web application. This allows the user to write Javascript that may interact with the browser in any way. The Javascript function that is added should return a boolean (true/false) value and the step will pass or fail according to the value return. 

Examples for when you might use CustomJS:

  • Verifying that the correct number of blog entries appear on the page
  • Verifying all ads got loaded from the correct website
  • Verifying the order in which certain information is presented to the user

See Video: Custom JS Example

If you are using an asynchronous function such as making an API call or map, for example, you will need to make a callback to Functionize when the call is complete. You can do this with functionizeeAsyncCallback.

functionizeAsyncCallback(boolean result)

 

Outcome Override

Similar to a custom Javascript Action, a user can override any verification with an Outcome Override. Fundamentally, this code will work the same as a Custom JS Action, but is tied to an element on the page. In Architect, you may Validate the code to ensure you are appropriately getting a true or false response back.

 

mceclip0.png

 

This value may be set in the Action Log -> Override tab. 

mceclip0.png

 

Also see Customizing Tests Using Selectors for additional information on Selector Overrides.