Cannot run the selected program/Script in selenium webdriver - eclipse

I am unable to run some of the classes in my project.After opening the class if i mouse over on Run button its showing different class that i executed previously.I am unable to run the class I opened and one thing i observed is the class which i am unable to run is used as extended class for other classes.Please help me out with this issue and suggest me if i need to change any Run configuration settings?.enter image description here

There is no test or main method to run which is why you are not seeing any option to run..either mark that f method with #Test or any other annotation from testng or create a main method

Related

How to use main class selection dialog?

I want my sbt plugin to have the same behavior as sbt run task - use a main class if there's only one and ask a user to choose one if there're multiple. How do I do it?
Turns out selectMainClass setting either shows a dialog or uses the value from mainClass

Intellij Main Class Always Changing

my question today is if there is a way for IntelliJ to build with the current class file I have Instead of always going into the configurations setting and changing the Main class from there.
Picture :
Ok I now understand want you want :)
I hope this image helps.
You can create a run configuration for each class with a main method. In this example we have three classes Main1, Main2 and Main3 which you can see on the left in the image. So I created three run configurations called Main1, Main2 and Main3 which have the corresponding classes set as Main class.
You can add multiple run configurations by clicking on the green plus.
In the toolbar you then can choose the run configuration which you want to run.
EDIT:
You can just make a right click on the main method and choose the option run. I guess that is what you want :)
You can probably go in and change the default to default to that class

Minimal JFace application making use of FilteredTree

In my RCP application I have a JFace dialog making use of FilteredTree, which depends on the running PlatformUI.
Now I want to add a main method to the dialog class, so I can start this dialog for testing purpose quickly. But I get an exception from within the FilteredTree ctor:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/e4/core/di/InjectionException
at org.eclipse.ui.PlatformUI.isWorkbenchRunning(PlatformUI.java:114)
at org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(AbstractUIPlugin.java:669)
at org.eclipse.ui.dialogs.FilteredTree.<clinit>(FilteredTree.java:196)
at my.MyDialog.createDialogArea(MyDialog.java:361)
Is there a simple solution?
You can't just add a main method. Eclipse has a huge amount of initialization that must be done before plug-in code can be run and this requires that the normal Eclipse main method is used.

Griffon View Script Generated from NetBeans Not Showing

I developed a UI in NetBeans that I want to use in my Griffon application. I chose to do so because I don't have enough time to figure out how to get the screen laid out correctly using SwingBuilder. According to the book Griffon in Action, I basically just need to place the .java file created in NetBeans under the appropriate package in the src directory of my Griffon project and run the griffon generate-view-script command with the fully qualified class name of the .java class (it took me a while to figure out how to do that). It then generates a .groovy file in the views directory that contains some code wrapping the .java class to make it work with SwingBuilder. When I try to run this as-is, nothing comes up. There are no exceptions being thrown, but nothing shows up either.
As it turns out, the .java class contains a Main() method in which the visible property of the class (it is a subclass of JFrame) is set to true. The Main() method does not get called by SwingBuilder, so the visible property was never being set to true. To correct this, I just had to add visible: true to the parameters to the generated widget node like below.
widget(new package.path.MyClass(), id: 'MyClass', visible: true)
Once I did that, it came up just fine.

Change display name of unit tests in JUnit Eclipse plugin

Is it possible for an Eclipse plugin to change the display name of unit tests run by the default Eclipse JUnit plugin?
Some background: I'm trying to create a plugin which will display unit test names (in the JUnit view in Eclipse) a bit different from the actual method name. If the actual test method name is "anEmptyCollectionHasSizeZero" I want it to be displayed in the Eclipse JUnit view as "An empty collection has size zero".
I've managed to display the test method names in the way described above as a separate view in a plugin, but would as I said like to get this feature integrated in the normal JUnit view. I tried to see if I could find a related extension point, but could not find anything. Is it possible to do this?
Also, is there a plugin which already does this, or similar?
I don't know the exact answer, but the best place to start is likely by looking at the code for org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart (in the plug-in org.eclipse.jdt.junit). That ViewPart is the JUnit view that you see in Eclipse.
It looks like org.eclipse.jdt.internal.junit.model.TestCaseElement.getTestMethodName() might be the place where the name is obtained from. Maybe you can trace how/when those elements are created and inject some other name. It looks like the implementation class is internal though (org.eclipse.jdt.internal.junit.model.TestElement), so you might be out of luck.
I'd suggest asking on the JDT forums about the possibility of doing this.
There don't seem to be any plugable way to change the label or the colors used.
(I had hoped the label provider used for the TestViewer was based on a PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator() so the image, label and color could be decorated, but that does not seem to be the case...)
You may want to look at the jnario sources. They have implemented something like that, where the JUnit window displays something that is surely not a stack frame.
You may use the setName() method of the class junit.framework.TestCase (or the constructor with the name parameter).
public MyTestCase() {
super("This is my JUnit test");
By default a TestCase defines the methods to be executed by it's name, which we have just overwritten. To make it runnable we have to overwrite the run method like this.
#Override
protected void runTest() throws Throwable {
testMyTest();
}