Groovy and Jemmy

In this demo, we have opportunities

1. To Bind your Java application with groovy console.

2. To Automate manual steps in groovy console.

1. Bind your Java application with groovy console.

//BindJavaApplication.groovy

import org.netbeans.jemmy.*;
import org.netbeans.jemmy.explorer.*;
import org.netbeans.jemmy.operators.*;

// Fire up the SwingSet2 Application

new ClassReference("SwingSet2").startApplication();

// Get a reference to the SwingSet JFrame and put it into the console's script binding.

mainFrame = new JFrameOperator("SwingSet")

def bind = new Binding()

bind.setProperty("testScript",this)

bind.setProperty("mainFrame",mainFrame)


// Fire up the Groovy console.

def console = new groovy.ui.Console(this.class.classLoader,bind)

console.run()

Thread.sleep(700000)


2 . Automate manual steps in console.

import org.netbeans.jemmy.*;

import org.netbeans.jemmy.explorer.*;

import org.netbeans.jemmy.operators.*;

// Get first button object to click
buttonObj = new JButtonOperator(mainFrame,0)

// to click on button with title “OK” buttonObj = new JButtonOperator(mainFrame,”OK”)

t = new Thread() {

buttonObj .push()

}

t.start()

Hey, what we have just done; we have just clicked first button of SwingSet.


Cheers !! Enjoy Automation.

~NV


Comments

Popular posts from this blog

Testing Shifts with agile automation #RPA #ML

Bots and What Not !!

Need > Want

Automate your everyday tedious tasks and free up time for higher-value work (with Microsoft free RPA solution)

Respect is not earned, It is given ⚘ 🙏

Popular posts from this blog

Typical Project flow with QA Loop in Jira (Atlassian)

Increase ROI in your organization with Automation Testing

Tip to create workflow in JIRA quickly

Headless Automation Testing

QuickTest Pro and Traceability Matrix

AFT (Automation Framework Team) should not take developers' false catches

Testing Priciples & Vocabulary

QA Project Checklist

How to automate test-scenarios which have Java Objects built on JMesa , JQuery, JSON and AJAX technology.