Asserting a failed login attempt on Simpletest
In case someone else wonders about this... It wasn't difficult, but I didn't realise at first that it can be done by copying part of the DrupalWebTestCase::drupalLogin() source code:

$edit = array(
  'name' =&gt; $user-&gt;name,
  'pass' =&gt; $user-&gt;pass_raw,
);
$this-&gt;drupalPost('user', $edit, t('Log in'));


And then asserting that the user could not log in:

// Assert that the user is not logged in
$this-&gt;assertNoLink(t('Log out'), 0, t('User not logged in.'), t('User login'));