Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/Testing/StrawManProposal"
< EclipseLink | Development | Testing
(→[http://en.wikipedia.org/wiki/Hollywood_Principle The Hollywood Principle]) |
(→[http://en.wikipedia.org/wiki/Hollywood_Principle The Hollywood Principle]) |
||
Line 13: | Line 13: | ||
The existing tests have code that is strongly coupled between setting up resources and the testing code. The NTF instead '''injects''' the resource into a tagged variable. Setting up the context for the resource is done in a separate class with its own requirements for composition/aggregation/inheritance. | The existing tests have code that is strongly coupled between setting up resources and the testing code. The NTF instead '''injects''' the resource into a tagged variable. Setting up the context for the resource is done in a separate class with its own requirements for composition/aggregation/inheritance. | ||
− | |||
− | |||
− | // javase imports | + | // javase imports |
− | import java.util.Properties; | + | import java.util.Properties; |
− | + | ||
− | // JUnit imports | + | // JUnit imports |
− | import org.junit.Before; | + | import org.junit.Before; |
− | import org.junit.BeforeClass; | + | import org.junit.BeforeClass; |
− | import org.junit.Ignore; | + | import org.junit.Ignore; |
− | import org.junit.Test; | + | import org.junit.Test; |
− | import org.junit.runner.RunWith; | + | import org.junit.runner.RunWith; |
− | import static org.junit.Assert.assertFalse; | + | import static org.junit.Assert.assertFalse; |
− | import static org.junit.Assert.assertNotNull; | + | import static org.junit.Assert.assertNotNull; |
− | import static org.junit.Assert.assertTrue; | + | import static org.junit.Assert.assertTrue; |
− | + | ||
− | // ntf imports | + | // ntf imports |
− | import org.eclipse.persistence.ntf.TestContext; | + | import org.eclipse.persistence.ntf.TestContext; |
− | import org.eclipse.persistence.ntf.TestContextRunner; | + | import org.eclipse.persistence.ntf.TestContextRunner; |
− | import org.eclipse.persistence.ntf.TestProperties; | + | import org.eclipse.persistence.ntf.TestProperties; |
− | import org.eclipse.persistence.ntf.Context; | + | import org.eclipse.persistence.ntf.Context; |
− | import static org.eclipse.persistence.ntf.IgnoreAssertion.ignore; | + | import static org.eclipse.persistence.ntf.IgnoreAssertion.ignore; |
− | + | ||
− | @RunWith(TestContextRunner.class) | + | @RunWith(TestContextRunner.class) |
− | public class ASetOfSimpleTests { | + | public class ASetOfSimpleTests { |
− | + | ||
− | + | @TestProperties public static Properties properties; | |
− | + | @TestContext(tag="context") public static Context<Object> context; | |
− | + | ||
− | + |
Revision as of 13:42, 22 November 2007
From the EclipseLink DevMeeting 071017, create a straw-man proposal for a new consolidated testing framework
New Testing Framework
- based on JUnit4 - Why?
- JUnit3 is at end-of-life
- Eclipse IDE has built-in support for JUnit4 tests
- while various testing frameworks have been extended, JUnit4 is extensible by design
Looked at requirements from MOXy/SDO, JPA, this is what we've got so far ...
The Hollywood Principle
Don't call us, we'll call you
The existing tests have code that is strongly coupled between setting up resources and the testing code. The NTF instead injects the resource into a tagged variable. Setting up the context for the resource is done in a separate class with its own requirements for composition/aggregation/inheritance.
// javase imports import java.util.Properties; // JUnit imports import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; // ntf imports import org.eclipse.persistence.ntf.TestContext; import org.eclipse.persistence.ntf.TestContextRunner; import org.eclipse.persistence.ntf.TestProperties; import org.eclipse.persistence.ntf.Context; import static org.eclipse.persistence.ntf.IgnoreAssertion.ignore; @RunWith(TestContextRunner.class) public class ASetOfSimpleTests { @TestProperties public static Properties properties; @TestContext(tag="context") public static Context<Object> context;