Skip to main content

conduct BDD by excel feature files

Project description

Use Excel file as BDD feature file, get example data from excel files, support automation tests

V1.4.6 changes: columns are not selected after a blank header is present in bdd format. behavior is removed, use excelbdd instead, as below. old: from excelbdd.behavior import get_example_list new: from excelbdd import excelbdd

#pip install excelbdd
import pytest
from excelbdd import excelbdd
import FizzBuzz

excelBDDFile = "path of excel file" 
@pytest.mark.parametrize("HeaderName, Number1, Output1, Number2, Output2, Number3, Output3, Number4, Output4",
                        excelbdd.get_example_list(excelBDDFile,"FizzBuzz"))
def test_FizzBuzz(HeaderName, Number1, Output1, Number2, Output2, Number3, Output3, Number4, Output4):
    assert FizzBuzz.handle(Number1) == Output1
    assert FizzBuzz.handle(Number2) == Output2
    assert FizzBuzz.handle(Number3) == Output3
    assert FizzBuzz.handle(Number4) == Output4

Get data from table in Excel, similar to get from csv file

from excelbdd import excelbdd
@pytest.mark.parametrize("Header01, Header02, Header03, Header04, Header05, Header06, Header07, Header08",
                         excelbdd.get_example_table(excelBDDFile, "DataTable4"))
def test_get_example_tableB(Header01, Header02, Header03, Header04, Header05, Header06, Header07, Header08):
    print(Header01, Header02, Header03, Header04, Header05, Header06, Header07, Header08)
    # add test code here

"Specification by testcase" is supported. the bdd excel files can be regarded as the test reports. The test format in excel is detected automatically, only extra parameters(expected, test result) are needed to take into test method.

Python unittest is also supported by ExcelBDD.

import unittest
from excelbdd import excelbdd
from parameterized import parameterized

class ExcelBDDTest(unittest.TestCase):
    @parameterized.expand(excelbdd.get_example_list(excelBDDFile))
    def test_get_example_tableB(self, HeaderName, ParamName1, ParamName2, ParamName3, ParamName4):
        print(HeaderName, ParamName1, ParamName2, ParamName3, ParamName4)
        # add test code here
        self.assertEqual(ParamName1, "P1")
        self.assertEqual(ParamName3, None)

more information at ExcelBDD Guideline by Python

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

excelbdd-1.4.8.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

excelbdd-1.4.8-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file excelbdd-1.4.8.tar.gz.

File metadata

  • Download URL: excelbdd-1.4.8.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for excelbdd-1.4.8.tar.gz
Algorithm Hash digest
SHA256 cb2bcf76fed0a2e45b9563141583855578f9b740b0a1aba34b30bc9da2d9c72d
MD5 d630ad871e158ca8e13e239ed1d36f2d
BLAKE2b-256 dbd9e8c0c8ae1c1428e0d1b483fccce306058aefc6b90c2980387804584721f4

See more details on using hashes here.

File details

Details for the file excelbdd-1.4.8-py3-none-any.whl.

File metadata

  • Download URL: excelbdd-1.4.8-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for excelbdd-1.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 063ab93194a7e1a7f57392018a1b78f7bcf92e2a22fcc9e8713fb5647e4bc84f
MD5 b3b13372a53be5bf8ae39b1ec989daa9
BLAKE2b-256 e4ee4b34e8d4665f451a82eb40f0b576753b49050cd91637f9aaec4a76e6680e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page