You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Thielen <da...@windward.net> on 2005/08/02 19:25:27 UTC

Shale question - is this the list?

Hi;

 

Is this the right list for shale questions?

 

If so I have three questions - both having to do with using the test
framework for my JSF code:

1.	I create a class TestDemo extends AbstractJsfTestCase. In my setUp
method I want to use servletContext but all of the mock objects are set to
null. Do I need to make some call to instantiate the mock objects?
2.	When running from IntelliJ, I can run/debug a specific test method.
But if I try to run/debug the entire class, it tells me there are no tests.
I know this is probably an IntelliJ issue but I'm hoping someone here has
run across this.
3.	Is there any documentation for this other than the javadocs? Or
sample code?

 

??? - thanks - dave


RE: Shale question - is this the list?

Posted by David Thielen <da...@windward.net>.
Hi;

Thank you - both for the answer and the ton of great code you've given to
the world.

- dave


David Thielen
303-499-2544
www.windwardreports.com


-----Original Message-----
From: Craig McClanahan [mailto:craigmcc@gmail.com] 
Sent: Tuesday, August 02, 2005 11:44 AM
To: Struts Users Mailing List
Subject: Re: Shale question - is this the list?

n 8/2/05, David Thielen <da...@windward.net> wrote:
> Hi;
> 
> 
> 
> Is this the right list for shale questions?
> 

Yep ... this is the list for user questions, while the Struts
developer list is the right one for questions about developing Shale
itself.  As a courtesy to folks who might not be interested, it's a
common convention to include "[shale]" at the beginning of the subject
line so people can filter out the threads they don't care about.

> 
> 
> If so I have three questions - both having to do with using the test
> framework for my JSF code:
> 
> 1.      I create a class TestDemo extends AbstractJsfTestCase. In my setUp
> method I want to use servletContext but all of the mock objects are set to
> null. Do I need to make some call to instantiate the mock objects?

Yes.  You might want to take a look at the test cases for the Shale
Use Cases example, which do exactly this sort of thing.  If in
particular you want to write unit tests for a ViewController, then try
extending AbstractViewControllerTestCase (which extends
AbstractJsfTestCase) instead ... it sets up a lot of the fundamental
objects for you.

> 2.      When running from IntelliJ, I can run/debug a specific test
method.
> But if I try to run/debug the entire class, it tells me there are no
tests.
> I know this is probably an IntelliJ issue but I'm hoping someone here has
> run across this.

I'm afraid I can't help you there ... but I've seen similar problem
reports from people who forgot to override the suite() method in their
own test case classes.  You might want to make sure you're doing that.

> 3.      Is there any documentation for this other than the javadocs? Or
> sample code?

The framework itself is currently documented only by the Javadocs, but
it is also used in the unit tests for the Use Cases and Clay examples
... check the "src/test" directory in those two downloads for the
source to these tests.

Going beyond unit tests, you might also want to look at how the system
integration tests for the Use Cases and Clay examples work.  They
expect you to have deployed the example app already, and then execute
a client application (based on both JUnit and HtmlUnit) to verify that
the emitted HTML is as expected.  HtmlUnit is quite nice because it
presents you a DOM view of the rendered markup, making it very easy to
validate assertions about what got created.

> 
> 
> 
> ??? - thanks - dave
> 
> 
> 

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Shale question - is this the list?

Posted by Craig McClanahan <cr...@gmail.com>.
n 8/2/05, David Thielen <da...@windward.net> wrote:
> Hi;
> 
> 
> 
> Is this the right list for shale questions?
> 

Yep ... this is the list for user questions, while the Struts
developer list is the right one for questions about developing Shale
itself.  As a courtesy to folks who might not be interested, it's a
common convention to include "[shale]" at the beginning of the subject
line so people can filter out the threads they don't care about.

> 
> 
> If so I have three questions - both having to do with using the test
> framework for my JSF code:
> 
> 1.      I create a class TestDemo extends AbstractJsfTestCase. In my setUp
> method I want to use servletContext but all of the mock objects are set to
> null. Do I need to make some call to instantiate the mock objects?

Yes.  You might want to take a look at the test cases for the Shale
Use Cases example, which do exactly this sort of thing.  If in
particular you want to write unit tests for a ViewController, then try
extending AbstractViewControllerTestCase (which extends
AbstractJsfTestCase) instead ... it sets up a lot of the fundamental
objects for you.

> 2.      When running from IntelliJ, I can run/debug a specific test method.
> But if I try to run/debug the entire class, it tells me there are no tests.
> I know this is probably an IntelliJ issue but I'm hoping someone here has
> run across this.

I'm afraid I can't help you there ... but I've seen similar problem
reports from people who forgot to override the suite() method in their
own test case classes.  You might want to make sure you're doing that.

> 3.      Is there any documentation for this other than the javadocs? Or
> sample code?

The framework itself is currently documented only by the Javadocs, but
it is also used in the unit tests for the Use Cases and Clay examples
... check the "src/test" directory in those two downloads for the
source to these tests.

Going beyond unit tests, you might also want to look at how the system
integration tests for the Use Cases and Clay examples work.  They
expect you to have deployed the example app already, and then execute
a client application (based on both JUnit and HtmlUnit) to verify that
the emitted HTML is as expected.  HtmlUnit is quite nice because it
presents you a DOM view of the rendered markup, making it very easy to
validate assertions about what got created.

> 
> 
> 
> ??? - thanks - dave
> 
> 
> 

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org