Avatar billede fredand Forsker
16. marts 2017 - 16:58 Der er 1 kommentar og
1 løsning

Test rich app (loaded from jar) with cucumber

Hello guys!

I'm just playing around with cucumber and thought that it would be nice if I could get references to the classes to test from a started app started from a jar like if I programmatically start it like:
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec( new String[] { "java", "-jar", fileName } );
I just thought that this would be a more realistic test.
But I do not find a way to get a reference to the loaded class Main for eg.
Do you think this is possible or should I just stop trying to do it this way?
Best regards
Fredrik
Avatar billede arne_v Ekspert
16. marts 2017 - 17:04 #1
Not sure what you want.

In this case you have two processes. Each is running a JVM and executing some Java code of yours.

Since it is two processes then you can not get a ref to:
- objects in other process
- actual class objects in other process

You may be able to get:
- name of class in other process
- a class object for that class
Avatar billede fredand Forsker
27. marts 2017 - 15:23 #2
Hello Arne!

I think your comment point me in the right direction.

Thank you!

Best regards
Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester