Using Liquibase in test automation

Hi, I’m looking to use liquibase to control my database for UI testing.

I have a product running in a VM, using a mysql database.

I’m going to be using selenium to perform manual testing against this environment and want a way to reset this database after each testing suite.

After data has been manually added to the db, is there any way to use liquibase to reset the db back to an older / template version?

I’ve attempted to use snapshots etc. to no avail and I’m hoping to get some pointers,

thanks!

Hi, Emerson!

Check this out: https://github.com/liquibase/liquibase-data. Liquibase Data is an extension to Liquibase that allows you to version the actual data in your database. It leverages Docker to do that.

We use this at Liquibase for our database validation and for testing our SaaS offering. The team likes it a LOT!

You can chat with me on our Discord (Liquibase). I’m r2liquibase over there.

Thanks!

Robert

1 Like

Liquibase will bring an empty database up-to-date. Therefore, reset the database (recreate or drop all tables), and then run liquibase.

You can also set changelogs to run every time, so you could clear certain records/tables and repopulate every time.

Hi, why not simply use:

liquibase update
[your test suite]
liquibase rollback <valid_tag>