org.netbeans.modules.jellytools.platform/3 3.13

org.netbeans.jellytools
Class JellyTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.netbeans.junit.NbTestCase
              extended by org.netbeans.jellytools.JellyTestCase
All Implemented Interfaces:
junit.framework.Test, NbTest

public class JellyTestCase
extends NbTestCase

JUnit test case with implemented Jemmy/JellyTools support stuff.


Field Summary
 boolean captureScreen
          screen capture feature in case of failure is enabled by default
 boolean closeAllModal
          closing all modal dialogs after each test case is disabled by default
 boolean dumpScreen
          screen XML dump feature in case of failure is disabled by default
 boolean waitNoEvent
          Wait 1000 ms before every test case
 
Constructor Summary
JellyTestCase(String testName)
          constructor required by JUnit
 
Method Summary
protected  void clearTestStatus()
          Clears test status (used when test does not depend on previous test)
static void closeAllModal()
          Closes all opened modal dialogs.
 void closeOpenedProjects()
          Close projects opened by openProjects(String ...) or openDataProjects(String ...)
 void closeOpenedProjects(Object... projects)
          Close projects opened by openProjects(String ...) or openDataProjects(String ...)
protected static junit.framework.Test createModuleTest(Class testClass, String... testNames)
           
protected static junit.framework.Test createModuleTest(String modules, String clusters, Class testClass, String... testNames)
           
protected  void endTest()
          Sets the test status to 'finished' state (test passed)
 void fail(Throwable t)
          Finishes test with status Fail
protected  void failNotify(Throwable reason)
          Method called in case of fail or error just after screen shot and XML dumps.
protected  void initEnvironment()
          Inits environment before test case is executed.
 void openDataProjects(String... projects)
          Open projects located within NbTestCase.getDataDir();
 void openProjects(String... projects)
          Open projects.
 void runBare()
          Overridden method from JUnit framework execution to perform conditional screen shot and conversion from TimeoutExpiredException to AssertionFailedError.
protected  void runTest()
          Ensures that screen capture is done before the tearDown() is called
protected  void startTest()
          Checks whether previous test finished correctly and sets test status to 'not finished' state
 void waitScanFinished()
          Waits for the source scanning to be finished.
 
Methods inherited from class org.netbeans.junit.NbTestCase
assertFile, assertFile, assertFile, assertFile, assertFile, assertFile, assertFile, assertFile, assertFile, assertFile, assertGC, assertGC, assertSize, assertSize, assertSize, assertSize, canRun, clearWorkDir, compareReferenceFiles, compareReferenceFiles, convertNBFSURL, failByBug, failByBug, getDataDir, getExpectedFail, getGoldenFile, getGoldenFile, getLog, getLog, getRef, getTestNumber, getWorkDir, getWorkDirPath, log, log, logLevel, logRoot, ref, run, runInEQ, setFilter, timeOut
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, setName, setUp, tearDown, 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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface junit.framework.Test
countTestCases
 

Field Detail

captureScreen

public boolean captureScreen
screen capture feature in case of failure is enabled by default


dumpScreen

public boolean dumpScreen
screen XML dump feature in case of failure is disabled by default


closeAllModal

public boolean closeAllModal
closing all modal dialogs after each test case is disabled by default


waitNoEvent

public boolean waitNoEvent
Wait 1000 ms before every test case

Constructor Detail

JellyTestCase

public JellyTestCase(String testName)
constructor required by JUnit

Parameters:
testName - method name to be used as testcase
Method Detail

initEnvironment

protected void initEnvironment()
Inits environment before test case is executed. It can be overridden in sub class but it is recommended to call super.initEnvironment() at the beginning.
Default initialization: output messages from jemmy are redirected to jemmy.log file in workdir; jemmy timeouts are loaded from org.netbeans.jellytools.timeouts and if system property jelly.timeouts_resource or jelly.timeouts_file are set, timeouts are loaded from specified resource/file;


runBare

public void runBare()
             throws Throwable
Overridden method from JUnit framework execution to perform conditional screen shot and conversion from TimeoutExpiredException to AssertionFailedError.
Waits a second before test execution.

Overrides:
runBare in class NbTestCase
Throws:
Throwable - Throwable

runTest

protected void runTest()
                throws Throwable
Ensures that screen capture is done before the tearDown() is called

Overrides:
runTest in class junit.framework.TestCase
Throws:
Throwable

failNotify

protected void failNotify(Throwable reason)
Method called in case of fail or error just after screen shot and XML dumps.
Override this method when you need to be notified about test failures or errors but avoid any exception to be throwed from this method.
super.failNotify() does not need to be called because it is empty.

Parameters:
reason - Throwable reason of current fail

closeAllModal

public static void closeAllModal()
Closes all opened modal dialogs. Non-modal stay opened.


fail

public void fail(Throwable t)
Finishes test with status Fail

Parameters:
t - Throwable reason of test failure

startTest

protected void startTest()
Checks whether previous test finished correctly and sets test status to 'not finished' state


endTest

protected void endTest()
Sets the test status to 'finished' state (test passed)


clearTestStatus

protected void clearTestStatus()
Clears test status (used when test does not depend on previous test)


waitScanFinished

public void waitScanFinished()
Waits for the source scanning to be finished.

Throws:
junit.framework.AssertionFailedError - if scanning was canceled or other exception appears

openProjects

public void openProjects(String... projects)
                  throws IOException
Open projects. All newly opened projects are remembered and could later be closed by closeOpenedProjects() method. The method could be executed many times for one project - nothing happens if project is opened already.

Parameters:
projects - - paths to the project directories.
Throws:
IOException

openDataProjects

public void openDataProjects(String... projects)
                      throws IOException
Open projects located within NbTestCase.getDataDir();

Parameters:
projects - - relative to dataDir (test/qa-functional/data) path names.
Throws:
IOException

closeOpenedProjects

public void closeOpenedProjects()
Close projects opened by openProjects(String ...) or openDataProjects(String ...)


closeOpenedProjects

public void closeOpenedProjects(Object... projects)
Close projects opened by openProjects(String ...) or openDataProjects(String ...)


createModuleTest

protected static junit.framework.Test createModuleTest(String modules,
                                                       String clusters,
                                                       Class testClass,
                                                       String... testNames)

createModuleTest

protected static junit.framework.Test createModuleTest(Class testClass,
                                                       String... testNames)

org.netbeans.modules.jellytools.platform/3 3.13

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.