我想从我的NUnit案例中提取描述和断言,以便生成测试手册。
示例:
创建帐户
代码:
class JobCell: UITableViewCell {
@IBOutlet weak var performTask: UIButton!
var actionBlock: (sender: AnyObject?) -> Void?
func someFunc() {
performTask. addTargetself, action: #selector(JobCell.didTapButton(_:)), forControlEvents: .TouchUpInside)
}
func didTapButton(sender: AnyObject) {
actionBlock?(sender)
}
}
答案 0 :(得分:0)
您可以为要声明的每个案例创建自己的测试
[Test, Description("Create Account"), Category("Account")]
public void ResponseMessageShouldEqualsOk()
{
Assert.That (res.ResponseStatus.Message, Is.EqualTo("OK"), "Account was not created");
}
[Test, Description("Create Account"), Category("Account")]
public void UserNameShouldEqualsName()
{
Assert.That (res.User.Name, Is.EqualTo("Name"));
}
[Test, Description("Create Account"), Category("Account")]
public void UserNationalityShouldEqualsUS()
{
Assert.That (res.User.Nationality, Is.EqualTo("US"));
}