我如何使用 .Net 在 fitnesse 中编写 BDD 场景,例如 Given,然后使用 Fitsharp 进行格式化
How do i write BDD scenarios in fitnesse with .Net like Given when then format using Fitsharp
我们需要在 Given When Then (Gherkin) 中编写 Fitnesse 中的场景
有什么办法吗?喜欢 java GivWenZen
我们使用 Fitsharp 在 .Net 4.0 中使用 fitnesse。
场景:
现有健身 table-
!define TEST_SYSTEM {fit}
!define COMMAND_PATTERN {%m -r fitnesse.fitserver.FitServer %p}
!define TEST_RUNNER {D:\API_TC_Setup\Fitnesse\Runner.exe}
!path D:\API_TC_Setup\FitnesseBDDDemo\FitnesseBDDDemo\bin\Debug\FitnesseBDDDemo.dll
|configure|processor|add operator|findmemberpattern|
!|import |
| FitnesseBDDDemo|
|Class1|
|Given User should login|
|When User place an Order|
|Then Order should present in market|
这是上述场景的代码
namespace FitnesseBDDDemo
{
public class Class1
{
[MemberPattern ( "Given User should login" )]
public void LoginUser1( )
{
Console.WriteLine ( "Executing loggin-" );
}
//When User place an Order
[MemberPattern ( "When User place an Order" )]
public void PlaceOrder( )
{
Console.WriteLine ( " Order placing-" );
}
//Then Order should present in market
[MemberPattern ( "Then Order should present in market" )]
public void OrderInMarket( )
{
Console.WriteLine ( "Order in market-" );
}
}
}
错误 -
没有错误我的场景在执行时被忽略请看这张快照
您可以使用 FindMemberPattern 运算符
参见:http://fitsharp.github.io/Fit/FindMemberPatternOperator.html
您的测试可能是:
(这些行可以放在祖先页面上)
!define TEST_SYSTEM {fit}
!define COMMAND_PATTERN {%m -r fitnesse.fitserver.FitServer %p}
(下一行可以放在设置页面上)
|configure|processor|add operator|findmemberpattern|
|Place Order|
|Given User user1 should login|
|When Placing Bid Order|
|Then Order Available In Market|
您的代码将包含:
[MemberPattern("Given User (.*) should login")]
public bool LoginUser(string user) { ... }
[MemberPattern("When Placing (.*) Order")]
public bool PlacingOrder(string side) { ... }
[MemberPattern("Then Order Available In Market")]
public bool OrderAvailableInMarket() { ... }
我们需要在 Given When Then (Gherkin) 中编写 Fitnesse 中的场景 有什么办法吗?喜欢 java GivWenZen
我们使用 Fitsharp 在 .Net 4.0 中使用 fitnesse。
场景: 现有健身 table-
!define TEST_SYSTEM {fit}
!define COMMAND_PATTERN {%m -r fitnesse.fitserver.FitServer %p}
!define TEST_RUNNER {D:\API_TC_Setup\Fitnesse\Runner.exe}
!path D:\API_TC_Setup\FitnesseBDDDemo\FitnesseBDDDemo\bin\Debug\FitnesseBDDDemo.dll
|configure|processor|add operator|findmemberpattern|
!|import |
| FitnesseBDDDemo|
|Class1|
|Given User should login|
|When User place an Order|
|Then Order should present in market|
这是上述场景的代码
namespace FitnesseBDDDemo
{
public class Class1
{
[MemberPattern ( "Given User should login" )]
public void LoginUser1( )
{
Console.WriteLine ( "Executing loggin-" );
}
//When User place an Order
[MemberPattern ( "When User place an Order" )]
public void PlaceOrder( )
{
Console.WriteLine ( " Order placing-" );
}
//Then Order should present in market
[MemberPattern ( "Then Order should present in market" )]
public void OrderInMarket( )
{
Console.WriteLine ( "Order in market-" );
}
}
}
错误 -
没有错误我的场景在执行时被忽略请看这张快照
您可以使用 FindMemberPattern 运算符 参见:http://fitsharp.github.io/Fit/FindMemberPatternOperator.html
您的测试可能是:
(这些行可以放在祖先页面上)
!define TEST_SYSTEM {fit}
!define COMMAND_PATTERN {%m -r fitnesse.fitserver.FitServer %p}
(下一行可以放在设置页面上)
|configure|processor|add operator|findmemberpattern|
|Place Order|
|Given User user1 should login|
|When Placing Bid Order|
|Then Order Available In Market|
您的代码将包含:
[MemberPattern("Given User (.*) should login")]
public bool LoginUser(string user) { ... }
[MemberPattern("When Placing (.*) Order")]
public bool PlacingOrder(string side) { ... }
[MemberPattern("Then Order Available In Market")]
public bool OrderAvailableInMarket() { ... }