My database involved testing setup


Today I'd like to show you my testing setup which involves database testing. Hopefully it can help someone out or maybe someone could suggest me better ways of doing things.

First of all, having all the tests in the root of the 't/' directory got too messy, so I'm using mostly the same directory structure in my 't/' directory, as I have in my 'lib/' directory for the ease of navigation. Let's say this is the 'lib/' tree:

- lib/
-     MyApp/
-         MyM…

Simplifying imports (mainly in tests)

During test writing often I find myself having to use a lot of modules and setting up various things that should be common for all of my tests in a given project. In some examples it may get ugly and I really don't like having a ~30 lines long setup in every single test file of mine. After some experimenting, I came up with a quick-and-dirty solution. I create a module in my 't' directory (let's say t/lib/Test/ and put everything I need into it's import sub:

package Test::MyApp;

sub import {
use v5.16;
use strict;

Post #1

Hello everyone, this is my first post here.
I'm fairly new to Perl (~1 year experience) and to testing. I'd like to write not so much articles, but short, to the point code snippets with comments that are useful for those, who are new to Perl, DBIx::Class, PerlDancer2 and testing.
I will try to post things that I would like to know when I started out, but could not find them.

About Davs

user-pic About my journey with Perl, PerlDancer2, DBIx::Class and testing.