当前位置: 首页 > news >正文

ExcelBDD Python指南

在Python里面支持BDD

Excel BDD Tool Specification By ExcelBDD Method

This tool is to get BDD test data from an excel file, its requirement specification is below

The Essential of this approach is obtaining multiple sets of test data, so when combined with Excel's Sheet, the key parameters are:

  1. ExcelFileName, required, which excel file is used.
  2. SheetName, optional, which Sheet the requirement writer writes in, if not specified, 1st sheet is chosen. An Excel file supports multiple Sheets, so an Excel is sufficient to support a wide range, such as Epic, Release, or a module.
  3. HeaderMatcher, filter the header row by this matcher, if matched, this set will be collected in.
  4. HeaderUnmatcher, filter the header row by this matcher, if matched, this set will be excluded.

Once the header row and parameter name column are determined by 'Parameter Name' grid automatically, the data area is determined, such as the green area in the table above. The gray area of the table above is the story step description, which is the general requirements step.

Install ExcelBDD Python Edition

pip install excelbdd

API

behavior.get_example_list

get_example_list(excelFile, sheetName = None, headerMatcher = None, headerUnmatcher = None)

  1. excelFile: excel file path and name, relative or absolute
  2. sheetName: sheet name, optional, default is the first sheet in excel file
  3. HeaderMatcher: filter the header row by this matcher, if matched, this set will be collected in. optional, default is to select all.
  4. HeaderUnmatcher: filter the header row by this matcher, if matched, this set will be excluded. optional, default is to exclude none.

behavior.get_example_table

get_example_table(excelFile,sheetName = None,headerRow = 1,startColumn = 'A')

  1. excelFile: excel file path and name, relative or absolute
  2. sheetName: sheet name, optional, default is the first sheet in excel file
  3. headerRow: the number of header row, optional, default is 1
  4. startColumn: the char of first data area, optional, default is column A in sheet

Simple example code

The Famouse FizzBuzz kata is described in excelbdd format, as below.

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

 Input vs Expect + Test Result Format - SBT - Specification By Testcase

 

testcase example is below, which uses headerMatcher to filter the data

@pytest.mark.parametrize("HeaderName, ParamName1, ParamName1Expected, ParamName1TestResult, \ParamName2, ParamName2Expected, ParamName2TestResult, ParamName3, \ParamName3Expected, ParamName3TestResult, ParamName4, ParamName4Expected, \ParamName4TestResult",get_example_list(bddFile1, "SBTSheet1","Scenario"))
def test_excelbdd_sbt(HeaderName, ParamName1, ParamName1Expected, ParamName1TestResult, ParamName2, ParamName2Expected, ParamName2TestResult, ParamName3, ParamName3Expected, ParamName3TestResult, ParamName4, ParamName4Expected, ParamName4TestResult):print(HeaderName, ParamName1, ParamName1Expected, ParamName1TestResult, ParamName2, ParamName2Expected, ParamName2TestResult, ParamName3, ParamName3Expected, ParamName3TestResult, ParamName4, ParamName4Expected, ParamName4TestResult)# add test data are loaded into the above parameters, add test code below

 ExcelBDD can detect 3 parameter-header patterns automatically, the last one is below.

Input vs Expected 

 

The demo code is below

@pytest.mark.parametrize("HeaderName, ParamName1, ParamName1Expected,  \ParamName2, ParamName2Expected, ParamName3, \ParamName3Expected, ParamName4, ParamName4Expected"get_example_list(bddFile1, "SBTSheet1","Scenario"))
def test_excelbdd_sbt(HeaderName, ParamName1, ParamName1Expected,  ParamName2, ParamName2Expected, ParamName3, ParamName3Expected, ParamName4, ParamName4Expected):print(HeaderName, ParamName1, ParamName1Expected, ParamName2, ParamName2Expected,  ParamName3, ParamName3Expected, ParamName4, ParamName4Expected)# add test data are loaded into the above parameters, add test code below

