报表门户集成客户端库
reportportal-behave-client的Python项目详细描述
说明
这个库是报表门户连接器,它允许您将报表门户与python behave bdd测试框架集成在一起
除非您选择与报表门户集成一起运行,否则您的自动化框架将与现在一样运行
安装
手动
- 克隆存储库
- 输入文件夹并运行
pip install .
使用pip和pypi.org
pip install reportportal-behave-client
向报表门户发送报表
要启用报表门户集成,请添加-D rp_enable=True
:
behave -D rp_enable=True
对于基于步骤的报告,还需要添加基于步骤的标志-D step_based=True
:
behave -D rp_enable=True -D step_based=True
在框架中集成lib
在environments.py文件中,在每个方法中添加服务。例如:
defbefore_all(context):rp_enable=context.config.userdata.getbool('rp_enable',False)step_based=context.config.userdata.getbool('step_based',False)add_screenshot=context.config.userdata.getbool('add_screenshot',False)launch_name=f"Execution using tags: {context.config.tags.ands[0]}"launch_description=f"BDD Tests for: {', '.join(tag for tag in context.config.tags.ands[0])}"context.behave_integration_service=BehaveIntegrationService(rp_endpoint=rp_endpoint,rp_project=rp_project,rp_token=rp_token,rp_launch_name=launch_name,rp_launch_description=launch_description,rp_enable=rp_enable,step_based=step_based,add_screenshot=add_screenshot)context.behave_integration_service.launch_service(context.config.tags.ands[0])defbefore_feature(context,feature):context.behave_integration_service.before_feature(feature)defbefore_scenario(context,scenario):context.behave_integration_service.before_feature(scenario)defbefore_step(context,step):context.behave_integration_service.before_step(step)defafter_step(context,step):context.behave_integration_service.after_step(step)defafter_scenario(context,scenario):context.behave_integration_service.after_scenario(scenario)defafter_feature(context,feature):context.behave_integration_service.after_feature(feature)defafter_all(context):context.behave_integration_service.after_all()