Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launching a JNLP file .Can I launch a JNLP file and test #45

Closed
mrif0393 opened this issue Nov 2, 2018 · 11 comments
Closed

Launching a JNLP file .Can I launch a JNLP file and test #45

mrif0393 opened this issue Nov 2, 2018 · 11 comments
Assignees

Comments

@mrif0393
Copy link

mrif0393 commented Nov 2, 2018

No description provided.

@mrif0393 mrif0393 changed the title Launching a JNLP file .Can I launch a JNLP file and test @croesch Launching a JNLP file .Can I launch a JNLP file and test Nov 2, 2018
@mrif0393
Copy link
Author

mrif0393 commented Nov 2, 2018

@croesch Can we launch JNLP file and tests,I have tool to inspect the swing elements.

@mrif0393 mrif0393 changed the title @croesch Launching a JNLP file .Can I launch a JNLP file and test Launching a JNLP file .Can I launch a JNLP file and test Nov 2, 2018
@croesch
Copy link
Collaborator

croesch commented Nov 2, 2018

You can test an jnlp application but IMO not via web start.

An JNLP file references an application and you should be able to start that application via AssertJ Swing through the ApplicationLauncher documented here.

This should help you. Please note that web start is not part of Java anymore.. so your application has to find alternative starting technologies.

Just reopen, if my answer doesn't help..

@croesch croesch closed this as completed Nov 2, 2018
@croesch croesch self-assigned this Nov 2, 2018
@mrif0393
Copy link
Author

mrif0393 commented Nov 2, 2018

Thanks for your response.
Basically this is to test oracle forms application.I have .JNLP file with me and I can open it using command .
"javaws xx.jnlp"

I am not sure how to open it with ApplicationLauncher any code snippets.

@croesch
Copy link
Collaborator

croesch commented Nov 2, 2018

Have a look inside the jnlp file, you should be able to identify the class with the main method. In doubt read the JNLP File Syntax which states that you should see an element application-desc with the attribute main-class.

That's the one you're looking for. Given that check the link I posted above and insert the main class in the example code of the ApplicationLauncher.

@mrif0393
Copy link
Author

mrif0393 commented Nov 2, 2018

Thanks again,I dont have an application-desc section in my JNLP. This is my JNLP looks like.I have section called applet desc.
frmchanged.txt

@croesch
Copy link
Collaborator

croesch commented Nov 2, 2018

Ok. In that case just use the AppletLauncher that is also documented on the same page as the ApplicationLauncher.

@mrif0393
Copy link
Author

mrif0393 commented Nov 2, 2018

Yes Thanks,I had a look at it earlier,So my concern is how I can launch the applet by giving the class name only.Fyi I do not have any source codes with me related to the application.I only have the JNLP file.
this is what I tried
AppletViewer viewer = AppletLauncher.applet("oracle.forms.engine.Main").start();

I can try with setting the applet properties as well but
I see lot of properties in JNLP file apart from applet properties.How can I set them and launch it. Any tips how can I do it?

Manually what i do is i just double click the JNLP file it launches the app.

@croesch
Copy link
Collaborator

croesch commented Nov 2, 2018

AssertJ Swing works fine if you just have the necessary files on the classpath of your test. It's easier (for debuggin) but not necessary to have the sources available. You just need to make sure that your test knows the AUT.

The JNLP file also contains the information about the class path. Please setup your code with the same class path. Either analyze the JNLP file or debug the running Java process at runtime. If you developed the application, then you should be able to know which classpath is relevant. Or at least should know somebody in your organization that can help you. If you're not the developer of the application, you should have the skills to reverse engineer a classpath - I will not give further advice for that scenario, since that usecase is slightly out of scope for AssertJ ;)

I feel like you either don't read the links I provide .. Please read the page again, linked multiple times, it contains the information about how to pass parameters to the AppletLauncher.

If you want to have further advice please show me how AssertJ Swing fails, I feel like I gave you enough information to solve your problem. I'm not a Java teacher .. at least until being paid :P

@mrif0393
Copy link
Author

mrif0393 commented Nov 4, 2018

Thanks,I am a Test Engineer,I just have the JNLP file no contact with any developers.But As you said I will give a try and get back to you.

@mrif0393
Copy link
Author

mrif0393 commented Nov 14, 2018

@croesch I am getting following error when trying to launch the applet.

Map<String, String> parameters = new HashMap<String, String>(); parameters.put("OpenURL","https://www.qoppa.com/files/pdfnotes/demo/serverfiles/sample02.pdf"); parameters.put("SaveURL", "https://www.qoppa.com/files/pdfnotes/demo/serverfiles/sample02.pdf"); parameters.put("OpenVisible", "false"); parameters.put("java_arguments", "Xmx256m"); AppletViewer viewer =AppletLauncher.applet("qoppa.webNotes.SaveToWeb").withParameters().start(); FrameFixture applet = new FrameFixture(viewer).show();

java.lang.Error: Unexpected window shown - this window should be handled with WindowInterceptor.
Window contents:


at org.assertj.swing.edt.GuiActionRunner.rethrowCaughtExceptionIn(GuiActionRunner.java:197)
at org.assertj.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:146)
at org.assertj.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:121)
at org.assertj.swing.launcher.NewAppletViewerQuery.showAppletViewerWith(NewAppletViewerQuery.java:40)
at org.assertj.swing.launcher.AppletLauncher.start(AppletLauncher.java:204)

jPDFNotes_savetoweb.jnlp.zip

@croesch
Copy link
Collaborator

croesch commented Nov 14, 2018

Hello @mrif0393

this looks like an application error. Do you have the full stack trace available? I suggest you ask the development department about that message..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants