「外部ウェブサイトから記事をインポートする」という機能があります。最初のシナリオでは、外部 Web サイトからリンクのリストをインポートするテストを行います。
Feature: Importing articles from external website
Scenario: Searching articles on example.com and return the links
Given there is an Importer
And its URL is "http://example.com"
When we search for "demo"
Then the Importer should return 25 links
And one of the links should be "http://example.com/demo.html"
私の手順では、@result
配列に 25 個のリンクがあります。
2 番目のシナリオでは、リンクの 1 つを取得して、記事が正しく解析されているかどうかをテストします。
明らかに、私は毎回外部 Web サイトにアクセスしたくありません。特に最初のシナリオが通過した今はなおさらです。
最初のシナリオで HTTP リクエストを行わずにテストを続行するには、どうすればよいですか? または、実際の結果セットを操作し続けることができるように、一度実行し@result
て残りのシナリオで配列を保持する必要がありますか?