예제 #1
0
        private static ProjectInfo CreateProjectInfoFile()
        {
            var pi = new ProjectInfo();

            pi.ProjectName = Instance.CurrentTestProgramSet.TestSetName;
            pi.Uuid        = Guid.NewGuid().ToString();
            if (UutManager.ProjectHasUUT(pi.ProjectName))
            {
                UUTDescription uut = UutManager.GetProjectUUT(pi.ProjectName);
                if (uut != null)
                {
                    pi.UutName = uut.name;
                    pi.UutId   = uut.uuid;
                }
            }
            string fileName = Path.Combine(ATMLContext.TESTSET_PATH, pi.ProjectName, "project-info.xml");

            FileManager.WriteFile(fileName, Encoding.UTF8.GetBytes(pi.Serialize()));
            LogManager.Warn(
                "Failed to find the project information file so a new file has been created.");
            return(pi);
        }
예제 #2
0
        public static void CreateProject(ProjectInfo projectInfo)
        {
            //--- Prompt for a test set name ---//
            //--- Check if the name exisists ---//
            //--- If name exists then notify the user, ask if they want to open that test set ---//
            //--- Otherwise create the test set and open it ---//
            if (projectInfo != null)
            {
                TestProgramSet currentTestProgramSet = TestProgramSet.CreateTestSet(projectInfo.ProjectName);
                if (currentTestProgramSet != null)
                {
                    SaveProjectInfo(projectInfo, currentTestProgramSet);
                    OpenProject(projectInfo.ProjectName);
                    Document uutDescriptionDocument = DocumentManager.GetDocument(projectInfo.UutId);
                    if (uutDescriptionDocument != null)
                    {
                        SaveATMLDocument(UutManager.BuildAtmlFileName(projectInfo.UutName),
                                         AtmlFileType.AtmlTypeUut,
                                         uutDescriptionDocument.DocumentContent);
                    }

                    //--- Create a Test Description ---//
                    if (uutDescriptionDocument != null)
                    {
                        var uutDoc = new DocumentReference();
                        uutDoc.ID   = "UUT1";
                        uutDoc.uuid = uutDescriptionDocument.uuid;
                        var uutRef = new ItemDescriptionReference();
                        uutRef.Item = uutDoc;
                        var testConfiguration = new TestConfiguration15();
                        testConfiguration.uuid = Guid.NewGuid().ToString();
                        testConfiguration.TestedUUTs.Add(uutRef);
                        SaveATMLDocument(projectInfo.ProjectName + ATMLContext.ATML_CONFIG_FILENAME_SUFFIX,
                                         AtmlFileType.AtmlTypeTestConfiguration,
                                         Encoding.UTF8.GetBytes(testConfiguration.Serialize()));
                    }
                }
            }
        }