O'Reilly logo

TestNg Beginner's Guide by Varun Menon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – writing a JUnit test

  1. Create a Java project named JunitProject with the following structure:
    Time for action – writing a JUnit test
  2. Download the latest JUnit JAR from the following URL: http://sourceforge.net/projects/junit/.
  3. Paste the following JAR to the lib folder as shown in the structure in the preceding image.
  4. Select the said JAR in Eclipse and do right-click and navigate to Build Path | Add to Build Path.
  5. Now create a new class file named JunitSampleTest under the package test.sample.junit and add the following code to it:
    package test.sample.junit; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required