How do I change the default port for a .zul unit test with ZATS?

asked 2018-12-11 16:02:50 +0800

GeoMal gravatar image GeoMal

Hello everyone!

I've been trying to carry out a unit test on a .zul file based on a .java class. The java class utilizes a database and one is supposed to be logged in before fetching data. The whole project has to be deployed to the localhost in order to be properly tested.

The problem is that the default port of the localhost is 8080, yet ZATS tries to access it through a random port, resulting in errors such as:

gr.xrikec.abte.param.Print512Test: Server returned HTTP response code: 500 for URL:

How can I make it connect to instead? I use NetBeans 8.2 and Glassfish 4.1.

Thank you in advance.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-02 09:53:34 +0800

cor3000 gravatar image cor3000
4466 2 7
ZK Team

updated 2019-01-02 10:24:25 +0800

short answer: you don't ... zats will start the whole server for you and 'know' the random port. You don't need to (and you can't) start the server yourself next to a zats test.

Zats will run an embedded Jetty with your application. By doing so it has access to the same memory as your application and gets direct access to the components'( internal state/controllers/viewmodels). That's the purpose/benefit when using ZATS - you can test the behavior of your application independent of a browser and without the overhead of a remote connection. The implication is: you have to run your application (or parts of it) in the provided embedded Jetty. e.g. by providing a WEB-INF folder with of your testing web.xml. As demonstrated in this example

The webapp folder and the WEB-INF folder don't have to be in the same subdirectory so you can test different configurations (e.g. using mocks) easily.

If you want do test your own glassfish (or a different application server) server you need to use a different testing tool such as Selenium/Testcafe/Sahi...

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2018-12-11 16:02:50 +0800

Seen: 8 times

Last updated: Jan 02

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More