You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by Andrew Jaquith <an...@mac.com> on 2007/12/10 00:44:21 UTC

Web unit tests: 1 out of 5 scenarios looking good!

All --

Dirk's efforts to get Selenium and Mootools to work nicely  
notwithstanding (thanks, by the way!) -- I have written up the current  
web unit tests as a set of instructions. I have enclosed it for your  
reference. These are exactly what our (currently failing) .web package  
is supposed to test.

The Ant web unit test script loads up five test webapps:

/test-custom
/test-container
/test-custom-absolute
/test-custom-jdbc
/test-container-jdbc

I've manually tested the complete set of tests against the /test- 
custom webapp. That gives me fairly high confidence that things are  
working nicely in the default scenario (relative URLs, custom auth,  
file-based user and group storage).

Anybody want to take the other webapps?

Andrew

-------

Web unit tests
--------------
Each of these tests needs to be tested for five scenarios (webapps):

/test-custom
/test-container
/test-custom-absolute
/test-custom-jdbc
/test-container-jdbc


I. Test Anonymous View & Anonymous View Image
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Verify the presence of text "You have successfully installed" and  
"This wiki is done using"
2. Verify that you can see the JSPWiki logo in the upper left corner.


II. Test Login
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Go to front page.
2. Log in with test user name and password (janne/myP@5sw0rd); verify  
redirect to front page.
3. Verify "G'Day JanneJalkanen" on front page.


III. Test Logout
0. Keep session from previous test alive...
1. Log out; verify redirect to front page.
2. Verify "G'Day anonymous guest" on front page
3. Verify that the cookie "JSPWikiAssertedName" is cleared in the  
browser.


IV. Test Asserted Name
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Go to the Main page. Verify the 'G'day anonymous guest' message.
2. Navivate to the 'My Prefs' page.
3. Set the asserted-name cookies to "Don Quixote"
4. Verify redirect to the Main page; verify the message "G'Day Don  
Quixote" (not logged in)"
5. Verify that the browser's cookie JSPWikiAssertedName is "Don+Quixote"
6. Go back to the "My Prefs" page and clear the asserted-name cookie.
7. Verify redirect to the Main page; verify the message "G'Day  
anonymous guest"
8. Verify that the cookie JSPWikiAssertedName is cleared.


V. Test ACL: Asserted Permissions
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Log in with test user name and password (janne/myP@5sw0rd).
2. Create a new group called "AssertedPermissions" with these menbers:

JanneJalkanen
Fred Flintstone

3. After creation go to "/Group.jsp?group=AssertedPermissions"; verify  
that the group was created and that it contains janne and Fred  
Flintstone.
4. Clear all session/assertion cookies using the browser options/ 
preferences tools.
5. Go to "/Group.jsp?group=AssertedPermissions"; verify that the  
anonymous user can't view the group.
6. Log in with test user name and password (janne/myP@5sw0rd).
7. Go to "/Group.jsp?group=AssertedPermissions"; verify that janne can  
still view the group.
8. Clear all session/assertion cookies using the browser options/ 
preferences tools.
9. Set the asserted-name cookie to "Fred Flintstone"
A. Go to "/Group.jsp?group=AssertedPermissions"; verify that Fred  
Flintstone can view the group.
B. Go to "/EditGroup.jsp?group=AssertedPermissions"; verify that Fred  
Flintstone cannot edit; should be redirected to login page.


VI. Test ACL: Authenticated
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Log in with test user name and password (janne/myP@5sw0rd).
2. Create new page "ACLAuthenticated" with these contents:

[{ALLOW view Authenticated}]
We created this page to test redirects.

3. Clear all session/assertion cookies using the browser options/ 
preferences tools.
4. Go to "/Wiki.jsp?page=ACLAuthenticated"; verify that anonymous  
can't view.
5. Log in with test user name and password (janne/myP@5sw0rd).
6. Verify that janne can see the page's text.


VII. Test ACL: Janne Edit
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Log in as 'janne'
2. Create new page via /Edit.jsp?page=AclEditOnly
3. Add this text:

