Skip to main content

Right now I have a Selenium WebDriver framework that looks like this (vastly simplified):

  • \app_func.py -- app_func has the web app's "actions", such as "save a new search"

  • \app_data.py -- app_data has common assertions, such as if I re-use some test data, it'll store that data's document count, so I can do assert count == app_data.big_zip_file in my test file

  • \util.py -- util has common, application-neutral functions like wait_for_text

  • \setup.cfg -- setup contains all the server info, etc.

Then I have a tests dir:

  • \tests\upload_big_zip -- each test.py file imports app_func, app_data, util.

And then a test looks like:

app_func.upload_data('big.zip')
app_func.save_a_search('search terms', app_data.big_search_hits)
app_func.verify_search_hits

So I get the key benefits of the PageObjects pattern -- like being able to easily update save_a_search if the developers change the UI. But it's a much "flatter" structure than the OO PageObjects. I can't yet wrap my mind around the pattern.

Is there any reason I should build up a new structure based on PageObjects? What I'm looking for is, what are the benefits compared to my approach?

Thanks.

Right now I have a Selenium WebDriver framework that looks like this (vastly simplified):

  • \app_func.py -- app_func has the web app's "actions", such as "save a new search"

  • \app_data.py -- app_data has common assertions, such as if I re-use some test data, it'll store that data's document count, so I can do assert count == app_data.big_zip_file in my test file

  • \util.py -- util has common, application-neutral functions like wait_for_text

  • \setup.cfg -- setup contains all the server info, etc.

Then I have a tests dir:

  • \tests\upload_big_zip -- each test.py file imports app_func, app_data, util.

And then a test looks like:

app_func.upload_data('big.zip')
app_func.save_a_search('search terms', app_data.big_search_hits)
app_func.verify_search_hits

So I get the key benefits of the PageObjects pattern -- like being able to easily update save_a_search if the developers change the UI. But it's a much "flatter" structure than the OO PageObjects. I can't yet wrap my mind around the pattern.

Is there any reason I should build up a new structure based on PageObjects? What I'm looking for is, what are the benefits compared to my approach?

Thanks.

Right now I have a Selenium WebDriver framework that looks like this (vastly simplified):

  • \app_func.py -- app_func has the web app's "actions", such as "save a new search"

  • \app_data.py -- app_data has common assertions, such as if I re-use some test data, it'll store that data's document count, so I can do assert count == app_data.big_zip_file in my test file

  • \util.py -- util has common, application-neutral functions like wait_for_text

  • \setup.cfg -- setup contains all the server info, etc.

Then I have a tests dir:

  • \tests\upload_big_zip -- each test.py file imports app_func, app_data, util.

And then a test looks like:

app_func.upload_data('big.zip')
app_func.save_a_search('search terms', app_data.big_search_hits)
app_func.verify_search_hits

So I get the key benefits of the PageObjects pattern -- like being able to easily update save_a_search if the developers change the UI. But it's a much "flatter" structure than the OO PageObjects. I can't yet wrap my mind around the pattern.

Is there any reason I should build up a new structure based on PageObjects? What I'm looking for is, what are the benefits compared to my approach?

Tweeted twitter.com/#!/StackSQA/status/216071924202217472
Source Link
Aaron
  • 2.3k
  • 6
  • 25
  • 27

Do I need the PageObjects design pattern or not?

Right now I have a Selenium WebDriver framework that looks like this (vastly simplified):

  • \app_func.py -- app_func has the web app's "actions", such as "save a new search"

  • \app_data.py -- app_data has common assertions, such as if I re-use some test data, it'll store that data's document count, so I can do assert count == app_data.big_zip_file in my test file

  • \util.py -- util has common, application-neutral functions like wait_for_text

  • \setup.cfg -- setup contains all the server info, etc.

Then I have a tests dir:

  • \tests\upload_big_zip -- each test.py file imports app_func, app_data, util.

And then a test looks like:

app_func.upload_data('big.zip')
app_func.save_a_search('search terms', app_data.big_search_hits)
app_func.verify_search_hits

So I get the key benefits of the PageObjects pattern -- like being able to easily update save_a_search if the developers change the UI. But it's a much "flatter" structure than the OO PageObjects. I can't yet wrap my mind around the pattern.

Is there any reason I should build up a new structure based on PageObjects? What I'm looking for is, what are the benefits compared to my approach?

Thanks.