Example #1
0
        static void Main(string[] args)
        {
            //Console.WriteLine("ZTester, (c) 2019 ZHENIA Zgurovets Inc.");

            #region testing region, remove after all



            #endregion

            _logInService.IsUserAdministrator();
            if (_fileService.CheckIfFileExists(_fileService.AppPath + "\\" + Constants.ZTestSettingConfigName))
            {
                SetConfiguration();
            }
            else
            {
                SelectTestPoint();
            }
        }
Example #2
0
        public void StartTest()
        {
            Console.WriteLine("SlelepTest running...");
            Thread.Sleep(1500);

            if (_fileService.IsShortcutOfRebootLoopExists)
            {
                _fileService.RemoveShortcutFromStartup();
            }

            _cmdService.RunCMDCommand("https://www.youtube.com/watch?v=_U24PBWOpjM", fileName: "iexplore.exe", waitForExit: false);
            Thread.Sleep(30000);

            _cmdService.RunCMDCommand("https://www.youtube.com/watch?v=jj_Mei27E7Q", fileName: "iexplore.exe", waitForExit: false);
            Thread.Sleep(30000);

            _cmdService.RunCMDCommand("https://www.youtube.com/watch?v=5TcOvHigjYE", fileName: "iexplore.exe", waitForExit: false);
            Thread.Sleep(30000);


            ZTestSettingModel testSettingModel = new ZTestSettingModel();

            testSettingModel = _xmlService.GetZTestSetting(TestType.SleepTest);
            string TestfilePath = testSettingModel.TestFileFullPath;

            NetworkSettingsModel networkSetting = _xmlService.GetNetworkSettings(TestType.KernelStressTest);

            if (TestfilePath == null || TestfilePath == "")
            {
                Console.WriteLine("The TestFileFullPath property does not setted, please open ZTester.config file and set TestFileLocation for SleepTest section");
                return;
            }

            bool result = _remoteConnectionService.MapDrive("M", networkSetting.TestFileLocation, networkSetting.Domain + @"\" + networkSetting.UserName, networkSetting.Password);



            string systemDrive          = _fileService.GetPathRoot(Environment.SystemDirectory);
            string testBinPath          = systemDrive + "TestBin";
            bool   isTestBinExist       = _fileService.CheckIfDirectoryExists(testBinPath);
            bool   isSleepTestFileExist = false;

            if (!isTestBinExist)
            {
                _fileService.CreateDirectory(Constants.TestBinPath);
                Process.Start("cmd.exe", @"/c xcopy M:\pwrtest.exe c:\TestBin\* /s /y");
            }
            else
            {
                isSleepTestFileExist = _fileService.CheckIfFileExists(testBinPath);
                if (!isSleepTestFileExist)
                {
                    Process.Start("cmd.exe", @"/c xcopy M:\pwrtest.exe c:\TestBin\* /s /y");
                }
            }



            Thread.Sleep(30000);

            _cmdService.RunCMDCommand("/sleep /c:4 /p:120 /d:150 /s:all", "pwrtest.exe", testBinPath);

            FinishTest();
        }
Example #3
0
        public void StartTest()
        {
            _xmlService.RemoveZtestSetting(TestType.WSHTest);

            List <string> xmlFiles       = _fileService.GetAllFilesWithExectExtantion(scriptLocation, "xml");
            List <string> scriptFolders  = null;
            bool          isXMLExists    = false;
            bool          isScriptExists = false;
            string        testName       = "";
            string        testPath       = "";
            string        sourceTestFile = "";
            string        scriptName     = "";
            ScriptType    testType       = ScriptType.None;
            Dictionary <string, string> xmlDictionary = new Dictionary <string, string>();
            string TCInfoXmlPath = "";

            Console.WriteLine("Type test name (Example: JS-Math): ");
            do
            {
                testName    = _inputService.ReadValueFromConsole();
                testPath    = "C:\\work\\" + testName + ".xml";
                isXMLExists = xmlFiles.Exists(item => item == testPath);
                if (!isXMLExists)
                {
                    Console.WriteLine("Test with this name does not exist, please type again: ");
                }
                else
                {
                    sourceTestFile = "C:\\work\\" + testName + " - source";
                    if (testName.Contains("JS"))
                    {
                        testType = ScriptType.JScript;
                    }
                    else if (testName.Contains("VBS"))
                    {
                        testType = ScriptType.VBScript;
                    }
                }
            } while (!isXMLExists);

            string scriptPath = @"C:\WSH\TC\Scripting VBSTest";

            scriptFolders = _fileService.GetDirectories($@"{scriptPath}\{testType}\{testName}");
            Console.WriteLine("Type script name (Example: Cos001): "); // need to implement for Cos001,Cos002,Cos003
            do
            {
                scriptName = _inputService.ReadValueFromConsole();
                scriptPath = $"C:\\WSH\\TC\\Scripting VBSTest\\{testType}\\{testName}\\{scriptName}";
                foreach (var item in scriptFolders)
                {
                    if (item == scriptPath)
                    {
                        isScriptExists = true;
                    }
                }
                if (!isScriptExists)
                {
                    Console.WriteLine("Script with this name does not exist, please type again: ");
                }
            } while (!isScriptExists);

            xmlDictionary.Add("TCName", scriptName);
            if (testType == ScriptType.JScript)
            {
                TCInfoXmlPath = $"\\Scripting VBSTest\\JScript\\{testName}\\{scriptName}\\TCInfo.xml";
            }
            else if (testType == ScriptType.VBScript)
            {
                TCInfoXmlPath = $"\\Scripting VBSTest\\VBScript\\{testName}\\{scriptName}\\TCInfo.xml";
            }

            bool isSpecific = (testName == "JS-Math" && scriptName[scriptName.Length - 1] == 'i');

            xmlDictionary.Add("TCInfoXmlPath", TCInfoXmlPath);
            if (isSpecific)
            {
                xmlDictionary.Add("VailOS", "Itanium OSes");
            }
            else
            {
                xmlDictionary.Add("VailOS", "All Operating Systems");
            }

            if (_fileService.CheckIfFileExists($"{sourceTestFile}.xml"))
            {
                _fileService.RemoveFile($"{scriptLocation}", testName, _fileService.CheckIfFileExists($"{scriptLocation}\\{testName}.xml"));
            }
            else
            {
                _fileService.RenameFile($"C:\\work\\{testName}.xml", $"{sourceTestFile}.xml");
            }


            _fileService.CreateAndWriteXMLFile($"C:\\work\\{testName}.xml", $"{testName}.xml", xmlDictionary, testName, isSpecific);

            string arguments     = $"{scriptName} {testName} 5.6";
            string fileName      = "WSHTester.exe";
            string workDirectory = "C:\\work";

            _cmdService.RunCMDCommand(arguments, fileName, workDirectory, "", true);

            _fileService.RemoveFile(scriptLocation, $"{testName}.xml", isXMLExists);
            _fileService.RenameFile($"{sourceTestFile}.xml", $"{testPath}");

            FinishTest();
        }