How to create a python behave page object model project


655
655 points
python behave page object model
python behave page object model

Python Behave Page Object Model project

We already disacussed how to get started with python behave here , but let’s go a little bit further and see how python behave page object model projects looks like .

Just to recap what is page object model :

Page Object Model is an Object Repository design pattern in Selenium WebDriver. POM creates our testing code maintainable, reusable. Page Factory is an optimized way to create object repository in POM concept.

I’m not gonna go in so much details about it , this is just a standard definition but I’ve already discussed page object model for a java seleniumn project here , also there was a discussion about design patters in testing   also c# selenium page object model project is here and ruby watir page obejct model is here.

This are just some links if you are interested in other programming languages rather than python and you can inspire yourslef and refine your project or maybe you can share your suggestions in the comments section bellow.

What is behave?

behave is behaviour-driven development, Python style. , you can read the entire philosophy here.

Python behave page object model project structure


├── README.md
├── behave.ini
├── build.xml
├── failed_scenarios_screenshots
│   └── Login\ and\ click\ summer\ dresses_failed.png
├── features
│   ├── TermsSearch.feature
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── environment.py
│   ├── lib
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── pagefactory.py
│   │   ├── pagefactory.pyc
│   │   └── pages
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── base_page_object.py
│   │   ├── base_page_object.pyc
│   │   └── google_home_page.py
│   └── steps
│   └── TermsSearch.py
├── requirements.text
├── results.json
├── seleniumframework_tests.log
└── sonar-project.properties

I’m not gonna go in details why we need page factory , why bdd , why and why , you can check my previous articles to understand more and you can clone the project from our github page here.

Happy testing!


Like it? Share with your friends!

655
655 points

What's Your Reaction?

cute cute
0
cute
scary scary
0
scary
wtf wtf
0
wtf
geek geek
0
geek
WIN WIN
0
WIN
Love Love
0
Love
OMG OMG
0
OMG
Angry Angry
0
Angry
Lol Lol
0
Lol
Test engineer

0 Comments

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

Choose A Format
Trivia quiz
Story