How to import Custom Code snippets (Classes) and Automation assets into Test Modeller with which you can build models and generate automation test cases in your chosen coded language already integrated within your framework.

In the example the assets are labelled 'Solar_Search_page'

Focus: language - Java, and on one particular Object.

Dependencies: use when code has no inherent back links to any other Page Objects or Identifiers in Test Modeller.

Use Case examples: Asserting PDF files or interacting with complex UI components, or connecting to a back-end data source.

Go from step 1 directly to step 5. Why? Well, updating Page Objects and uploading as Code as a one-directional process and therefore not easy to maintain. Test Modeller solves this by allowing you to Disable & Add Custom Code directly through the New Function pane. It helps avoid parts 2, 3 & 4.

Part 1a: Import the Custom Code (Class) - zipfile

This example shows code for various actions that can be performed. Import it as a zip into Test Modeller.

Click Models in main menu (in updated UI - Explorer) > Click Import button > From dropdown it’s Page Object > Browse and locate the relevant zipfile.

What’s to know? A Function Type listed as Abstract means no inherent linkback to the underlying code you’ve just imported. To verify this: click Models in main menu (in updated UI - Explorer) > Click on the newly imported module indicated by parentheses <>. Here listed is the file's path plus each functions/parameter. Click to Edit any one of the functions, and the Function Type is Abstract.

Benefit: Not having an inherent backlink allows the newly imported attributes can be overlayed across many models.

Part 1b: Begin overlaying new functions on a model canvas

Click New Model. Now on the new Canvas Import assets from the Project Explorer pane. Place a Start node and click on it > Navigate to the new import through the Project Explorer pane > Click Import after selecting each of the relevant functions listed. Result: This Automation functionality gets represented in a model (flow).

Part 2: Objects can be disabled and added by updating and deleting from the original Code

What’s to know? Test Modeller features a full Syncronization Engine for code which regonnizes patterns of the same name and structure for the purpose of merging re-uploads.

To start: Go to the original Code file independent of Test Modeller, modify it and reZip for Re-uploading.

  • Modify a Function’s attribute: Maybe you need to change the GoToURL function. Change it to for example SolrSearchPage name.

  • Delete a Function: Possible you want to delete Enter Query.

Part 3: Update these Automation references

What’s to know? The model created will indicate 'requires your attention', obviously as it sees some Objects no longer exist.

Click the Validate icon (on the right icon bar) to reveal which nodes require attention. Click the Automation Icon > Click the cog and choose Edit. Now you can relocate.

Part 4: Equally it’s possible add code and synchronising it to the original scanned Code Test Modeller

Back in the folder containing the required Page Object. Click Import > Code Page Object > Locate the Java file. The new Object is syncronised with the orignal Scanned Object.

What’s to know? Again, this is marked as Function Type: Abstract.

A one-directional process: The new Generated Object doesn’t download with the original Code file.

Part 5: Main Custom Code within Test Modeller

Click Add New Function > Drop down on Function Type to Custom Code > Click Customer Code tab > Add code.