[Webtest] Execute a single test or suite

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Tue, 23 Sep 2008 09:15:51 +0200


Hi,

if you put your properties loading task in the main build file, then you
can simply set the wt.testInWork property to the name of the single
test/test suite to run:

ant -Dwt.testInWork=tests/sanitySuite.xml

Cheers,
Marc.
-- 
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com

av8r wrote:
> 
> Sorry - The title for the post should have been execute a single test or
> suite.
> 
> Hope to hear from someone who has done this soon.
> 
> 
> 
> av8r wrote:
>> I am having some trouble getting webtest to execute one test (or one
>> testSuite). I would like to
>> do this while I am developing tests, rather than to have comment out rest
>> of the tests in my suite file.
>> My set up is as below:
>>
>> In build.xml, the property wt.testInWork is set as below:
>>
>> <?xml version="1.0"?>
>> <project name="test" default="wt.full">
>>
>> 	<property name="webtest.home" value="/Users/qa/Canoo"/>
>>
>> 	<import file="definitions.xml" description="Import custom definitions (if
>> any)"/>
>> 	<import file="${webtest.home}/webtest.xml" description="Import all
>> functionalities for a full build"/>
>> 	
>> 	<property name="wt.testInWork" value="tests/allTests.xml"/>	
>> </project>
>>
>>
>> The file tests/allTest.xml has information about various suite of tests
>> that I have as shown below:
>>
>> <?xml version="1.0"?>
>> <project default="test">
>> 	<property file="../properties/english.properties"/>
>> 			
>> 	<target name="test" description="runs all the tests">
>> 		<!-- ant dir="accounts" antfile="accountsSuite.xml"/-->
>> 		<ant dir="sanity" antfile="sanitySuite.xml"/>
>> 	</target>
>>
>> </project>
>>
>> Finally, I have the test suite files in each of the directories which have
>> lists of tests that make up that particular test suite (sanitySuite.xml),
>> as shown below:
>>
>> ?xml version="1.0"?>
>> <project default="test">
>> 	
>> 	<target name="test" description="runs all the tests">
>> 		<!--ant antfile="./Install.xml"/-->
>> 		<ant antfile="./InitialLogin.xml"/>
>> 	</target>
>>
>> </project>
>>
>> As you can see, I have the accountsSuite.xml commented out in the
>> tests/allTest.xml
>> file and the Install.xml commented out in the sanitySuite.xml file,
>> because the only test
>> that I want to run is the InitialLogin.xml.
>>
>> Could someone please point me out to how can I run any one test (or any
>> one testSuite) directly
>> rather than having to comment and uncomment in my various testSuite or
>> allTests build files.
>> Anytime I try to run the test directly, I start getting errors similar to
>> the one shown:
>>
>> BUILD FAILED
>> /Users/qa/Canoo/Sugar/tests/allTests.xml:11: The following error occurred
>> while executing this line:
>> /Users/qa/Canoo/Sugar/tests/accounts/accountsSuite.xml:5: The following
>> error occurred while executing this line:
>> /Users/qa/Canoo/Sugar/tests/accounts/SearchAccount.xml:5: Problem: failed
>> to create task or type webtest
>> Cause: The name is undefined.
>> Action: Check the spelling.
>> Action: Check that any custom tasks/types have been declared.
>> Action: Check that any <presetdef>/<macrodef> declarations have taken
>> place.
>>
>> I realize this may be more of an ant question, but I couldn't find
>> anything suitable on the
>> web while searching for this. Everything does run properly if I just
>> execute webtest.sh.
>>
>> TIA
>>
>>
>