1

I have some experience with using Selenium and Python to set up testing frameworks for web applications using the Page Object pattern. However, my current employer wishes to keep all of our tests within TestComplete. I was wondering if it's possible to use the Page Object Model with TestCompelete. I can think of the following two ways of going about this - but I'm unsure if they work in practice.

  1. Create PageObjects inside of TestComplete in either Python or using the Record/Play tool, and then write a series of test suites using these Page Objects.

  2. Create a Page Object Model framework outside of TestComplete using Python and Selenium, and then import this into TestComplete, where I would write a series of test suites using methods created via this framework.

Any advice or stories on successfully/unsuccessfully implementing the Page Object Model in TestComplete would be appreciated too.

2

Yes, you can use the Page Object model with TestComplete. You can use Selenium, or you can learn how TestComplete's web object model works and use that instead. If you haven't already done so, I'd recommend reading SmartBear's documentation on the topic.

Some of the things you will need to consider:

  • To use Selenium, you would need to work out how to reference the Selenium .dll files and manually build the reference into your test projects. My experience with TestComplete and third-party .dll files is that it's a lot easier to work with TestComplete's built-in functionality
  • TestComplete's web control management is extremely easy to work with. I strongly recommend using it rather than Selenium, then using TestComplete's aliasing ability to define simple named aliases for the controls you are interacting with. That way, if something changes you don't need to make any code changes: just update your mapped alias.
  • I recommend using the Record/Play tool only to locate your objects and components.
  • If you need to write cross-browser web tests, the TestComplete web mapping tool may not be your best choice. (Hierarchy and names of objects in mapped name of a same object are varying from browser to browser in TestComplete).
  • A general TestComplete caveat: you will need to make sure you are not running your scripts headless. The tool requires an active GUI interface. The method I've seen used effectively is to use TestComplete's light-weight execution engine (TestExecute) to run on remote systems, and check progress by one or more of:
    • Setting up the remote system with a lightweight VNC server and connecting to it using a VNC client.
    • If the remote system is on a virtual machine server, using the VM client connection tools to check it.
    • Exporting test logs to a shared network location for checking.
    • Adding a scripted wrap up routine to collate and email script results at the end of a run.
  • Thanks Kate. Do you have any advice, or do you know of any good sources, where I can look at how one should structure their POM framework inside of a TestCompletes Projects folder structure? For instance, would each Page Object be written inside of the script section? – Edward_Haigh May 22 '17 at 12:15
  • @edward_haigh - I'd recommend asking on the TestComplete site after looking through their support and knowledge base articles. I'm several years out of date with TestComplete right now. – Kate Paulk May 22 '17 at 15:56
  • Thanks Kate. I think I've found a simple way to do it. Create two folders in the Script section, one for Page Objects and one for tests. Then just record clicking all the buttons to get the items and create a function for each one. For works well for basic to moderately complex sites. – Edward_Haigh May 23 '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.