|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.jvnet.hudson.test.HudsonTestCase
public abstract class HudsonTestCase
Base class for all Hudson test cases.
| Nested Class Summary | |
|---|---|
class |
HudsonTestCase.WebClient
Extends WebClient and provide convenience methods
for accessing Hudson. |
| Field Summary | |
|---|---|
protected java.lang.String |
contextPath
Where in the Server is Hudson deploed? |
protected TestEnvironment |
env
|
protected HudsonHomeLoader |
homeLoader
|
Hudson |
hudson
|
protected JavaScriptDebugger |
jsDebugger
JavaScript "debugger" that provides you information about the JavaScript call stack and the current values of the local variables in those stack frame. |
protected int |
localPort
TCP/IP port that the server is listening on. |
protected java.util.List<Recipe.Runner> |
recipes
|
protected org.mortbay.jetty.Server |
server
|
protected java.util.List<LenientRunnable> |
tearDowns
Runnables to be invoked at tearDown(). |
| Constructor Summary | |
|---|---|
protected |
HudsonTestCase()
|
protected |
HudsonTestCase(java.lang.String name)
|
| Method Summary | ||
|---|---|---|
|
assertBuildStatus(Result status,
R r)
Asserts that the outcome of the build is a specific outcome. |
|
|
assertBuildStatusSuccess(R r)
|
|
void |
assertLogContains(java.lang.String substring,
Run run)
Asserts that the console output of the build contains the given substring. |
|
void |
assertXPath(com.gargoylesoftware.htmlunit.html.HtmlPage page,
java.lang.String xpath)
Asserts that the XPath matches. |
|
protected Ant.AntInstallation |
configureDefaultAnt()
Extracts Ant and configures it. |
|
protected Maven.MavenInstallation |
configureDefaultMaven()
Locates Maven2 and configure that as the only Maven in the system. |
|
protected org.mortbay.jetty.security.UserRealm |
configureUserRealm()
Configures a security realm for a test. |
|
protected FreeStyleProject |
createFreeStyleProject()
|
|
protected FreeStyleProject |
createFreeStyleProject(java.lang.String name)
|
|
protected Launcher.LocalLauncher |
createLocalLauncher()
Creates Launcher.LocalLauncher. |
|
protected MatrixProject |
createMatrixProject()
|
|
protected MatrixProject |
createMatrixProject(java.lang.String name)
|
|
protected MavenModuleSet |
createMavenProject()
Creates a empty Maven project with an unique name. |
|
protected MavenModuleSet |
createMavenProject(java.lang.String name)
Creates a empty Maven project with the given name. |
|
DumbSlave |
createSlave()
|
|
DumbSlave |
createSlave(Label l)
Creates and launches a new slave on the local host. |
|
DumbSlave |
createSlave(Label l,
EnvVars env)
Creates a slave with certain additional environment variables |
|
TaskListener |
createTaskListener()
Creates a TaskListener connected to stdout. |
|
java.io.File |
createTmpDir()
Allocates a new temporary directory for the duration of this test. |
|
protected javax.servlet.ServletContext |
createWebServer()
Prepares a webapp hosting environment to get ServletContext implementation
that we need for testing. |
|
void |
interactiveBreak()
Blocks until the ENTER key is hit. |
|
protected
|
last(java.util.List<T> items)
Returns the last item in the list. |
|
protected Hudson |
newHudson()
Creates a new instance of Hudson. |
|
protected void |
pause()
Pauses the execution until ENTER is hit in the console. |
|
protected void |
recipe()
Called during the setUp() to give a test case an opportunity to
control the test environment in which Hudson is run. |
|
protected void |
recipeLoadCurrentPlugin()
If this test harness is launched for a Hudson plugin, locate the target/test-classes/the.hpl and add a recipe to install that to the new Hudson. |
|
protected void |
runTest()
|
|
protected com.gargoylesoftware.htmlunit.Page |
search(java.lang.String q)
Performs a search from the search box. |
|
protected void |
setUp()
|
|
com.gargoylesoftware.htmlunit.html.HtmlPage |
submit(com.gargoylesoftware.htmlunit.html.HtmlForm form)
Submits the form. |
|
com.gargoylesoftware.htmlunit.html.HtmlPage |
submit(com.gargoylesoftware.htmlunit.html.HtmlForm form,
java.lang.String name)
Submits the form by clikcing the submit button of the given name. |
|
protected void |
tearDown()
|
|
HudsonTestCase |
with(HudsonHomeLoader homeLoader)
|
|
HudsonTestCase |
withExistingHome(java.io.File source)
|
|
HudsonTestCase |
withNewHome()
|
|
HudsonTestCase |
withPresetData(java.lang.String name)
Declares that this test case expects to start with one of the preset data sets. |
|
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runBare, setName, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public Hudson hudson
protected final TestEnvironment env
protected HudsonHomeLoader homeLoader
protected int localPort
protected org.mortbay.jetty.Server server
protected java.lang.String contextPath
Server is Hudson deploed?
protected java.util.List<LenientRunnable> tearDowns
Runnables to be invoked at tearDown().
protected java.util.List<Recipe.Runner> recipes
protected JavaScriptDebugger jsDebugger
Unlike Java debugger, which you as a human interfaces directly and interactively, this JavaScript debugger is to be interfaced by your program (or through the expression evaluation capability of your Java debugger.)
| Constructor Detail |
|---|
protected HudsonTestCase(java.lang.String name)
protected HudsonTestCase()
| Method Detail |
|---|
protected void setUp()
throws java.lang.Exception
setUp in class junit.framework.TestCasejava.lang.Exception
protected void tearDown()
throws java.lang.Exception
tearDown in class junit.framework.TestCasejava.lang.Exception
protected void runTest()
throws java.lang.Throwable
runTest in class junit.framework.TestCasejava.lang.Throwable
protected Hudson newHudson()
throws java.lang.Exception
Hudson. If the derived class wants to create it in a different way,
you can override it.
java.lang.Exception
protected javax.servlet.ServletContext createWebServer()
throws java.lang.Exception
ServletContext implementation
that we need for testing.
java.lang.Exceptionprotected org.mortbay.jetty.security.UserRealm configureUserRealm()
protected Maven.MavenInstallation configureDefaultMaven()
throws java.lang.Exception
java.lang.Exception
protected Ant.AntInstallation configureDefaultAnt()
throws java.lang.Exception
java.lang.Exception
protected FreeStyleProject createFreeStyleProject()
throws java.io.IOException
java.io.IOException
protected FreeStyleProject createFreeStyleProject(java.lang.String name)
throws java.io.IOException
java.io.IOException
protected MatrixProject createMatrixProject()
throws java.io.IOException
java.io.IOException
protected MatrixProject createMatrixProject(java.lang.String name)
throws java.io.IOException
java.io.IOException
protected MavenModuleSet createMavenProject()
throws java.io.IOException
java.io.IOExceptionconfigureDefaultMaven()
protected MavenModuleSet createMavenProject(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionconfigureDefaultMaven()protected Launcher.LocalLauncher createLocalLauncher()
Launcher.LocalLauncher. Useful for launching processes.
public java.io.File createTmpDir()
throws java.io.IOException
java.io.IOException
public DumbSlave createSlave()
throws java.lang.Exception
java.lang.Exception
public DumbSlave createSlave(Label l)
throws java.lang.Exception
java.lang.Exception
public DumbSlave createSlave(Label l,
EnvVars env)
throws java.lang.Exception
java.lang.Exception
public void interactiveBreak()
throws java.lang.Exception
java.lang.Exceptionprotected <T> T last(java.util.List<T> items)
protected void pause()
throws java.io.IOException
This is often very useful so that you can interact with Hudson from an browser, while developing a test case.
java.io.IOException
protected com.gargoylesoftware.htmlunit.Page search(java.lang.String q)
throws java.lang.Exception
java.lang.Exception
public <R extends Run> R assertBuildStatus(Result status,
R r)
throws java.lang.Exception
java.lang.Exception
public <R extends Run> R assertBuildStatusSuccess(R r)
throws java.lang.Exception
java.lang.Exception
public void assertLogContains(java.lang.String substring,
Run run)
throws java.lang.Exception
java.lang.Exception
public void assertXPath(com.gargoylesoftware.htmlunit.html.HtmlPage page,
java.lang.String xpath)
public com.gargoylesoftware.htmlunit.html.HtmlPage submit(com.gargoylesoftware.htmlunit.html.HtmlForm form)
throws java.lang.Exception
java.lang.Exception
public com.gargoylesoftware.htmlunit.html.HtmlPage submit(com.gargoylesoftware.htmlunit.html.HtmlForm form,
java.lang.String name)
throws java.lang.Exception
name - This corresponds to the @name of <f:submit />
java.lang.Exceptionpublic TaskListener createTaskListener()
TaskListener connected to stdout.
protected void recipe()
throws java.lang.Exception
setUp() to give a test case an opportunity to
control the test environment in which Hudson is run.
One could override this method and call a series of withXXX methods,
or you can use the annotations with Recipe meta-annotation.
java.lang.Exception
protected void recipeLoadCurrentPlugin()
throws java.lang.Exception
This file is created by maven-hpi-plugin at the testCompile phase when the current packaging is hpi.
java.lang.Exceptionpublic HudsonTestCase withNewHome()
public HudsonTestCase withExistingHome(java.io.File source)
throws java.lang.Exception
java.lang.Exceptionpublic HudsonTestCase withPresetData(java.lang.String name)
public HudsonTestCase with(HudsonHomeLoader homeLoader)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||