1

How can one apply Window Object Model to a WPF application (or POM for web application) that actually doesn't contain different windows?

Actually, I'm working on automating WPF application using CodedUI, and that application doesn't contain different windows for each module. My application under test is using only one WpfWindow and other windows are being displayed inside that main window only. So, what approach should I take to use Window Object Model in my testing or in this case I can't use it.

3 Answers 3

2

Of course you can use the WOM/POM. You need to consider DRY (Don't Repeat Yourself) and Single Responsibility/Ownership (Each function is owned by exactly one object, and is the sole responsibility of that object).

You can define parent/child relationships within your model objects to deal with the fact that your application creates child windows.

So, if your application has a login, you'd have a LoginWindow object to handle logging in. You might also have a HomeWindow object for the home screen after a successful login. If your application uses components that can appear on more than one window/screen/module define an object for these components, such as MiniCartComponent for (as an example) the shopping cart icon that displays on multiple screens/pages in a web store app.

My approach here would be to start with the obvious objects, create helper libraries for routine repeated tasks like navigation between screens, and refactor as necessary until the whole thing was as clean as I could get it.

2

I think Martin Fowler's definition of Page Objects is really helpful:

Despite the term "page" object, these objects shouldn't usually be built for each page, but rather for the significant elements on a page

https://martinfowler.com/bliki/PageObject.html

Then, as Kate has suggested, you can continue to use good practice OOP principles for each of your objects, with functional groupings rather than 'page' groupings.

1
  • I really like the blog content and it was very helpful.
    – Dhiman
    Commented Feb 23, 2017 at 17:18
-1

Just use PiriPiri nuget package in coded ui project. And the implementation is same as selenium. Link goes here https://www.nuget.org/packages/PiriPiri For the documentation you can refer here https://ethenhunt321.github.io/Index.html

And luckily I am the owner of this package too.

3
  • 1
    Please edit your answer to state that you are the author/owner of the package. Please also expand on your answer to explain why your package provides a better outcome for the OP than the other answers. If you do not do this, your response is likely to be flagged as spam. (sqa.stackexchange.com/help/promotion)
    – Kate Paulk
    Commented Aug 21, 2018 at 16:10
  • Till now there is no such package till now which provide such design pattern. This has been tested several times and ended with best outcome. The implementation is exactly same as selenium. I am sure one who is asking about this here must have gone through same in selenium, and if knows same he can even implement same in coded ui in fraction of minutes. Commented Aug 21, 2018 at 16:17
  • That's fine - but you must tell us in the body of your answer that you are the author of the package. Otherwise your answer violates the anti-spam policy.
    – Kate Paulk
    Commented Aug 22, 2018 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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