In the book Java For Testers, I teach Java slightly differently to make it easier to learn. Let me explain how.
When you learn Java, one of the first things you traditionally learn is how to create a ‘main’ method.
That makes sense right?
- You’re learning how to write applications.
- Applications need to be compiled.
- A compiled Java application needs a main method to run.
Of course, you also need to know:
- How to use ‘javac’ to compile the program
- How to use ‘java’ to run the program
And you might need to know:
- How to write a manifest file
- how to use ‘jar’ to package the program
How to sign the ‘jar’
jar cmf manifest.mf helloworld.jar HelloWorld.class java -jar helloworld.jar
And if you are beginning your learning in how to program Java, then you don’t even understand the code you’ve written to write “Hello World” to the console
I wonder why people prefer to learn scripting languages like Python and Ruby?
But, you don’t have to learn all this when you start, especially not when you want to learn to write automation code rather than application code.
- Write all your code in an IDE
- Write JUnit @Test methods
- Run the JUnit @Test methods from the IDE
- (right click on the method name and choose “Run”)
That way, you can start to learn the Java programming language. And use it to “do stuff” without all the baggage.
That’s why in the book Java For Testers, you learn to write all your code as JUnit @Test methods.
And of course, our evil, manipulative subtext… you’ll also start your career in Java programming by learning “Test First”. So you’re learning TDD and you might not even realise it.
Sneaky, but, what did you expect from the people behind EvilTester.com
Java For Testers is a tutorial guide. Learn Java by writing JUnit
Java For Testers ebook available from: