It's all about the answers!

Ask a question

Junit/selenium adapter Error


Aparna Sukumaran (333660) | asked Mar 27 '14, 7:24 p.m.
edited Mar 27 '14, 7:27 p.m.
I'm trying to run Test cases using Junit/selenium adapter.  I get these error below in my Results.


com.ibm.dashboard.AutomationMain:initializationError() java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) at

Not sure about the values that need to be entered in Test Class, Class path fields?

Can some one please help me?



Comments
Brian Lahaie commented Aug 18 '15, 12:13 a.m. | edited Aug 18 '15, 12:19 a.m.

As stated below, I was getting the same error but I was able to resolve it by:
(1)Adding these import statements to my script:
import org.junit.Before;

annotations
import org.junit.Test;
(2)Added these JUnit annotations to my script:
@Before
@Test


Brian Lahaie commented Aug 18 '15, 12:20 a.m.

import java.io.File;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.junit.Before;
import org.junit.Test;

public class MyClass {
    public WebDriver driver;
    
    @Before
    public void setUp()throws Exception{
        driver = new FirefoxDriver();
    }
    
    @Test
    public void myTest() throws Exception{
           driver.get("http://www.ibm.com");
          String i = driver.getCurrentUrl();
          System.out.println(i);
          MyClass me = new MyClass();
          driver.close();
    }
}

2 answers



permanent link
Brian Lahaie (1081514) | answered Aug 18 '15, 12:21 a.m.
I was getting the same error but I was able to resolve it by:
(1)Adding these import statements to my script:
import org.junit.Before;
annotations
import org.junit.Test;
(2)Added these JUnit annotations to my script:
@Before
@Test

Comments
Brian Lahaie commented Oct 06 '15, 2:49 a.m. | edited Oct 06 '15, 2:50 a.m.

After working more with RQM and Selenium I found these annotations to be more useful, @BeforeClass, @Test, and @AfterClass.  These import statements are needed to use these annotations:
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.AfterClass;


permanent link
Ara Masrof (3.2k15) | answered Mar 27 '14, 8:11 p.m.
JAZZ DEVELOPER
 Aparna,
If you have a moment, take a quick look at this article

https://jazz.net/library/article/755

..its a great overview on running JUnit tests in RQM

Comments
Aparna Sukumaran commented Apr 01 '14, 6:33 p.m.

I'm getting the error below, after following all the steps from the Article. Any recommendations to fix this error.

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)
    at com.ibm.rqm.adapter.commandline.JUnitLauncher.main(JUnitLauncher.java:115)


Brian Lahaie commented Aug 17 '15, 3:49 p.m.

I am having a similar issue.



automationFramework.FirstTestCase:initializationError()
java.lang.Exception: No runnable methods
    at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:191)
    at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128)
    at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)
    at org.junit.runners.ParentRunner.(ParentRunner.java:84)
    at org.junit.runners.BlockJUnit4ClassRunner.(BlockJUnit4ClassRunner.java:65)
    at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.