0 Replies Latest reply on Jan 16, 2011 12:19 PM by Bernhard Hurzeler

    How do I test StatusMessages

    Bernhard Hurzeler Novice

      Can someone show me how to test StatusMessages please?


      I have a TestNG test that should check for the existence of a newly written StatusMessage


           // Sample Test
               @Test
           public void testMessage() throws Exception {
                new FacesRequest(){
      
                     @Override
                     protected void invokeApplication() {
                          assert invokeMethod("#{identity.login}").equals("loggedIn");               }
      
                     protected void renderResponse() {
                          assert ((String) getValue("#{statusMessages.currentGlobalMessages}")).startsWith("Welcome");
                     }
      
                }.run();
           }
      


      Unforunately statusMessages is empty in renderRespons but has tasks (i.e. Welcome ...) after the invokeMethod.


      If you could show me how to test statusMessages that would be great. Thanks in advance!