Selenium TestCases with Holmium in Python

Holmium core is nose plugin that provides utilities for simplifying the creation and maintenance of tests that rely on Selenium. Holmium introduce concept of Page Objects reduces the coupling and allow test authors to separate the layout of the page under test and the functional behaviour being tested.This separation also results in more maintainable test code.

Check out Getting Started with Selenium Python – Part 1

Installation of the Holmium:
Assuming you have Nose module installed on the Machine. If not check out my Nose installation post.

 

Importing Holmium in Project:
First you have to Import the the TestCase, Page , Element and Locators.

 

Adding Test Cases:
Lets add Login Test Cases into the project with the Login functionality. Create a class LoginPage ( A Page object class) with inherit the Page of the Holmium.core and will be used to get the elements on the that page and sending keys to them.

 

Lets add another class LoginTest which inherit the Test Case from the Holmium.core and only be used to assert the desired functionality.

Running the Code with the nose:

Final code with Running Test results.

Source Code Here.

Leave a Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Shares
Share
Tweet
Pin