Require Spring Framework version in order to use correct Spring TestContext Framework

I need to test some configuration pages that extends AdminPage and I'm hoping to use the Spring TestContext Framework to be able to instantiate my classes. If this assumption is correct, I need to know the version of the Spring framework that TeamCity 8 uses, so that I can retrieve it from the Maven repository.

If there is another way to test such classes, I'd be happy to use or investigate those options.

Let me know if I need to provide more information.


I would appreciate any direction anybody can offer. I've looked at some other popular plugins, and there doesn't seem to be much of a testing strategy, besides what tcWebHooks does, which is to define a mock proxy etc.

Can one in some way use the Spring TestContext Framework to test plugin pages, or is there another way to instantiate these classes. Using mockito fails, presumably since there are all kinds of internals that is instantiated by reflection, that I can't possibly know of without seeing the source code, based on the null pointer exceptions I'm getting.


Hi Pieter,

Sorry for late answer.

TeamCity 8.0 uses Spring 3.0.5. You can found org.springframework.test-3.0.5.RELEASE.jar and other useful libraries to tests you plugin in <TeamCityHome>/devPackage/tests directory.
For example you can take a look on tests of rake-runner plugin (they are both server and agent-side).

If you have further questions, don't hesitate to ask.


No problem, thank you very much. I didn't think of looking inside the tests directory of the dev package, and thanks for the example project. So if I understand correctly, I essentially need my test case to extend jetbrains.buildServer.BaseTestCase. I will let you know if I don't make any progress, but this should be fine.


I'm referencing the JARs in the dev package and installed the TestNG runner for Eclipse, but I get the following error running an empty test:

java.lang.NoClassDefFoundError: jetbrains/buildServer/serverSide/db/DBAction

The only DBAction available is jetbrains.buildServer.serverSide.db.DBAction2.

My classpath contains the following:

        <classpathentry kind="var" path="TEAMCITY_HOME/devPackage/tests/org.springframework.test-3.0.5.RELEASE.jar"/>

        <classpathentry kind="var" path="TEAMCITY_HOME/devPackage/tests/patches-test.jar"/>

        <classpathentry kind="var" path="TEAMCITY_HOME/devPackage/tests/tests-integration.jar"/>

        <classpathentry kind="var" path="TEAMCITY_HOME/devPackage/tests/tests-support.jar"/>

        <classpathentry kind="var" path="TEAMCITY_HOME/devPackage/tests/jmock-1.2.0.jar"/>

This is the test class:

package com.whatsthatlight.teamcity.hipchat.test;


import jetbrains.buildServer.controllers.BaseControllerTestCase;

import org.testng.annotations.Test;

import com.whatsthatlight.teamcity.hipchat.HipChatConfigurationController;

public class NewTest extends BaseControllerTestCase<HipChatConfigurationController> {


  public void test() {



  protected HipChatConfigurationController createController() throws IOException {

    // TODO Auto-generated method stub

    return null;



My second question is: How do I test pages, e.g. classes that extends AdminPage?


To run tests you actually need server runtime libraries, located in <TeamCityHome>/webapps/ROOT/WEB-INF/lib/ . DBAction is also there in db.jar

To test AdminPage you can use something like:

public class ProjectsAdminPageTest extends BaseServerTestCase {
  private ProjectsAdminPage myPage;

  protected void setUp() throws Exception {
    WebFixture webFixture = new WebFixture(myFixture);
    myPage = new ProjectsAdminPage(webFixture.getPagePlaces(), myFixture.getProjectManager());

  protected Map<String, Object> doGetTab() {
    HashMap<String, Object> map = new HashMap<String, Object>();
    MockRequest request = new MockRequest();
    myPage.fillModel(map, request);
    return map;
  public void test_show_all_projects() throws Exception {
    Map<String, Object> beansMap = doGetTab();

BTW: There are two another ways to bootstrap plugin development:
1. There are maven artifacts available.
2. Plugin template (for use with IDEA)


Thank you, this helps tremendously. I'm making some good progress now.


Please sign in to leave a comment.