You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "W.Mazur (JIRA)" <ji...@apache.org> on 2012/08/16 11:02:37 UTC

[jira] [Created] (WICKET-4712) WicketTester: application cannot be reused with new tester

W.Mazur created WICKET-4712:
-------------------------------

             Summary: WicketTester: application cannot be reused with new tester
                 Key: WICKET-4712
                 URL: https://issues.apache.org/jira/browse/WICKET-4712
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.6
         Environment: N/A
            Reporter: W.Mazur
            Priority: Trivial


Rationale: it takes some time to start my application, so I want to create one instance of application and reuse it in various tests. It's not possible - At this moment I have to create new app instance for each wicket tester. 

Reproduction:
Get Quick start, create app (private static WicketApplication app = new WicketApplication();), change SetUp() Method to: tester = new WicketTester(app); Second test will fail with Illegal State Exception: "Application name can only be set once."

Root Cause: 
BaseWicketTester, constructor, line 293: application.setName("WicketTesterApplication-" + UUID.randomUUID());

Proposed fix:
if(application.getName() == null)
 application.setName("WicketTesterApplication-" + UUID.randomUUID());




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4712) WicketTester: application cannot be reused with new tester

Posted by "W.Mazur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436597#comment-13436597 ] 

W.Mazur commented on WICKET-4712:
---------------------------------

You are right and you are not...
Caching WicketTester solvs the problem if there is easy way to reset it's state. I haven't found any good description of Wicket tester, so I will have to find out myself - by trials and errors. Moreover, whenever my test fail i will have to analyze - whether it's my fault or it's leftover from previous test...actually I should do the same thing if test passes :-)

Another thing that worries me - the test I have written so far, it was just a warm-up - I was going to create suite of multi user scenarios (like one tester/thread gets objects and edits it, second thread deletes the same objects, or two threads edit the same object). I have no idea if WicketTester is thread safe or not...
                
> WicketTester: application cannot be reused with new tester
> ----------------------------------------------------------
>
>                 Key: WICKET-4712
>                 URL: https://issues.apache.org/jira/browse/WICKET-4712
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.6
>         Environment: N/A
>            Reporter: W.Mazur
>            Priority: Trivial
>              Labels: test
>         Attachments: myproject.zip
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Rationale: it takes some time to start my application, so I want to create one instance of application and reuse it in various tests. It's not possible - At this moment I have to create new app instance for each wicket tester. 
> Reproduction:
> Get Quick start, create app (private static WicketApplication app = new WicketApplication();), change SetUp() Method to: tester = new WicketTester(app); Second test will fail with Illegal State Exception: "Application name can only be set once."
> Root Cause: 
> BaseWicketTester, constructor, line 293: application.setName("WicketTesterApplication-" + UUID.randomUUID());
> Proposed fix:
> if(application.getName() == null)
>  application.setName("WicketTesterApplication-" + UUID.randomUUID());

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4712) WicketTester: application cannot be reused with new tester

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4712.
-------------------------------------

    Resolution: Won't Fix

WicketTester is a wrapper around the WebApplication. It gives you helper methods to make requests and to assert states (e.g. validate responses).
                
> WicketTester: application cannot be reused with new tester
> ----------------------------------------------------------
>
>                 Key: WICKET-4712
>                 URL: https://issues.apache.org/jira/browse/WICKET-4712
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.6
>         Environment: N/A
>            Reporter: W.Mazur
>            Priority: Trivial
>              Labels: test
>         Attachments: myproject.zip
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Rationale: it takes some time to start my application, so I want to create one instance of application and reuse it in various tests. It's not possible - At this moment I have to create new app instance for each wicket tester. 
> Reproduction:
> Get Quick start, create app (private static WicketApplication app = new WicketApplication();), change SetUp() Method to: tester = new WicketTester(app); Second test will fail with Illegal State Exception: "Application name can only be set once."
> Root Cause: 
> BaseWicketTester, constructor, line 293: application.setName("WicketTesterApplication-" + UUID.randomUUID());
> Proposed fix:
> if(application.getName() == null)
>  application.setName("WicketTesterApplication-" + UUID.randomUUID());

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4712) WicketTester: application cannot be reused with new tester

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436575#comment-13436575 ] 

