Explicitly set working directory for automation tests

- MatterSlice not found: IssueMatterHackers/MCCentral#612
This commit is contained in:
John Lewin 2016-10-17 11:02:40 -07:00
parent 4b2c0740bb
commit aa6f2a539f

View file

@ -354,12 +354,24 @@ namespace MatterHackers.MatterControl.Tests.Automation
QueueTemplate queueItemFolderToAdd = QueueTemplate.None,
int overrideWidth = -1, int overrideHeight = -1)
{
// Walk back a step in the stack and output the callers name
StackTrace st = new StackTrace(false);
Debug.WriteLine("\r\n ***** Running automation test: {0} {1} ", st.GetFrames().Skip(1).First().GetMethod().Name, DateTime.Now);
if (staticDataPathOverride == null)
{
// Popping one directory above MatterControl, then back down into MatterControl ensures this works in MCCentral as well and MatterControl
staticDataPathOverride = TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl", "StaticData");
}
#if DEBUG
string outputDirectory = "Debug";
#else
string outputDirectory = "Release";
#endif
Environment.CurrentDirectory = TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl", "bin", outputDirectory);
#if !__ANDROID__
// Set the static data to point to the directory of MatterControl
StaticData.Instance = new FileSystemStaticData(staticDataPathOverride);