You must already have the java jdk downloaded on your machine and the path must be set in the environment variables since we need the ability to compile and run Java programs from the command line. In this video we start by taking a quick look at the environment variables setup on my windows machine. For this example, I have written a small program that simply adds a series of numbers in an array and returns the sum. Here is the Calculator program.
- View Offline
- [Instructor] I'm sure we both know programmers…that prefer to use text editors to write their Java code.…In that case they're going to be using the command line.…Well, we can still use the command line…to run JUnit test cases.…To run programs from the command line…you must already have the Java JDK…downloaded on your machine…and the path must be set in the environment variables…since we need the ability to compile…and run Java programs from the command line.…Let's start by taking a quick look…at the environment variables setup on my Windows machine.…
I'm going to type env to go to…the system environment variables screen.…Here, on the bottom of the page…it says Environment Variables.…Let's click there.…The top half has user variables.…The bottom half is system variables.…Under the system variables I have a Java Home…variable that points to the JDK…that's stored at jdk1.8.0_91/bin.…Below that, I have added a JUnit Home…to indicate where my JUnit JAR file is located.…
When I downloaded the JUnit JAR file…and the Hamcrest JAR file I added…
- What is JUnit?
- Comparing values with assertions
- Using JUnit with different Java IDEs
- Creating basic unit tests
- Testing for exception handling
- Creating parameterized tests