Instructions for Preparation
Total Page:16
File Type:pdf, Size:1020Kb
Instructions for preparation Hi all! Thank you so much for registering for my workshop ‘API testing with REST Assured’ as part of the 2017 Romanian Testing Conference! I am really looking forward to meeting you all and sharing with you some tips and tricks about REST Assured and WireMock. In order to lose as little time as possible at the start of the workshop day, I’d like you to prepare your laptop for the exercises you’ll be working on by following these instructions. If you have any questions about or problems with completing these instructions, please let me know as soon as possible by email: [email protected], and I’ll try and help you as best as I can. See you on May 11th in Cluj! -- Bas Installing and configuring Java Development Kit (JDK) 1.8 Writing tests using REST Assured, as well as writing stubs using WireMock is software development! Java software development, to be more precise. This means we’ll need a Java Development Kit installed to be able to write, compile and run our tests and stubs. I highly recommended to install and use a recent version of Java 8, which implies a JDK version 1.8. If you don’t have a JDK on your laptop yet, here’s a link to the download and installation instructions: http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html Be sure to set your PATH and JAVA_HOME variables after installation, as described in the installation instructions. Installing and configuring an IDE To be able to efficiently write our tests and stubs, we also need an Integrated Development Environment (IDE). There are several available, with the two most popular for Java being: IntelliJ IDEA (https://www.jetbrains.com/idea/) Eclipse (http://www.eclipse.org/downloads/) I’m not going to argue about which one is better. If you have a favorite of your own, pick that one. If you don’t know which one to choose, I’d go with IntelliJ, simply because of the next two steps. (Eclipse only) Installing Maven support The project I have prepared for this workshop is a Maven project. This means that your IDE should be configured to support Maven projects. IntelliJ IDEA supports Maven projects out of the box. If you’re using IntelliJ, you can skip this step. I’m quite confident that newer releases of Eclipse also support Maven out of the box, but I’m not 100% sure as I haven’t tested it with recent Eclipse versions. If you downloaded Eclipse Neon (the most recent version), you should be good to go to the next step. If not, download and install the m2e plugin for Eclipse from here: http://www.eclipse.org/m2e/ (Eclipse only) Installing the TestNG plugin In this workshop, I use TestNG as the test runner. Again, IntelliJ supports this out of the box, so you can skip this step if you do. When you use Eclipse, you’ll need to download a plugin. See http://testng.org/doc/download.html for instructions, under ‘Eclipse plug-in’. Importing the workshop project As said above, I have prepared a Maven project containing all of the examples, exercises and even the answers to these exercises. I chose to include the answers to give you a means of getting ahead if you’re really stuck during the workshop. There’s only one way to really learn, however, and that’s by trying yourself and failing until you succeed You can get the project from two different locations: As a .zip download: http://www.ontestautomation.com/files/rtc2017workshop.zip From my GitHub page: https://github.com/basdijkstra/rtc2017 The GitHub version is available when you read these instructions. The .zip file will be available on Tuesday, May 2nd end of day at the latest. After you cloned (GitHub) or downloaded and unpacked (.zip) the project, import it into your IDE workspace. Instructions on how to do that can be found here: For IntelliJ IDEA: https://www.jetbrains.com/help/idea/2017.1/importing-project-from- maven-model.html (you can use the default settings) For Eclipse: http://javapapers.com/java/import-maven-project-into-eclipse/ If you’re using Eclipse, you might also want to right-click on the project after importing it and choose Maven > Update Project to be sure that all dependencies are successfully downloaded. Testing the workshop project The final step! To be sure that you’re ready to participate in the workshop, test that everything is set up by running the examples in both src/test/java/exercises/RestAssuredExamples.java and src/test/java/exercises/WireMockExamples.java. Eclipse Right-click the file mentioned and choose Run As > TestNG Test. This should result in something resembling these test results: IntelliJ IDEA Right click the file mentioned and choose ‘Run RestAssuredExamples’ (or Run ‘WireMockExamples). This should result in something resembling these test results: Don’t worry that some tests pass while others fail. The important thing is that you’re up and running if you get to this point! See you on May 11th! .