How to use Oracle as an embedded database for running unit tests in maven?
NickName:Riduidel Ask DateTime:2016-06-03T15:11:49

How to use Oracle as an embedded database for running unit tests in maven?

I have an application for which the prod/test/qa database is only Oracle. Furthermore, I suspect SQL queries to be Oracle-specific. And unfortunatly, this application has second to no unit tests.

As a consequence, I would like to implement to unit tests, specifically regarding the search component (which obviously performs lots of Oracle operations, including table creation).

Usually, when I want to run tests, I start an embedded database (HSQL, as an example), run my tests on that database, and let it fade away when my tests end.

Due to my lack of confidence on the standardization level of this application, I would prefer to run tests on an Oracle database. As a consequence, I would like to start oracle database when my tests start, fill it with some test datan and stop it on test end. How can I do that in a maven context ?

Copyright Notice:Content Author:「Riduidel」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37608120/how-to-use-oracle-as-an-embedded-database-for-running-unit-tests-in-maven

Answers
alexbt 2016-06-04T02:59:19

I understand you want Oracle, but you may also try with h2 using oracle mode flag\n\njdbc:h2:~/test;MODE=Oracle\n\n\nI have the same need in most of my projects, and this is the closest to Oracle I found. You can define aliases for the few missing functions.",


More about “How to use Oracle as an embedded database for running unit tests in maven?” related questions

How to use Oracle as an embedded database for running unit tests in maven?

I have an application for which the prod/test/qa database is only Oracle. Furthermore, I suspect SQL queries to be Oracle-specific. And unfortunatly, this application has second to no unit tests. ...

Show Detail

Running Ruby unit tests within maven integration

Does anyone have experience with running unit tests written in Ruby from within Maven. Any inputs, like the library/maven plugin to be used, will be highly appreciated! We are already using Maven+

Show Detail

Build Maven Project Without Running Unit Tests

How do you build a Maven project without running unit tests? Currently restructuring some code I have for a Servlet and would like to try it out in my web browser (which means running mvn install ...

Show Detail

Exploring embedded derby database using IntelliJ DB Navigator Plugin

I have created an in-memory Derby database (created with maven plugin). I am looking for a way to explore the database like how DB Navigator does with oracle/mysql databases. PS: I am very new to ...

Show Detail

Threaded Maven builds with sequential Unit Tests?

With Maven 3 it`s possible to build Projects with multiple Threads, like mvn -T 4 clean install Since we have Unit-Tests setting up on a consistent Database (and manipulating the data during exec...

Show Detail

Starting an embedded Cassandra instance for Unit tests

I need to start a Embedded cassandra instance to perform some operations on a Cassandra keyspace via Unit tests. Programming Language is Java. What are the options to start an embedded cassandra? ...

Show Detail

Maven deploy multiple wars to embedded server for integration tests

I have had no issue running a maven war project on an embedded server for its own integration tests, but now I need to run multiple wars and test from a different project. I would like to setup the

Show Detail

Run unit tests on multiple databases using Spring and H2

I have an application that supports multiple databases (MySQL, Oracle, SQL Server, Postgre). I want to config multiple profiles in Spring to run unit tests on multiple databases (I use H2 as my main

Show Detail

How to add classpaths for unit tests in maven ?

I am using maven to make a simple application and writing unit tests for it. I am new to both using maven as well as writing unit tests with Junit. My directory structure is as follows :- The so...

Show Detail

Initialization of ORACLE database In unit tests

I have been trying to write some unit tests for my application. I am using oracle database in a docker container. I am using ScriptUtils.executeSqlScript() to initialize the database from sql files...

Show Detail