轻质bdd图案

apple-mango的Python项目详细描述


BDD模式
*PU-安装苹果芒果'BR/>< BR/>目标> BR/> *兼容Python UnTest.BR/> *兼容现有测试代码
*支持Python 3BR/> BR/> *下一步
*注册到pyPI
*添加CI
*支持pyTest.BR/>< BR/>用法> BR/> *定义常规测试重量轻类
*用`@mango.given()`
*用`@mango.when()`
*定义内部的``when`方法,然后用`@mango.then()`
*运行python测试:`python-m unittest test_file.py`
*不需要调用内部的` when`和`then`方法,因为` given(),when(),然后,` decorator会处理好它的


`` python
``python
是的self.given.user_photo='我的_photo'

self.given.unread_notifications_count=1

@mango.when('i click profile')
def when_click_profile():
print('click')

@mango.then('i see profile')
def then_profileself.assertequal(self.given.user_profile,'my_profile')

@mango.then('i see my photo')
def then_photo():
self.assertequal(self.given.user_photo,'我的照片')

@mango.when('i click notification')
1未读通知')
然后定义未读通知():
self.asserteQual(self.given.unread\u通知计数,1)

@mango.given('i am logged out user')
def test廑auth(self):
self.given.status廑code=401

@mango.when('i access profile by url')
def when廑access廑profile():
print('access profile')

@mango.then('i see 401 error')
def then廑error():
self.assertertequal(self.give.status_code,401)


````



```运行示例
``` python
python-m unittestest-test-example.pypypypypy
```

`
``
``贡献


``运行测试
``` python
python-m unittest test tests/test芒果.py
```



欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
ApachePOI如何通过java从excel文件中删除空白列?   linux到后台Java服务应用程序的简单发送/接收接口   java ActionBarPullToRefresh什么都没发生   java从millis获取错误的整数天   java相同的代码在两个不同的包上表现不同   java将每个新的char元素写入一个文件(如果被覆盖)   mysql如何在Java中通过外键链接的多个表中插入数据   java环境下mysql网络文件访问   java当使用构建器模式时,为什么我不应该重用builderobject来访问对象配置?   java jQueryServlet post异常失败   java应该使用什么逻辑来创建像《愤怒的小鸟》中那样的锁屏   java Android:在不滑动的情况下更改ViewPager中的片段   java在使用我的程序逻辑时获得空输出