This is my first question in this amazing service.
So this is what i want to do:
I want to start Android Emulator, perform few actions with UI (fill login/password form and click Login button) and then leave it running.
I wrote some automatic tests with Robotium framework before and know how to make a TEST that running an asserting something. The problem is that test will terminate soon or later. But i need to log in through UI and leave emulator running like some kind of homemade system service.
What would you suggest to solve this problem?
Thanks.
Related
Hi I am writing an SWTBot test which launches a file from a hyperlink using Program.launch. From the bot test I need to check that the 3rd party application opened to display the file. The only thing that seems obvious to me is checking that focus was lost on the underlying workbench but all focus, enabled and visible assertions remain true. Does anyone have any assertion ideas here?
I would recommend to avoid letting the test spawn a process at all. You'll have to wait for the process, kill that process in tear down to leave a clean environment, etc.
If possible I'd rather mock the program launching code during tests and verify that it gets executed if the hyperlink was selected.
But if you really want to test that the 3rd party app was launched , I would rather check if a new process was created. There seems to be neither support in the JRE nor a library to list OS processes so that you probably have to resort to System.exec() ps or tasklist.exe, depending on the OS you are running on.
I have created a Java application which needs to run as a service. For service wrapper I tried using tanuki and other wrapper softwares.
Now, my application does run as a service - however, it runs as a service under SYSTEM and not under currently logged in user.
My application has a UI, which does not show when the application is running as a service. I doubt that this has happened because the service is running under SYSTEM and not under currently logged in user.
When I run the application (without installing it as a service), the UI does show up and I could see the java process running under the current user's id, whereas it runs under SYSTEM when installed as a service.
Now, there is nothing to my application if there is no UI. I need to application to run as a service when the system boots up and the UI needs to show up as well.
Has anyone tried to do what I am doing here and has faced a similar issue. If so, how did you go about resolving it?
Is there a different wrapper service that I could use and not have this issue.
Tanuki's documentation does explain setting a java application as a service, but does not talk about a java applicaiton with a UI and running it under the currently logged in user.
Update
Just so that folks here could get a bit more idea as to what is it that I am trying to accomplish - the behavior that I am trying to have with my app is similar to how Dropbox or Yahoo Messenger or any other software has which starts with Windows boot and continues to run in the background, allowing the users to interact with it using the system tray icon. So basically all of this has been built in Java/Swing. Now when it has come to deployment of the app - I can run it standalone but running the jar file or by creating and running an executable wrapper for it. However, I want the software to start with Windows boot and continue to run as a service in the background, while allowing the user to make changes and interact with it via lets say bringing up the UI from a system tray icon that it sets.
As of now, it does run as a service successfully. It performs all the actions that it ideally should - there just is no system tray icon to bring up the UI and make changes to its configuration.
Update - 2
Ok.. I tried advanced installer and it does wrap up everything for me to generate an exe installer for windows. Now all I need is to auto-start the software. Can anyone help me with this? I don't see an option in Advanced installer to automatically have the program add itself up in the auto-start.
Link to tanuki's doc http://wrapper.tanukisoftware.com/doc/english/faq.html
Rohan,
Please take a look at the following page:
http://wrapper.tanukisoftware.com/doc/english/prop-ntservice-interactive.html
You will need to mark the Service as interactive and then run as the SYSTEM user in order to get your GUI to show up on the first logged in desktop.
The problem is that Microsoft changed what services are allowed to do starting with Windows 2008 and Vista. This means that starting with these versions, the GUI will always show up on a sandboxed desktop which the user will need to switch over to.
If you want to show a GUI on all desktops, in all versions of Windows, you will need to run the JVM within the desktop.
Cheers,
Leif
I wanted to comment on your question, but I don't have enough reputation to do it. So I'm misusing the answer function now.
I have a similar problem. I used the tanuki wrapper for a while now on a Windows XP machine and the Swing GUI was shown to all users who logged in.
Now I migrated to Windows 2008 Server and configured the current version of the tanuki wrapper like this:
wrapper.ntservice.interactive=true
wrapper.ntservice.hide_console=true
(see documentation here and here)
The Windows service runs under the LOCAL SYSTEM account.
But the GUI is still not shown. Did you find any solution to the problem?
Don't think you should have a UI with a service. Put it in the startup group instead ?
What's does the UI and application do?
I have a question about the Android virtual device(avd)... as what you already know, that you can test your android application through avd in eclipse, and i'm getting a boring repeted thing with that.
each time I want to test my application and when I make a small change to my application, I have to run the avd again and wait for a long time till the application run(switch the device on and wait for the system to boot and then wait for the application to start,this takes approx. 15 sec)... as I said, each time I make whatever change to the program I have to go through these boaring time consuming loop :( ...
So, is there is a way to avoid these issue, and makes the avd run only for the first time and any changes can take effect quickly and only needed to restart the application without needed to stop and run the project again ??
I hope there is a way for that.
When you're done with a debug cycle, do you close the AVD? If you keep the AVD running, it should do exactly what you're describing.
If that doesn't work for you, a look at your application manifest may be needed.
Simply don't quit the emulator. Leave it running, hit Run (or Debug) in Eclipse, and if anything changed, the program will be uploaded to the emulator again.
Don't close the emulator. Keep it running and click debug again, it will run fast since it won't reboot. (The emulator will just re-install the app instead).
I am trying to create a fully-automated test suite for a web application, using Selenium RC and test cases written in Java. However, I have encountered a few problems that I have not been able to solve. Please let me know if you have a suggestion about any of these issues.
Single window mode. I would like to run single window mode because I think it will provide a significant performance improvement, and probably solve problem 2. I am able to run my test cases in single window mode with Firefox and everything works as expected, with much faster execution. However, I have not been able to get my test cases to execute when using single window mode with Internet Explorer; button clicks do not work at all, so the tests fail due to the browser never advancing to the next screen. The exact same test case executes fine in multi-window Internet Explorer. Is there some kind of trick I can use to get this working?
When running in multi-window mode, if there is an error in the test, or if the user exits the Selenium GUI window, the browser never closes. I know that it is possible to get the process id and kill it, but this seems rather dangerous, especially if the user is running multiple instances of the browser. This is part of the reason that I would like to use single window mode, if possible. Is there some other way, possibly by handling the window close event for the Selenium GUI, to solve this?
I am unable to use the waitForPageToLoad command in any of my test scripts because it will never recognize that the page has loaded and resume execution. I think this is because the pages use Javascript, but I am not sure; I don't have too much experience in webpage development. Right now, I am using the wait command and specifying the amount of time to wait. However, this is very unreliable, sometimes if the Internet connection is slow, my tests fail because the wait times are not long enough. Other times the tests are excessively slow, due to long wait times. Any ideas for how to handle this problem?
Thank you! I appreciate any answers or suggestions you can give. Please let me know if you would like some more information.
For multi widow close issue, you need to handle the exceptions. Call the close function in the finally block will resolve the window close issue.
For Page refresh, you need to check that manually and call in correct places. Usually clicking on links will cause page refresh before showing next screen.
Have you tried IE HTA mode? When I used to mess with this stuff it was the only reliable way to run tests on IE.
Not sure
You need to use the wait class. In essence you make an action then poll on an element which isn't present yet but you know will be when its safe to continue with the test. So you only ever wait the minimum time needed.
How do I detect when user closes(navigates away) or refreshes web page with JavaFX applet in it? I want to do some clean up in my code on those events.
Java Applet had some callback methods to do that, but how would I do it in JavaFX running in browser?
Two steps:
You may need to use a Javascript's window.onunload event to tell your JavaFX app to "close". If you do this, you can then
Add FX.addShutdownAction(myfunction); to your run() function. This will execute myfunction when your app is closed.
I don't have some complete code for you here, but I hope it's a start. You may not need to do step 1.