I'm working on an automation project in C# and it has 2 wrappers: DesktopAutomation and BrowsersAutomation. The first has a dependency on UIAutomation.dlls (access to the MS desktop elements) and the latter on Selenium. Their role is understood I hope ;)

Now, There are user actions on the browsers that require a dependency on UIAutomation(or DesktopAutomation for that matter), since Selenium gives you access to the DOM and not the extensions buttons in Chrome for example.

So my question is, what would be the correct way / best practice, software construction wise:

  1. Adding a dependency to BrowsersAutomation on DesktopAutomation which has the advantage of a working project that has existing methods I can use.
  2. Adding a direct dependency to BrowsersAutomation on UIAutomation.dlls which makes this project more generic. e.g. using it in other projects won't require another dependency.

Or, perhaps, some other configuration I haven't thought of...?

  • 1
    If the requirements change such that only the automation from within a browser remains, would it then be viable to drop DesktopAutomation completely without affecting the overall architecture and functionality? If yes, then BrowserAutomation does not have an actual dependency on DesktopAutomation. They just happen to share UIAutomation.dll as a common dependency. – Bart van Ingen Schenau Jan 1 '17 at 13:28
  • DesktopAutomation is necessary regardless of BrowsersAutomation. – Moshisho Jan 2 '17 at 7:39

This sentence of yours

which has the advantage of a working project that has existing methods I can use

means there are reusable methods or classes which might be used both from BrowsersAutomation and from some non-generic parts of DesktopAutomation, right?

If that is correct, I recommend you refactor the reusable methods from DesktopAutomation to a place where they can be used from BrowsersAutomation and DesktopAutomation as well, for example, to a new DLL called MyUIAutomation.DLL (I assume you cannot put the methods into UIAutomation.DLL directly, because you have a 3rd party lib like Microsoft's UIAutomationCore.DLL in mind with that, right)?

This approach gives you the benefit you named in point 1 (reusage of existing methods) together with the advantage of not making BrowsersAutomation depend on the non-generic parts of DesktopAutomation.

| improve this answer | |
  • Thanks for the reply! I like the idea of making another library which will be more generic. I'll give it a try. – Moshisho Jan 2 '17 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.