mercredi 28 février 2018

getting started with JUnit

Hi I am starting to learn junit but i Have following issues

C:\JUNIT_WORKSPACE>javac TestJunit.java TestRunner.java
TestJunit.java:1: error: package org.junit does not exist
import org.junit.Test;
            ^
TestJunit.java:2: error: package org.junit does not exist
import static org.junit.Assert.assertEquals;
                   ^
TestJunit.java:2: error: static import only from classes and interfaces
import static org.junit.Assert.assertEquals;
^
TestRunner.java:1: error: package org.junit.runner does not exist
import org.junit.runner.JUnitCore;
                   ^
TestRunner.java:2: error: package org.junit.runner does not exist
import org.junit.runner.Result;
                   ^
TestRunner.java:3: error: package org.junit.runner.notification does not 
exist
import org.junit.runner.notification.Failure;
                                ^
TestJunit.java:4: error: cannot find symbol
@Test
^
symbol:   class Test
location: class TestJunit
TestJunit.java:7: error: cannot find symbol
assertEquals("Junit is working fine",str);
    ^
symbol:   method assertEquals(String,String)
location: class TestJunit
TestRunner.java:6: error: cannot find symbol
Result result = JUnitCore.runClasses(TestJunit.class);
    ^
symbol:   class Result
location: class TestRunner
TestRunner.java:6: error: cannot find symbol
Result result = JUnitCore.runClasses(TestJunit.class);
                    ^
symbol:   variable JUnitCore
location: class TestRunner
TestRunner.java:7: error: cannot find symbol
for (Failure failure : result.getFailures()) {
         ^
symbol:   class Failure
location: class TestRunner
11 errors

Source of learning: https://www.tutorialspoint.com/junit/junit_environment_setup.htm

I have the path:

%JUNIT_HOME%\junit-4.12

added to Path. and the system variable

JUNIT_HOME | C:\JUNIT\

Aucun commentaire:

Enregistrer un commentaire