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

网站建设过程中什么最重要用flash做游戏下载网站

网站建设过程中什么最重要,用flash做游戏下载网站,中山网络推广seo专业,哈尔滨模板建站系统BDD - Python Behave 入门 Behave 是什么Behave 的主要特点和组成部分Behave 实践安装 BehaveBehave 项目目录结构创建项目创建 Feature 文件创建步骤定义文件 执行用例执行全部用例执行部分用例 生成报告生成 Json report生成 HTML 报告生成 Junit report生成 Cucumber report… BDD - Python Behave 入门 Behave 是什么Behave 的主要特点和组成部分Behave 实践安装 BehaveBehave 项目目录结构创建项目创建 Feature 文件创建步骤定义文件 执行用例执行全部用例执行部分用例 生成报告生成 Json report生成 HTML 报告生成 Junit report生成 Cucumber report生成 Allure 报告 Behave 是什么 Behave 是一个用于 Python 的行为驱动开发BDD框架。BDD 是一种敏捷软件开发方法它促使开发人员、QA质量保障团队和非技术利益相关者之间更好地合作以确保软件开发的最终产物符合预期的行为。 Behave 的 BDD 侧重于从用户的角度出发关注软件的行为和功能以一种易于理解的自然语言来描述。Behave 使用 Gherkin 语言来描述软件的功能该语言是一种用于描述软件行为的业务可读的语言。Gherkin 语言的特点是简洁易懂非技术人员也能够理解。 Behave 的主要特点和组成部分 Gherkin 语言 Behave 使用 Gherkin 语言描述软件的功能和行为。Gherkin 是一种简单的自然语言它使用关键字如 Given、When、Then来描述场景和行为这使得非技术人员能够轻松理解和参与。 Feature 文件 Behave 的测试用例以 .feature 文件的形式存在其中包含了用 Gherkin 语言编写的场景描述。这些文件包含了对软件功能的期望行为和测试用例。 步骤定义 Behave 允许用户使用 Python 编写步骤定义将 Gherkin 语言中描述的场景映射到实际的测试代码。步骤定义包括 Given、When、Then 等关键字并通过正则表达式与实际的测试逻辑关联起来。 运行测试 Behave 提供了一个命令行界面通过该界面可以运行定义的测试用例。测试执行过程中Behave 将解释 Gherkin 语言的描述并调用相应的步骤定义执行实际的测试代码。 报告生成 Behave 生成详细的测试报告其中包含测试用例的执行结果、失败的步骤、日志信息等。这有助于团队追踪测试进度和了解软件的行为是否符合预期。 Behave 实践 官网 Github 和 文档 安装 Behave pip install behave或升级 Behave pip install -U behaveBehave 项目目录结构 最简单的目录结构 复杂的目录结构 注意 Feature 文件 可以按子目录分类但是步骤定义文件不能按子目录分类必须统统都在 steps 文件夹中steps 文件夹的位置跟 Features 目录推荐是兄弟关系比较清晰也可以是父子关系。 创建项目 按下面结构来创建 feature 文件和步骤实现测试计算器的加法。 创建 Feature 文件 创建一个名为 calculator.feature 的.feature 文件其中描述了加法功能的场景 这里 calculator2.feature 只是 calculator.feature 的 copymock 两个功能吧。 # calculator.featureFeature: Calculator AdditionIn order to verify that the calculator can perform additionAs a userI want to ensure that the addition operation is correctScenario: Add two numbersGiven the calculator is turned onWhen I add 5 and 7Then the result should be 12创建步骤定义文件 创建一个 Python 文件用于定义 Gherkin 语言中描述的步骤的实际执行代码。保存为 calculator_steps.py # calculator_steps.pyfrom behave import given, when, thengiven(the calculator is turned on) def step_calculator_turned_on(context):context.calculator_on Truewhen(I add {num1:d} and {num2:d}) def step_add_numbers(context, num1, num2):context.result num1 num2then(the result should be {expected_result:d}) def step_check_result(context, expected_result):assert context.result expected_result, fActual result: {context.result}, Expected result: {expected_result}执行用例 执行全部用例 打开终端进入包含 Features 和 Steps 目录的父目录 BDD并运行以下命令behave Behave 将解释 BDD 目录下所有 .feature 文件中的场景并调用 calculator_steps.py 中定义的步骤执行相应的测试逻辑 PS C:\Automation\Test\BDD behave Feature: Calculator Addition # Features/Calculator/calculator.feature:3In order to verify that the calculator can perform additionAs a userI want to ensure that the addition operation is correctScenario: Add two numbers # Features/Calculator/calculator.feature:8Given the calculator is turned on # steps/calculator_steps.py:5When I add 5 and 7 # steps/calculator_steps.py:9Then the result should be 12 # steps/calculator_steps.py:13Feature: Calculator Addition test # Features/Calculator2/calculator2.feature:3In order to verify that the calculator can perform additionAs a userI want to ensure that the addition operation is correctScenario: Add two numbers test # Features/Calculator2/calculator2.feature:8Given the calculator is turned on # steps/calculator_steps.py:5When I add 5 and 7 # steps/calculator_steps.py:9Then the result should be 12 # steps/calculator_steps.py:132 features passed, 0 failed, 0 skipped 2 scenarios passed, 0 failed, 0 skipped 6 steps passed, 0 failed, 0 skipped, 0 undefined Took 0m0.000s执行部分用例 也可以只运行部分 feature 场景执行 behave Features/Calculator2 只运行 Features/Calculator2 目录下的用例Features/Calculator 的用例不会执行。 PS C:\Automation\Test\BDD behave Features/Calculator2 Feature: Calculator Addition test # Features/Calculator2/calculator2.feature:3In order to verify that the calculator can perform additionAs a userI want to ensure that the addition operation is correctScenario: Add two numbers test # Features/Calculator2/calculator2.feature:8Given the calculator is turned on # steps/calculator_steps.py:5When I add 5 and 7 # steps/calculator_steps.py:9Then the result should be 12 # steps/calculator_steps.py:131 feature passed, 0 failed, 0 skipped 1 scenario passed, 0 failed, 0 skipped 3 steps passed, 0 failed, 0 skipped, 0 undefined Took 0m0.000s生成报告 生成 Json report 执行behave -f json -o report.json PS C:\Automation\Test\BDD behave -f json -o report.json 2 features passed, 0 failed, 0 skipped 2 scenarios passed, 0 failed, 0 skipped 6 steps passed, 0 failed, 0 skipped, 0 undefined Took 0m0.000s上述命令将运行 Behave 测试并将结果输出到当前目录下 report.json 文件中。你可以根据需要更改输出文件的名称。 生成 HTML 报告 如果你希望使用 HTML 报告你可以考虑使用 behave-html-formatter 插件。 首先你需要安装该插件 pip install behave-html-formatter然后使用以下命令运行 Behavebehave -f behave_html_formatter:HTMLFormatter -o report.html PS C:\Automation\Test\BDD behave -f behave_html_formatter:HTMLFormatter -o report.html 2 features passed, 0 failed, 0 skipped 2 scenarios passed, 0 failed, 0 skipped 6 steps passed, 0 failed, 0 skipped, 0 undefined Took 0m0.016s这样就会在当前目录下生成一个名为 report.html 的 HTML 报告文件 生成 Junit report 执行命令behave --junit PS C:\Automation\Test\bdd behave --junit Feature: Calculator Addition # Features/Calculator/calculator.feature:3In order to verify that the calculator can perform additionAs a userI want to ensure that the addition operation is correctScenario: Add two numbers # Features/Calculator/calculator.feature:8Given the calculator is turned on # steps/calculator_steps.py:5When I add 5 and 7 # steps/calculator_steps.py:9Then the result should be 12 # steps/calculator_steps.py:13 Feature: Calculator Addition 2 # Features/Calculator2/calculator2.feature:3In order to verify that the calculator can perform additionAs a userI want to ensure that the addition operation is correctScenario: Add two numbers 2 # Features/Calculator2/calculator2.feature:8Given the calculator is turned on # steps/calculator_steps.py:5When I add 5 and 7 # steps/calculator_steps.py:9Then the result should be 12 # steps/calculator_steps.py:132 features passed, 0 failed, 0 skipped 2 scenarios passed, 0 failed, 0 skipped 6 steps passed, 0 failed, 0 skipped, 0 undefined Took 0m0.007s默认会创建 reports 子目录生成测试报告。 当然也可以指定目录执行命令behave --junit --junit-directory my_reports 生成 Cucumber report Behave 本身直接生成 Cucumber 报告的功能是有限的因为 Cucumber 报告通常与 Gherkin 语法密切相关而 Behave 使用的是 Gherkin 语法的 Python 版本。 如果你想生成类似 Cucumber 风格的报告你可以考虑使用 behave2cucumber 工具。该工具能够将 Behave 的 JSON 报告转换为 Cucumber JSON 格式。 以下是使用该工具的步骤 安装 behave2cucumber pip install behave2cucumber运行 Behave 以生成 JSON 报告 behave -f json -o report.json使用 behave2cucumber 工具将 Behave JSON 报告转换为 Cucumber JSON 格式 python -m behave2cucumber -i report.json -o cucumber_json.json-i 表示由 behave 生成的测试 json 文件中的输入文件 -o 表示兼容 cucumber json文件的输出文件 cucumber_json 利用 jenkins 上的 cucumber reports 插件配置 cucumber json 文件生成 cucumber 报告 生成 Allure 报告 对于更漂亮和交互式的报告你可能需要考虑使用专门的报告生成工具例如 Allure 或其他定制的报告工具。 Allure 支持 Behave 并提供了漂亮的图形化报告和交互式功能。 以下是使用 Allure 生成漂亮的报告的示例 安装 Allure 及 Behave 插件 pip install allure-behave运行 Behave 测试并生成 Allure 报告 PS C:\Automation\Test\bdd behave -f allure_behave.formatter:AllureFormatter -o allure-results 2 features passed, 0 failed, 0 skipped 2 scenarios passed, 0 failed, 0 skipped 6 steps passed, 0 failed, 0 skipped, 0 undefined Took 0m0.000s当前目录下生成 3. 生成和查看 Allure 报告 根据官方 Allure Report installation 本地安装 Allure 确保安装了Java版本8或更高版本并且在JAVA_HOME环境变量中指定了它的目录。.从 latest Allure Report release on GitHub 下载 allure-.zip 或 allure-.tgz.将下载的压缩文件解压缩到任意目录Allure 报告现在可以使用 bin/allure 或 bin/allure.bat 脚本运行具体取决于操作系统。 生成和查看 report 执行命令allure serve C:\Automation\Test\BDD\allure-results
http://www.zqtcl.cn/news/738874/

