Add a build sep to the build that changes the status.
There is a Builder class to help you with this called MockBuilder. It could be 
used something like this:

public class Test extends HudsonTestCase {

    public void testSomeThing() throws IOException, ExecutionException, 
InterruptedException {
        FreeStyleProject project = createFreeStyleProject();
        project.getBuildersList().add(new MockBuilder(Result.UNSTABLE));
        Result result = project.scheduleBuild2(0).get().getResult();
        assertSame(Result.UNSTABLE, result);
    }
}

/B

> -----Original Message-----
> From: [email protected] [mailto:jenkinsci-
> [email protected]] On Behalf Of David Pärsson
> Sent: den 8 februari 2012 10:30
> To: Jenkins Developers
> Cc: [email protected]
> Subject: Changing build status in a HudsonTestCase
> 
> Hi,
> 
> We're trying to create a plugin that reverts the last commit in an SVN
> repository if build status is changed from SUCCESS to UNSTABLE.
> Currently we're trying to create a HudsonTestCase which verifies this,
> and we would thus like to set the build status on specific builds
> triggered from the test cases.
> 
> Is this possible? If so, how?
> 
> Best Regards
> David and Christian

Reply via email to