Get Table

The test data are organized in normal table, as below.

 the below code show how to fetch the test data into testcase

from excelbdd.behavior import get_example_table@pytest.mark.parametrize("Header01, Header02, Header03, Header04, Header05, Header06, Header07, Header08",get_example_table(tableFile, "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 data are loaded into the above parameters, add test code below

ExcelBDD Python指南线上版维护在ExcelBDD Python Guideline

ExcelBDD开源项目位于 ExcelBDD Homepageicon-default.png?t=N7T8https://dev.azure.com/simplopen/ExcelBDD

 

相关文章:

ExcelBDD Python指南

在Python里面支持BDD Excel BDD Tool Specification By ExcelBDD Method This tool is to get BDD test data from an excel file, its requirement specification is below The Essential of this approach is obtaining multiple sets of test data, so when combined with…...

基于深度学习的驾驶员疲劳监测系统的设计与实现

点击以下链接获取源码: https://download.csdn.net/download/qq_64505944/88421622?spm1001.2014.3001.5503 基于深度学习的驾驶员疲劳监测系统的设计与实现 1 绪论 在21世纪,各国的经济飞速发展,人民越来越富裕,道路上的汽车也逐…...

B树、B+树详解

B树 前言   首先,为什么要总结B树、B树的知识呢?最近在学习数据库索引调优相关知识,数据库系统普遍采用B-/Tree作为索引结构(例如mysql的InnoDB引擎使用的B树),理解不透彻B树,则无法理解数据…...

使用hugging face开源库accelerate进行多GPU(单机多卡)训练卡死问题

目录 问题描述及配置网上资料查找1.tqdm问题2.dataloader问题3.model(input)写法问题4.环境变量问题 我的卡死问题解决方法 问题描述及配置 在使用hugging face开源库accelerate进行多GPU训练(单机多卡)的时候,经常出现如下报错 [E Process…...

IDEA 修改插件安装位置

不说假话,一定要看到最后,不然你以为我为什么要自己总结!!! IDEA 修改插件安装位置 前言步骤 前言 IDEA 默认的配置文件均安装在C盘,使用时间长会生成很多文件,这些文件会占用挤兑C盘空间&…...

牛客网SQL160

国庆期间每类视频点赞量和转发量_牛客题霸_牛客网 select * from ( select tag,dt, sum(单日点赞量)over(partition by tag order by dt rows between 6 preceding and 0 following), max(单日转发量)over(partition by tag order by dt rows between 6 preceding and 0 follo…...

HDFS Java API 操作

文章目录 HDFS Java API操作零、启动hadoop一、HDFS常见类接口与方法1、hdfs 常见类与接口2、FileSystem 的常用方法 二、Java 创建Hadoop项目1、创建文件夹2、打开Java IDEA1) 新建项目2) 选择Maven 三、配置环境1、添加相关依赖2、创建日志属性文件 四、Java API操作1、在HDF…...

论文阅读之【Is GPT-4 a Good Data Analyst?(GPT-4是否是一位好的数据分析师)】

文章目录 论文阅读之【Is GPT-4 a Good Data Analyst?(GPT-4是否是一位好的数据分析师)】背景:数据分析师工作范围基于GPT-4的端到端数据分析框架将GPT-4作为数据分析师的框架的流程图 实验分析评估指标表1:GPT-4性能表现表2&…...

【数据结构】:二叉树与堆排序的实现

1.树概念及结构(了解) 1.1树的概念 树是一种非线性的数据结构,它是由n(n>0)个有限结点组成一个具有层次关系的集合把它叫做树是因为它看起来像一棵倒挂的树,也就是说它是根朝上,而叶朝下的有一个特殊的结点&#…...

纯css手写switch

CSS 手写switch 纯css手写switchcss变量 纯css手写switch 思路: switch需要的元素有:开关背景、开关按钮。点击按钮后,背景色变化,按钮颜色变化,呈现开关打开状态。 利用typecheckbox,来实现switch效果(修…...

PyTorch 深度学习之处理多维特征的输入Multiple Dimension Input(六)

1.Multiple Dimension Logistic Regression Model 1.1 Mini-Batch (N samples) 8D->1D 8D->2D 8D->6D 1.2 Neural Network 学习能力太好也不行(学习到的是数据集中的噪声),最好的是要泛化能力,超参数尝试 Example, Arti…...

LeetCode【438】找到字符串中所有字母异位词

题目&#xff1a; 注意&#xff1a;下面代码勉强通过&#xff0c;每次都对窗口内字符排序。然后比较字符串。 代码&#xff1a; public List<Integer> findAnagrams(String s, String p) {int start 0, end p.length() - 1;List<Integer> result new ArrayL…...

关于LEFT JOIN的一次理解

先看一段例子&#xff1a; SELECTproduct_half_spu.id AS halfSpuId,product_half_spu.half_spu_code,product_half_spu.half_spu_name,COUNT( product_sku.id ) AS skuCount,product_half_spu.create_on,product_half_spu.create_by,product_half_spu.upload_pic_date,produc…...

各报文段格式集合

数据链路层-- MAC帧 前导码8B&#xff1a;数据链路层将封装好的MAC帧交付给物理层进行发送&#xff0c;物理层在发送MAC帧前&#xff0c;还要在前面添加8字节的前导码&#xff08;分为7字节的前同步码1字节的帧开始定界符&#xff09;MAC地址长度6B数据长度46&#xff5e;1500B…...

【算法-动态规划】最长公共子序列

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kuan 的首页,持续学…...

区块链游戏的开发流程

链游&#xff08;Blockchain Games&#xff09;的开发流程与传统游戏开发有许多相似之处&#xff0c;但它涉及到区块链技术的集成和智能合约的开发。以下是链游的一般开发流程&#xff0c;希望对大家有所帮助。北京木奇移动技术有限公司&#xff0c;专业的软件外包开发公司&…...

目标检测网络系列——YOLO V2

文章目录 YOLO9000better,更准batch Normalization高分辨率的训练使用anchor锚框尺寸的选择——聚类锚框集成改进——直接预测bounding box细粒度的特征图——passthrough layer多尺度训练数据集比对实验VOC 2007VOC 2012COCOFaster,更快网络模型——Darknet19训练方法Strong…...

15. Java反射和注解

Java —— 反射和注解 1. 反射2. 注解 1. 反射 动态语言&#xff1a;变量的类型和属性可以在运行时动态确定&#xff0c;而不需要在编译时指定 常见动态语言&#xff1a;Python&#xff0c;JavaScript&#xff0c;Ruby&#xff0c;PHP&#xff0c;Perl&#xff1b;常见静态语言…...

pdf处理工具 Enfocus PitStop Pro 2022 中文 for mac

Enfocus PitStop Pro 2022是一款专业的PDF预检和编辑软件&#xff0c;旨在帮助用户提高生产效率、确保印刷品质量并减少错误。以下是该软件的一些特色功能&#xff1a; PDF预检。PitStop Pro可以自动检测和修复常见的PDF文件问题&#xff0c;如缺失字体、图像分辨率低、颜色空…...

微信小程序入门开发教程

&#x1f389;&#x1f389;欢迎来到我的CSDN主页&#xff01;&#x1f389;&#x1f389; &#x1f3c5;我是Java方文山&#xff0c;一个在CSDN分享笔记的博主。&#x1f4da;&#x1f4da; &#x1f31f;推荐给大家我的专栏《微信小程序开发实战》。&#x1f3af;&#x1f3a…...

Flask RESTful 示例

目录 1. 环境准备2. 安装依赖3. 修改main.py4. 运行应用5. API使用示例获取所有任务获取单个任务创建新任务更新任务删除任务 中文乱码问题&#xff1a; 下面创建一个简单的Flask RESTful API示例。首先&#xff0c;我们需要创建环境&#xff0c;安装必要的依赖&#xff0c;然后…...

vscode(仍待补充)

写于2025 6.9 主包将加入vscode这个更权威的圈子 vscode的基本使用 侧边栏 vscode还能连接ssh&#xff1f; debug时使用的launch文件 1.task.json {"tasks": [{"type": "cppbuild","label": "C/C: gcc.exe 生成活动文件"…...

【JVM】- 内存结构

引言 JVM&#xff1a;Java Virtual Machine 定义&#xff1a;Java虚拟机&#xff0c;Java二进制字节码的运行环境好处&#xff1a; 一次编写&#xff0c;到处运行自动内存管理&#xff0c;垃圾回收的功能数组下标越界检查&#xff08;会抛异常&#xff0c;不会覆盖到其他代码…...

PL0语法,分析器实现!

简介 PL/0 是一种简单的编程语言,通常用于教学编译原理。它的语法结构清晰,功能包括常量定义、变量声明、过程(子程序)定义以及基本的控制结构(如条件语句和循环语句)。 PL/0 语法规范 PL/0 是一种教学用的小型编程语言,由 Niklaus Wirth 设计,用于展示编译原理的核…...

在鸿蒙HarmonyOS 5中使用DevEco Studio实现录音机应用

1. 项目配置与权限设置 1.1 配置module.json5 {"module": {"requestPermissions": [{"name": "ohos.permission.MICROPHONE","reason": "录音需要麦克风权限"},{"name": "ohos.permission.WRITE…...

mysql已经安装,但是通过rpm -q 没有找mysql相关的已安装包

文章目录 现象&#xff1a;mysql已经安装&#xff0c;但是通过rpm -q 没有找mysql相关的已安装包遇到 rpm 命令找不到已经安装的 MySQL 包时&#xff0c;可能是因为以下几个原因&#xff1a;1.MySQL 不是通过 RPM 包安装的2.RPM 数据库损坏3.使用了不同的包名或路径4.使用其他包…...

是否存在路径(FIFOBB算法)

题目描述 一个具有 n 个顶点e条边的无向图&#xff0c;该图顶点的编号依次为0到n-1且不存在顶点与自身相连的边。请使用FIFOBB算法编写程序&#xff0c;确定是否存在从顶点 source到顶点 destination的路径。 输入 第一行两个整数&#xff0c;分别表示n 和 e 的值&#xff08;1…...

安宝特案例丨Vuzix AR智能眼镜集成专业软件,助力卢森堡医院药房转型,赢得辉瑞创新奖

在Vuzix M400 AR智能眼镜的助力下&#xff0c;卢森堡罗伯特舒曼医院&#xff08;the Robert Schuman Hospitals, HRS&#xff09;凭借在无菌制剂生产流程中引入增强现实技术&#xff08;AR&#xff09;创新项目&#xff0c;荣获了2024年6月7日由卢森堡医院药剂师协会&#xff0…...

C语言中提供的第三方库之哈希表实现

一. 简介 前面一篇文章简单学习了C语言中第三方库&#xff08;uthash库&#xff09;提供对哈希表的操作&#xff0c;文章如下&#xff1a; C语言中提供的第三方库uthash常用接口-CSDN博客 本文简单学习一下第三方库 uthash库对哈希表的操作。 二. uthash库哈希表操作示例 u…...

【SpringBoot自动化部署】

SpringBoot自动化部署方法 使用Jenkins进行持续集成与部署 Jenkins是最常用的自动化部署工具之一&#xff0c;能够实现代码拉取、构建、测试和部署的全流程自动化。 配置Jenkins任务时&#xff0c;需要添加Git仓库地址和凭证&#xff0c;设置构建触发器&#xff08;如GitHub…...