-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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: 127.0.0.1:60347/tools/print512.zul
How can I make it connect to 127.0.0.1:8080 instead? I use NetBeans 8.2 and Glassfish 4.1.
Thank you in advance.
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...
Asked: 2018-12-11 16:02:50 +0800
Seen: 9 times
Last updated: Jan 02 '19