Hi,
I am trying to use testharness classes for running some JUnit tests on the
local machine. I am wondering, what is the best way to launch the daemon
programmatically, so that I can then use methods like 'expectSuccessfulTestRun'
to execute test applications in it? My current method, arrived at through trial
and error, is to manually set a few System variables within my unit test, like
org.smartfrog.iniFile
org.smartfrog.sfcore.processcompound.sfProcessName
org.smartfrog.sfcore.processcompound.sfRootLocatorPort
and then launch the daemon using SmartFrogTestBase.startSmartFrog. But I
suspect that there is a better way to do this. Is there?
And another question. SmartFrogTestBase.terminateSmartFrog(), which calls
SFSystem.runConfigurationDescriptor(new
ConfigurationDescriptor(":TERMINATE:::localhost:")), ends up executing
System.exit(0), which kicks me out of the test runner - not what I want. Is
there a better way to shut down the daemon?
Thank you,
Dmitry
> -----Original Message-----
> From: Steve Loughran [mailto:[email protected]]
> Sent: Monday, September 20, 2010 3:20 PM
> To: Dmitry Epstein; Peter Gagarinov
> Cc: [email protected]; [email protected]
> Subject: re: [Smartfrog-users] Running applications using Ant tasks
>
>
> Hi.
>
> sorry to only just get back to you, -my mail from this list goes to a
> machine that I only check @work, and I've been working from home the
> last few days.
>
> The best way to programatically run an SF application from within JUnit
> 3.8.x is to use our testharness classes (in the sf-testharness JAR)
>
> http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/testha
> rness/src/org/smartfrog/test/DeployingTestBase.java?revision=8404&view=
> markup
>
> There's also a subclass, PortCheckingTestBase, which can be made to
> check for ports being open before/after test runs. This is handy for
> blocking until things are up and running.
>
> http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/testha
> rness/src/org/smartfrog/test/PortCheckingTestBase.java?revision=8404&vi
> ew=markup
>
> The code in DeployingTestBase and it's parent, SmartFrogTestBase,
> should
> show you how to create an SF application in Java code, which is
> generally fairly straightforward: you load up a configuration, then
> deploy it to the target machine, and look for errors or an RMI-
> remotable
> interface.
> http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/testha
> rness/src/org/smartfrog/test/SmartFrogTestBase.java?revision=8404&view=
> markup
>
> In the DeployingTestBase we try and do something a bit cleverer in that
> it will deploy components which implement the TestBlock interface,
> these
> -provide more lifecycle events
> -let you know if their child started/finished/failed, etc.
>
> With components that implement this interface (TestBlockImpl and the
> more sophisticated TestCompound/TestCompoundImpl), we can just use
> JUnit
> as a launcher for the tests, get the traces back when they fail and
> generally push most of the test work -starting something, running
> tests-
> into the app. For the problem we often have -functional testing of a
> SmartFrog component- this is good, though the limitations of Ant's XML
> to HTML Junit process do show (there's no way to get text descriptions
> of tests into the HTML, or show which tests were skipped).
<snip>
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Smartfrog-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smartfrog-users