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.9 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 Python Guideline

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.9.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: excelbdd-1.4.9.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.9.tar.gz
Algorithm Hash digest
SHA256 135a7cd9a16b98a6b9bb4369a56d60cc7c512e2b0990efe485cd322d41cd16aa
MD5 55a17e1b5b01dd9c58b7defa46601658
BLAKE2b-256 c320ab4eafe776b35cd9dd1bd46ca884b19abcacfa40ffe0987ed90bb2d8d583

See more details on using hashes here.

File details

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

File metadata

  • Download URL: excelbdd-1.4.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 7143ebb4e2a3bf2bd0156c24c7512ee1ff722729e6bfbe894eb2f1c39b273d17
MD5 e3ebbad32b6753c93a3e2780d58fe591
BLAKE2b-256 c4234344d0e001167d75c2413f05fc843fb4116a2f8e077a248281da0e9c7c12

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