private void 시작ToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     foreach (MacroNode macronode in Nodes)
     {
         RunTest.Run(macronode, true);
     }
     this.Enabled = true;
 }
        /*
         * /// <summary>
         * /// 각각의 워킹플로우를 실행하는 스레드입니다.
         * /// </summary>
         * public void RealRun()
         * {
         *  for (int i = 0; i < NodesList.Count; i++)
         *  {
         *      if (!threadRunning) break;
         *      int SnapCount = 0;
         *      foreach (MacroNode node in NodesList[i])
         *      {
         *          if (!threadRunning) break;
         *          SnapCount = RunTest.Run(node, textBox_SnapPath.Text, FilenameList[i], SnapCount, (ImageExtensions)comboBox_ImageFormat.SelectedIndex, SaveScreen);
         *      }
         *  }
         * }
         */// RealRun 백업

        /// <summary>
        /// 각각의 워킹플로우를 실행하는 스레드입니다.
        /// </summary>
        public void RealRun()
        {
            for (int i = 0; i < NodesList.Count; i++)
            {
                if (!threadRunning)
                {
                    break;
                }
                if (saveLog | saveScreen)
                {
                    DirectoryInfo di = new DirectoryInfo(string.Format("{0}\\{1}", textBox_SnapPath.Text, FilenameList[i]));
                    if (!di.Exists)
                    {
                        di.Create();
                    }
                }
                if (SaveLog)
                {
                    using (FileStream fs = new FileStream(string.Format("{0}\\{1}\\Log.{2}", textBox_SnapPath.Text, FilenameList[i], comboBox_LogFormat.SelectedItem.ToString()), FileMode.Append, FileAccess.Write)) // + "\\" + FilenameList[i] + "\\Log.csv", FileMode.Append, FileAccess.Write))
                        using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
                        {
                            sw.WriteLine("No,Time,Event,X,Y,Interval,InputString,Tag,Window Class,Window Caption,Control Type,Name");
                            int no = 1;
                            foreach (MacroNode node in NodesList[i])
                            {
                                if (!threadRunning)
                                {
                                    break;
                                }
                                RunTest.Run(node, textBox_SnapPath.Text, FilenameList[i], no, (ImageExtensions)comboBox_ImageFormat.SelectedIndex, SaveScreen);

                                if (SaveLog)
                                {
                                    StringBuilder     className = new StringBuilder(256);
                                    StringBuilder     caption   = new StringBuilder(256);
                                    IntPtr            hwnd      = (IntPtr)WindowFromPoint(Cursor.Position);
                                    AutomationElement AE        = AutomationElement.FromHandle(hwnd);


                                    GetClassName(hwnd, className, 256);
                                    GetWindowText(hwnd, caption, 256);

                                    sw.WriteLine(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}",
                                                               (no++).ToString(),
                                                               DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"),
                                                               node.state.ToString(),
                                                               node.x.ToString(),
                                                               node.y.ToString(),
                                                               node.interval.ToString(),
                                                               node.inputString,
                                                               node.tag,
                                                               className,
                                                               caption,
                                                               AE.Current.ControlType.LocalizedControlType,
                                                               AE.Current.Name
                                                               ));
                                }
                            }
                            sw.Flush();
                        }
                }
                else
                {
                    int SnapCount = 1;
                    foreach (MacroNode node in NodesList[i])
                    {
                        if (!threadRunning)
                        {
                            break;
                        }
                        SnapCount = RunTest.Run(node, textBox_SnapPath.Text, FilenameList[i], SnapCount++, (ImageExtensions)comboBox_ImageFormat.SelectedIndex, SaveScreen);
                    }
                }
            }
        }
Beispiel #3
0
 static void Main(string[] args)
 {
     RunTest.Run();
 }