CS401 | sw engineering
  • outline
  • projects
  • syllabus
  • links

JUnit Testing Demo in Android Studio

 

STEP 1: click on class name (right click Generate->Test) to generate a Test class for it

>>>>select JUnit (note below this is an example using JUnit 4, use what version is the latest, depending on this you may need to update dependencies --look online for this info -i.e. developer site or search on Google)

 

STEP 2: Inside the new JUnit Test Class right click and do Generate ->Test Method (and select methods you want to test)

STEP 3: Run the Test (click on the left of the Test class name where there is a run symbol)

 

Results where I specifically made user one of the 5 test methods would fail

 

 

cs401:sw engineering

  • home
  • outline
  • projects
  • syllabus
  • links