Easy Repro: what is it?

By | June 25, 2018

 

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:

image

  • 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

image

– 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

image

–  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

image

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.

Leave a Reply

Your email address will not be published. Required fields are marked *