views:

126

answers:

4

I have Hudson to run builds as soon as changes have been made to any of the repositories.

There are some builds that I want to run once a week during the weekends, but with more special tests which take longer and I wouldn't want to run every time there is a change in one of the source repositories.

Is there a way to pick and choose which tests to run or have it look up some environment variable that i set up before the build so it knows to run the additional tests.

Or is it best to separate those long tests into their own repository, and create a new weekend build. I use maven not ant.

Thoughts?

Please and thank you.

A: 

I'd pass a variable from Hudson job down to the Ant task.

spektom
how would i do that with JUnit? Please be more explicit with your answer.
garbagecollector
@garbagecollector: Please do not be a help vampire.
Paul Nathan
@Paul Nathan honestly, whatever he said was out of context and useless. I asked a question. If you want to answer your more than welcome to. If not, be on your way. Watching too much twilight there huh Paul?
garbagecollector
A: 

You can place long tests in separate packages so that you can exclude these packages in hudson, but in my experience, that will sometime mess up your testing, for example, your testcase might lose access and visibility simply because it resides in a different package.

I suggest that you prefix long test class files, ex: "Long_PersonDAOTest.java". Then, in hudson, create a separate job with an ANT script that excludes test files that have this prefix. This should speed up the process. Your weekend build script can remain the way it is so that it executes all test files. I wouldn't recommend you hooking up two ANT scripts in a same job because it might really mess up your historical static code analysis reports.

Granted, I haven't encounter whole lot of problem with long tests, but this is something I might consider doing if I have this issue.

limc
I dont use ant scripts. maven is what I use to build.
garbagecollector
+1  A: 

How do you run your test? Do you call mvn clean install and maven does it's magic? If so you can skip testing by running mvn clean install -Dmaven.test.skip=true. As far as I know this skips at least the unit tests. If all tests that you have are unit tests, you have to separate them out of the building phase. You can goals to a mvn build.

This is definitely a maven issue. Get accustomed with the maven life cycle first or find someone who knows maven better. The golden rule is, when you are able to run the build steps from command line, you can accomplish it with Hudson as well.

Peter Schuetze
thanks. I appreciate your help. I will look into what you suggested.
garbagecollector
+3  A: 

Is there a way to pick and choose which tests to run or have it look up some environment variable that i set up before the build so it knows to run the additional tests.

The Maven Surefire Plugin does support Inclusions and Exclusions of Tests so you could put a specific configuration in a profile and configure Hudson to run your weekend builds using this profile. This is in my opinion the way to implement your use case.

Pascal Thivent
I looked into this but this requires maintaining two copies of the same file with different parameters.
garbagecollector
@garbagecollector: Hmm... No, this solution doesn't require maintaining two copies of... of what by the way? This solution solves exactly what you asked for. Having to maintain two copies of I don't know what would be only required because of some constraints that you didn't express. And I don't see how skipping all tests does solve your problem.
Pascal Thivent