Easy Repro seems to be a bit unusual name for what is, basically, an automated UI testing framework, since it’s not so much about reproducing the issues as it is about testing various UI scenarios:
https://github.com/Microsoft/EasyRepro
And I wanted to emphasize it right here. Easy Repro is not a product.. neither it’s a technology.. It’s relatively high-level library/framework developed by Microsoft to facilitate automated UI testing specifically on the Dynamics 365 projects.
What’s powering that framework is the SeleniumHQ browser automation open-source project: https://www.seleniumhq.org/
Selenium, and, more specifically, Selenium Web Driver, gives us the way of controlling the browser from code. For the purpose of Easy Repro it’s all about C# code, but, in general, it can be Java, PHP, etc.
From that standpoint, a UI test using Selenium Web Driver would normally look like this:
- There would be some test code
- Which we would use to instruct the web driver to execute certain browser commands
- We would also use it to verify what’s been loaded into the browser in response to those commands(HTML elements, javascripts, etc)
- Finally, we would do required validations
This is all doable without Easy Repro – all you need is a Visual Studio and a quick “how to”.. for instance, you might use the one here:
https://www.guru99.com/selenium-csharp-tutorial.html
However, the main problem with doing it that way would be that you’d have to do a lot of HTML parsing. For every test you want to write, you’d have to identify HTML component so you could fill them with proper values; you’d have to find submit buttons; you’d have to analyze drop down menu structures; you’d have to.. hope you get the idea. And, in order to verify the results of your tests, you’d have to dig into those HTMLs; you’d have to find the identifiers; extract values; compare them with the expected results. As the number of tests starts growing, you’ll have to keep maintaining those test scripts, and this is going to start taking away time from other activities. Which might still be worth it because of the benefits you’ll get from automated testing, but this is where, if you wanted to make it somewhat easier to do, Easy Repro might save you some time and efforts.
That’s because, as suggested by Martin Fowler:
“When you write tests against a web page, you need to refer to elements within that web page in order to click links and determine what’s displayed. However, if you write tests that manipulate the HTML elements directly your tests will be brittle to changes in the UI. A page object wraps an HTML page, or fragment, with an application-specific API, allowing you to manipulate page elements without digging around in the HTML.”
https://martinfowler.com/bliki/PageObject.html
Easy Repro is doing exactly that – it’s introducing a level of abstraction so as to minimize the need to work with HTML directly by isolating all that low-level work in the framework code. Just have a look:
– There are 3 projects in the solution
– Out of those 3, the first two (API and Browser) represent the actual framework
You will, actually, find classes such as LoginPage, Office365Page, etc in the API project
– And the last project (Samples) shows you how to write the tests
For example, here is a sample test for creating a case in Dynamics
If you look at the code above, you’ll see how it’s calling a number of methods, but it’s not dealing with the HTML directly, and that’s exactly what Easy Repro is for. It gives you the classes (and methods) to work with various pages in Dynamics 365 so that, instead of having to work with the Web Driver by finding the HTML elements to click on etc, you can work with that high-level model and just call methods from that model.
If there are any changes in the underlying HTML model when an update for Dynamics is released, Microsoft will be updating Easy Repro classes on github, so you will only need to download updated classes/assemblies, and all your custom tests which are using Easy Repro will continue to work.
All that said, I think it’s still an open question whether it’s going to be easy to maintain those tests, even when utilizing Easy Repro. Though that might also depend on how advanced you would want those tests to be.
For example, when looking at the sample tests, you will rarely (if at all) find tests reading a value from any field. Although, there is a GetValue method in the XrmPage class. Most of the tests are all about setting some values, then saving the changes, so those samples don’t seem to take synchronous plugins/real-time workflows into account. As an alternative, maybe it would make sense to combine UI testing with server-side data testing.. As in, once the UI test has been completed, we might want to use regular SDK classes to go to Dynamics, to query data, and to run additional validations on that data. That would not be a pure UI test anymore, but that might be part of the overall test scenario.
Either way, if you do need to automate UI testing on a Dynamics project, Easy Repro is definitely worth looking at. Just keep in mind it does require some coding skills, and you may also have to start setting time aside for the maintenance of those tests moving forward.
Hello Alex, i would like to learn Easy Repro framework, can you please let me know if there is any Sample Test application URL which I can use for learning the framework?
Hi Paul, there is a sample project on GitHub: https://github.com/Microsoft/EasyRepro/tree/releases/v9.1/Microsoft.Dynamics365.UIAutomation.Sample I’m pretty sure you could just get a trial of Dynamics 365 and use it with those samples.
Hi Alex, Can we use EasyRepro for Microsoft Dynamics 365 mobile automation? If Yes, how?
Hi Sagar, I may be mistaken, but I think Selenium in general is for web applications testing, so EasyRepro is probably not going to work for mobile testing.
Hi Alex,
I tried the test methods for the standard Entities and works great. How would this work for Custom entities?
Would it just be passing the custom entity name in the below code:
Asuming its a new entity within the Sales hub.
xrmApp.Navigation.OpenSubArea(“Sales”, “CustomEntityName”)
and then accessing the fields within that ??
Hi Majesh,
yes, that’s right. It would be more or less along these lines:
xrmApp.Navigation.OpenSubArea(“Main”, “New Entities”);
xrmApp.CommandBar.ClickCommand(“New”);
xrmApp.Entity.SetValue(“ita_name”, TestSettings.GetRandomString(5,15));
Thanks Alex.
Hi Alex,
Can EasyRepro be used with Powerapps applications of a canvas-type?
Thank you
Hi, as far as I know Canvas Apps are not supported. EasyRepro relies on the html structure common for all model-driven apps, but canvas applications are not following any common structure in that sense. You can probably still try using “pure” Selenium, but it’ll be more involved than working with EsyRepro
Hi, is there any approach /technique to setup external parameters for the EasyRepro test cases or just for “pure” Selenium ? Therefore, we are trying to do load testing and want to run the same code but tweak the parameters.
Regards
Hi, maybe runsettings files would help?
https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2019
https://stackoverflow.com/questions/31707415/how-to-access-testrunparameters-within-runsettings-file
Hi Alex,
I ‘m working on Dynamic HR Management. I wonder that Easy Repro can recognize the web objects of HCM. Thanks a lot.
Regards
Hey,
I’m guessing you meant http://www.dynamics-hr-management.com? As long as it’s a model-driven application, which it seems to be, EasyRepro should work.
Hi,
I am new to using EasyRepro. Can EasyRepro be used for D365 Finance and Operations?
Thanks.
Hi, I believe it was always meant to work with Dynamics CRM/365/Model-Driven apps (but not with Finance and Operations)
Hi Alex,
I recently started using EasyRepro for CRM D365 CE but i want to know is there any restriction/unsupported to use the same automation framework for CRM D365 on-premise application? or this is framework is only for online CRM instance only?
Thanks,
Venkatesh
Hi Alex,
Can we use Easy repro for Dynamic CRM Project Operatios ??? Using Selenium is better or easy repro for Project operations automation testing which has lot of costomixations.
Thanks in advance.
Regards,
Arpita
Hi Alex,
FOr dynamics CRM Project operations automation testing , which one is better Easy repro or selenium C# ??
The project has lot of costomizations.
Regards,
Arpita
HI Alex,
Just wanted to check whether EasyRepro supports portal power app applications??
Regards,
Kashyap
Hi Kashyap,
I don’t think it does, though you could probably use native “selenium” to do that (but might have to create your own wrapper library)
Can EasyRepro work with on premise Dynamics 365 business central?