Hello Sarosianer,

As the common HTML UI project is growing I want to write some tests for the
it. This are not UI test (as there is no user action, or network needed),
but just JUnit test. What I try to do is getting a ProjectListManager
instance for my test. This manager needs an IWorkspaceRoot and I have no
clue how to create a test WorkspaceRoot.

In Eclipse I normally would do something like:
new EclipseWorkspaceRootImpl(ResourcesPlugin.getWorkspace().getRoot());[1]

But to keep this test IDE independent, I figured that I probably need some
kind of injection here, but I don't know how to do it. This don't work (plm
is null, running as JUnit, and JUnit Plug-In Test)

@Inject
private IWorkspaceRoot wRoot;

@Before
public void setUp() {
     ProjectListManager plm = new ProjectListManager(wRoot);
}

I looked at some existing JUnits,(for example the EclipseWorkspaceImplTest
[2] ) in Saros and find that we often use EasyMock to set up our tests. I
read the guide but I am not quite sure how to start.[3] But since I need a
REAL WorkspaceRoot this is not what I looking for or?

My questions are (besides any other hint and advice you have):
Can I even do this with a JUnit or do I need to start a STF test (or a
JUnitPlug-inTest), since I need a real WorkspaceRoot to work with?
How to get the same WorkspaceRoot as it would start Saros_STF_Alice?
How I would get a STF test running in the UI Project, since there should
not be a dependence from the UI to Saros.

I am kind of confused here how to even start.

Best
 Matthias


[1]
http://stackoverflow.com/questions/27789115/setup-eclipse-workspace-in-java-code
[2]
https://github.com/saros-project/saros/blob/bdd1edd9b49ecd8fd7ecbb09d04ae6fc8261deda/de.fu_berlin.inf.dpp/test/junit/de/fu_berlin/inf/dpp/filesystem/EclipseWorkspaceImplTest.java
[3] http://easymock.org/user-guide.html
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
DPP-Devel mailing list
DPP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dpp-devel

Reply via email to