轻质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
```
*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'
@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
```