Anyone tried running tests through a build agent

854
3
04-24-2017 02:25 PM
JoeHershman
MVP Regular Contributor

Hi,

We are using Visual Studio online for source control and also using for CI builds.  I am also trying to see if I can run unit tests as part of this build process.  While it won't be able to run many tests because they are dependent on our Portal there are a number that don't have this dependency and I was hoping to run these as part of the build.

The issue is that I cannot figure out how to set the InitialDirectory so that the RuntimeEnvironment sees the Runtime deployment folders.  Because of this it cannot properly initialize and the tests fail.

Has anyone given this a try?  Any ideas?  It sure would be nice to do

Thanks

-Joe

Thanks,
-Joe
Tags (1)
0 Kudos
3 Replies
MoreHavoc
New Contributor III

I have not done any CI with the runtime, but I have gotten my unit tests to work, I had the same problem you did.  The main thing I added was this, within my [TestClass]:

[TestInitialize]
public void ConfigureEsriRuntime()
{
    if (!Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.IsInitialized)
    {
        Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InstallPath = Directory.GetCurrentDirectory();
    }
}‍‍‍‍‍‍‍‍

I think I also had to set the Platform target in the properties for the Test Project, but I'm not sure.  In my case, the output directory contained the right ArcGISRuntime100.0 folder, but the InstallPath wasn't set correctly.

0 Kudos
JoeHershman
MVP Regular Contributor

I ended up moving to Jenkins instead of vs online.  In Jenkins I can control where everything is placed and use the same folder structure as our development machines.  Also kind of slick it does multi-branch setup so it will build against any branch commits.  The scripting took a bit to figure out (I have not setup Jenkins for a couple years) but once you get a handle seems pretty powerful.

Thanks,
-Joe
0 Kudos
JoeHershman
MVP Regular Contributor

Ya..I was able to get the tests to run when running through a the test runner in VS (using the same basic method),  Its figuring out a way to run the a build agent that is beating me up.

Thanks...

Thanks,
-Joe
0 Kudos