Now that we've had a look through the application that we're going to be testing in this course, it's time for us to get our development environment set up, i.e. the environment where we're actually going to write Karate tests. In order to make that as easy as possible, what we're actually going to do is we're going to clone another repository. And this one just contains all of the Karate set up that we already need. So it's going to make getting us up and running with our own development environment really quick and really simple. So let's go ahead and do that now.
What I'm going to do is I'm going to head over to this website here. Again, I'm on Karate Labs, I'm on GitHub. And this time I'm in the Karate template. Again, this template just contains all of the code that we need just to get started writing Karate in as little time as possible. It contains all of the dependencies, all of the configuration, etc. already set up for us. So we can just go ahead and clone this repo and use it for our own testing.
Again, as before, I'm going to click on code and I'm going to copy this URL here. I'll switch over to my terminal again. I've still got the Karate Todo running as before, so that's fine. So I'm going to do, I'm just going to create a new terminal window. I'm going to see the back just so that I'm just outside of my Karate Todo folder. And what I'm going to do here is I'm going to say Git clone. And then I'm going to clone this Karate template. And then let's just call this Karate API testing. That's just what we're going to call our folder here. Now, that's going to clone the template into the Karate API testing folder. It's going to change into that folder. Now we've copied that to our local machine.
So now I just want to open Visual Studio code here. So to do that I can just do code dot. And that's just opened up Visual Studio code for us. Let's just go through some of the files that get included in this repository. We've got the readme here. This is just the readme from the Karate template. If we look at the POM.XML, this is the Maven file. And what this basically does is it has all of the dependencies that we need in order to get Karate installed. So it contains things like the Karate version. And again, the other dependencies that we just need to run Karate tests. Again, you don't need to worry too much about the files in here. Just know that this exists and just know that this is where basically the Karate package's dependencies, etc. all get pulled into the projects.
Going up, we've got a GItIignore file. We don't need to worry about that. It just ignores certain files from our version control system. If we open up the source folder here, we have a look in this logback-test.xml. What this logback does is it essentially just controls how the logging works. It's just going to basically print out logs when we write our Karate tests, we're going to have logs printed out to the standard output, i.e. the terminal, and also logs are going to get written into a file as well. We'll be seeing that in the moment once we start writing running tests. Again, you don't need to edit anything in here. We go up a bit, we can have a look at this Karate config.js And again, this is just some default configuration for Karate that gets included. So again, we don't need to change anything in here at the moment. We'll be making a few edits in this later on in the course, but everything in here is fine and that's good to go already.
Let's go up a bit more, look in the examples folder. So if we look at this example to test what this basically just is, is the Karate runner. So this is basically the file that gets executed when we run our Karate tests and it controls the execution of the Karate test that we're going to define. So again, we don't need to make any changes to this runner. This is all set up and all ready to go for us. It's already just pointing to the examples folder, which is where our Karate tests live, and that's what we're going to take a look at in just a few seconds. Just to the bottom here, we're set up for parallel execution 5. What this basically means is that when we run Karate tests, particularly when we're running a lot of tests, is that Karate will actually run those tests in parallel across 5 different threads. What that does is it really speeds up your test execution. You can imagine if you've got, say, a thousand tests, we've only been able to run one test at a time. Even if the tests are quite quick, that's going to take quite a long time for those API tests to run through. But when you're running tests in parallel, you can really speed up the test execution. Again, this is another really cool feature of Karate that parallel test execution is supported right out of the box. The test runner is fine. Let's just have a look now inside this user's folder. In here, there's another runner in here as well. What are the differences between these two runners that the examples test that we looked at, this is basically just going to run all of the tests in the folder and the user's runner is just another runner that would just run tests inside the user's folder. Again, these two runners, are both doing the same thing. They're just executing Karate tests. It's just showing which level of test to execute here, essentially. Again, we don't need to be some of the user's funnel now. Let's take a look at the users.feature. And this is where we actually write our Karate tests and we actually define our test steps.
So if we just look down at this test because it's not particularly readable like everything here is just in grade, it's no color coding. It's quite difficult to read and tell what's going on. Now in order to make this a bit easier to understand, what we can actually do at this point is install the Karate plug-in. So let's go ahead and do that in the next video.