specflow java,specflow如何处理多个参数?

As the title says how does specflow handle this

x = AddUp(2, 3)

x = AddUp(5, 7, 8, 2)

x = AddUp(43, 545, 23, 656, 23, 64, 234, 44)

The link I gave is how it is usually done.

What i want to know is what should the annotation on the top be?

[Then(@"What should I write here")]

public static void AddUp(params int[] values)

{

int sum = 0;

foreach (int value in values)

{

sum += value;

}

return sum;

}

解决方案

You add parameters by adding single quote marks like this:

[When(@"I perform a simple search on '(.*)'")]

public void WhenIPerformASimpleSearchOn(string searchTerm)

{

var controller = new CatalogController();

actionResult = controller.Search(searchTerm);

}

you can use comma seperated lists

When i login to a site

then 'Joe,Bloggs,Peter,Mr,Some street,15' are valid

Also you can use table vales

When I login to a site

then the following values are valid

| FirstName | LastName | MiddleName | Greeting| Etc | Etc |

| Joe | Bloggs | Peter | Mr | you get| The Idea|

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值