Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

maven integration test

22 views
Skip to first unread message

e.d.pro...@gmail.com

unread,
Nov 23, 2022, 9:41:35 AM11/23/22
to
Why does integration test fail?
If I add <goal>integration-test</goal> in the build, plugins section under the maven-failsafe-plugin, failsafe executes the *IT.java test programs and throws "failed to connect" (to local JDBC database) on running mvn install.
Without that goal line, install succeeds.
If I right click the tests in eclipse and select run as junit test, they succeed.
We are using a .properties file for the jdbc connect string.
I am loading the .properties file with the <file> tag using read-project-properties in the properties-maven-plugin.

e.d.pro...@gmail.com

unread,
Nov 23, 2022, 9:47:53 AM11/23/22
to
> We are using a .properties file for the jdbc connect string.
> I am loading the .properties file with the <file> tag using read-project-properties in the properties-maven-plugin.
duh. failsafe needs the properties file values. Of course I mess with this for 3 days then ask why it doesn't work and right away take a closer look and see I never put the properties-maven-plugin in the plugins section, just in the pluginManagement section.

e.d.pro...@gmail.com

unread,
Nov 23, 2022, 10:44:32 AM11/23/22
to
> > We are using a .properties file for the jdbc connect string.
> > I am loading the .properties file with the <file> tag using read-project-properties in the properties-maven-plugin.
> duh. failsafe needs the properties file values. Of course I mess with this for 3 days then ask why it doesn't work and right away take a closer look and see I never put the properties-maven-plugin in the plugins section, just in the pluginManagement section.

Now what am I missing?
I deleted the integration-test goal, then ran these commands, all success.
mvn validate
mvn compile
mvn test
mvn package
mvn verify
mvn install
Then I put the integration-test goal back in and ran mvn clean install and it fails database connection again.

Jeffrey H. Coffield

unread,
Nov 23, 2022, 10:58:21 AM11/23/22
to
What is the output from maven with -e and -X?

Jeff Coffield

e.d.pro...@gmail.com

unread,
Nov 23, 2022, 11:47:23 AM11/23/22
to
> What is the output from maven with -e and -X?
>
> Jeff Coffield

Unit tests are fast. I hate these integration tests.
I took out the integration-test goal and ran another full mvn clean install and it succeeded.
I put it back in and ran mvn -e -X install. It's just now finishing, with "network adapter could not establish the connection".

Jeffrey H. Coffield

unread,
Nov 23, 2022, 11:57:33 AM11/23/22
to
Have you checked the server side logs and possibly turned on debugging
there to see what, if any, shows there?

e.d.pro...@gmail.com

unread,
Nov 23, 2022, 12:01:42 PM11/23/22
to
> Have you checked the server side logs and possibly turned on debugging
> there to see what, if any, shows there?
Server side? It's a jdbc connection, to an oracle database on the same machine.
Tests run fine if I right click them to run as junit in eclipse.

Jeffrey H. Coffield

unread,
Nov 23, 2022, 12:11:34 PM11/23/22
to
But is there a difference between when it connects and it doesn't in the
server logs?

e.d.pro...@gmail.com

unread,
Nov 23, 2022, 3:30:31 PM11/23/22
to
> But is there a difference between when it connects and it doesn't in the
> server logs?
Again, there is no server? I'm running a maven build on localhost with integration tests failing to connect to an oracle service running on localhost. What log are we looking for?

Jeffrey H. Coffield

unread,
Nov 24, 2022, 12:22:42 AM11/24/22
to
The Oracle service should have a log file that you can set a debug level
on to see what is being passed to it. That will tell you if any
connection is made when the tests fail and what is being passed.

e.d.pro...@gmail.com

unread,
Nov 28, 2022, 12:59:54 PM11/28/22
to
> The Oracle service should have a log file that you can set a debug level
> on to see what is being passed to it. That will tell you if any
> connection is made when the tests fail and what is being passed.
solved it. The connection machine name, port is in .properties files.
The test wasn't finding the right .properties file which was in a package folder under src/test/java. I moved that path under src/test/resources.
There are multiple properties files. The tests don't work with the default app file, this file needs to override it.
0 new messages