• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How to Populate a H2 database using SQL scripts in a specific folder  RSS feed

Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing cucumber tests in my Spring Boot project, I need to create a H2 (in-memory database) first. Then, the cucumber step definitions will use data from the database to validate if my application is working.

The problem that I am having is that the H2 database is not being created in the first place.

Here is the database section of my application.yml:

My cucumber tests are stored in src/integTest/acceptTests.

I have a couple of SQL files to create & populate the H2 database: schema.sql & data.sql. These are stored in src/integTest/resources

I think, by default Spring looks for these files in src/main/resources, but I need to somehow point them to the integTest/resources via my application.yml

Does anyone have any suggestions on what changes I need to make in order to do this?

I can post further code if it is required.

Thanks in advance for any feedback!
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!