|
10 | 10 | importjava.util.HashSet; |
11 | 11 | importjava.util.Properties; |
12 | 12 | importjava.util.Set; |
| 13 | +importnet.sf.j2s.core.astvisitors.Bindings; |
13 | 14 | importnet.sf.j2s.core.astvisitors.DependencyASTVisitor; |
14 | 15 | importnet.sf.j2s.ui.classpath.CompositeResources; |
15 | 16 | importnet.sf.j2s.ui.classpath.ContactedClasses; |
|
28 | 29 | importorg.eclipse.debug.core.ILaunchConfiguration; |
29 | 30 | importorg.eclipse.jdt.core.IJavaModel; |
30 | 31 | importorg.eclipse.jdt.core.IJavaProject; |
| 32 | +importorg.eclipse.jdt.core.IMethod; |
| 33 | +importorg.eclipse.jdt.core.IType; |
31 | 34 | importorg.eclipse.jdt.core.JavaCore; |
| 35 | +importorg.eclipse.jdt.internal.corext.util.JavaModelUtil; |
32 | 36 | importorg.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
33 | 37 | importorg.eclipse.jface.dialogs.MessageDialog; |
34 | 38 | importorg.eclipse.swt.widgets.Display; |
@@ -642,7 +646,23 @@ private static String generateHTML(ILaunchConfiguration configuration, |
642 | 646 | buf.append("ClazzLoader.loadClass (\"junit.textui.TestRunner\", function () {\r\n"); |
643 | 647 | buf.append("ClazzLoader.loadClass (\"" +mainType +"\", function () {\r\n"); |
644 | 648 | //buf.append("" + mainType + ".main(" + ArgsUtil.wrapAsArgumentArray(args) + ");\r\n"); |
645 | | -buf.append("junit.textui.TestRunner.run (" +mainType +");\r\n"); |
| 649 | +ITypemType =JavaModelUtil.findType(javaProject,mainType); |
| 650 | +booleanisTestSuite =false; |
| 651 | +if (mType !=null) { |
| 652 | +IMethodsuiteMethod =JavaModelUtil.findMethod("suite",newString[0],false,mType); |
| 653 | +if (suiteMethod !=null) { |
| 654 | +StringreturnType =suiteMethod.getReturnType(); |
| 655 | +if ("QTest;".equals(returnType) |
| 656 | +||"Qjunit.framework.Test;".equals(returnType) ) { |
| 657 | +isTestSuite =true; |
| 658 | +} |
| 659 | +} |
| 660 | +} |
| 661 | +if (isTestSuite) { |
| 662 | +buf.append("junit.textui.TestRunner.run (" +mainType +".suite ());\r\n"); |
| 663 | +}else { |
| 664 | +buf.append("junit.textui.TestRunner.run (" +mainType +");\r\n"); |
| 665 | +} |
646 | 666 | buf.append("});\r\n"); |
647 | 667 | buf.append("});\r\n"); |
648 | 668 | buf.append("</script>\r\n"); |
|