anchor.diff:      meck:expect(amoc_dist, do, fun(sample_test, 0, []) -> {ok, mocked} end);
   setup_meck(start_scenario_with_users_and_settings) ->
       meck:expect(amoc_dist, get_state, fun() -> idle end),
  -    meck:expect(amoc_dist, do, fun(sample_test, 10, Settings) ->
  -                                       ?assertEqual(lists:sort(Settings), lists:sort(settings())),
  -                                       {ok, mocked}
  -                               end);
  +    meck:expect(amoc_dist, do,
  +                fun(sample_test, 10, Settings) ->
  +                    ?assertEqual(lists:sort(Settings), lists:sort(settings())),
  +                    {ok, mocked}
  +                end);
  +setup_meck(fail_to_start_when_amoc_dist_fails) ->
  +    meck:expect(amoc_dist, get_state, fun() -> idle end),
  +    meck:expect(amoc_dist, do,
  +                fun(sample_test, 10, Settings) ->
  +                    ?assertEqual(lists:sort(Settings), lists:sort(settings())),
  +                    {error, mocked}
  +                end);
   setup_meck(stop_scenario) ->
       meck:expect(amoc_dist, get_state, fun() -> running end),
       meck:expect(amoc_dist, stop, fun() -> {ok, mocked} end);
  +setup_meck(fail_to_stop_when_amoc_dist_fails) ->
  +    meck:expect(amoc_dist, get_state, fun() -> running end),
  +    meck:expect(amoc_dist, stop, fun() -> {error, mocked} end);
   setup_meck(add_users) ->
       meck:expect(amoc_dist, get_state, fun() -> running end),
       meck:expect(amoc_dist, add, fun(10) -> {ok, mocked} end);
  +setup_meck(fail_to_add_users_when_amoc_dist_fails) ->
  +    meck:expect(amoc_dist, get_state, fun() -> running end),
  +    meck:expect(amoc_dist, add, fun(10) -> {error, mocked} end);
   setup_meck(add_users_on_nodes) ->
       meck:expect(amoc_dist, get_state, fun() -> running end),
       meck:expect(amoc_dist, add, fun(10, [node1@host1, node2@host2]) -> {ok, mocked} end);
   setup_meck(remove_users) ->
       meck:expect(amoc_dist, get_state, fun() -> running end),
       meck:expect(amoc_dist, remove, fun(10, false) -> {ok, mocked} end);
  +setup_meck(fail_to_remove_users_when_amoc_dist_fails) ->
  +    meck:expect(amoc_dist, get_state, fun() -> running end),
  +    meck:expect(amoc_dist, remove, fun(10, false) -> {error, mocked} end);
   setup_meck(remove_users_on_nodes) ->
       meck:expect(amoc_dist, get_state, fun() -> running end),
       meck:expect(amoc_dist, remove, fun(10, false, [node1@host1, node2@host2]) -> {ok, mocked} end);
  
positive.code: 
  fail_to_start_when_not_idle(_Config) ->
      JsonBody = #{scenario => bad_scenario},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/start", JsonBody),
      ?assertEqual(409, HttpCode).
  
  stop_scenario(_Config) ->
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/stop"),
      ?assertEqual(200, HttpCode).
  
  fail_to_stop_scenario_when_not_running(_Config) ->
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/stop"),
      ?assertEqual(409, HttpCode).
  
  add_users(_Config) ->
      JsonBody = #{users=> 10},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/add_users", JsonBody),
      ?assertEqual(200, HttpCode).
  
  add_users_on_nodes(_Config) ->
      JsonBody = #{users=> 10, nodes=> [node1@host1, node2@host2]},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/add_users", JsonBody),
      ?assertEqual(200, HttpCode).
  
  fail_to_add_users_when_not_running(_Config) ->
      JsonBody = #{users=> 10},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/add_users", JsonBody),
      ?assertEqual(409, HttpCode).
  
  remove_users(_Config) ->
      JsonBody = #{users=> 10},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/remove_users", JsonBody),
      ?assertEqual(200, HttpCode).
  
  remove_users_on_nodes(_Config) ->
      JsonBody = #{users=> 10, nodes=> [node1@host1, node2@host2]},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/remove_users", JsonBody),
      ?assertEqual(200, HttpCode).
  
  fail_to_remove_users_when_not_running(_Config) ->
      JsonBody = #{users=> 10},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/remove_users", JsonBody),
      ?assertEqual(409, HttpCode).
  
  update_settings(_Config) ->
      JsonBody = #{settings=> json_settings()},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/update_settings", JsonBody),
      ?assertEqual(200, HttpCode).
  
  update_settings_on_nodes(_Config) ->
      JsonBody = #{settings=> json_settings(), nodes=>[node1@host1, node2@host2]},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/update_settings", JsonBody),
      ?assertEqual(200, HttpCode).
  
  fail_to_update_settings_when_not_running(_Config) ->
      JsonBody = #{settings=> json_settings()},
      {HttpCode, _Body} = amoc_api_helper:patch("/execution/update_settings", JsonBody),
      ?assertEqual(409, HttpCode).
  
  fail_to_update_with_invalid_settings(_config) ->
      {InvalidJsonSettings, Error} = invalid_json_settings_and_error(),
  
negative.code: 
  start_scenario(_Config) ->
      JsonBody = #{scenario => sample_test},
      {HttpCode, Body} = amoc_api_helper:patch("/execution/start", JsonBody),
      ?assertEqual(200, HttpCode),
      ?assertEqual(#{}, Body).
  
  start_scenario_with_users_and_settings(_Config) ->
      JsonBody = #{scenario => sample_test, users => 10, settings => json_settings()},
      {HttpCode, Body} = amoc_api_helper:patch("/execution/start", JsonBody),
      ?assertEqual(200, HttpCode),
      ?assertEqual(#{}, Body).
  
  fail_to_start_when_amoc_dist_fails(_Config) ->
      JsonBody = #{scenario => sample_test, users => 10, settings => json_settings()},
      {HttpCode, Body} = amoc_api_helper:patch("/execution/start", JsonBody),
      ?assertEqual(500, HttpCode),
      ?assertEqual(#{<<"error">> => <<"mocked">>}, Body).
  
  fail_to_start_non_existing_scenario(_Config) ->
      JsonBody = #{scenario => bad_scenario},
  