Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-13693

Come up with an automated solution for link verification in the Rice portal

    Details

    • Type: Task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Quality Assurance
    • Labels:
    • Rice Team:
      QA

      Description

      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.

        Attachments

          Activity

          Hide
          ewestfal Eric Westfall added a comment -

          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.

          Show
          ewestfal Eric Westfall added a comment - 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.
          Hide
          gilesp Peter Giles (Inactive) added a comment -

          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!

          Show
          gilesp Peter Giles (Inactive) added a comment - 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!
          Hide
          gilesp Peter Giles (Inactive) added a comment -

          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.

          Thanks,
          Peter

          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://172.25.27.79:3306/KRICE : No suitable driver
          >
          > Thanks & Regards
          > M.Srikanth
          > 9819782893

          Show
          gilesp Peter Giles (Inactive) added a comment - 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. Thanks, Peter 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://172.25.27.79:3306/KRICE : No suitable driver > > Thanks & Regards > M.Srikanth > 9819782893
          Hide
          smummadi Srikanth Mummadi (Inactive) added a comment -

          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");
          maintForm.getInputByName("document.definition").setValueAttribute("definition");
          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://172.25.27.79:3306/KRICE : 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.

          Show
          smummadi Srikanth Mummadi (Inactive) added a comment - 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"); maintForm.getInputByName("document.definition").setValueAttribute("definition"); 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://172.25.27.79:3306/KRICE : 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.
          Hide
          gilesp Peter Giles (Inactive) added a comment -

          It's strange that the other tests are working and this one isn't since they should share common datasource configurations. Is jdbc:mysql://172.25.27.79:3306/KRICE 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 172.25.27.79 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.

          Show
          gilesp Peter Giles (Inactive) added a comment - It's strange that the other tests are working and this one isn't since they should share common datasource configurations. Is jdbc:mysql://172.25.27.79:3306/KRICE 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 172.25.27.79 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.
          Hide
          ewestfal Eric Westfall added a comment -

          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

          Show
          ewestfal Eric Westfall added a comment - 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
          Hide
          ewestfal Eric Westfall added a comment -

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

          Show
          ewestfal Eric Westfall added a comment - estimating 8 hours, let me know if that is accurate or not

            People

            • Assignee:
              Unassigned
              Reporter:
              gilesp Peter Giles (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 1 week
                1w
                Remaining:
                Remaining Estimate - 1 week
                1w
                Logged:
                Time Spent - Not Specified
                Not Specified