Test execution gets stopped after an assertion error in pytest With Fixtures

117
March 24, 2022, at 11:20 PM

I am new to Python ,

For the data driven testing, if there is 10tests , and the assertion fails [ AssertionError. ] for 4th test , then the rest of the 6 data sets are not considered for execution and the program gets stopped at that point completely. I want test to continue even if one dataset fails ? How can we achieve with fixtures ? Or is there any other way ?

We set up a fixture for Data Driven Testing using Fixtures.

========== TEST DATA ============

Test data is defined in Json  File [ array of JSON Objects ] 

==============. Fixture Code =========

from _pytest.fixtures import fixture
users_json_files_path=. “//Pathto_Input_Json_File”.   
@fixture(params=load_jsondata(users_json_files_path))
def users_testdata(request):
    user_test_data=request.param
    return user_test_data

=========== Passing Fixture to Test Method . ==============

def test_one(users_testdata):    
      assert len(users_not_present == 0 ,"Following Users not present :: " + str(users_not_present)

Thanks, Deepti

Answer 1

Not exactly sure what you are asserting. You can use this for your case: https://pypi.org/project/pytest_check/

Rent Charter Buses Company
READ ALSO
Conda does not create environment from yml file on MacOS

Conda does not create environment from yml file on MacOS

I'm trying to create an environment with conda after having installed Miniconda3, on macOSI am using the conda env create -f SEM1-CB

154
Gensim - index_to_key gives numbers instead of words as output

Gensim - index_to_key gives numbers instead of words as output

I'm trying to get 5 most frequent words from word2vec model created from wikipedia dumpI turned this model into KeyedVectors and the code looks like that:

180
Sending data from html form to python api then send that data to html

Sending data from html form to python api then send that data to html

So i just started working witih python since it was necessary for this project (because the API im using)So i've struggled with this a bit

107
Parsing CSV datafile with nested string Dictionary

Parsing CSV datafile with nested string Dictionary

I'm trying to use a large amount (20GB, approx 1000 files) of csv data from Telegram collected via Telethon over a couple weeksI collected other data previously, but unfortunately, I completely messed up, used the wrong script and let my collection script...

130