Automated Unit Testing has now become one of the most important aspects of any project implementation. Unit Testing makes sure that the code works as expected. Also, if there are any changes or any new functionality is implemented, running the unit test makes sure that the code is still behaving properly and the addition of changes hasn’t broken it.
Download it from the below location.
XrmPage-Mock as the name implies mocks the XrmPage object and its functions.
To get started, create a blank ASP.NET Web Application.
Select the Empty template.
Download the latest version.
- qunit 2.9.2.js
- qunit 2.9.2.css
Create a new Script and CSS folder in the solution to add the Qunit and XrmPage-Mock libraries
Based on the gender code, we are showing and hiding the birthdate field on the form.
Below is our Test File. It mocks the attributes used and then calls the function.
Below is the HTML page which will display the test result.
Add all the required css and js files along with the DIV as shown below.
Open the page in the browser to check the Test Results