From the course: API Testing and Validation (2017)
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Introduce variables in requests
From the course: API Testing and Validation (2017)
Introduce variables in requests
- [Narrator] While our feature test works, it still has some major problems. For example, wouldn't it be nice to search for things other than behat? To do this, we need to introduce a variable. By default, any number is automatically treated as a variable. But we can't do that here. For example, if we said this was 400, this would automatically be handled as a variable. But in this case, we need to do something a little different. We want to wrap it in quotes. Double quotes, specifically. So now when I say, when I search for behat, this is going to be placed in the method itself. Let me show you how this works. But first, we'll go back and we'll run the test. Very quickly we get an error. The first step passes, as we'd expect, the second one fails. It fails because it doesn't exist, we haven't defined it. So let's go ahead and generate that, and copy and paste this directly into our code. Now we have to figure out how to fill this in. Notice, it's different from I search for behat in…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.