hwellmann / refit

Automatically exported from code.google.com/p/refit
1 stars 0 forks source link

ant tasks #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Do you have any ant task definitions?  I was trying to run refit from the unit 
tests from within ANT and couldn't find a good way to specify the output 
directory for the Jenkins job.  We output all the reports in the build job's 
workspace in a build/reports directory which is configured in an ANT property 
and refit was putting things in target/fit which was putting it in the base of 
Jenkins install were all our scripts are and and not in the Jenkins job 
workspace.  If there was a refit ANT task which I could set 
properties/attributes it would be nice.

Original issue reported on code.google.com by shawndga...@gmail.com on 14 Mar 2012 at 11:32

GoogleCodeExporter commented 9 years ago
reFit does not have an Ant task.

I'd recommend using a FitSuite with a custom configuration which reads the 
output directory and possibly other parameters from system properties.

Then you can simply use the Ant junit task to run your FitSuite as a JUnit 
test, passing in the required system properties.

See the FitSuite Javadoc and the following example:

@RunWith(SpringFitSuite.class)
@FitConfiguration(MyFitSuite.Configuration.class)
public class MyFitSuite {

    public static class Configuration extends DefaultFitConfiguration {

        private String inputDir;

        private String dataDir;

        private String[] includes;

        @Override
        public String getInputDir() {
            if (inputDir == null) {
                inputDir = System.getProperty("my.fit.inputRoot");
            }
            return inputDir;
        }

        @Override
        public String[] getIncludes() {
            if (includes == null) {
                String prop = System.getProperty("my.fit.includes",
                        "**/*.fit.html");
                includes = StringUtils.split(prop, ",");
            }
            return includes;
        }
    }
}

By the way, since you mentioned Jenkins, have you tried the reFit Jenkins 
plugin?

Original comment by hwellman...@gmail.com on 13 Apr 2012 at 6:51