Skip to content

yogananda-muthaiah/SAP-Commissions-Pytest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAP Incentive Management ODI, XDL File Types PyTests

Test for various SAP Incentive Management ODI.XDL file templates. Below is the reference to help doc

SAP Incentive Management XDL File Templates

Installation

  1. Clone the repository to your local machine:

    git clone https://github.com/niro1987/sapcommissions-pytests
  2. Install requirements:

    python -m pip install -r requirements.txt

Usage

  1. Place your ODI files in the source directory. [Added Samples in Source folder - Delete and replace with your files]

  2. Currently TXSTA and TXTA is available for Unit Testing. To add other file types.. Go to fixtures\headers folder with adding your file types and custom file types

  3. Run tests.

    python -m pytest

A detailed report is generated at ./report.html.

Visual Studio Code

The repository is configured to work with VSCode. Open Test Explorer using the icon
on the Activity Bar. Running tests this way will not generate an html report.

Contribute

I encourage anyone to write additional tests for their respective ODI templates. Fork the repository to make your changes and open a pull request to get your changes merged.

Each test files should include a pytest marker to exlude the entire module if no files for the specific template are found in the source folder.

from .common import source_files

pytestmark = pytest.mark.skipif(
    len(source_files('TEMPLATE')) == 0,
    reason=f"No files found for this ODI template."
)

Inherrit from common.GenericTests to include tests that any ODI template should pass. GenericTests expects some class variables to be included, see example below.

from .common import GenericTests

class TestMyTemplate(GenericTests)
    """Tests for MyTemplate."""

    template: str = "MY_TEMPLATE"
    primary_key: list[str] = [] # Columns that make the row unique in the file.
    required: list[str] = [] # Columns that are required to be filled.
    numbers: list[str] = [] # Number columns, joined by UNITTYPEFOR... columns.
    dates: list[str] = [] # Date columns, MM/DD/YYYY format.
    booleans: list[str] = [] # Boolean columns, can only contain NULL, 0 or 1.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%