Issue with JCEF lifecycle on automated tests

Having problems with building or using the JCEF Java binding? Ask your questions here.

Issue with JCEF lifecycle on automated tests

Postby bbcno » Wed Sep 05, 2018 4:21 am

Hi,

I'm using JCEF to display a custom HTML GUI in a kiosk application. The entire application is written in Java, and we have several automated tests using JUnit, and some integration tests using Groovy.
Starting and stopping JCEF along with the application works well, but when running automated tests which launches the GUI we encounter a problem. The first test will work, but all consecutive tests will fail because JCEF throws an IllegalStateException when trying to re-launch the GUI:
Code: Select all
java.lang.IllegalStateException: Must be called before CefApp is initialized
   at org.cef.CefApp.addAppHandler(CefApp.java:205)
   at view.html.ChromiumFrame.<init>(ChromiumFrame.java:46)

So seems that the CefApp is somehow not re-initialized on each test, staying in the TERMINATED state.

Any pointers on how to solve this would be much appreciated!
bbcno
Newbie
 
Posts: 1
Joined: Wed Sep 05, 2018 4:02 am

Re: Issue with JCEF lifecycle on automated tests

Postby magreenblatt » Wed Sep 05, 2018 4:24 am

You can't initialize/shutdown JCEF multiple times in the same process. I suggest you modify your test harness to initialize/shutdown JCEF a single time for all of your tests.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 14 guests