Hi Janandith,

Am Donnerstag, den 29.05.2008, 00:33 +0530 schrieb janandith
jayawardena:
> Hi all ,
> 
> I would like to write test cases (Automated tests) for the scala module as I
> code.
> 
> Can you guide me how to write automated tests.

The best thing to do is to have unit tests. You create the in the
src/test/java folder (paralells the src/main/java folder but for test
cases -- these will not be packaged into the final artifact).

If maven finds tests in src/test/java, these are automatically run when
building the project. By default the build fails if any of the tests
fails, which is a good thing IMHO.

Maven supports multiple test frameworks, within Sling we use JUnit. Any
test case your write is a class which extends from org.junit.TestCase.
Each public method prefixes with "test" -- e.g. testSomething -- is
automatically run by JUnit.

For more hints you might want to refer to existing unit tests, e.g. in
the jcr/resource bundle. These tests there also depend on the
commons/testing module, which contains some common helpers for creating
test cases.

> 
> And are these tests performed in maven while building or can I run them
> separately.

Yes, maven runs them automatically provided they are in the right place
-- src/test/java by default.

> 
> If some of the tests fail in maven build but the module gets built and loads
> in the launchpad  as a bundle  what will  be the effect  ?

Module The Maven build fails if any of the tests fail.

Regards
Felix

Reply via email to