오이와 루비를 사용하여 자동화하고 있습니다. 내 시나리오는 다음과 같습니다.오이에서 개별적으로 두 단계 정의를 구현할 수 없습니다.
Given I'm on home page
When i click on links
Then it should redirect to corresponding pages.
구현하려면 두 번째 단계에서 모든 링크를 클릭하여 반복했습니다.
이렇게하려면 매번 홈 페이지로 돌아가서 확인해야합니다. 매번 두 번째 단계 구현을 반복해야합니까? 아니면 세 번째 단계를 건너 뛰고 두 번째 단계 자체에서 모든 것을 구현할 수 있습니까?
Background: Member should open homepage
Given member goes to home page
@javascript
Scenario: Member should go to correct url by clicking links in head menu
Then member should ensure that links in the table go to correct url
| Spor Giyim | /spor-giyim |
| Kadın | /kadin |
| Erkek | /erkek |
| Ayakkabı & Çanta | /ayakkabi-canta |
루비 부분은 다음과 같이해야한다 :
Given I am on home page
When I collect a list of links and the text from the header menu
Then visiting each link should return a page where the title matches the link text
:
When(/^member should ensure that links in the table go to correct url$/) do |table|
# table is a Cucumber::Core::Ast::DataTable
links = table.raw
links.each do |line|
link = line[0]
target_url = line[1]
click_link(link)
url = page.current_url
expect(url).to include target_url
end
end
감사합니다. 지금 해보 겠어. – Rohin
@Rohin은 대답을 수락하기를 바랍니다. –