Trouble with Ant script and TestBox

I am trying to get an Ant script to run TestBox scripts, but am running into problems. Whether I use directory or bundles I get “java.net.MalformedURLException: no protocol:” on the “<get” line.
I have tried several things; with and without @, src argument order, with and without & after {url.runner}, to name a few.
Does anyone have any insight?

Thanks,
Sam

<?xml version="1.0" encoding="UTF-8"?> Tests ran at ${start.TODAY}

Sorry for the trouble.
Found that the “url.runner” actually has to be a real url (duh!).

But still running into issues.

Does anyone have a good example of a TestBox ant script?

Thanks much.

Sam

FYI: ColdBox 3.2.0

What’s the error you’re getting now? We’re actually phasing out all our ant scripts in favor of just using the CommandBox “testbox run” command. It hits the URL for you, echos the test results back tot he console, and returns an exit code of 1 (failure) if the tests fail.

box testbox run http://mylocalsite.dev:8080/tests/runner.cfm

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks Brad,

Our reason for Ant is for Jenkins integration. (if there is a better way I am all ears)

The error I am getting is:

BUILD FAILED
C:\public\data\trunk\Application\sweb\testing\TestBox\build.xml:32: Can’t get http://localhost/AppName/testing/TestBox/testbox/test-harness/runner.cfm?reporter=junit&labels=&propertiesSummary=true&bundles=http://localhost/AppName/testing/TestBox/tests/Hello.cfc?method=runRemote; to C:\public\data\trunk\Application\sweb\testing\TestBox\results\results.html

You can use testbox run on Jenkins! Just install CommandBox on the server and call it in a shell script! Jenkins will automatically fail based on the exit code.

Regarding your error, what happens when you hit that URL in the browser? is the server running? We use CommandBox in our builds to start the server first, run the tests, and then stop the server afterwards so it’s all self contained.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Brad,
Thanks for the tip on Command Box. Are there any walk thoughts/examples you can point me to?

The test runs off the url correctly.

Sam.

FYI. I am going through your commandBox video right now.

Thanks for the help. Trying to get testbox running from commandBox. I have the box.json (created with init) and have filled in the testbox section (see below) but it seems to be running “tests.specs.BDDTest” which is not my test. Any insights?

Thanks

The directory struct is

…\testing\TestBox

Box.json

\TestBox – where the testbox system lives

\tests

Where the hello.cfc is.

Just the testbox part of box.json

“testbox”:{

“runner”:[

{

“default”:“http://localhost/MyApp/testing/TestBox/testbox/test-harness/runner.cfm

}

],

“labels”:[

],

“reporter”:“simple”,

“reporterResults”:“results”,

“bundles”:[

http://localhost/MyApp/testing/TestBox/tests/hello.cfc?method=runRemote

],

“directory”:{

“mapping”:“tests”,

“recurse”:true

},

“watchers”:[

],

“notify”:{

“emails”:[

],

“growl”:"",

“URL”:""

}

}

I’m not sure, but I think what you have for bundles is wrong in your JSON. Also, is there a reason you’re using the sample runner that’s included in the testbox library and not the runner under you tests folder?

testbox run just does an http request, so whatever works in your browser should work the same way from the CLI.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Brad,

I started fresh. New directory, install testbox, run, and got my test to run off of commandbox, and in Jenkins. I am now working through getting junit output, but there is none appearing.

My command file is:

“C:\Program Files (x86)\Command Box\box.exe” package set testbox.runner=http://localhost/MyApp/testing/boxTest/testbox/tests/runner.cfm

“C:\Program Files (x86)\Command Box\box.exe” testbox run

My JSON file in ‘boxTest’ is now very simple:

{

“dependencies”:{

“testbox”:"^2.4.0+80"

},

“installPaths”:{

“testbox”:“testbox”

},

“testbox”:{

“runner”:“http://localhost/MyApp/testing/boxTest/testbox/tests/runner.cfm”,

“reporter”:“junit”,

“reporterResults”:“results”

}

}

Any thoughts?

I am now working through getting junit output,

If you want junit output, are you using the junit reporter?

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

So I have figured out that the run through CommandBox does not use the box.json (or it’s having no effect).

On this script:

“C:\Program Files (x86)\Command Box\box.exe” package set testbox.runner=http://localhostx/eBusiness/testing/boxTest/testbox/tests/runner.cfm?reporter=JUnit
“C:\Program Files (x86)\Command Box\box.exe” testbox run

When executing reports this:
Executing tests via http://localhostx/eBusiness/testing/boxTest/testbox/tests/runner.cfm?reporter=JUnit?recurse=true&reporter=text, please wait…

I can’t find where it is appending the ‘recurse’ and reporter. In the actual runner.cfm i have changed the url.reporter to JUnit.

Thanks for the help.

Sam

Still cant figure out why the test will append recurse=true&reporter=text on to

“C:\Program Files (x86)\Command Box\box.exe” testbox run “http://localhost/ebusiness/testing/boxTest/testbox/tests/runner.cfm

That’s because the testbox run command always uses the text reporter. Honestly, I think Luis assumed you wouldn’t want to use a junit reporter, etc when running from the command line. Unfortunately, TestBox doesn’t let you run more than one reporter at a time.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Ok. So how do I use the CommandBox to run under Jenkins and implement Junit report?

I think we need to make a fix to CommandBox to allow for this. I’d never tried to use another reporter from the testbox run command. Our internal builds don’t use the junit stuff any longer. We just use the exit code from the testbox run command to know if it passed/failed.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com