Important note: tests created for Dynamics NAV 2017 Web Client may not work on Dynamics 365 Business Central without any changes.  Though both solutions look very similar there are differences in design.

Note: at the time of writing this article the best option is to use Firefox for recording.  Firefox version used is 60.0.1 (64-bit).

In this article we'll not cover login into the system. Best option is to setup auto login:

or record a separate test that will ensure that user is logged in and just invoke it at the beginning of your test scenarios with Global.DoInvokeTest.

You can also use login test from rapise-powerpack repository.

So we start from the home page.

After performing a first recording session do self check. Ensure that the list of libraries in the main test file contains DomDynamicsNAV.

g_load_libraries=["%g_browserLibrary:Firefox HTML%", "DomDynamicsNAV"];

Recording Tips

General Rules

Do not hurry and let Rapise capture your actions. When an action is captured it is added to the Recording Activity Dialog:

Note: Rapise does not capture drag and  drag & drop mouse moves.

Record in small sessions: 5-10 steps. Then ensure playback works as you expect. Rapise can attach to a browser at any state (unlike Selenium which always starts a new browser session).

Links, Buttons

Clicks on links and buttons are just recorded, nothing special.

Edit Fields

Click on a field to set focus. Rapise will capture the Click action. Then enter text using keyboard.  Press TAB to move focus out of the field and Rapise will capture SetText action.

Lookup Values

Click on the ... button and then choose a value from the drop down table.

Rapise will capture Open action for the button and then ClickCell action for the value.

Tables

Basic rule is to record  a click on a cell first. Then if the cell has a lookup table click on Open button.  After recording the test must contain a cell click operation before any interaction with cell's value.

Here is the recording session that resulted in the RVL presented above.

Note:  Since build 5.6.13.23 Rapise automatically scrolls tables horizontally during playback. This is to make a required column visible on screen.

If Recorded Test Fails on Playback

Symptom #1:  Object Is Not Found

Reason #1: Page is Not Ready Yet

Browser did not have enough time to initialize all controls after loading data from a server.  This may happen of previous action of the test was navigation or AJAX operation. There are two ways to adjust the test.

1. Insert Global.DoWaitFor('objId')  action before interacting with the control.

2. Or change test settings that define how many times Rapise tries to find an object during playback. E.g. set ObjectLookupAttempts to 30.

Reason #2: Object is Not Available at Specified XPath

If you believe that the object is on screen but it can not be found on playback do additional check. Select the object in the object tree and do Flash.

If object is not found try to re-learn it (Re-Learn item in the same popup menu you used to Flash). If object is still not found copy it's XPath from Properties grid to clipboard and launch Web Spy.

In Spy paste XPath into the first field on the ribbon (highlighted) and press Test XPath  button. Object will not be found. Adjust the XPath expression until Test XPath returns the only result. After that copy new XPath, close Spy and paste XPath expression into the Properties grid (in the field where you originally copied it to clipboard).