As an example, I have:
@Test
public void login(*Code ommitted*){
That tests logging into a site.
Then I want to do other tests that start with logging in, so I've got:
@Test
public void sendUserInvite(){
login();
*Other code omitted*
}
Something is intuitively telling me this is really bad practise, but at the same time if the login test does what I need it to, so why not re-use it in this way? Can anyone clarify this. After a while I end up doing several tests at the start of another test because they are the pre-conditions in order to carry out a particular test.