Martin Grigorov commented on WICKET-4712:
-----------------------------------------

Why don't you cache the WicketTester instance instead ?
                
> WicketTester: application cannot be reused with new tester
> ----------------------------------------------------------
>
>                 Key: WICKET-4712
>                 URL: https://issues.apache.org/jira/browse/WICKET-4712
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.6
>         Environment: N/A
>            Reporter: W.Mazur
>            Priority: Trivial
>              Labels: test
>         Attachments: myproject.zip
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Rationale: it takes some time to start my application, so I want to create one instance of application and reuse it in various tests. It's not possible - At this moment I have to create new app instance for each wicket tester. 
> Reproduction:
> Get Quick start, create app (private static WicketApplication app = new WicketApplication();), change SetUp() Method to: tester = new WicketTester(app); Second test will fail with Illegal State Exception: "Application name can only be set once."
> Root Cause: 
> BaseWicketTester, constructor, line 293: application.setName("WicketTesterApplication-" + UUID.randomUUID());
> Proposed fix:
> if(application.getName() == null)
>  application.setName("WicketTesterApplication-" + UUID.randomUUID());

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4712) WicketTester: application cannot be reused with new tester

Posted by "W.Mazur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13435854#comment-13435854 ] 

W.Mazur commented on WICKET-4712:
---------------------------------

BTW. Comment @BaseWicketTester, above setName() puzzles me:

		// FIXME some tests are leaking applications by not calling destroy on them or overriding
		// teardown() without calling super, for now we work around by making each name unique

There is no destroy() nor teardown() method in Application class...
                
> WicketTester: application cannot be reused with new tester
> ----------------------------------------------------------
>
>                 Key: WICKET-4712
>                 URL: https://issues.apache.org/jira/browse/WICKET-4712
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.6
>         Environment: N/A
>            Reporter: W.Mazur
>            Priority: Trivial
>              Labels: test
>         Attachments: myproject.zip
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Rationale: it takes some time to start my application, so I want to create one instance of application and reuse it in various tests. It's not possible - At this moment I have to create new app instance for each wicket tester. 
> Reproduction:
> Get Quick start, create app (private static WicketApplication app = new WicketApplication();), change SetUp() Method to: tester = new WicketTester(app); Second test will fail with Illegal State Exception: "Application name can only be set once."
> Root Cause: 
> BaseWicketTester, constructor, line 293: application.setName("WicketTesterApplication-" + UUID.randomUUID());
> Proposed fix:
> if(application.getName() == null)
>  application.setName("WicketTesterApplication-" + UUID.randomUUID());

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4712) WicketTester: application cannot be reused with new tester

Posted by "W.Mazur (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

W.Mazur updated WICKET-4712:
----------------------------

    Attachment: myproject.zip

Quick Start Attached - run TestHomePage as JUnit
                
> WicketTester: application cannot be reused with new tester
> ----------------------------------------------------------
>
>                 Key: WICKET-4712
>                 URL: https://issues.apache.org/jira/browse/WICKET-4712
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.6
>         Environment: N/A
>            Reporter: W.Mazur
>            Priority: Trivial
>              Labels: test
>         Attachments: myproject.zip
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Rationale: it takes some time to start my application, so I want to create one instance of application and reuse it in various tests. It's not possible - At this moment I have to create new app instance for each wicket tester. 
> Reproduction:
> Get Quick start, create app (private static WicketApplication app = new WicketApplication();), change SetUp() Method to: tester = new WicketTester(app); Second test will fail with Illegal State Exception: "Application name can only be set once."
> Root Cause: 
> BaseWicketTester, constructor, line 293: application.setName("WicketTesterApplication-" + UUID.randomUUID());
> Proposed fix:
> if(application.getName() == null)
>  application.setName("WicketTesterApplication-" + UUID.randomUUID());

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira