---
name: "Bio::Chado::Schema::Test"
section: "3pm"
platform: "linux"
package: "libbio-chado-schema-perl"
version: "0.20000-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Bio::Chado::Schema::Test"
---

# Bio::Chado::Schema::Test(3pm)

Library to be used by Bio::Chado::Schema test scripts.

## NAME

Bio::Chado::Schema::Test - Library to be used by Bio::Chado::Schema test scripts.

## SYNOPSIS

```
  use lib qw(t/lib);
  use Bio::Chado::Schema::Test;
  use Test::More;
  my $schema = Bio::Chado::Schema::Test->init_schema();
```

## DESCRIPTION

This module provides the basic utilities to write tests against Bio::Chado::Schema.

## METHODS

### init\_schema

```
  my $schema = Bio::Chado::Schema::Test->init_schema(
    deploy            => 1,
    populate          => 1,
    storage_type      => '::DBI::Replicated',
    storage_type_args => {
      balancer_type=>'DBIx::Class::Storage::DBI::Replicated::Balancer::Random'
    },
  );
```

This method removes the test SQLite database in t/var/BCS.db and then creates a new, empty database.

This method will call **deploy\_schema()** by default, unless the deploy flag is set to 0.

This method will call **populate\_schema()** if the populate argument is set to a true value.

### has\_custom\_dsn

Returns true if the BCS\_TEST\_DSN environment variable is set.

### deploy\_schema

```
  Bio::Chado::Schema::Test->deploy_schema( $schema );
```

This method does one of two things to the schema.  It can either call the experimental `$schema`-\>**deploy()** if the BCSTEST\_SQLT\_DEPLOY environment variable is set, otherwise the default is to read in the t/lib/sqlite.sql file and execute the SQL within. Either way you end up with a fresh set of tables for testing.

### populate\_schema

```
  Bio::Chado::Schema::Test->populate_schema( $schema );
```

After you deploy your schema you can use this method to populate the tables with test data.