[{ALLOW edit janne}]
This page was created with an ACL by janne

4. Click 'ok'
5. Log out & clear cookies.
6. Try to view page 'AclEditOnly'. It should NOT succeed; will be  
redirected to the login page.
7. Try to edit page 'AclEditOnly'. It should NOT succeed; will be  
redirected to the login page.
8. Login as 'janne' again.
9. Try to view page 'AclEditOnly'. It should succeed.
10. Try to edit page 'AclEditOnly'. It should succeed also.


VIII. Test Acl: Janne Edit, All View
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Log in with test user name and password (janne/myP@5sw0rd).
2. Create new page via /Edit.jsp?page=AclViewAndEdit
3. Add this text:

[{ALLOW edit janne}]
[{ALLOW view All}]
This page was created with an ACL by janne

4. Click 'ok'
5. Log out & clear cookies.
6. Try to view page 'AclViewAndEdit'. It should succeed.
7. Try to edit page 'AclViewAndEdit'. It should NOT succeed; will be  
redirected to the login page.
8. Login as 'janne' again.
9. Try to view page 'AclEditOnly'. It should succeed.
10. Try to view page 'AclEditOnly'. It should succeed also.


IX. Test Anonymous Create Group
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Try to create a new group by navigating to "/NewGroup.jsp"
2. Verify redirect to login page.


X. Test Create Group: Full Name
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Log in with test user name and password (janne/myP@5sw0rd).
2. Create a new group called FullName with this member:

Janne Jalkanen

3. Go to "/Group.jsp?group=FullName"; verify that Janne Jalkanen is a  
member.
4. Clear all session/assertion cookies using the browser options/ 
preferences tools.
5. Go to "/Group.jsp?group=FullName"; verify that anonymous can't  
view; should be redirected to login page.
6. Go to "/EditGroup.jsp?group=FullName"; verify that anonymous can't  
view; should be redirected to login page.
7. Log in with test user name and password (janne/myP@5sw0rd).
8. Go to "/Group.jsp?group=FullName"; verify that janne can still view  
the group.
9. Go to "/EditGroup.jsp?group=FullName"; verify that janne can still  
edit the group.


XI. Test Create Group: Login Name
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Log in with test user name and password (janne/myP@5sw0rd).
2. Create a new group called LoginName with this member:

janne

3. Go to "/Group.jsp?group=LoginName"; verify that janne is a member.
4. Clear all session/assertion cookies using the browser options/ 
preferences tools.
5. Go to "/Group.jsp?group=LoginName"; verify that anonymous can't  
view; should be redirected to login page.
6. Go to "/EditGroup.jsp?group=LoginName"; verify that anonymous can't  
view; should be redirected to login page.
7. Log in with test user name and password (janne/myP@5sw0rd).
8. Go to "/Group.jsp?group=LoginName"; verify that janne can still  
view the group.
9. Go to "/EditGroup.jsp?group=LoginName"; verify that janne can still  
edit the group.


XII. Test Create Group: Wiki Name
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Log in with test user name and password (janne/myP@5sw0rd).
2. Create a new group called WikiName with this member:

JanneJalkanen

3. Go to "/Group.jsp?group=WikiName"; verify that JanneJalkanen is a  
member.
4. Clear all session/assertion cookies using the browser options/ 
preferences tools.
5. Go to "/Group.jsp?group=WikiName"; verify that anonymous can't  
view; should be redirected to login page.
6. Go to "/EditGroup.jsp?group=WikiName"; verify that anonymous can't  
view; should be redirected to login page.
7. Log in with test user name and password (janne/myP@5sw0rd).
8. Go to "/Group.jsp?group=WikiName"; verify that janne can still view  
the group.
9. Go to "/EditGroup.jsp?group=WikiName"; verify that janne can still  
edit the group.


XIII. Test Rename Profile
0. Clear all session/assertion cookies using the browser options/ 
preferences tools.
1. Create new user profile with login name "TestRenameProfileUser",  
name "TestRenameProfileUser" and password "password".
2. Verify that it was created by looking for the text "G'Day  
TestRenameProfileUser".
3. Clear all session/assertion cookies using the browser options/ 
preferences tools.
4. Log in with test user name and password (janne/myP@5sw0rd).
5. Create a new page called "TestRenameProfilePage" with these contents:

[{ALLOW edit TestRenameProfileUser}]
This page was created with an ACL by TestRenameProfileUser

6. Clear all session/assertion cookies using the browser options/ 
preferences tools.
7. Log in with renamed user name (TestRenameProfileUser/password).
8. Try to view page 'TestRenameProfilePage'. It should succeed.
9. Try to edit page 'TestRenameProfilePage'. It should succeed also.
A. Go to the My Prefs page, the Profile tab. Change the login name and  
wiki name to "RenamedUser".
B. Verify that the front page now shows "G'Day RenamedUser".
C. Try to edit page 'TestRenameProfilePage'. It should still succeed.  
Verify that the ACL contains:

[{ALLOW edit RenamedUser}]
This page was created with an ACL by TestRenameProfileUser


Re: Web unit tests: 1 out of 5 scenarios looking good!

Posted by Dirk Frederickx <di...@gmail.com>.
Andrew,


The patches for mootools are indeed very small.

Tx for the help on automating these test through ant !


dirk

On Dec 11, 2007 3:48 AM, Andrew Jaquith <an...@mac.com> wrote:
> Dirk, I took a look at what you did with Selenium. Looks like you
> patched two of the Selenium-Core files in very minor ways: scripts/
> selenium-browserbot.js and scripts/core/scripts/htmlutils.js.
>
> As it happens, there's a jar version of the Selenium server that
> includes the Selenium core that you uploaded into the JSPWiki tree.
> I've patched that JAR file in my own builds, and will check it in
> soon. What that means is that we won't need to keep the whole Selenium
> core directory in the JSPWiki tree (we don't want to anyway) -- just
> the jar file. In the next batch of checkins from me, I'll remove the
> selenium directory structure and replace it with the selenium-server
> jar, in the lib directory. I'll also add the Ant script mods to launch
> and run the tests, and re-base the tests so that they run against the
> test webapps.
>
> In the meantime, if you've got additional HTML Selenium tests (tests/
> selenium-tests), just keep checking them in. :)
>
> Andrew
>
>
>
> On Dec 10, 2007, at 3:49 PM, Andrew Jaquith wrote:
>
> > Great! I've already written the Ant scripts to start/stop the
> > Selenium server. I'll take a look at your checkins, and if possible
> > check in the Ant scripts.
> >
> > Yeah, Selenium is a pretty cool package for generating web tests,
> > huh? I love the "record test" feature in the Firefox plugin...
> >
> > Andrew
> >
> > On Dec 10, 2007, at 3:40 PM, Dirk Frederickx wrote:
> >
> >> Andrew, e.a.,
> >>
> >> I just committed a first set of ported web unit tests  based on
> >> selenium, as well as the selenium core package, including the
> >> mootools
> >> patches.
> >> It's quite easy to run these tests manually from within your browser.
> >>
> >>
> >> I someone could help to have them run automatically from ant, that
> >> would be great. (you'll need to include the remove selenium server as
> >> well)
> >>
> >>
> >>
> >> dirk
> >
>
>

Re: Web unit tests: 1 out of 5 scenarios looking good!

Posted by Andrew Jaquith <an...@mac.com>.
Dirk, I took a look at what you did with Selenium. Looks like you  
patched two of the Selenium-Core files in very minor ways: scripts/ 
selenium-browserbot.js and scripts/core/scripts/htmlutils.js.

As it happens, there's a jar version of the Selenium server that  
includes the Selenium core that you uploaded into the JSPWiki tree.  
I've patched that JAR file in my own builds, and will check it in  
soon. What that means is that we won't need to keep the whole Selenium  
core directory in the JSPWiki tree (we don't want to anyway) -- just  
the jar file. In the next batch of checkins from me, I'll remove the  
selenium directory structure and replace it with the selenium-server  
jar, in the lib directory. I'll also add the Ant script mods to launch  
and run the tests, and re-base the tests so that they run against the  
test webapps.

In the meantime, if you've got additional HTML Selenium tests (tests/ 
selenium-tests), just keep checking them in. :)

