More on JWebUnit Step 56
There are many other commands you can do with JWebUnit. In our UserBook application you should add ids to the menu tree. You need to have ids properly set so JWebUnit can select on them. if you add an id on the link href="UserAction.do?action=addUser" id='test' in your header file, then you can run a test against it. After adding the id, add this test to your JWebUnit class.
tester.clickLink("test");
Now your tests will run against the add User jsp page.
You can input text into the form and submit the form like this:
tester.setTextField("newUser.firstName","Bob");
tester.setTextField("newUser.lastName","Jones");
tester.submit();
Bob Jones has now been added to the database from your test.
Go To Step 57

0 comments:
Post a Comment