Share
Go down
dbekkerman
Posts : 2
Join date : 2010-01-29

can't make RC code to run

on Fri Jan 29, 2010 7:01 am
I am not sure I have build in all the jar files into lib directory that requires, but when I try to run even the simplest code below I get error messages

Multiple markers at this line
- The hierarchy of the type NewTest is inconsistent
- The type junit.framework.TestCase cannot be resolved. It is indirectly referenced from
required .class files


Here is my code below. What am I missing ? Please help. Thank you

package com;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

public class NewTest extends SeleneseTestCase
{
public static void main(String args[])
{
NewTest nt = new NewTest();
nt.setUp();
nt.testNew();
}

public void setUp() throws Exception
{
setUp("http://www.google.com/", "*firefox");
}
public void testNew() throws Exception
{
selenium.open("/");
selenium.type("q", "selenium rc");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
}

}
avatar
Advisor
------------------------
------------------------
Posts : 383
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: can't make RC code to run

on Fri Jan 29, 2010 11:31 am
Hi,

First try to remove package from your code . just write in a simple one class file.Don't use package concept.

You have to take setUp() and testNew() method out of main class block also.

You have to link 2 jar file to your project in your IDE or editor you are using to write code.
1. Junit.jar
2. selenium-java-client-driver.jar

You have to start selenium server also before executing the code.Finally run your code and I'm sure it will be execute.


Hope this will help you. Best of luck.

Bye
avatar
Advisor
------------------------
------------------------
Posts : 383
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: can't make RC code to run

on Fri Jan 29, 2010 11:38 am
dbekkerman
Posts : 2
Join date : 2010-01-29

Re: can't make RC code to run

on Sat Jan 30, 2010 6:23 am
Hi Adviser.

The reason it did not work b/c I I did not build in JUnit.jar - just so others beware to download it from junit.org and add to Reference Libraries along with selenium-java-client-driver.jar

Now it is working ... gosh I spent 3 freaking days trying to make it run

Thank you !!!
mjd2010
Posts : 2
Join date : 2010-05-04

Re: can't make RC code to run

on Wed May 05, 2010 12:09 am
Hi, I have associated junit-4.8.1.jar and selenium-java-client-driver.jar files. Still I see the below issue.

java.lang.NoSuchMethodError: main
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\COMMON~1\MERCUR~1\FUNCTI~1\Java\classes;C:\PROGRA~1\COMMON~1\MERCUR~1\FUNCTI~1\Java\classes\jasmine.jar
Exception in thread "main"



Can some one please help me.
metman
Amateur
Amateur
Posts : 58
Join date : 2010-04-02

Re: can't make RC code to run

on Wed May 05, 2010 11:53 pm
You have no main method. However, you are using jUnit 4+, so there are a few things you should be doing (or not doing).

1. Your tests shouldn't extend TestCase/SeleneseTestCase. That was the way in jUnit 3 and before, but not jUnit 4.

2. Use annotations. In jUnit 4+, the primary annotations to use are @BeforeClass, @AfterClass, @Before, @After, and @Test. The way you use annotations is to put them just before each method. The way they work is:
@BeforeClass and @AfterClass are methods that will run once, as the names suggest, before and after the whole class runs. Generally, these are used for environment setup/tear down steps, like initializing and cleaning up a test environment required for all your tests to run. @Before and @After run before and after each individual test. These are generally used for per test generic setup steps, for selenium tests for example, that is often setting up/tearing down browser sessions. @Test is the annotation used to mark the methods that are actual tests. jUnit test runners will look for these annotations when trying to run tests, and jUnit aware IDEs will do the same.
Sponsored content

Re: can't make RC code to run

Back to top
Permissions in this forum:
You cannot reply to topics in this forum