Skip to content

Tables are not created for test_database while running behave test #136

@SALIMA534

Description

@SALIMA534

We are using Behave tool for running BDD tests and when we run the tests using Behave only the tests are running fine. Here is an example to show how we are running test

behave login.feature

When we use the 'behave-django' to integrate BDD tests with Django, tests can't be run. We followed the steps available from these pages
https://behave-django.readthedocs.io/en/latest/installation.html
&
https://behave-django.readthedocs.io/en/latest/usage.html

and the error what we are hitting is like this:
Option 1:

python manage.py behave
.........
..........
Creating test database for alias 'default'...
Traceback (most recent call last):
  File "C:\Users\USER 1\PycharmProjects\behaveproject\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "auth_user" does not exist
The above exception was the direct cause of the following exception:
.............
.............
django.db.utils.ProgrammingError: relation "auth_user" does not exist

Option 2:

python manage.py behave --keepdb
.........
.........
Using existing test database for alias 'default'...
Traceback (most recent call last):
  File "C:\Users\USER 1\PycharmProjects\behaveproject\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "auth_user" does not exist
The above exception was the direct cause of the following exception:
..........
..........
django.db.utils.ProgrammingError: relation "auth_user" does not exist

This is really blocking our deployments because tests can't be run. Could someone look at this issue and help us unblocking it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions