From the course: API Testing and Validation (2017)

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Running your first test: Write, generate, fill in, and refactor cycle

Running your first test: Write, generate, fill in, and refactor cycle

From the course: API Testing and Validation (2017)

Start my 1-month free trial

Running your first test: Write, generate, fill in, and refactor cycle

- Starting from a new project of PHP Storm, we just ran Behat--Init. So let's see what we have. The vendor directory is where all of our supporting libraries are installed through composer. As usual we can ignore it. The features directory is where the magic happens. From this point forward, we'll have two type of files, features and context. A feature is where we define and describe our test. In the Given-When-Then Gherkin Syntax. A context is where all the supporting PHP does the actual mark. Let's mark through this piece by piece to see how they relate. First let's remember that while we're testing things we are not writing tests exactly. We are validating the behavior of the system. We're basically making sure the features do exactly what we want them to do. So let's create our first feature. In this case, we will start with a simple search so we create a file called search.feature. Listen the features directory. First we want to give a little explanation of what's actually going…

Contents