Perform multiple tests without restarting server | Dash Testing

Hi,

I am using dash testing to test my dash app. It is a multipage application (2 pages - Dashboard & Main).

I want to test my application without restarting the server. It is possible to write all testcases inside single test function, but that approach has downsides. If one testcase fails, the remaining testcases won’t run.

Normal Approach

def test_name(dash_duo):
    app = import_app("index")
    dash_duo.start_server(app)
    name = dash_duo.find_element("#name")
    assert name == "My app"

def test_description_test(dash_duo):
    app = import_app("index")
    dash_duo.start_server(app)
    desc = dash_duo.find_element("#description")
    assert desc == "My Description"

Normal Approach would starts a new instance of server for each test.

Single Function Approach

def name_test(dash_duo):
    name = dash_duo.find_element("#name")
    assert name == "My app"

def description_test(dash_duo):
    desc = dash_duo.find_element("#description")
    assert desc == "My Description"

def test_dashboard(dash_duo):
    app = import_app("index")
    dash_duo.start_server(app)

    name_test(dash_duo)
    description_test(dash_duo)

In the above approach, if name_test fail, description_test test won’t run.

I wanted to test this application with multiple test function without restarting the server. Is this possible in Dash Testing?
Can you help me in solving this problem?

Thanks in advance :slight_smile:

1 Like