5 Replies Latest reply on Nov 17, 2010 10:43 AM by ssilvert

    JSFUnit, Arquillian, TestNG, Glassfish random NPE in JSFServerSession

    pizzapill

      Hello,

       

      i attached a test-project, this fails on "maven test" an average of 4 tests. It contains one class with 11 Test of whom 2*5 are roughly the same and one test always fails! If you change the order of the test methods other methods fail. The reason for the failures is always that the JSFServerSession isn't properly initialized, both private properties (ClientIDs, currentFacesContext) of it beeing null.

      Anybody knows why this is so unreliable?

       

      My setup is a x64 Quadcore running Ubuntu 10.04 with 8 GB Ram. Maven version used is 2.2.1 and Maven 3.x-SNAPSHOT in cooperation with Eclipse 3.6. The Error is reproduceable on a Ubuntu 32 bit.

        • 1. Re: JSFUnit, Arquillian, TestNG, Glassfish random NPE in JSFServerSession
          ssilvert

          I think this is probably a problem with the way Arquillian is handling TestNG.  I haven't tried TestNG yet, but I know that with JUnit 4 you will get a new instance of your test class and a new HttpSession each time a new test is called.  If you were running under JUnit 4 then that would cause your instance variables to be fully reset each time.

           

          If you can play around with this and let me know then I'd be grateful.  I need to create some TestNG JSFUnit tests for JSFUnit 2.0 and it would be helpful to know as much as possible before I start that work.

           

          Stan

          • 2. Re: JSFUnit, Arquillian, TestNG, Glassfish random NPE in JSFServerSession
            pizzapill

            Oh I see your blog about the 1.3.0.Final suggested that TestNG would be supportet! I'd love to play around with it some more and I will report back to you if I do find something useful!

            • 3. Re: JSFUnit, Arquillian, TestNG, Glassfish random NPE in JSFServerSession
              ssilvert

              Moritz Winter wrote:

               

              Oh I see your blog about the 1.3.0.Final suggested that TestNG would be supportet! I'd love to play around with it some more and I will report back to you if I do find something useful!

              Sorry.  I didn't mean to mislead anyone.  TestNG does work but "supported" is an overloaded term and maybe too strong a word to use until JSFUnit 2.0.  Plus, Arquillian itself hasn't declared a GA or Final level of "support" yet.

               

              Stan

              • 4. Re: JSFUnit, Arquillian, TestNG, Glassfish random NPE in JSFServerSession
                pizzapill

                Its suprising enough that it mostly works then, right? I'll do my best to provide you with good starting information as soon as I can because I'd love to use JSFUnit with TestNG. Is there something you specifically need to know? Would some JSFUnit 1.3.0.Final Unittests against TestNG help you somehow?

                • 5. Re: JSFUnit, Arquillian, TestNG, Glassfish random NPE in JSFServerSession
                  ssilvert

                  I don't find it surprising at all.  But you might be the first to use the Arquillian/JSFUnit/TestNG combo.  I'm not sure if the Arquillian guys tested it or not.  I just know that we have both used it with JUnit 4 and there are no known bugs.

                   

                  I'm also not sure if your test exposes an Arquillian/JSFUnit/TestNG bug.  I know JUnit requies a new instance of your test class every time it calls a new test method and Arquillian follows this requirement with JUnit.  I don't know if TestNG requires that or not.  If not then Arquillian is working correctly and you would need to change your test class accordingly.  So if you can find the answer to that question it would be very helpful.  If it is a bug with Arquillian then we need to report it.

                   

                  TestNG unit tests would be very helpful!!  If you would like to become a JSFUnit comitter and work on this then let me know.  I think at the very least we need TestNG versions of the tests I've already written with JUnit 4.

                   

                  Also, later today I'm going to write some documentation on using the new CDI/JSFUnit annotations that make it easier to create and manage the JSFSession.  It would be great if you can let me know how this works with TestNG.  It's even possible that it fixes (or at least works around) your problem.

                   

                  Stan