Testing SWING app with no user interaction

Hi,
I have a small SWING application, it contains a few text fields and a
button. I want to test this without human interaction. For buttons, I tried the button.doClick() but it did not do anything! And for the text fields, I can't figure out how to do it. I am relatively new to SWING, I would appreciate your help so much.
Thanks,
Ann

It may not be what you want, but why can't you simply have the button call a method when pressed. That way, in your test code you can simply call that method.
button.addActionListener( new ActionListener() {
     public void actionPerformed( ActionEvent e ) {
          doAction();
// Debug
if (DEBUG) {
  doAction();
}Jonathan

Similar Messages

  • How do I test a website with multiple users?

    Hello,
    I want to test a website with multiple users. Is there a testing tool that can simulate
    multiple users?
    I have already written some HTTPUnit tests and it would be cool to use these tests in
    a "multiple user test". Is there any way to reuse the HTTPUnit tests in a "multiple user
    test"?

    Take a look at JMeter "http://jakarta.apache.org/jmeter"
    And if your web app uses session variables.....use "BadBoy"
    http://www.badboy.com.au/

  • Can't Open 3rd party Apps with my User (Icon Bouncing then Application Not Responding)

    Hi
    Problem:
    I can't Open 3rd Part Apps with my user (FireFox, Chrome, Dropbox, GoogleDrive, Mega, Final Cut Pro X, etc) they just star bouncing and after a while they stop bouncing then i righ click on them and it says "Application Not Responding", but i can open native apps like Safari, iTunes, iMovie, Finder, Settings
    Other Events:
    -Just Before this happend i was editting a video on FCPX, y export it and tried to upload to Google Drive (in Chrome), when it was uploading I closed FCPX and the uploading stop it at 91%, y tried to reupload but then I realized that this video was in a temp folder and it wasnt there anymore, so I open FCPX to export it again and i couldnt, it was just bouncing and then "App not responding".
    -After Installing Yosemite i feelt it slow even after it finished the encriptation File Vault, specially in chrome.
    I have tried:
    1-Repair Disk Permisions
    2-Reset SMC
    3-Reinstall FCPX
    4-Decrypted the Disk and create another user and i was able to run Chrome, FireFox and FCPX, When I opened FCPX it started but when it was trying to open the project that i was working , it restarted the app and i couldnt open FCPX again, just bouncing and App Not Responding
    Any suggestions to keep my User working?
    Macbook Pro Mid 2012
    -OSX Yosemite,
    -16GB Ram1600MHz DDR3
    -750GB 5400RPM
    -2.9GHz dual-core Intel Core i7 processor (Turbo Boost up to 3.6GHz) with 4MB L3 cache

    Yes, as long as you let TM do a full disc backup (that is, you do not exclude anything in the TM backup settings) you will have a backup that allows a full system restore - puts everything back just as it was.
    You can also clone your system using the shareware app SuperDuper or the donation-ware app CarbonCopyCloner
    http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html
    http://www.bombich.com/
    Both of these apps will make a true clone (literally, a bit-by-bit copy) of your hard drive onto an external drive.  This clone will actually be bootable itself (you plug in the drive and hold the option key during startup then select the clone to boot from).  You would boot from the clone, then reverse-clone it back onto your internal hard drive.
    If you are really serious about being highly confident of not loosing files, you could use both  - I keep a TM backup on one drive, and 2 clones on separate bus-powered hard drives.
    P.S. even if you had not had any issues, you really, REALLY should be keeping regular, up to date backups anyway - things go flooey without warning sometimes and you risk loosing everything on your machine if you DON'T keep regular backup copies available.

  • Deployment with minimal user interaction

    We are interested in deploying iPads to users in our company, but we want to do so with minimal user interaction. From what I can tell the best way to do this would be to sync our iPads with one computer and have that computer's iTunes manage the applications that can be installed on all device.
    What features would our users not have access to without having direct access to iTunes on their own computer (e.g., data backup)?
    Why would doing this not be a good idea?
    If after the initial setup we would like to install another application, must we physically obtain the device(s) again to install the application?

    halabaluba wrote:
    We are interested in deploying iPads to users in our company, but we want to do so with minimal user interaction. From what I can tell the best way to do this would be to sync our iPads with one computer and have that computer's iTunes manage the applications that can be installed on all device.
    What features would our users not have access to without having direct access to iTunes on their own computer (e.g., data backup)?
    Why would doing this not be a good idea?
    If after the initial setup we would like to install another application, must we physically obtain the device(s) again to install the application?
    Who will own the iPads?
    Will you allow them to take the iPads home?
    If they take the iPads home and sync them at home (they will) then anything you installed from your central computer is GONE. The only thing that will stick is the setting you deployed using the “configuration utility”.

  • How to automate testing of features that require user interaction?

    I am currently evaluating a test automation tool (RIATest) for my Flex app. In my app, the user uploads/downloads several files from the server. When I try to create an automation script for the process, I get error #2176 (also copied in the end of the post).
    Now, my question is that is there anyway to prevent this from happening? Is there some config file that could be modified to set up an isolated test environment without these security restrictions?
    My app uses some features that are only available with Flash 10, so using Flash 9 is not an option (I have understood that these security settings came with Flash 10).
    Thanks.
    Error: Error #2176: Certain actions,
           such as those that display a pop-up window,
           may only be invoked upon user interaction,
           for example by a mouse click or button press.

    jake_flex wrote:
    M*A*S*H 4077 wrote:
    Well, if player version is the problem, you can restrict the minimum version required and if the user's version is lower, he will get asked to update.
    Thanks for the reply.
    I need some features that are only present in FP10, so I need to compile against that version.
    Actually, I installed FP9 to my browser and compiled the app against version 9. Everything went well so far, maybe I'm getting confused with my own software already
    Anyway, that got me one step forward. When uploading a file, the user is presented the file browse dialog, which in my knowledge is the operating system specified component. At least RIATest doesn't seem to be able to control this. If someone knows how to handle such case with any test automation tool, please let me know.
    Edit: Just found this discussion on the same matter on RIATest forum http://www.riatest.com/forums.html?func=view&id=246&catid=9#246

  • Closing a Swing App with Window Closing Event With Dialogs On Close

    A while back I started a thread discussing how to neatly close a Swing app using both the standard window "X" button and a custom action such as a File menu with an Exit menu item. Ultimately, I came to the conclusion that the cleanest solution in many cases is to use a default close operation of JFrame.EXIT_ON_CLOSE and in any custom actions manually fire a WindowEvent with WindowEvent.WINDOW_CLOSING. Using this strategy, both the "X" button and the custom action act in the same manner and can be successfully intercepted by listening for a window closing event if any cleanup is required; furthermore, the cleanup could use dialogs to prompt for user actions without any ill effects.
    I did, however, encounter one oddity that I mentioned in the previous thread. A dialog launched through SwingUtilities.invokeLater in the cleanup method would cause the app to not shutdown. This is somewhat of an academic curiosity as I am not sure you would ever have a rational need to do this, but I thought it would be interesting to explore more fully. Here is a complete example that demonstrates; see what you think:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.BoxLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class CloseByWindowClosingTest {
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        launchGUI();
         private static void launchGUI() {
              final JFrame frame = new JFrame("Close By Window Closing Test");
              JPanel panel = new JPanel();
              panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
              JButton button1 = new JButton("No Dialog Close");
              JButton button2 = new JButton("Dialog On Close");
              JButton button3 = new JButton("Invoke Later Dialog On Close");
              button1.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        postWindowClosingEvent(frame);
              button2.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        JOptionPane.showMessageDialog(frame, "Test Dialog");
                        postWindowClosingEvent(frame);
              button3.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        SwingUtilities.invokeLater(new Runnable() {
                             public void run() {
                                  JOptionPane.showMessageDialog(frame, "Test Dialog");
                        postWindowClosingEvent(frame);
              panel.add(button1);
              panel.add(button2);
              panel.add(button3);
              frame.setContentPane(panel);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.addWindowListener(new WindowAdapter() {
                   @Override
                   public void windowClosing(WindowEvent event) {
                        System.out.println("Received Window Closing Event");
              frame.setVisible(true);
         private static void postWindowClosingEvent(JFrame frame) {
              WindowEvent windowClosingEvent = new WindowEvent(frame, WindowEvent.WINDOW_CLOSING);
              frame.getToolkit().getSystemEventQueue().postEvent(windowClosingEvent);
    }An additional note not in the example -- if in the button 3 scenario you were to put the window closing event posting inside the invoke later, the app then again closes. However, as implemented, what is it that causes button 3 to not result in the application closing?
    Edited by: Skotty on Aug 11, 2009 5:08 PM -- Modified example code -- added the WindowAdapter to the frame as a window listener to show which buttons cause listeners to receive the window closing event.

    I'm not sure I understand why any "cleanup" code would need to use SwingUtilities.invokeLater() to do anything. Assuming this "cleanup method" was called in response to a WindowEvent, it's already being called on the EDT.
    IIRC, my approach to this "problem" was to set the JFrame to DO_NOTHING_ON_CLOSE. I create a "doExit()" method that does any cleanup and exits the application (and possibly allows the user to cancel the app closing, if so desired). Then I create a WindowListener that calls doExit() on windowClosingEvents, and have my "exit action" call doExit() as well. Seems to work fine for me.

  • How can I share Quicken and other apps with another user on the same iMac?

    I would like to share some apps including Quicken with anoter user on the same iMac. I have put the Quicken app and the .QFX file in /usrs/share and changed the permissions to R/W on both files but when I log in as the other user and run Quicken it does not use the .QFX file and instead comes up with no accounts.

    The Quicken app. should be in the Applications folder at the root of Macintosh HD. It's accessible to all users from there.
    To share a file, (this from Finder Help menu)
    "Sharing files with others who use your computer
    You can share files with others who use your computer by placing the files in the Public folder in your home folder. Anyone with an account on your computer can read or copy the items you put in your Public folder (except for your Drop Box folder, which only you can open).
    To share files using your Public folder:
    Copy the files you want to share into your Public folder, inside your home folder.
    To give a copy of a file directly to another person, copy it to their Drop Box folder (inside their Public folder), where only they can see it."
    When opening a file just double-click the file - it will open the application automatically.

  • Can I share apps with another user account on our mac even though its a different apple ID?

    Husband and I have just bought a new Mac to share, but we've both got iphones and itunes of our own.  I thought the best way to deal with this would be to have a user account each on the new Mac with our own iTunes, but this obviously means that each user account has a different apple ID associated with it.  I've just bought Pages, Numbers and Keynote on my user account, is it going to be possible to share these apps with my husbands user account.
    I've got a harrible feeling that I should have created a joint user account and apple ID, and I've just wasted the best part of £40...please tell me theres a way to fix this!!
    Thanks

    Welcome to the Apple Support Communities
    You can, but you will have to update the applications from the user account with the Apple ID you used to purchase those apps. There isn't any other problem, but it may be illegal (but I think it's legal if you run them on the same Mac)

  • Exception in javascript library when testing Mail app with IE9/ Safari

    Hi,
    I have almost finished my mail app, but a strange issue that only appears with IE9 prevents me from successfully completing the verification process and therefore I can not publish my app.
    The issue is very similar to this post, which could unfortunately not have been answered so far:
    'OSF is undefined' script error in o15apptofilemappingtable.js
    file when Mail App launched
    I have tested the app successfully with the following browsers: Chrome (40.0.2214.111 m), Firefox (35.0.1), IE 11 and IE 10.
    In IE9 I first get:
    App
    Error Something
    went wrong and we couldn't start this app. Please try again later or contact your system administrator.
    When
    I then click "retry" I get:
    App
    Error This
    app may not load properly, but you can still try to start it.
    After
    I click start the app works. The debug console of IE indicates that there is a problem in the o15apptofilemappingtable.js file:
    SCRIPT438: Object doesn't support property or method 'GetContext' o15apptofilemappingtable.js, line 11 character 110934
    The problem should be the call to: "window.external.GetContext()" in the file mentioned above.
    Important to mention is, that when I build and deploy the sample mail project that ships with Visual Studio it just works fine (this is a difference to the other thread from above). There must be something special with my code but even after days of research
    I can absolutely not figure out what it is. In contrast to the sample mail app, my project is an ASP.NET MVC application by the way (if that is important).
    To isolate the problem I tried several things:
    * I have removed all other javascript libraries to make sure that there are no conflicts between them.
    * I removed all javascript code except the Office.initialize= ...
    code to be sure that there isn't a problem with my custom javascript code. 
    But whatever I tried it doesn't help and basically I am fishing in troubled waters as I do not have an idea what the real problem is and why it is only happening on IE9.
    Best regards
    Stefan

    Hi,
    in the meantime I noticed that I also get this problem with Safari.
    I started to debug the office api and could isolate the problem further. 
    Please forward the following information to the responsible microsoft engineer as it contains valuable information to fix the problem.
    The Exception I get happens becaus of a call to window.external.GetContext() in in the o15apptofilemappingtable.js.  The calls happens because in the function OSF.InitializationHelper.prototype.getAppContext, the value of this._hostInfo.isRichClient
    is true. Looks like in IE9 and Safari the api thinks it is running in the desktop version of outlook (but of course it is not and therefore the call to window.external fails -> I guess only available/set in desktop environment).
    The api thinks of running as rich client becaus the XdmInfoValue does not exist in o15apptofilemappingtable.debug.js line 155 (it is undefined). I am not a javascript specialist and don't know what xdm stands for (cross domain? X-Document?) but however:
    the xdm part which should be passed in the window.location as a hash value is not set in IE9/ Safari.
    At this position I lose the scent and don't know where the xdm part is passed/added to the url. Perhaps in the osfruntime.js? Unfortunately I couldn't find a debug version of this file.
    Please do not hesitate to contact me if you have further questions
    Regards
    Stefan

  • Re-image computer with no user interaction at all - SCCM 2012

    I have searched many posts and havent found a clear solution for my question.
    Basically, I have OSD task sequence ready to go on my SCCM 2012 R2. It is fine to run it as "Available".
    If I deploy the OSD through Software Center as "Required" and "ASAP", then I login the client, the client will run OSD task sequence sometime after about 30Min-1 hour later, not sure. And there will be no user interaction needed. However
    this means I need remotely log into each computer to let OSD happen.
    If I deploy the same TASK Sequence as "Required" and "ASAP" through "PXE", it will first ask PXE Password(Which I set in DP->PXE Panel), then I need hit "Next" again to start the assigned OSD, which means I need
    physically go to each computer to do this. (EDIT: If needed, I can remove PXE password and add VB scripts in other Task Sequence, however I want to know if I still need press NEXT to start the OSD).
    The clients are not AMT enabled but Lan Wake up enabled and also can be set to LAN WAKE UP Enabled with boot from LAN. I can wake up/shutdown the whole collection with command if needed. 
    Is there a way that I can Re-image one collection of Computers without any interaction on client side?  
    The other question is how long to wait for OSD when it is set to "ASAP"?
    RockyOZ

    Guess I just answered question myself. With PXE Password removed, the OSD runs without user interaction. Thanks. I will add the password in task sequences instead.
    RockyOZ

  • Auto-install updates, with no user interaction?

    Due to problems with malware, we can't really trust everyone to be logged on with administrator privileges all the time as it used to be with Windows 2000 and XP. Consequently the installed software can not be modified by staff anymore.
    This doesn't affect Windows Updates since those can be configured to install automatically on a schedule without any user interaction or privilege elevation.
    Java for Windows however does not detect when a logged in user does not have administrative rights, so it offers updates to everyone who logs on, including people who can not and will not ever be able to install the updates.
    One "solution" is to turn off the update checking so that people aren't hassled by useless update notifications, but then this means Windows desktops will gradually fall further and further out of date, opening them up to attack by malware that exploits unpatched bugs in older Java versions.
    The proper solution that I really want, is for Java to be capable of auto-update and self-install without any user interaction or privilege elevation at all. However so far I have not found a solution for this.
    A hack may be possible using Windows group policy, the Windows Server task scheduler, and a java website screenscraper.
    Nightly:
    * Screenscrape Java.com for a newer client version
    * If new one is found, download, put in global read-access share
    * Using a database of machines known to be running Java, flag each candidate that's using an older version
    * Wake-on-LAN the machines needing the update
    * Schedule a remote install of the update with Administrative privileges
    * If update successful, clear flag for that machine in central database
    * shut down again for the night.
    OR
    Java programmers could implement an auto-install mechanism of their own, that can run by itself without user interaction at system startup, shutdown, or on a timed schedule set by the administrator through registry entries (and therefore configurable via group policy applied to desktops).
    ==========
    How are other network administrators handling managed business desktops that need periodic, automatic, and non-interactive Java updates?

    We use Altiris Software Delivery solution to deploy our Java updates but you could also use similar solutions such as Microsoft System Center Configuration Manager.
    The problem is that these are both options that cost money and require investment and training.
    Altiris allows you to create a collection based on the text string held in the Add/Remove Programs list (as well as other fields) - so you can easily create a collection of computers that do not have the required version of Java.
    You can then create a software delivery task to silently install Java with admin rights and target it towards the collection that needs updating.
    The collection updates dynamically. As the computers get Java they drop out of the collection and are no longer targetted for upgrade. This used to work well for me - as I could update about 500 machines in about 2-3 days.
    The problem is that the Java installer doesn't work consistently as you mentioned since JRE 6u25 - the installer doesn't always behave as expected and the switches to do silent installs keep changing. You also have a problem if you try to update Java and the person has their web browser open... Yes, I do my updates during working hours as well.
    In a constantly changing environment in terms of security - you'd think Oracle would have sorted the deployment options out by now?

  • Dialog with no user interaction

    Hi all,
    I would like to use the one button dialog that would just showing a message without requiring any user interaction.  With the dialog, I only want to display a message for the user. I want the program to continue running without needing user interaction.  I just want to let the user know that something happened.  I don't need to user to do anything.  How do I do that? 
    Yik
    Kudos and Accepted as Solution are welcome!
    Solved!
    Go to Solution.

    A more common approach is to use a "Status log" (just a string on the UI that gives the user some idea what is going on.)
    Here is a construct I often use (place the control "Status" on the UI, Add a control to the referance to "Status" wire the Connector pane.)  This type of action engine (see Ben's excellant nugget) lets you send update messages to the user from anywhere in the application instance space without leaving pop-ups all over the screen.
    And should you wish, you can add cases to Show, blink, unblink, highlight, move or Hide the indicator so it peeks out and dances
    Jeff

  • Toplink\JPA vs JDBC - Toplink died for my app with 5000 users

    Hi All Just a quick question about performance when comparing toplink jpa ans jdbc.
    I have an app I just develpoed using toplink for all data acces that will have approx 5000 users and initial testing with 200 things look good. However after launch and going live for 5000 people the app blew up. Lot's of memory heap errors, and TopLink exceptions...
    To make things work I have replaced all the toplink with traditional JDBC, this works but I am currious as to why toplink blew up? I notice when JDev creates the Toplink code that it never does any checking for open connections and never explicitly closes connections. Is this something that I have to do?
    I should not that I was not using datacontrols directly, I created a datacontrol but then ised the FacesContext to create a list of results in the backing bean??
    Anyway, I know that's not a great description but I thought I would throw this question out there and see what people had to say?
    Thanks
    J

    It is hard to say where a memory issue occurred. Normally usage of a memory profiler such as JRockit JRA, or JProfiler is useful in debugging such issues.
    There were a couple related memory issues in previous releases, so ensure you have the latest release or patch release.
    Using an isolated (shared=false) or weak cache may also help.
    In general you should be able to scale to 5000 users without any issues.
    James : http://www.eclipselink.org

  • Synching apps with 2 user accounts, 3 devices and one computer only

    I have a question that I can't find a clear answer.
    I previous had one iPod touch and one iPad that I synched with my iTunes library. No problem. But now the wife has finally purchased a verizon iPhone and I want to be able to use my vast app collection for her phone.
    Scenario is we each have separate user accounts (so we can maintain our own calendars and contacts, ect.). We each have our own ITunes accounts and our own iTunes libraries by default. She will not be purchasing much on her account though.
    How do I, without creating a can of worms, create one library to sync to so I can put apps and music on her phone without erasing any of her separate information. I have read a lot on the subject and there does not seem to be a clear answer anywhere. Yes, I have read ht1495 but that does not seem to be exactly on point
    Basically, I have 3 devices, 2 user accounts and 2 iTunes accounts but one computer only. I want to be able to have all iTunes stuff available on both user accounts and be able to have both people be able to read and write to the same library. I am sure there are plenty of people running into this issue with more and more people getting iPhones with verizon. It seems that it is easier to do with multiple computers than one computer.
    So, I am looking for help or advice on the easiest way to accomplish this task.

    In a way, each iTunes libary is considered to be a different account. Your daughter's iTunes account doesn't have access to your wife's data which has all the verification data.
    One option would not only to place the library in a Shared area, but also the verification data. I poked around and am not sure where it's stored. It's a good discussion to have with an Apple store Genius if you have one nearby.

  • How do I share not only my music but also my apps with other users on the same computer?

    I've searched around and this one link keeps comming up:
    http://support.apple.com/kb/HT1203
    That link only tells me how share with music I want apps and everything else shared between multiple users on the same windows computer.
    Thanks.

    Thank you Joe - I tried this but it's only showing a teensy amount of music - the stuff on the second users account as opposed to the giagntic library on the 'main' account. I actually went to a Genius Bar and they said that apple doesn't really want you to share music between accounts - parents don't want to hear their kids music etc. Which seemed strange, but it might be the case sadly   Thanks anyway!

Maybe you are looking for

  • 10.8.2 Update Failed

    I tried to download and install the 10.8.2 update but received an error message stating that the file could not be expanded. Now the update does not appear in the App Store under updates. I presume that the file is still on my iMac so the App Store t

  • Tools to upload data into SRM 7.0 with webdynpro for ABAP

    Hi, Webdynpro for abap is used in SRM70. I need to load data in SRM70 (product category...). ECATT is not working with web dynpro for abap. What other tools can i use to load data in SRM70 ? LSMW ? I would like to avoid to create a Z program to load

  • Is there a function to detect file names?

    Hi Guys I'm using actionscript to create a custom navigator for a PDF Portfolio. Currently my navigator uses the function getFileExtension(value.filename) to detect the filetype, and then assign an appropriote icon. I'm wanting to change it so that i

  • The future playstations

    Hello, my name is Hamad Ali, im the boss of Sony and i am here today to bring to light what the future playstations hold for younow there is a very difficult matter when it comes down to the products you buy, especially playstations, since it is a ga

  • Print out name of Approver

    Dear Experts, On an approved document - say Purchase Order is it possible to print out the names of the people who approved it using crystal report layouts on SAP 8.8 ? Regards,