2 Replies Latest reply on May 12, 2008 6:54 PM by Pete Muir

    Accessing response in SeamTest

    Nicklas Karlsson Master

      Hi,

        I'm working on unit testing of the candidate for Seam Excel support and I'm wondering if there is any way of accessing the HTTP response of the test?


      It would help if I could write a bunch of .xhtml-pages and the run them and plug the underlying Excel library to work on the binary response to examine if the correct result has been produced.


      Thanks in advance

        • 1. Re: Accessing response in SeamTest
          Nicklas Karlsson Master

          I tried something along the lines of


          @Test
          public class ExcelTest extends SeamTest
          {
             public void testAddCell() throws Exception {
                new FacesRequest() {
                   @Override
                   protected void invokeApplication() throws Exception
                   {
                      Renderer.instance().render("/addcell.xhtml");
                      // Get the component, fetch data etc.
                   }
                }.run();
             }
          
          }
          



          but run into a NPE on the Renderer instance being null. Pardon my n00bishness on the finer (any) details of Seam testing but what do you need to set up / mock yourself before you could access the renderer and components like that?

          • 2. Re: Accessing response in SeamTest
            Pete Muir Master

            You could take a look at what I did to allow you to test Seam Mail - getRenderedMailMessage().