Question

Here is the situation, I am attempting to fire a set of Gallio tests after the build/deploy process to a server. The build script is Nant and we activate it via Hudson to the remote servers.

After a good bit of effort I have ran into the following error from our build script. NOTE: I scrubbed the file paths and replaced them with (Description)

Buildfile: file:///(Build script location)
Target framework: Microsoft .NET Framework 4.0
Target(s) specified: build-robot 


[include] Including file (Build script location)
[property] Read-only property "doDeploy" cannot be overwritten.
[property] Read-only property "runSmokeTests" cannot be overwritten.
[tstamp] Tuesday, November 22, 2011 3:51:01 PM.
[tstamp] Tuesday, November 22, 2011 3:51:01 PM.
[echo] Setting RELEASE mode to true
[echo] The Output Folder is set to: (Nightly build server)
[echo] Loading Gallio Task from: (Source dir path)\References\Gallio\Gallio.NAntTasks.dll
[loadtasks] Scanning assembly "Gallio.NAntTasks" for extensions.

global.failure:


tear.down:

 [echo] In tear.down...

clean:

 [echo] Starting clean target...
 [echo] End of clean target...

BUILD FAILED - 0 non-fatal error(s), 2 warning(s)

(output dir)(30,3):
Failure scanning
"(Source dir path)\References\Gallio\Gallio.NAntTasks.dll" for extensions.
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Here is the script area where I load the assembly.

<!-- Load Gallio Tasks for automated Testing -->
<echo message="Loading Gallio Task from: ${path::combine(repoDirectory,'Source\References\Gallio\Gallio.NAntTasks.dll')}" />
<loadtasks assembly="${path::combine(repoDirectory,'Source\References\Gallio\Gallio.NAntTasks.dll')}"  if="${file::exists(path::combine(repoDirectory,'Source\References\Gallio\Gallio.NAntTasks.dll'))}"  /> 
<echo message="Failed to find Gallio.NantTasks.dll" unless="${file::exists(path::combine(repoDirectory,'Source\References\Gallio\Gallio.NAntTasks.dll'))}"  /> 
<echo message="${LoaderExceptions}" />
<echo message="Gallio Tasks Loaded..." />

And the Gallio task itself.

<target name="run.automated.tests"> 
    <echo message="Begining Automated Testing..." />
    <property name="nant.onfailure" value="global.failure" />       

    <gallio result-property="exitCode" failonerror="false" >

        <files>
            <include name="${path::combine(outputDirectory,'bin\AutomatedQATest.dll')}" />
        </files>
        <!--
        <runner-extension value="AutomatedQATest,Gallio.AutomatedQATest" /> 
        <assemblies>                
          <include value="${path::combine(outputDirectory,'bin\AutomatedQATest.dll')}" /> 
        </assemblies>  -->
    </gallio>
    <fail message="Oh no!" if="${exitCode} != '0'}" />
</target>

Any ideas? I have spent the better part of today searching for an answer, Google either presents me with depreciated work arounds or ideas that don't work.

Thanks guys!

Was it helpful?

Solution 2

Come to find out this is several problems acting together. First off the tasks were not loaded correctly: Gallio requires the Gallio.dll AND Gallio.Nant.tasks.dll to be loaded.

Secondly the tests I was attempting to run required a gui to run properly, in order to have a gui on a remote machine you have to set an interactive flag. Gallio does not have a flag for this, so I ended up dancing around that issue by calling PSEXEC.exe to run Gallio.Echo.exe on the remote machine with interactive mode on and set to use RDP-TCP session id #1. The command in nant looks like this.

<exec program="psexec.exe" failonerror="false" >
    <arg line="\\${test.auto1.serverpath} /accepteula -i 0 -u ${DevUsername} -p ${DevPassword} C:\Gallio\bin\Gallio.Echo.exe (The path) ${build.version}.${date.prefix}\bin\${theTargetTest} /rd:C:\Reports /rt:HTML /ra:zip /rnf:${projectName}-${date.cal}" />
</exec>     

So basically in the end I removed the need to have nant run the tests by having it call Gallio with the correct parameters on the remote machine directly with the above command after I build, zip the required bits up, move it to the server and unzip it. After the test finishes I zip up the test report and move it back to the hudson server.

Hope this saves someone some pain in the future.

OTHER TIPS

Enable Fusion logging to get more detailed error messages.

See this tutorial: http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx

I'm thinking there is one or more missing dependencies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top