We are currently working on the forum. For the short-term, all forum content will be in read-only format. We apologize for the interruption and look forward to collaborating with you shortly. All the best in your research!

Another question for the Dev team... Spring MVC Testing in the Web module...

first.. is this the best place to ask a dev question? I dislike adding issues in Github and not sure where else to ask..

second.. Any plans to update the version of spring being used? its quite old (3.0.5 was release in October of 2010)...

third. Do you have any tests for Spring MVC controllers? In the Web Module I see a couple of servlet tests.. I see a bunch of DAO and Service tests in Core module.. but don't see any for Spring MVC Controllers.. Just spent the better part of a day trying to add one but can't seem to nail down loading your application context.. its definitely exposing my "ran away from Java 5 years ago" rustiness with Java and Spring.. was hoping there was something there (especially given you do have a bunch of controllers.. there should be some tests somewhere)..



  • aborisenkoaborisenko Posts: 5
    Hi Gary,

    Working in a similar project we had to roll our own controller tests on top of OpenClinica. An example of the test we created is here, the AbstractContextSensitiveTest: http://bit.ly/1SS3wto

    This then would be used as a superclass by a BaseControllerTest object: http://bit.ly/1PO7WRu

    And then, could be used to test actual controller objects: http://bit.ly/1WVpH0L

    Ah, the hierarchies! Anyway, hope this is useful for you.

    Best, Aleksandr
  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    via Email

    That is amazing. Like 300 lines to get to a couple of actual test! But I
    guess that's Java for you.

    Anyway, this is the 3rd test suite I've heard of for OC code, but the first
    open source one.

    How much of the ClinCapture test suite could be upstreamed to 3.9, in your

    If there is a good deal of overlap I'd rather adapt this work than start
  • gpinkhamgpinkham Posts: 37
    @aborisenko thanks for this! funny.. looking at the abstract class I'm sure I did that with the context xml files and the loading of properties.. curious.. what are the system settings for running this? (I'm running this in IntelliJ).. I set the basedir system property to "/home/gpinkham/dev/OpenClinica/core/src/test/resources".. it kept having issues with the coreResources bean.. I think it's due to having trouble finding the applicationContext-core-spring.xml file.. I'll try your way and see if maybe there was a step I missed.. thanks again!

    and I second Lindsay's question regarding the tests being upstreamed to the OC code base..
  • gpinkhamgpinkham Posts: 37
    I also just noticed that clincapture is running spring 3.2.1 which is about 4 years newer than than the 3.0.5 version openclinica is still running.. since I haven't actually committed to using OpenClinica not sure I want to tackle upgrading OC's Spring version for my experimental POC...

    Just a note.. 3.2.x is end of life this year.. since 3.0.5 is 4 years older I'm assuming it has entered end of life already.. There's quite a few old not supported any more libraries in OC.. Its one of the major concerns I have with investing in using it.. before I can even tackle the feature gaps I'll have to upgrade a bunch of libraries and an unknown amount of code.. :(
  • gpinkhamgpinkham Posts: 37
    well after spending the day on this I'm going to revert back and hold off on testing the springmvc page I added.. again this is just a POC.. I wanted to see how hard it would be to add a spring mvc test to OC.. and indeed it's quite hard.. I'll add this to my gap analysis and move onto finding more gaps.. I still think this might be a smaller project than building from scratch in Ruby, but its getting closer every day..

    @aborisenko how close do you track with the OC code base? I mean how much of a lag is there from their release to inclusion in ClinCapture? or is this a case by case basis? I had wondered a while back if I should start with ClinCapture as my base for this project and not OC..
  • aborisenkoaborisenko Posts: 5
    Hi @gpinkham, and @lindsay.stevens,

    Thanks very much for your interests. I can try to answer your questions one at a time:

    - ClinCapture test suite into OpenClinica; please note that some of it is for Clinovo's own controller objects, that were created for its own feature set. However, the base classes should be applicable to the code base (not sure about difficulty, based on Gary's findings).

    - System settings with Intellij IDEA: I asked one developer who is using IDEA and ClinCapture code, he said that it should be easy to run if you import it as a project. Other developers use Eclipse and run the tests from the command line (ClinCapture has changed the maven files a little, so that 'mvn clean install' should run all tests by default).

    - Spring 3.2.1: Yes, Clinovo changed it actually several years ago, based on a forum posting in the old OpenClinica mailing list. It did not seem like a big deal at the time to go from 3.0 to 3.2.x. Clinovo developers have also thought about an upgrade to Spring 4, since running Spring 3.2.x always breaks on Java 8. Have you had that experience as well?

    - Tracking with OpenClinica: I know that ClinCapture regularly checks on OpenClinica changes and makes sure that upgrades from versions of OC will not break the database. Here is the latest ticket to cover that: http://bit.ly/1NOCGKT Features from OpenClinica are included on a case-by-case basis.

    Please ask more questions if you have them, happy to help.

    Regards, Aleksandr
  • gpinkhamgpinkham Posts: 37
    revisiting the old library thought.. I'm surprised you can "validate" an app that has libraries that are no longer supported by the vendor.. how do you get security fixes etc? I guess its a good thing I don't work in the QA department.. they must not notice these types of things..
Sign In or Register to comment.