Andrew


On Dec 10, 2007, at 3:49 PM, Andrew Jaquith wrote:

> Great! I've already written the Ant scripts to start/stop the  
> Selenium server. I'll take a look at your checkins, and if possible  
> check in the Ant scripts.
>
> Yeah, Selenium is a pretty cool package for generating web tests,  
> huh? I love the "record test" feature in the Firefox plugin...
>
> Andrew
>
> On Dec 10, 2007, at 3:40 PM, Dirk Frederickx wrote:
>
>> Andrew, e.a.,
>>
>> I just committed a first set of ported web unit tests  based on
>> selenium, as well as the selenium core package, including the  
>> mootools
>> patches.
>> It's quite easy to run these tests manually from within your browser.
>>
>>
>> I someone could help to have them run automatically from ant, that
>> would be great. (you'll need to include the remove selenium server as
>> well)
>>
>>
>>
>> dirk
>


Re: Web unit tests: 1 out of 5 scenarios looking good!

Posted by Andrew Jaquith <an...@mac.com>.
Great! I've already written the Ant scripts to start/stop the Selenium  
server. I'll take a look at your checkins, and if possible check in  
the Ant scripts.

Yeah, Selenium is a pretty cool package for generating web tests, huh?  
I love the "record test" feature in the Firefox plugin...

Andrew

On Dec 10, 2007, at 3:40 PM, Dirk Frederickx wrote:

> Andrew, e.a.,
>
> I just committed a first set of ported web unit tests  based on
> selenium, as well as the selenium core package, including the mootools
> patches.
> It's quite easy to run these tests manually from within your browser.
>
>
> I someone could help to have them run automatically from ant, that
> would be great. (you'll need to include the remove selenium server as
> well)
>
>
>
> dirk


Re: Web unit tests: 1 out of 5 scenarios looking good!

Posted by Dirk Frederickx <di...@gmail.com>.
These patches were already published on the mootools mailing list. So
all credits go to someone else ;-)
So all that info is publicly available.


dirk

On Dec 11, 2007 8:24 AM, Janne Jalkanen <Ja...@ecyrd.com> wrote:
>
> Just out of curiosity: did you contribute those patches back to
> mootools & selenium?  Or at least publish them somewhere - I think
> many people might like them!
>
> /Janne
>
>
> On 10 Dec 2007, at 22:40, Dirk Frederickx wrote:
>
> > Andrew, e.a.,
> >
> > I just committed a first set of ported web unit tests  based on
> > selenium, as well as the selenium core package, including the mootools
> > patches.
> > It's quite easy to run these tests manually from within your browser.
> >
> >
> > I someone could help to have them run automatically from ant, that
> > would be great. (you'll need to include the remove selenium server as
> > well)
> >
> >
> >
> > dirk
>
>

Re: Web unit tests: 1 out of 5 scenarios looking good!

Posted by Janne Jalkanen <Ja...@ecyrd.com>.
Just out of curiosity: did you contribute those patches back to  
mootools & selenium?  Or at least publish them somewhere - I think  
many people might like them!

/Janne

On 10 Dec 2007, at 22:40, Dirk Frederickx wrote:

> Andrew, e.a.,
>
> I just committed a first set of ported web unit tests  based on
> selenium, as well as the selenium core package, including the mootools
> patches.
> It's quite easy to run these tests manually from within your browser.
>
>
> I someone could help to have them run automatically from ant, that
> would be great. (you'll need to include the remove selenium server as
> well)
>
>
>
> dirk


Re: Web unit tests: 1 out of 5 scenarios looking good!

Posted by Dirk Frederickx <di...@gmail.com>.
Andrew, e.a.,

I just committed a first set of ported web unit tests  based on
selenium, as well as the selenium core package, including the mootools
patches.
It's quite easy to run these tests manually from within your browser.


I someone could help to have them run automatically from ant, that
would be great. (you'll need to include the remove selenium server as
well)



dirk