Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cannot run my test using the EasyTest framework in my Project #64

Open
DeLaphante opened this issue Jan 14, 2014 · 4 comments
Open

I cannot run my test using the EasyTest framework in my Project #64

DeLaphante opened this issue Jan 14, 2014 · 4 comments

Comments

@DeLaphante
Copy link

Can anyone help me??
I'm having a NoClassDefFoundError:org/slf4j/Loggerfactory issue when trying to build my test by adding @RunWith(DataDrivenTestRunner.class) at the beginning of my class.

My code is as follows:

import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.easetech.easytest.annotation.;
import org.easetech.easytest.runner.
;
import org.easetech.easytest.loader.*;

@RunWith(DataDrivenTestRunner.class)
@dataloader(filePaths = { "C:/Users/Christian/Documents/TestData.csv" }, loaderType = LoaderType.CSV)

public class Homepage {
static WebDriver driver ;

@Before
public void setUp() throws Exception{

 System.setProperty("webdriver.chrome.driver", "C:/Users/Christian/Documents/chromedriver_win32_2.0/chromedriver.exe");
    driver = new ChromeDriver();     

}

@Test
public final void testMethod1(@Param(name="Name")String name , @Param(name="Number")String number, @Param(name="Email")String email) throws Exception
{
     driver.get("http:\\www.google.com");
    driver.findElement(By.linkText("Search")).click();

    driver.findElement(By.xpath("//*[@id='wpcf7-f220-t1-o1']/form/p/span[1]/input")).sendKeys(name);

    driver.findElement(By.xpath("//*[@id='wpcf7-f220-t1-o1']/form/p/span[2]/input")).sendKeys(number);

    driver.findElement(By.xpath("//*[@id='wpcf7-f220-t1-o1']/form/p/span[3]/input")).sendKeys(email);

    driver.findElement(By.xpath("//*[@id='wpcf7-f220-t1-o1']/form/p/input")).click();
}

@Test
public void testMethod2() throws Exception{

    driver.get("http:\\www.testhouse.net");


    driver.findElement(By.linkText("Test Tools")).click();

}

@After
public void tearDown(){
    driver.quit();
}

}

The trace log is a follows:

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.easetech.easytest.runner.DataDrivenTestRunner.(DataDrivenTestRunner.java:85)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 19 more

@anujgandharv
Copy link
Member

Hi,
Looks like SLF4J jar is not in your classpath. If you are using Maven, can you try with including the following JARs in your pom.xml file :

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.1</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
        <scope>runtime</scope>
        <exclusions>
            <exclusion>
                <groupId>javax.mail</groupId>
                <artifactId>mail</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.1</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.6.1</version>
        <scope>runtime</scope>
    </dependency>

@DeLaphante
Copy link
Author

Hi there,

Thanks but I'm actually using ANT.

@anujgandharv
Copy link
Member

So just include the above JAR files as dependenies in your project (by either downloading and copying the jar files in your lib dir manually or making ANT to do the same)

Cheers!

@DeLaphante
Copy link
Author

Thanks!...it works now..but there were other dependences I had to add to my CLASSPATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants