Skip to main content



      Home
Home » Archived » Test and Performance Tools Platform (TPTP) » open perspective problem in tptp junit plguin test
open perspective problem in tptp junit plguin test [message #79885] Fri, 04 August 2006 04:57 Go to next message
Eclipse UserFriend
i create a tptp junit plugin test,the test does nothing but open a
perspective.
when run the java file as "junit plugin test" no problem.
but when run the .testsuite file as "tptp junit plugin test" problem
accured.
a exception throw at the latst line of showPerspective(..,..) at
"Workbench class
I tryed 4.2 release and 4.1.0 on linux , both as this problem.
PS: the "tptp junit plugin test" started eclispe ,and runed
successfully.SO no problem related to rac or other thing.

ANY BODY can try such code:


following is the sourcecode:
----------------------------

import junit.framework.Test;

import org.eclipse.hyades.test.common.junit.DefaultTestArbiter;
import org.eclipse.hyades.test.common.junit.HyadesTestCase;
import org.eclipse.hyades.test.common.junit.HyadesTestSuite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.intro.IIntroManager;

/**
* Generated code for the test suite <b>AAA</b> located at
* <i>/AA/src/AAA.testsuite</i>.
*/
public class AAA extends HyadesTestCase {
/**
* Constructor for AAA.
* @param name
*/
public AAA(String name) {
super(name);
}

/**
* Returns the JUnit test suite that implements the <b>AAA</b>
* definition.
*/
public static Test suite() {
HyadesTestSuite aAA = new HyadesTestSuite("AAA");
aAA.setArbiter(DefaultTestArbiter.INSTANCE).setId(
"F2D2A48B54869012B944FE00239411DB");

aAA.addTest(new
AAA("test1").setId("F2D2A48B54869012BD3DFD90239411DB")

setTestInvocationId("F2D2A48B54869012C59C7A20239411DB"));
return aAA;
}

/**
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
}

/**
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
}

private static boolean FIRST_TEST = true;

private static IWorkbench fWorkbench;
/**
* test1
* @throws Exception
*/
public void test1()
throws Exception
{

fWorkbench = PlatformUI.getWorkbench();

// close intro
IIntroManager intro = fWorkbench.getIntroManager();
intro.closeIntro(intro.getIntro());

// open PDE perspective

fWorkbench.showPerspective("org.eclipse.pde.ui.PDEPerspective ",
fWorkbench.getActiveWorkbenchWindow());
System.out.println("fworkbench");

assertNull(null);


}

}
Re: open perspective problem in tptp junit plguin test [message #80216 is a reply to message #79885] Tue, 08 August 2006 21:18 Go to previous message
Eclipse UserFriend
Julien answered my question, anybody have the same confusion may look the
following:

------------------------------------------------------------ ---------

The main difference between JUnit plug-in tests and TPTP JUnit plug-in
tests is that the formers run in eclipse UI thread, whereas the latters
run by default in an eclipse job (ie. a non-UI thread).
The javadoc for IWorbench.getActiveWorkbenchWindow states that it "returns
null if called from a non-UI thread." This explains why you get a null
value.

But you can run your TPTP JUnit plug-in tests in the UI thread, if you
wish. To do so, you need to create a new Workbench Location (named, for
instance, "Local Eclipse - UI thread") (New... > Test > Test Assets >
Workbench Location). In the wizard, check the "Run tests in the UI thread"
option.
Then you have to create a deployment: don't add any artifact, but add the
workbench location you've created (named, for instance "Deployment on
local eclipse - UI thread")
You're ready to run plug-in tests in the UI thread: in the test launch
configuration, select your test, and pick the deployment "Deployment on
local eclipse - UI thread" instead of "Deployment on the local worbench".
Previous Topic:Sample Java Client is receiving incomplete data
Next Topic:ProbeKit filtering issue and design concern
Goto Forum:
  


Current Time: Thu May 08 11:27:38 EDT 2025

Powered by FUDForum. Page generated in 0.03712 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top