Run multiple RCP junit tests encompassed in multiple bundles - eclipse

We have multiple RCP bundles and seperate fragment projects to test these bundles with either RCP plugin or plain jUnit tests.
Problem
To test the well functioning of the whole ecosystem we would like to run all tests from all plugins before we push new code to our CI environment.
Yet, till now we only figured out how to run the tests inside single projects at once. Thus, to run all tests on all plugins we currently select one plugin at a time and execute the tests inside via the context menu. This manual process is error-prone.
Question
Is there a way in the eclipse IDE to run all tests inside all plugin projects at once?

The easiest way is to create a Launch Group; you can find it under Debug Configurations.
Add all your existing JUnit (or JUnit Plug-in Test) launch configurations to it and then hit the Debug button.
Unfortunately if you create additional JUnit Plug-in tests after this Launch Group was created, then you have to add those new Plug-ins manually.

Related

KIE Workbench Test Scenarios as a part of Maven build

In my current project we need to run Test Scenarios created in Workbench as a part of a Maven build. The final goal is to have these functional tests included to the continuous integration process.
We spent a couple of days trying to figure it out.
We opened a project that is created by Workbench in the .niogitfolder and are trying to run a maven goal.
But seems that maven goals like mvn clean install or mvn clean verify or mvn clean test don't run the Test Scenarios having a .scenario type at all.
Do you have any ideas on that?
Test scenarios are specific to kie-workbench. maven commands will not execute them during build. If you want tests to be executed during maven build then you have to write junit tests to check the execution of rules and processes.
there is currently work in progress on new version of scenarios in the kie-workbench. See the list of tasks. I would recommend you to bring this requirement there.

How do I create a self contained package of Selenium JUnit Tests?

I have a bunch of Selenium Tests which I currently run on JUnit from Eclipse. (Using the Firefox webDriver)
I need to create an easy to install/use package of these tests to give to various members of the QA team so they can run them on different computers.
Is there something that already does this, is there a way to zip up eclipse + tests so they can be run from any computer?
Yes there are a couple of ways
I use maven for managing the project dependencies and run the tests via sure-fire plugin... but it looks like an overkill for your case
You can see a simple explanintion here:
how to export (JUnit) test suite as executable jar

Force Eclipse to clean a project automatically before every run

I'm looking for a solution that will force Eclipse to automatically clean a project before I run it (I'm talking about running a project using just Eclipse- no Maven, no Ant). For building I already have a Maven configuration, but sometimes I run the build directly from Eclipse as well and this is when I need that cleaning.
Shouldn't it be possible to have Maven and Eclipse use different class folders, e.g. /target for the Maven build and /bin for the Eclipse internal Java compiler? If so, you should be able to have 2 different launch configurations running the code from 2 different locations.
Second alternative: You can create a small Ant script to clear the target directory. That Ant script can be run from inside Eclipse, so a workaround is running the Ant launch configuration first and your Java launch configuration afterwards. To make this a one-step process, please install the launch groups feature from Eclipse CDT (you only need that small feature, not the whole CDT!), then you can create a "batch" like launch configuration from the other two launch configurations. Now everything is inside Eclipse with a single launch configuration!

Can Ant detect if a project is closed in Eclipse?

We're using Eclipse on a flat multi-project set-up. Ant builders are set up on each project to create jars as needed; the ant files are used to manually kick off junit tests, create junit reports, etc.
One project is set up as a "master build" project, from which one has a convenient single ant target "test-all", which invokes the test target in all the other projects. This works, no problem.
The challenge is, that to some developers, certain projects represent optional components that aren't relevant to their immediate work task. So they close these projects to create some time-savings when doing things like clean and rebuild the whole workspace. This is fine, Eclipse ignores the closed projects as intended.
Problems occur when one goes to the "master build" project, and runs the ant test-all target. As you'd expect, it goes and tries to run the tests for all the projects, not just the "open" ones.
Any easy way to make the ant script smarter when running in an eclipse environment to know about "closed" projects, so I could make it ignore those?
Sort of adding an "unless=${CLOSED.UNDER.ECLIPSE}" type of ability to my ant files.
many thanks.

How to run Eclipse launch configurations programmatically?

I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:
You can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.
We check these in to SVN. The developers can pass them around, and it helps getting new devs running a working application quicker.
I'd like to check these out as part of our build and use them to programatically run the application, the tests, etc, without spinning up the whole IDE.
What would be the best way to run a .launch file outside of the UI?
Edit: I am trying to unify the tests run on the build server and the IDE. I do not
particularly want to give up integrated debugging, which would be the case with an ant script to run the tests .
This is probably more a problem for integration testing with multiple bundles, or unit testing a whole bundle, where you'd like to mock up extensions.
there is an eclipse plugin built over JUnit, called TPTP. It provides an automation client which can be used to launch the test from eclipse with no gui. maybe it helps
Ant4Eclipse may provide a good starting point on how to do this.
Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin JUnit tests.
I have recently had alot of success building an Eclipse RCP app inside a Hudson CI server using Eclipse Buckminster. It took a bit of doing, but once I setup both features, made my RCP product be based on features, and added the Buckminster query files and the like, it worked. There is a Hudson/Jenkins Buckminster plugin that allowed me to have hudson build the application.
After saving the launch configurations for each test fragment, I created hudson commands to invoke them (yes one line per test fragment unfortunately), but after that I got the automated CI build that I wanted.
You could also use the shell command Eclipse uses. To get it:
Run your program in Eclipse
Go to the "Debug" view
Right-click on the process (probably the second item in the tree) and select "Properties"
Copy shell command and delete the agentlib flag to run in bash
I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.
This article describes how to run the tests during your build process. With this process, you use a special "Test" Eclipse and load the plugins you want to test.
Perhaps running the configurations the way you would run your own custom run configurations would help here. It is described in this article.