GemPyp Plugin

Introduction

Step into the realm of efficient testing with Gempyp – a robust plugin designed to
seamlessly incorporate Behave and Pytest. Say goodbye to the hassle of managing multiple reporting and configuration setups; Gempyp simplifies the testing process, providing an intelligent solution for your testing needs.

Getting Started

1. Testcase File

Your test case file remains just like other Pytest and behave files.

Pytest Test File

from testFunction import TestFunction
import pytest
from gempyp.common import common

def test_string_assertion():
    assert ("loud noises".upper() == "LOUD NOISES")

def test_list_assertion():
    assert (list(reversed([1, 2, 3, 4])) == [4, 3, 2, 1])

@pytest.mark.webtest
def test_loop_assertion():
    assert (37 in {
        num
        for num in range(2, 50)
        if not any(num % div == 0 for div in range(2, num))
    })

@pytest.fixture
def setup_data():
    data = [1, 2, 3, 4, 5]
    return data

Behave Feature File

Feature: MIS_Automation - Dashboard Profile

    Background: Login to MIS
        Given Navigate to website
        Given Login to MIS with Username "*********" and password "***********"
        When Click on Signin button
        Then User should be navigated to MIS homepage

    Scenario Outline: Dashboard Profile: User enter invalid phone number
        When Click on edit details button
        Then Enter mobile number
        Then User clicks on Update button
        Then Verify popup with message "<AlertType>" and "<Message>"
        Examples:
            | AlertType | Message                            |
            | Sucsess   | Your profile data has been updated successfully.   |


    Scenario Outline: Dashboard Profile: User enter invalid emergency phone number
        When Click on edit details button
        Then Enter emergency number "<phoneNumber>"
        Then User clicks on Update button
        Then Verify popup with message "<AlertType>" and "<Message>"
        Examples:
            | AlertType | Message                            | phoneNumber |
            | Warning   | Please put 10 digit mobile number. | 123456789   |

2. pytest.ini Configuration File

Use pytest.ini file for behave and pytest integration in gempyp. Specify the suite details such as project name, environment, jewel user, jewel bridge token, and entry point.

pytest.ini file

[pytest] 
project-name = projectName 
environment = environmentName 
jewel-user = username 
jewel-bridge-token = jewelToken 
enter-point = https://betaapi.gemecosystem.com/gemEcosystemDashboard/v1/enter-point 

3. Running Pytest with Gempyp

This command triggers the Gempyp plugin, providing a detailed report highlighting pass and failed test cases.

Command

pytest filename.py --gempyp-enable

4. Original Pytest Execution

If you prefer to run the original Pytest without the Gempyp plugin, you can still achieve this through the standard Pytest command.

5. Running Behave with Gempyp

Add a environment.py file and import all the functions from gempyp.plugin.custom_hooks

from gempyp.plugin.custom_hooks import *

6. Original Behave Execution

If you prefer to run the original Behave without the Gempyp plugin, you can still achieve this by removing or commenting on the import statement in environment.py fil

Benefits

  • One Reporting: Gempyp provides a unified reporting solution, eliminating the need for managing multiple reporting for different type of testcase.
  • Effortless Configuration: Simply configure your project details in the pytest.ini file, and Gempyp takes care of the rest.
  • Detailed Reports: Receive comprehensive reports and add your own test steps in the report.