[KULRICE-13693] Come up with an automated solution for link verification in the Rice portal Created: 26/Jun/09  Updated: 16/Jan/15

Status: Open
Project: Kuali Rice Development
Component/s: Quality Assurance
Affects Version/s: None
Fix Version/s: Backlog

Type: Task Priority: Major
Reporter: Peter Giles (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: Old
Remaining Estimate: 1 week
Time Spent: Not Specified
Original Estimate: 1 week

Rice Team: QA


As part of our functional testing, we will want to verify that all the links in the portal are valid – that they take us to other pages in the portal, and that those pages don't give us an exception incident form or some other clear indication of brokenness – and do so in an automated fashion. It would be a bonus to do HTML validation as we go.

What I'd like you to do is begin by assessing our options here. We can use a specific link checking tool, or we could write our own crawler & link checker using HtmlUnit/JWebUnit or Selenium.

I would like for whatever we choose to be practical to execute via JUnit tests, so that is one hard constraint.

One advantage of using Selenium is that it will get you familiar with that tool set which we're planning to use for more specific functional testing testing of our pages, but I want you to be free to choose something else if is compellingly better.

Once we've agreed on a tool, you can begin coding it up or setting it up as the case may be.

Comment by Eric Westfall [ 27/Jun/09 ]

It might be nice here to do this as part of our standard set of unit tests. We can add a unit test to the "web" module and everything there is already set up to run with an embedded jetty server as part of the test harness (see the other unit tests in that module for examples). They all currently use HtmlUnit to interact with the web application.

Comment by Peter Giles (Inactive) [ 14/Jul/09 ]

Srikanth, any progress here since our email exchange re: using HtmlUnit? Let me know if you need more guidance from me to make headway on this. Thanks!

Comment by Peter Giles (Inactive) [ 16/Jul/09 ]

Hi Srikanth,

I'm replying through JIRA and including your message below to keep things in one place. The idea is to add a new test case that will crawl the links in the rice portal and report broken links as a test failure. It should collect all the broken links and then fail so the failure output shows all broken links, not just the first one it finds. In order for the report to be helpful, it should probably show the url for the page that each broken link was found on as well. You may want to use BaseLineAppStartTest as a basis for your test, as it starts up the portal and does a trivial bit of HtmlUnit work.

WRT to your issue with running the test cases, aside from the obvious thing of checking to make sure the MySQL jdbc driver is in your classpath when the test is run, I'm not sure what to suggest. If you're running tests through maven, you can add a -X after your mvn command, e.g. 'mvn -X test' to get exhaustive logging of what is going on. It's a little overwhelming, but the output will include the full classpath used to run the tests.

Let me know if I can be of further assistance.


On Thu, 16 Jul 2009 12:56 +0530, "Mummadi, Srikanth" <Srikanth_Mummadi@Syntelinc.com> wrote:
> Peter,
> Please let me know the test cases which will use HtmlUnit and the process to develop the test cases.
> I am getting the following error when I am running the test cases.
> Caused by: java.lang.RuntimeException: java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection exception: java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection no connection available java.sql.SQLException: Cannot get connection for URL jdbc:mysql:// : No suitable driver
> Thanks & Regards
> M.Srikanth
> 9819782893

Comment by Srikanth Mummadi (Inactive) [ 20/Jul/09 ]

Created the new class by extending the BaseLineAppStartTest with the following method.

public void verifyLink() throws Exception {
HtmlPage htmlPage = HtmlUnitUtil.gotoPageAndLogin(HtmlUnitUtil.BASE_URL+"url");

HtmlForm maintForm = (HtmlForm)htmlPage.getFormByName("KualiForm");
HtmlPage returnPage = (HtmlPage)((HtmlInput)maintForm.getInputByName("methodToCall.search")).click();
I am getting the following error when I run the test case

Caused by: java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection exception: java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection no connection available java.sql.SQLException: Cannot get connection for URL jdbc:mysql:// : No suitable driver

The required jar file "mysql-connector-java-5.1.5" is in the class path. All other test classes are running, except BaseLineAppStartTest. Modified rice-config.xml, build.properties files to point to the local database.url path.

Comment by Peter Giles (Inactive) [ 20/Jul/09 ]

It's strange that the other tests are working and this one isn't since they should share common datasource configurations. Is jdbc:mysql:// the correct jdbc url? Is that what you have configured in $HOME/kuali/test/dev/common-test-config.xml ? I think typically it would refer to localhost, e.g. jdbc:mysql://localhost/ricetest, but if is your IP address or you are pointed at a non-local test database that might be correct.

In any case, Unless you have a better idea I suggest grabbing the xapool source (https://test.kuali.org/maven/xapool/xapool_old/1.5.0-patch3/xapool-1.5.0-patch3-src.zip), configuring eclipse to link your xapool-1.5.0-patch3.jar to the source (you can right-click on the jar in your eclipse "Referenced Libraries" and go to "Properties" to set the source Location path), and setting a breakpoint in StandardPoolDataSource.getConnection(...) to see what is actually going on. Maybe you can get an idea why the driver isn't being found from there.

You can create a utility method to check what is currently on the classpath (something similar to what is shown here: http://www.javaworld.com/javaworld/javatips/jw-javatip105.html?page=2) and call it in a debug Expression to make sure that the MySQL driver is accessible in the getConnection(...) call.

Comment by Eric Westfall [ 04/Aug/09 ]

Srikanth will be out for a little while. I'd like to continue to pursue these automated means for functional testing but I don't think it's a requirement for 1.0. Moving to 1.0.1

Comment by Eric Westfall [ 25/Aug/09 ]

estimating 8 hours, let me know if that is accurate or not

Generated at Tue Sep 29 14:50:39 CDT 2020 using JIRA 7.0.11#70121-sha1:19d24976997c1d95f06f3e327e087be0b71f28d4.