title: How to run a file in Eclipse as TestNG
body: <p>I'm trying to run a very simple test on a mock API and when I go to the Eclipse to hit &quot;Run as&quot; it should have a testNG option, but instead has a greyed out (none applicable) option which you can't click. I tried installing TestNG JAR file but when I do, it has duplication errors on imports such as <code>Assert.assertEquals</code>.</p>
  <pre class="lang-java prettyprint-override"><code>import org.testng.Assert;
  import org.testng.annotations.Test;
  
  import files.Payload;
  import io.restassured.path.json.JsonPath;
  
  public class sumValidation {
      @Test
      public void sumOfCourses() {
          int sum = 0;
          JsonPath js = new JsonPath(Payload.CoursePrice());
          int courseSize = js.getInt(&quot;courses.size()&quot;);
          for(int i = 0; i &lt; courseSize; i++) {
              int prices = js.getInt(&quot;courses.price[&quot; + i + &quot;]&quot;);
              int copies = js.getInt(&quot;courses.copies[&quot; + i + &quot;]&quot;);
              int amount = prices * copies;
              System.out.println(amount);
              sum = sum + amount;
              int purchaseAmount = js.getInt(&quot;dashboard.purchaseAmount&quot;);
              Assert.assertEquals(sum, purchaseAmount);
          }
      }
  }
  </code></pre>