【发布时间】:2017-03-10 18:05:04
【问题描述】:
学习新的 Rails 应用程序并为其编写一些测试。在编写测试时,遇到的问题是:
在水豚测试中使用黄瓜写“背景”是什么意思?为什么我们要写“背景”?可以避免吗?
-> 和test数据库有关系吗?还是作为“场景”的数据库?
Feature: User signup
As a user
I want to sign in
So I can use service features
**Background**:
Given user with "jack@daniles.com" email and "qwerty" password
Scenario: Signing in with correct credentials
When I go to sign in page
And I fill in "email" with "jack@daniles.com"
And I fill in "password" with "qwerty"
And I click "Login" button
Then I should see "Welcome, jack@daniles.com!"
【问题讨论】:
标签: ruby-on-rails cucumber capybara