Last active
December 28, 2015 10:09
-
-
Save DinisCruz-Dev/7484135 to your computer and use it in GitHub Desktop.
SWTBot scritps (inside TeamMentor Eclipse Plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//run these first (so that the code below compiles) | |
eclipseAPI.extraGroovyJars = | |
[ "/Users/plugin/_Dev/eclipses/Kepler/plugins/org.eclipse.swtbot.eclipse.finder_2.1.2.201311041021.jar" , | |
"/Users/plugin/_Dev/eclipses/Kepler/plugins/org.eclipse.swtbot.swt.finder_2.1.2.201311041021.jar" , | |
"/Users/plugin/_Dev/eclipses/Kepler/plugins/org.apache.log4j_1.2.15.v201012070815.jar" ] | |
def groovyExecution = view.groovyExecution; | |
def groovyShell = groovyExecution.groovyShell; | |
//def jar = "asd"; | |
//URL url = new URL("file://" + jar); | |
//groovyShell.getClassLoader().addURL(url); | |
return groovyExecution.executeScript(''' | |
def a = 2+2 | |
return a; | |
'''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//run these first (so that the code below compiles) | |
def extraGroovyJars = | |
[ "/Users/plugin/_Dev/eclipses/Kepler/plugins/org.eclipse.swtbot.eclipse.finder_2.1.2.201311041021.jar" , | |
"/Users/plugin/_Dev/eclipses/Kepler/plugins/org.eclipse.swtbot.swt.finder_2.1.2.201311041021.jar" , | |
"/Users/plugin/_Dev/eclipses/Kepler/plugins/org.apache.log4j_1.2.15.v201012070815.jar" ] | |
eclipseAPI.extraGroovyJars = [] | |
import tm.eclipse.groovy.plugins.*; | |
//def groovyExecution = view.groovyExecution; | |
def groovyExecution = new GroovyExecution(); | |
def groovyShell = groovyExecution.groovyShell; | |
for(def jar in extraGroovyJars) | |
{ | |
URL url = new URL("file://" + jar); | |
groovyShell.getClassLoader().addURL(url); | |
} | |
return groovyExecution.executeScript(''' | |
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; | |
def bot = new SWTWorkbenchBot(); | |
// return bot.menu("TeamMentor"); | |
'''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//run these first (so that the code below compiles) | |
def eclipseDir = "/Users/plugin/_Dev/eclipses/Kepler/plugins"; | |
def extraGroovyJars = | |
[ "${eclipseDir}/org.eclipse.swtbot.eclipse.finder_2.1.2.201311041021.jar" , | |
"${eclipseDir}/org.eclipse.swtbot.swt.finder_2.1.2.201311041021.jar" , | |
"${eclipseDir}/org.apache.log4j_1.2.15.v201012070815.jar" , | |
"${eclipseDir}/org.hamcrest.core_1.3.0.v201303031735.jar", | |
"${eclipseDir}/org.hamcrest.library_1.3.0.v201305281000.jar", | |
"/Users/plugin/_Dev/git/TeamMentor_Eclipse_Plugin/TeamMentor.Eclipse.UxTests_SWTBot/bin/" | |
]; | |
import tm.eclipse.groovy.plugins.*; | |
def groovyExecution = new GroovyExecution(); | |
def groovyShell = groovyExecution.groovyShell; | |
for(def jar in extraGroovyJars) | |
{ | |
URL url = new URL("file://" + jar); | |
groovyShell.getClassLoader().addURL(url); | |
} | |
return groovyExecution.executeScript(''' | |
import static tm.swtbot.helpers.SWTBot_Views.*; | |
import tm.swtbot.SWTBot_JUnit; | |
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; | |
// def bot = new SWTWorkbenchBot(); | |
// return bot.menu("TeamMentor"); | |
// return inspect(swtBot_Views()[0]); | |
return swtBot_View("TeamMentor") | |
'''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//run these first (so that the code below compiles) | |
def eclipseDir = "/Users/plugin/_Dev/eclipses/Kepler/plugins"; | |
def extraGroovyJars = | |
[ "${eclipseDir}/org.eclipse.swtbot.eclipse.finder_2.1.2.201311041021.jar" , | |
"${eclipseDir}/org.eclipse.swtbot.swt.finder_2.1.2.201311041021.jar" , | |
"${eclipseDir}/org.apache.log4j_1.2.15.v201012070815.jar" , | |
"${eclipseDir}/org.hamcrest.core_1.3.0.v201303031735.jar", | |
"${eclipseDir}/org.hamcrest.library_1.3.0.v201305281000.jar", | |
"/Users/plugin/_Dev/git/TeamMentor_Eclipse_Plugin/TeamMentor.Eclipse.UxTests_SWTBot/bin/" | |
]; | |
import org.junit.runner.JUnitCore; | |
import org.junit.runner.Result; | |
import org.junit.runner.notification.Failure; | |
import tm.eclipse.groovy.plugins.*; | |
def groovyExecution = new GroovyExecution(); | |
def groovyShell = groovyExecution.groovyShell; | |
for(def jar in extraGroovyJars) | |
{ | |
URL url = new URL("file://" + jar); | |
groovyShell.getClassLoader().addURL(url); | |
} | |
return groovyExecution.executeScript(''' | |
import org.junit.runner.JUnitCore; | |
import org.junit.runner.Result; | |
import org.junit.runner.notification.Failure; | |
import static tm.swtbot.helpers.SWTBot_Views.*; | |
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; | |
def jUnitResult = JUnitCore.runClasses(tm.eclipse.ui.TeamMentor_Menu_Test.class); | |
def failures = jUnitResult.getFailures(); | |
// inspect(jUnitResult) | |
// inspect(failures[0]) | |
return failures.collect { '\\n - ' + it } + '\\n' + | |
'\\n runCount : ' + jUnitResult.runCount + | |
'\\n failureCount: ' + jUnitResult.failureCount + | |
'\\n runTime : ' + jUnitResult.runTime; | |
// def bot = new SWTWorkbenchBot(); | |
// return bot.menu("TeamMentor"); | |
// return inspect(swtBot_Views()[0]); | |
return swtBot_View("TeamMentor") | |
'''); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def groovyExecution = new GroovyExecution() | |
def pathToProjectsRoot = "/Users/plugin/_Dev/git/TeamMentor_Eclipse_Plugin"; | |
def binFolder = pathToProjectsRoot + "/TeamMentor.Eclipse.UxTests/bin/"; | |
def jUnitClass = "tm.eclipse.api.EclipseLog_Test" | |
groovyExecution. addRefsToGroovyShell([ binFolder ]); | |
groovyExecution.execute_JUnit_Test(jUnitClass); | |
if (groovyExecution.executionException != null) | |
return groovyExecution.executionException; | |
return groovyExecution.returnValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def groovyExecution = new GroovyExecution() | |
def pathToProjectsRoot = "/Users/plugin/_Dev/git/TeamMentor_Eclipse_Plugin"; | |
def binFolder = pathToProjectsRoot + "/TeamMentor.Eclipse.UxTests_SWTBot/bin/"; | |
def jUnitClass = "tm.eclipse.ui.TeamMentor_Menu_Test" | |
groovyExecution.addRefsFor_SWTBot() | |
groovyExecution.addRefsToGroovyShell([ binFolder ]); | |
Thread.start | |
{ | |
groovyExecution.execute_JUnit_Test(jUnitClass); | |
// if (groovyExecution.executionException != null) | |
// eclipseAPI.log(groovyExecution.executionException.toString().replace("\n"," ")); | |
eclipseAPI.log(groovyExecution.returnValue.toString().replace("\n"," ")); | |
} | |
return groovyExecution |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment