Using SWTBot on a Maven Project - java

I am relatively new to SWTBot.
I have installed it through the "install new software" in eclipse.
I am trying to use it on an SWT application that was imported from an existing maven pom.xml. This application is not an eclipse plugin. Its just a standalone plain SWT application.
The problem is that I can't seem to be able to import any of SWTBot's classes in a test case.
I am wondering if there is a maven artefact I may need to add? I am not finding one.
If there is a more complex setup, how can I set it up?

if you installed the swtbot plugin/bundle via eclipse then you'll need an eclipse plugin project that depends on that bundle to hold your tests. Create a new plugin project and edit the manifest file to import the swtbot bundle.
You will then need a run configuration that will launch the application under test. I'm not sure how this can be achieved with a standalone maven project, but there's probably a way. If the project under test was an Eclipse application, you'd only need to right-click on your swtbot test and select run as swtbot test. I don't have an Eclipse with swtbot up and running atm so I can't give more detail, sry
[EDIT]
IMHO you should first try to test a dummy eclipse application. Put the plugin containing your test and the one containing your dummy app in your workspace, then run the test as described above. Once you have that running you should have a look at this post and the answer by the maintainer of SWTBot. A new instance of Eclipse will be launched with all UI contributions added by your dummy Eclipse application and the test will be run.
And have you already seen this similar post on SO? Sounds promising to me...

Related

Cannot run project - the selection cannot be launched and there are no recent lanuches

i have following problem:
Yesterday i worked on my selenium&maven project in java on eclipse and after work i export project as archive, today i want to import whole project and run it on second computer, but i receive 'the selection cannot be launched and there are no recent lanuches'.
I tried run configuration, but there's no effect.
My archive is available here: https://drive.google.com/open?id=1BB0tqege1iWE_qdbHSEhfvNuFqPa8SO7 or https://github.com/mtpx/af/tree/master/automationFramework
How can I execute this project?
It using Selenium, Maven and TestNG, so there's no main class here
Maybe the project you have in hands was not exported properly, missing important metadata for the compiler.
Make sure the project is being correctly exported using (right click) export option and not only copy+paste/zip+share.

Cucumber is not recognizing defined steps "Undefined Steps"

I can't execute a simple test with cucumber for a project. I am on Intellij 13 Community, with cucumber plugin.
I wrote my feature file in my features directory, I have also implemented my steps creating them with the help of the plugin. My steps in the feature files are recognized by intellij, which can navigate and go to the step implementation.
When I try to run my scenario, if fails stating "Undefined step". Any help will be greatly appreciated.
Here is how i organized my project :
It sounds as if you are trying to run the feature from Idea. It also sounds as if you have some issue with the wiring of your project.
My approach would be to start with something that works and then modify it to suit your needs. A project that works is the Java skeleton provided by the Cucymber team. Download or clone it from GitHub: https://github.com/cucumber/cucumber-java-skeleton
You should be able to build this project using Maven, Ant, or Gradle. It will also be possible to open it using IntelliJ IDEA and modify it to suit your needs.

Eclipse plugin not working properly

I developed an Eclipse plugin that compiles and runs java code in German. The technique I am using is that I translate the code to English and pass it to Java Compiler and get the results back and print it in the console.
The problem is that the plugin works when I run the plugin from Inside Eclipse but when I install the plugin in Eclipse so that when I open Eclipse it already exists there and start to test if a real user uses my plugin and creates a new Java project and try to the compile button in my plugin it says [The chosen operation is not currently available] ![Here is the the way I run and it opens a new Eclipse application with the installed plugin ]
Any help please
the way you installed your plugin sounds a little weird to me. So at first please try to export your plugin via the Export Wizard.
(Select Export -> Deployable plugins and features from your projects context menu)
Export your project as jar file and copy it to the 'plugin' folder of your eclipse instance.
After that it might be helpful to debug your plugin on OSGI-Level as there might be a problem loading your plugin (at least the error description you have posted indicates that).
Run eclipse with -console -noExit -consoleLog flags to open an OSGI console for debugging. After that try running ss <your-plugin-name> to see what the state of your plugin is.
The output gives you the ID of your plugin and the state it currently has. If the state of your plugin is not ACTIVE try running start <your-plugin-id> to see whether it starts correctly. If there is a problem starting your plugin you should get a respective log message. Feel free to post it here in case you need further help.
Otherwise there are plenty of options what might cause your problems, so maybe its better to try the steps I have described above before getting into details.
If you want to run eclipse plug-in withput using Eclipse Application , then you need to make a Feature project.
Now if your algorithm has something to do with system Path , you must
check Unpack plug-in and you should read the resource accordingly.
Like PLatformUI.getWorkBC() etc..
No other eclipse plug-in (jar) should be inside plugins directory of eclipse of same name of your plug-in. Ensure for this.

oData4j sample eclipse project

I have downlaoded oData4J jar files from odata.org and I intend to do a sample producer, within a basic web service.
I assumed that InMemoryProducerExample.java from http://code.google.com/p/odata4j/ will do the job and most probably it is.
My problem is that I have no clue which type of project to create (Eclipse Java), how to deploy and test this example.
Does anyone have such a start up hellow world tutorial for odata step by step, or an eclipse project which use InMemoryProducerExample.java from oData. I really need a starting point and I can see one online.
Thanks.
The easiest way to run the odata4j example is to simply checkout their project, and open it in eclipse.
If you don't have mercurial installed, install it from here.
checkout the latest odata4j code using this mercurial command,
hg clone https://code.google.com/p/odata4j/
Open the project in eclipse using the maven eclipse plugin. If you are using the latest version of eclipse, this will be installed already, it not you can install it from here.
In eclipse, go import->maven->Existing maven projects
Then select the directory where mercurial checked out odata4j.
When eclipse finishes importing the projects, you can find InMemoryProducerExample, and right click on it to run it as a java program. You can run any of the other examples in the same way.
Meanwhile, forks of odata4j which continued their lives are also available on GitHub, see https://github.com/odata4j/odata4j and my own https://github.com/vorburger/odata4j/ (which I am about to transfer to https://github.com/lukinf), which included some minor fixes for opening it in Eclipse.

Adding 3 projects to version control (SVN) in Eclipse

I'm currently developing an application, and I have worked in the last weeks with the following 3-project setup :
the code itself;
unit tests;
acceptance tests.
Until now, I had only the code itself under version control. I'm researching on how to include all the 3 projects under version control. I'd like to have everything under the same repository. I've created 3 folders(one for each project) under my SVN repo.
In a new workspace, I've imported each one of the projects into Eclipse. This seems, at first, to be working fine, but I'm not sure if I won't get problems later on when trying to make commits to the server and the different projects aren't in the most recent update.
I'd guess this wouldn't be a problem as they don't share any file, at all, but I'm not really sure. Is this the correct approach for the given situation? How would you handle this?
You create a local project in Eclipse, right-click on it, and select Team/Share project...
Then a wizard will guide you, and allow putting the code into the correct folder of the svn server.

Categories