But it would be _very_ easy to introduce such a mechanism to Arquillian. And the Containers then just implement that interface. We did the same already for DeltaSpike CdiCtrl.
LieGrue, strub ----- Original Message ----- > From: Aslak Knutsen <[email protected]> > To: Mark Struberg <[email protected]> > Cc: "[email protected]" > <[email protected]> > Sent: Thursday, July 12, 2012 11:56 AM > Subject: Re: [1/3] git commit: Fix BeanProviderTest so order doesn't matter > > Arquillian JUnit supports the annotation @InSequence(n), which will > sort the Test methods and give a deterministic execution order. > > The CDI contexts are a bit up in the air at the moment. In a full > container, you should have a new Request and Session context pr @Test > execution based on how the Servlet Protocol impl works. While for the > standalone/embedded containers it depends on how they are implemented. > > The original intent was to add some Arquillian CDI SPI for manually / > consistently setting/creating the scopes, as scope activation etc is > not part of a public view of the CDI spec. This work has so far not > moved to much forward as CDI 1.1 will provide spec APIs for Scope > Control (to my knowledge). > > -aslak- > > On Thu, Jul 12, 2012 at 10:57 AM, Mark Struberg <[email protected]> wrote: >> Yikes, good catch. >> >> But the origin of this is really dangerous. >> >> >> It seems that Arquillian doesn't clean the contexts between @Test > method invocations. >> >> So any @Inject will always have the state of whatever test runs first. This > will be a _huge_ problem once we go test JPA and JTA stuff. >> Aslak, is there anything we can do against this? >> I remember we talked about manual context control for arquillian tests > already (for simulating multi-request use cases by simply stopping and > restarting the request context). >> >> >> LieGrue, >> strub >> >> >> >> ----- Original Message ----- >>> From: "[email protected]" > <[email protected]> >>> To: [email protected] >>> Cc: >>> Sent: Thursday, July 12, 2012 9:28 AM >>> Subject: [1/3] git commit: Fix BeanProviderTest so order doesn't > matter >>> >>> Updated Branches: >>> refs/heads/master d5b0327e0 -> b1623a764 >>> >>> >>> Fix BeanProviderTest so order doesn't matter >>> >>> Was seeing an issue (seems to be jvm dependent due to test ordering) >>> where the test would fail because we didn't reset the bean's > properties >>> when we were done with the test. >>> >>> >>> Project: > http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo >>> Commit: >>> > http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/c021b63a >>> Tree: > http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/c021b63a >>> Diff: > http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/c021b63a >>> >>> Branch: refs/heads/master >>> Commit: c021b63ae3474ace10afb48ba1d1011030231d47 >>> Parents: d5b0327 >>> Author: Jason Porter <[email protected]> >>> Authored: Wed Jul 11 09:22:42 2012 -0600 >>> Committer: Jason Porter <[email protected]> >>> Committed: Thu Jul 12 01:27:46 2012 -0600 >>> >>> ---------------------------------------------------------------------- >>> .../test/core/api/provider/BeanProviderTest.java | 2 ++ >>> 1 files changed, 2 insertions(+), 0 deletions(-) >>> ---------------------------------------------------------------------- >>> >>> >>> > http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/c021b63a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java >>> ---------------------------------------------------------------------- >>> diff --git >>> > a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java >>> > b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java >>> index 6348473..4a7ab2b 100644 >>> --- >>> > a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java >>> +++ >>> > b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java >>> @@ -191,5 +191,7 @@ public class BeanProviderTest >>> TestBean testBean = >>> BeanProvider.getContextualReference(TestBean.class); >>> >>> Assert.assertEquals(newValue, testBean.getI()); >>> + >>> + testBean.setI(4711); // reset the value if this test is > executed first >>> } >>> } >>> >
