I'm starting a new project and my choice is Weld.
Currently I know it is CR1 and I think is stable enough to use it seriously(Right?).
The CR1 is appropriate for use in development. Of course, there are a few bugs, some of which we already know about. In a few weeks will will deliver a release that is suitable for use in production.
Since there is no updated documentation(yet) I was checking the examples from the distribution. They are nice but I did not see any test... now my question.
Hrm, we have a test harness for the TCK, but that may be a bit over-engineered for general development testing. I guess this is something I need to chat with Pete about.
Great, this is something cool.
I am very interested in this as well. If you need any help, such as an alpha/beta tester, please let me know.
IMO we need to over a number of testing options ranging from simple scaffolding (e.g. a quick unit test for prototyping) through to full integration testing.
Aslak is currently working on building out the testing framework we want to use for Seam 3. What we are planning is a framework which allows you to write a test once, and run in multiple places (e.g. standalone Weld container, in Embedded JBoss, in full JBoss AS, in GlassFish, in Tomcat, in Jetty, in a SeamTest esque mock-JSF environment etc.), using either TestNG or JUnit, from either the command line or your IDE. This is being built on the same foundations as the new Embedded JBoss, so should work great in combo :-)
Of course, you will be able to specify that test is only for integration testing etc. You'll also be able to easily configure what deployment descriptors (beans.xml etc.) to put into the deployment, and eventually configure the deployment descriptor from the test using a fluent API.
I hope we will have an alpha of this by mid-November.
Pete mentioned a sophisticated test framework for Weld.
Are there examples of less sophisticated tests that we can use for testing basic dependency injection and code functionality?
At the very least, do any examples show how to instantiate the container via TestNG or JUnit?
For example, if we wanted to modify the numberguess org.jboss.weld.examples.numberguess.Generator class, and change the line:
// private int maxNumber = 100; private int maxNumber = 100000;
and then write a test to confirm that it now is producing random numbers from above 100, how would we do so? Would that require a full, sophisticated suite?
No. For now you can use then TestContainer class from org.jboss.weld:weld-core-tests and do
TestContainer container = new TestContainer(new MockServletLifecycle(), Generator.class); container.startContainer().ensureRequestActive(); // Test container.stopContainer();