Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent when using behave --simple #143

Open
ariesmaulana opened this issue Aug 1, 2022 · 1 comment
Open

Inconsistent when using behave --simple #143

ariesmaulana opened this issue Aug 1, 2022 · 1 comment

Comments

@ariesmaulana
Copy link

Hi thanks for this awesome package

I'm trying add behave-django for my project, but several times when running testing it often crashes when there is data migration

example i have migration some app like this

app
-- migration
---- 0001_initial.py --> migration table structure
---- 0002_add_default_data.py --> migration default data
---- 0003_add_field.py ---> alter table add field with validation not null
...

At first I just used ./manage.py behave and it failed with error
"..... field new_field violate not null constraint ...."

when i tried to solve this issue i found this and this and both suggest using ./manage.py behave --simple

first try

Feature: Login User to New Dashboard # features/user_login.feature:1
  Login with rest api with initial user "user-test" with password "password"
  Scenario Outline: User login with username and password -- @1.1 Login user  # features/user_login.feature:12
    Given Server is up                                                        # features/steps/user_login_test.py:6 0.449s
    When User input name: user-test and password                             # features/steps/user_login_test.py:14 0.001s
    Then System will try to login                                             # features/steps/user_login_test.py:19 0.743s
    Then User will see correct status code 200                                # features/steps/user_login_test.py:28 0.001s

  Scenario Outline: User login with username and password -- @1.2 Login user  # features/user_login.feature:13
    Given Server is up                                                        # features/steps/user_login_test.py:6 0.162s
    When User input name: user-test and wrong password                       # features/steps/user_login_test.py:14 0.002s
    Then System will try to login                                             # features/steps/user_login_tes    Then System will try to login                                             # features/steps/user_login_test.py:19 0.189s/api/v1/login/
    Then User will see correct status code 401                                # features/steps/user_login_test.py:28 0.022s

1 feature passed, 0 failed, 0 skipped
2 scenarios passed, 0 failed, 0 skipped
8 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m1.569s

second try i got previous error on migration data "..... field new_field violate not null constraint ...."

so tried several times and the result is inconsistent, sometimes my test is pass some time my tes break because failed migration.

i'm using:
behave-django==1.4.0
django==2.2.3

@bittner
Copy link
Member

bittner commented Oct 14, 2022

Since other users report that using --simple solves their problem(s), I believe, the only way to fix this problem (for you and everyone else that may be affected) is to create a test case that can reproduce the issue. If you can come up with such a test, a PR is very welcome!

On the other hand, could the problem be related to your test setup? Feel free to post relevant parts of your setup to make it better understood.

@bittner bittner changed the title Inconsiten when using behave --simple Inconsitent when using behave --simple Oct 14, 2022
@bittner bittner changed the title Inconsitent when using behave --simple Inconsistent when using behave --simple Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants