提交 433b8b36 编写于 作者: K kohsuke

added a new assert method so that we can see the cause of a failure better

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@12795 71c3de6d-444a-0410-be80-ed276b4c234a
上级 368ced0b
......@@ -17,6 +17,7 @@ import hudson.model.Item;
import hudson.model.UpdateCenter;
import hudson.model.Saveable;
import hudson.model.Run;
import hudson.model.Result;
import hudson.tasks.Mailer;
import hudson.Launcher.LocalLauncher;
import hudson.util.StreamTaskListener;
......@@ -246,6 +247,15 @@ public abstract class HudsonTestCase extends TestCase {
protected void pause() throws IOException {
new BufferedReader(new InputStreamReader(System.in)).readLine();
}
public void assertBuildStatus(Result status, Run r) throws Exception {
if(status==r.getResult())
return;
// dump the build output
System.out.println(r.getLog());
assertEquals(status,r.getResult());
}
//
// recipe methods. Control the test environments.
......
......@@ -35,7 +35,7 @@ public class SubversionSCMTest extends HudsonTestCase {
));
FreeStyleBuild b = p.scheduleBuild2(0).get();
System.out.println(b.getLog());
assertEquals(Result.SUCCESS,b.getResult());
assertBuildStatus(Result.SUCCESS,b);
SubversionTagAction action = b.getAction(SubversionTagAction.class);
assertFalse(b.hasPermission(action.getPermission()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册