This can resolve the crash problem.
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace Core
{
public class genericLibrary
{
public void KillProcess(string processName)
{
System.Diagnostics.Process myproc = new System.Diagnostics.Process();
try
{
foreach (Process thisproc in Process.GetProcessesByName(processName))
{
thisproc.Kill();
}
}
catch (Exception Exc)
{
throw new Exception("", Exc);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture]
public class SuccessTests : genericLibrary
{
//[TestFixtureSetUp]
[SetUp]
public void Init()
{
KillProcess("chromedriver");
KillProcess("chrome");
}
//[TestFixtureTearDown]
[TearDown]
public void Cleanup()
{
}
}
}
Before dev this feature, the script that I'm maintain only can execute no more than 40 cases and then crash but now it can execute more than 200 cases with no crash.
You can execute these cases in the night or on VM.
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace Core
{
public class genericLibrary
{
public void KillProcess(string processName)
{
System.Diagnostics.Process myproc = new System.Diagnostics.Process();
try
{
foreach (Process thisproc in Process.GetProcessesByName(processName))
{
thisproc.Kill();
}
}
catch (Exception Exc)
{
throw new Exception("", Exc);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture]
public class SuccessTests : genericLibrary
{
//[TestFixtureSetUp]
[SetUp]
public void Init()
{
KillProcess("chromedriver");
KillProcess("chrome");
}
//[TestFixtureTearDown]
[TearDown]
public void Cleanup()
{
}
}
}