コード例 #1
0
        static void Main(string[] args)
        {
            using (TCAPI tcapi = TCAPI.CreateInstance())
            {
                TCWorkspace     workspace      = tcapi.OpenWorkspace(@"C:\Users\estan\Desktop\trainings\TOSCA Customizations\Tosca Workspace\Training Customizations\Training Customizations.tws", "Admin", "");
                TCProject       project        = workspace.GetProject();
                List <TCObject> result         = project.Search($"=>SUBPARTS:TCFolder[UniqueId==\"{unique_id_test_case_folder}\"]");
                TCFolder        testCaseFolder = (TCFolder)result.First();
                testCaseFolder.Checkout();

                TestCase testCase = testCaseFolder.CreateTestCase();
                testCase.Name = "Test Creating Test Case";

                XModule tboxSetBuffer = (XModule)project.Search($"=>SUBPARTS:XModule[UniqueId==\"{unique_id_tbox_set_buffer}\"]").First();
                XModule tboxWait      = (XModule)project.Search($"=>SUBPARTS:XModule[UniqueId==\"{unique_id_tbox_wait}\"]").First();


                XTestStep      setBufferTestStep  = testCase.CreateXTestStepFromXModule(tboxSetBuffer);
                XTestStepValue setBUfferStepvalue = setBufferTestStep.CreateXTestStepValue(tboxSetBuffer.Attributes.First());
                setBUfferStepvalue.Name       = "Test Buffer Creation";
                setBUfferStepvalue.Value      = "42";
                setBUfferStepvalue.ActionMode = XTestStepActionMode.Input;

                XTestStep      tboxSetWaitTimeStep      = testCase.CreateXTestStepFromXModule(tboxWait);
                XTestStepValue tboxWaitSettimeStepValue = tboxSetWaitTimeStep.TestStepValues.First();
                tboxWaitSettimeStepValue.Value = "500";
            }
        }
        public override TCObject Execute(TCObject obj, List <TCObject> dropObjects, bool copy, TCAddOnTaskContext context)
        {
            TCFolder folder = obj as TCFolder;
            TestCase tc     = folder.CreateTestCase();

            tc.Name = "AddOn Drag-drop Test Cases";
            foreach (TCObject objDrop in dropObjects)
            {
                TCFolder        moduleFolder = objDrop as TCFolder;
                List <TCObject> modules      = moduleFolder.Search("=>SUBPARTS:XModule");
                tc.CreateXTestStepFromXModule(modules);
            }
            return(null);
        }
コード例 #3
0
        public override TCObject Execute(TCObject obj, List <TCObject> dropObjects, bool copy, TCAddOnTaskContext context)
        {
            TCFolder folder   = (TCFolder)obj;
            TestCase testCase = folder.CreateTestCase();

            testCase.Name = "Drop Task AddOn";
            testCase.EnsureUniqueName();

            foreach (var objDrop in dropObjects)
            {
                TCFolder moduleFolder = objDrop as TCFolder;
                if (moduleFolder == null)
                {
                    continue;
                }
                List <TCObject> modules = moduleFolder.Search("=>SUBPARTS:XModule");
                testCase.CreateXTestStepFromXModule(modules);
            }

            return(null);
        }