wood burning stoves*
The moose likes Spring and the fly likes [Spring Web Flow 2] Spring Web Flow 2 comes with direct support of Tests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Spring
Bookmark "[Spring Web Flow 2] Spring Web Flow 2 comes with direct support of Tests" Watch "[Spring Web Flow 2] Spring Web Flow 2 comes with direct support of Tests" New topic
Author

[Spring Web Flow 2] Spring Web Flow 2 comes with direct support of Tests

Markus Staeuble
Author
Greenhorn

Joined: Apr 12, 2009
Posts: 16
The framework Spring Web Flow 2 offers an integrated mechanismn of testing the flows.
More information could be read here: http://static.springframework.org/spring-webflow/docs/2.0.x/reference/htmlsingle/spring-webflow-reference.html#testing

We have used that integration inside our project and it helps us to increase the quality of the flows.


Author of the book Spring Web Flow 2 Web Development. Available at http://www.packtpub.com/develop-powerful-web-applications-with-spring-web-flow-2/book
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Thanks. To test flows, does it need to deploy application to Servlet container? Or we can test outside the container?

And how to run the test? From documentation, it doesn't explain how to run.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Markus Staeuble
Author
Greenhorn

Joined: Apr 12, 2009
Posts: 16
The tests could be run outside a servlet container. The tests are "simple" JUnit-Tests. The concept behind that tests is to test the flow itself. A description is provided here: http://static.springframework.org/spring-webflow/docs/2.0.x/reference/htmlsingle/spring-webflow-reference.html#testing
Additionally we have one chapter (chapter 5) in our book which is dedicated to testing a Spring Web Flow application.
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Thanks Markus.
Could you please to be more specific about how to run the tests?
Like in TestNG, there are 3 methods: run from Ant script, run from Eclipse (with TestNG plug-in), and run from command line.
Markus Staeuble
Author
Greenhorn

Joined: Apr 12, 2009
Posts: 16
The tests are JUnit (http://junit.org) - Tests. Therefore you can run it from Apache ANT (http://ant.apache.org), Maven (http://maven.apache.org). Additionally you can run it from the IDE of your choice, for example from eclipse. The commandline is possible, too.
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Thanks, got it.
Sven Lüppken
Author
Greenhorn

Joined: Apr 08, 2009
Posts: 6
In my opinion the chapter about testing your flows is fairly extensive...I hope you'll like it as much as I do! It explains how to test your flows, subflows, persistence contexts and also gives a short introduction to EasyMock, which helps you to create mock implementations of your interfaces.

Thanks,
Sven

Author of the book Spring Web Flow 2 Web Development. Available at http://www.packtpub.com/develop-powerful-web-applications-with-spring-web-flow-2/book
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Kengkaj Sathianpantarit wrote:Thanks. To test flows, does it need to deploy application to Servlet container? Or we can test outside the container?


do we have any testing framework support testing after deploy the application on the servlet container?


Mourougan
Open Source leads to Open Mind
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Mourouganandame Arunachalam wrote:
Kengkaj Sathianpantarit wrote:Thanks. To test flows, does it need to deploy application to Servlet container? Or we can test outside the container?


do we have any testing framework support testing after deploy the application on the servlet container?

Yes. After deploy to servlet container, we can open a JSP page to run tests (logic to run test is in the JSP).
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Kengkaj Sathianpantarit wrote:Yes. After deploy to servlet container, we can open a JSP page to run tests (logic to run test is in the JSP).


Is there any testing framework enforces this type of testing....? just curious ...
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Mourouganandame Arunachalam wrote:
Kengkaj Sathianpantarit wrote:Yes. After deploy to servlet container, we can open a JSP page to run tests (logic to run test is in the JSP).


Is there any testing framework enforces this type of testing....? just curious ...

I think every testing framework support running tests from command line. If we can run tests from command line, we can run from Java codes as well.
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Kengkaj Sathianpantarit wrote:
Mourouganandame Arunachalam wrote:
Kengkaj Sathianpantarit wrote:Yes. After deploy to servlet container, we can open a JSP page to run tests (logic to run test is in the JSP).


Is there any testing framework enforces this type of testing....? just curious ...

I think every testing framework support running tests from command line. If we can run tests from command line, we can run from Java codes as well.



I know testing frameworks provides way to test your java class either from command line or using some IDE.

However, I never heard of testing frameworks forces to test after deploying the code into servlet container. Am I missing something?
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Mourouganandame Arunachalam wrote:
However, I never heard of testing frameworks forces to test after deploying the code into servlet container. Am I missing something?

Start Servlet container just means make the dependencies available to use.
There are two approaches when testing Java EE, in-container test and out-of-container test.

In case of out-of-container test, we have to simulate the container to make the dependencies available.
I was curious that if Spring Web Flow Test is a custom testing framework that offers simulated container, that was the reason why I asked, and after that I realized that they are JUnit tests (not a custom testing framework of Spring Web Flow).
 
GeeCON Prague 2014
 
subject: [Spring Web Flow 2] Spring Web Flow 2 comes with direct support of Tests