相关文章:

  • 本地郑州网站建设东莞网站优化中易
  • 动态域名可以建网站德州公司做网站
  • 深圳建设银行官方网站wordpress 添加qq
  • 甘肃第九建设集团公司网站网站对企业的好处
  • 论坛网站建设规划书公司网站建设与设计制作
  • 做棋牌游戏网站犯法吗如何进行搜索引擎的优化
  • 常见的网站首页布局有哪几种陈光锋网站运营推广新动向
  • 手机网站活动策划方案开一个设计公司
  • 宝塔建设网站教程visual studio 2010 网站开发教程
  • 做网站购买服务器做谷歌网站使用什么统计代码吗
  • 网站系统与网站源码的关系emlog轻松转wordpress
  • 网站的简介怎么在后台炒做吉林省住房城乡建设厅网站首页
  • 泉州易尔通网站建设国际酒店网站建设不好
  • 网页下载网站福田企业网站推广公司
  • 北京网站建设开发公司哪家好网站添加在线留言
  • 新建的网站怎么做seo优化平面广告创意设计
  • yy陪玩网站怎么做软件项目管理计划
  • 西安建网站价格低百度推广区域代理
  • 中英网站模板 照明公司注册在自贸区的利弊
  • 全球十大网站排名wordpress标题连接符
  • 网站开发可能遇到的问题四川建筑人才招聘网
  • 镇江网站托管怎么做淘宝网站赚钱吗
  • 交互式网站是什么知名vi设计企业
  • 上海个人做网站网站建设销售好做嘛
  • 邵阳建设网站哪家好手机网站栏目结构图
  • 做动车哪个网站查网站环境配置
  • 那些网站可以做h5国内新闻最新消息今天简短
  • asp网站开发实例河南省建设招投标网站
  • 营销型网站搭建公司有没有专做推广小说的网站
  • 汕头网站搭建wordpress文章列表摘要