private XRayTest CreateTestCase(string testName, List <TestCaseStep> testSteps)
        {
            //Potentially use the 'import' instead of this as it may be much quicker
            GenerateTestSteps(testSteps, out var steps);

            var folder = string.IsNullOrEmpty(TestFolder) ? "" : "folderPath: \"" + TestFolder + "\"";

            var query = "mutation {createTest(testType: { name: \"Automated\" }steps: "
                        //+"[{action: \"Create first example step\", result: \"First step was created\"},{action: \"Create second example step with data\", data: \"Data for the step\", result: \"Second step was created with data\" }]"
                        + steps
                        + " jira: {fields: { summary:\"" +
                        testName.Trim() + "\", project: {key: \"" + Project + "\"} }}" + folder + ") {test {issueId testType {name} steps {id action data result} jira(fields: [\"key\", \"summary\"])} warnings}}";


            dynamic rsp;

            lock (Locker)
            {
                Wait();
            }
            rsp = ApiObj.PostCall(Endpts.Graph, new { query }, "");

            if (Convert.ToString((object)rsp).ToLower().Contains("error"))
            {
                try
                {
                    Console.WriteLine(Convert.ToString((object)rsp));

                    Console.WriteLine($"Query: {query}");
                }
                catch { }
            }

            var test = new XRayTest(rsp.data.createTest.test);

            Tests.Add(test);
            return(test);
        }
        private void UpdateTestCase(string testName, XRayTest test, List <TestCaseStep> testSteps)
        {
            //check diff count
            var diff = test.StepDiff(testSteps);

            if (diff > EditTestThreshold)
            {
                RemoveTestFromTestRun(test.IssueId);
                MoveTestCase(test.IssueId, RetiredFolder);
                CreateTestCase(testName, testSteps);
            }
            else if (diff > 2)
            {
                var mutations   = new List <string>();
                var removeItems = true;
                int index;
                for (index = 0; index < testSteps.Count; index++)
                {
                    //if testSteps is out of range, break
                    if (index >= test.Steps.Count)
                    {
                        removeItems = false;
                        break;
                    }
                    else if (!((string)test.Steps[index].action).Equals(testSteps[index].StepDescription.Replace("\\", "-")))
                    {
                        break;
                        //if old and new steps don't match, break
                        //make sure prior steps are removed from that index on
                    }
                }

                if (removeItems || testSteps.Count < test.Steps.Count)
                {
                    //TODO figure out how to remove steps if any remain
                    for (int i = index; i < test.Steps.Count; i++)
                    {
                        mutations.Add($"removeTestStep(stepId: \"{(string)test.Steps[i].id}\")");
                    }
                }

                //update test steps that already exist
                for (int i = index; i < test.Steps.Count && i < testSteps.Count; i++)
                {
                    GenerateTestSteps(new List <TestCaseStep>()
                    {
                        testSteps[i]
                    }, out var str);
                    mutations.Add($"updateTestStep(stepId: \"{(string)test.Steps[i].id}\" step: {str[1..^1]})");
                }

                //add new test steps
                for (int i = test.Steps.Count; i < testSteps.Count; i++)
                {
                    GenerateTestSteps(new List <TestCaseStep>()
                    {
                        testSteps[i]
                    }, out var str);
                    mutations.Add($"addTestStep(issueId: \"{(string)test.IssueId}\" step: {str[1..^1]}){{id}}");
                }

                for (int i = 0; i < mutations.Count; i += 10)
                {
                    var query = $"mutation {{ {string.Join(" ", GetMutationSubset(mutations, i))} }}";

                    dynamic rsp;
                    lock (Locker)
                    {
                        Wait();
                    }
                    rsp = ApiObj.PostCall(Endpts.Graph, new { query }, "");
                }

                //TODO build call to add new test steps

                //somehow figure out how to update the steps
                //start with finding where steps differ
                //from that point, update existing steps
                //if now fewer steps, then remove excess
                //if now more steps, then add
                //if steps are the same, then make no change
            }
        }