Using webdriver from soapUI groovy script is possible, i did it some time ago, also, you can work around the spaghetti code by setting your classes as context objects in groovy and then call it from another groovy script. Anyway, using soapUI as you test harness may seem like a neat idea in the beginning, but soon enough you will end up writing everything in java (at least i did) and at that point you ask yourself: "what benefits do I get comparing to pure java test code together with testng or similar" and, (oh did i think of it), you'll probably end up with none. So if you need to do something that some managers call end-2-end testing, meaning you will trigger some action from webUI, that will trigger an call to a webservice, that will trigger a call to a database, that will trigger a response to a webservice that will return some stuff to UI ... and you want to test all 42 paths of that algorithms in one test (you shouldnt but people can ask for it).. then it is possible, that you will end up in a situation where 9 out of 10 of your soapUI teststeps are of type groovy script, and all you get is that you lose the flexibility you get when you just write your testcode in pure java.
Anyway, sry, a lot of text, a little information. What you want is (from top of my head):
class Login{
def context;
def testRunner;
def log;
WebDriver driver;
@FindBy(id = "userBlablA") WebElement userName;
@FindBy(id = "passPass") WebElement password;
def Login(logIn, contextIn, testRunnerIn){
// trololooo, so logged in soon ! !1
}
public void login(){
userName.sendKeys("boss");
password.sendKeys("hasReturned");
// do more stuff
}
}
And, after the class, you will just set it as a context propery so you can call it if you want, something like:
context.setProperty( "login", new Login(log, context, testRunner) )
-----
and then, should you need it, in another groovy script you can just tell something like:
testRunner.testCase.testSuite.project.testSuites["mega"].testCases["yolo"].testSteps["logg"].run(testRunner, context)
// do register
def inLogger = context.login
inLogger.login()
So that is basically it.
good luck
erki