博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Cucumber 使用例子
阅读量:6446 次
发布时间:2019-06-23

本文共 3766 字,大约阅读时间需要 12 分钟。

1. junit  配置@RunWith(Cucumber.class)@CucumberOptions(format ={"pretty","html:target/cucumber"},features={"src/main/java/demoapp"},tags={"@third"})public class test {    }# language: zh-CN功能:测试@third场景大纲:一些测试假如 firstw "demo"当 demoinfo 
那么 appdemo
例子:|name| info||first|dalong||second|aaaaa|Feature:Belly@firstScenarioOutline: a few cukesGiven firstw "demo"When demoinfo
Then appdemo
Examples:|name| info||first|dalong||second|aaaaa|publicclassMyStepdefs{@Given("I have (\\d+) cukes in my belly")publicvoid I_have_cukes_in_my_belly(int cukes){System.out.format("Cukes: %n\n", cukes);}@When("^I wait (\\d+) hour$")publicvoid i_wait_hour(int arg1)throwsThrowable{// Write code here that turns the phrase above into concrete actionsthrownewPendingException();}@Then("^dodemo$")publicvoid dodemo()throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("dodemo");}@Given("^first \"([^\"]*)\"$")publicvoid first(String arg1)throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("first"+": "+ arg1);}@Then("^my belly should growl$")publicvoid my_belly_should_growl()throwsThrowable{// Write code here that turns the phrase above into concrete actionsthrownewPendingException();}@Given("^first demo$")publicvoid first_demo()throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("first_demo");}@When("^user names$")publicvoid user_names(DataTable arg1)throwsThrowable{// Write code here that turns the phrase above into concrete actions// For automatic transformation, change DataTable to one of// List
, List
>, List
> or Map
.// E,K,V must be a scalar (String, Integer, Date, enum etc)List
>list= arg1.raw();System.out.println(list.get(0));System.out.println(arg1.toString());}@When("^demoinfo ([^\"]*)$")publicvoid demoinfo_name(String name)throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println(name+"demoinfo_name");//Assert.assertTrue(false);}@Then("^appdemo ([^\"]*)$")publicvoid appdemo_info(String name )throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println(name+"appdemo_info");}@When("^call me$")publicvoid call_me()throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("call me");}@Then("^docall$")publicvoid docall()throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("docall");}@Given("^firstw \"([^\"]*)\"$")publicvoid firstw(String arg1)throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("firstw");}@When("^demoinfo$")publicvoid demoinfo()throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("demoinfo");}@When("^printinfos$")publicvoid printinfos(List
info)throwsThrowable{// Write code here that turns the phrase above into concrete actions// For automatic transformation, change DataTable to one of// List
, List
>, List
> or Map
.// E,K,V must be a scalar (String, Integer, Date, enum etc)info.forEach(newConsumer
(){@Overridepublicvoid accept(String t){// TODO Auto-generated method stubSystem.out.println(t+"demo info");}});}@Then("^appdemo$")publicvoid appdemo()throwsThrowable{// Write code here that turns the phrase above into concrete actionsSystem.out.println("appdemo");}}
info.cukes
cucumber-java
1.2.5
test
info.cukes
cucumber-junit
1.2.5
test
junit
junit
4.11
test
maven-compiler-plugin
3.1
1.8
1.8
sonatype-snapshots
https://oss.sonatype.org/content/repositories/snapshots
true

  

转载地址:http://edpwo.baihongyu.com/

你可能感兴趣的文章
修正锚点跳转位置 避免头部fixed固定部分遮挡
查看>>
Dubbo序列化多个CopyOnWriteArrayList对象变成同一对象的一个大坑!!
查看>>
linux下ping不通的解决方法
查看>>
关于大型网站技术演进的思考(三)---- 存储的瓶颈(3)
查看>>
利用ItextPdf、core-renderer-R8 来生成PDF
查看>>
irc操作小记
查看>>
JAVA 与 PHP 的不同和相同
查看>>
03-Java环境变量配置
查看>>
Python mysql操作
查看>>
建立Ftp站点
查看>>
NavigationController的使用
查看>>
android 内存泄漏
查看>>
HTML5:Canvas-绘制图形
查看>>
Sass--传多个参数
查看>>
多线程编程之Windows环境下创建新线程
查看>>
ASP.Net MVC的开发模式
查看>>
困惑的托管与非托管混合调试时遇到的不能设断点的问题
查看>>
groupbox 下的datagridview的列标题字体修改混乱
查看>>
HDU-3092 Least common multiple---数论+分组背包
查看>>
CentOS 7使用systemctl如何补全服务名称
查看>>