Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9186731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:36:12+00:00 2026-06-17T19:36:12+00:00

I want to write integration tests for my application, which is using a MySQL

  • 0

I want to write integration tests for my application, which is using a MySQL db via jdbc.
(FYI: The application has a user database and a wiki so far, so nothing sophisticated really)

I came across a lot of posts, mostly talking about HSQLDB or H2, as well as some exotics or discontinued (like mxj)

Sadly, most of these threads were made years ago and so many things have changed since then.
I’m looking for people with recent experience (or even better having a similiar setup like I got – that means spring and the need to run these tests both locally and on jenkins)!

I understand that the best way to find the answer is to try it myself and see what works best, but maybe someone has recent experience and is willing to share 🙂


Technologies used:

  • MySQL
  • Spring
  • TestNG
  • Jenkins

I’d be very thankful if you can share your experience and advices with me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:36:13+00:00Added an answer on June 17, 2026 at 7:36 pm

    So I decided to use h2, which gave me some problems with importing MySQL dumbs. The answer is here: Running h2 in MODE=MySQL doesn't support MySQL dumps

    Basically, you have to remove quotes around table-names (they seem to work fine for fields nevertheless). You can use back-ticks ( ` ) or not use any ticks/quotes at all.
    Another thing that caused a problem was a “AUTO_INCREMENT = 1” at the end of the table definition. Since h2 uses 1 as default after the start, this command is not needed anyways.

    Here’s an example how to setup the embedded database:

    public class InMemoryTest {
        @org.testng.annotations.Test // ofc this can be JUnit @Test as well
        public void test() throws Exception {
            Class.forName("org.h2.Driver");
    
            Connection conn = DriverManager.
                    getConnection("jdbc:h2:mem:test;MODE=MySQL;IGNORECASE=TRUE;INIT=RUNSCRIPT FROM 'src/test/resources/test.sql'");
    
    
            Statement stat = conn.createStatement();
            stat.execute("INSERT INTO `usr_avatar` (\"usr_avatar_user_id\") VALUES (1)");
        }
    }
    

    and the test.sql would be:

    DROP TABLE IF EXISTS usr_avatar;
    CREATE TABLE IF NOT EXISTS usr_avatar (
      "usr_avatar_id" int(11) NOT NULL AUTO_INCREMENT,
      "usr_avatar_user_id" int(11) NOT NULL
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write integration tests for my application. I want to test, that
I want to write some integration-tests for my connect-middleware and test it with real-http-requests
I am using Specflow (http://specflow.org/) to write some integration tests and I would like
I am trying to write an integration test using AbstractTransactionalJUnit4SpringContextTests . I want to
I want to write integration application test to test the full CRUD operations. I
I want to write an integration test for a library that handles streamed http
I want write a simple query which will fetch data from a table (which
I want write a little code analyzer which parses nested structures and translates into
Hello I want write my own desktop sharing application in Java. The application should
I want to write a batch script statement where: FINDSTR has to check for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.