SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.24k stars 754 forks source link

SpecRun command line arguments in WPF application #1586

Closed Priyasolanke closed 5 years ago

Priyasolanke commented 5 years ago

I am trying to call specRun command line through WPF application

Code

private void GenerateTestResultsBtn(object sender, RoutedEventArgs e)
{
    Process process = new Process();
    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.WindowStyle = ProcessWindowStyle.Minimized;
    startInfo.FileName = "cmd.exe";
    startInfo.Arguments = @"$@"/C C:\MyProject\packages\SpecRun.Runner.1.8.5\tools\SpecRun.exe run {ComboBoxEnvironment.SelectedValue}.srprofile " + "\" \\basefolder:C:\\MyProject\\bin\\Debug\"" + "\" \\outputfolder:C:\\Users\\Desktop\\New folder\"";
    process.StartInfo = startInfo;
    startInfo.RedirectStandardOutput = true;
    startInfo.UseShellExecute = false;
    process.Start();
    process.WaitForExit();
}

Note: Here I am selecting specific profile to run the test cases.

This command is not working

david1995 commented 5 years ago

Hi @Priyasolanke,

is your Arguments string intended as it is written in the issue description? Because that way it is not a valid C# string.

As far as I can tell, you are writing this code in the code-behind file of the Window. There is a pattern for writing WPF application called MVVM. There is a good introduction to it: https://msdn.microsoft.com/en-us/magazine/dd419663.aspx9. I'd suggest you to have a look at this pattern. From my personal experience I can tell you it has helped me decluttering my WPF code dramatically and make it more readable 😊

SabotageAndi commented 5 years ago

Closing because of inactivity

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.