- dbekkerman
- Posts : 2
Join date : 2010-01-29
can't make RC code to run
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");
}
}
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");
}
}
Re: can't make RC code to run
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
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
- dbekkerman
- Posts : 2
Join date : 2010-01-29
Re: can't make RC code to run
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 !!!
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
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.
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.
- metmanAmateur
- Posts : 58
Join date : 2010-04-02
Re: can't make RC code to run
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.
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.
- For every change in the code of selenium RC, Is that necesary to compile the selenium RC code every time.
- how to make script to wait until ajax components get loaded in page
- How to make IDE to focus on a newly opened tab?
- how to write code using DOM
- 2 Button exist with same name. How to make the script instead of using positions..
Permissions in this forum:
You cannot reply to topics in this forum
|
|