public void v_OwnerInformation()
        {
            Helper.WaitForElement(By.TagName("h2")).Text.Should().Match("Owner Information");
            GraphWalkerRestClient.setData("numOfPets = " + Helper.WaitForElements(By.XPath("//th[text()=\"Visit Date\"]")).Count + ";");

            JObject jsonData = GraphWalkerRestClient.getData();

            Console.WriteLine("  Number of pets (the data is fetched from PetClinic and set in the model): " + jsonData.GetValue("numOfPets"));
        }
Exemple #2
0
        private void run(string fileModelName)
        {
            GraphWalkerRestClient.load(fileModelName);

            // As long as we have elemnts from GraphWalkers path generation
            // to fetch, we'll continue
            while (GraphWalkerRestClient.hasNext())
            {
                // Get the next element name from GraphWalker.
                // The element might either be an edge or a vertex.
                JObject nextStep = GraphWalkerRestClient.getNext();

                // Create a mapping from the model name to an actual class.
                Type            type = Type.GetType("PetClinic." + nextStep.GetValue("modelName").ToString());
                ConstructorInfo ctor = type.GetConstructor(System.Type.EmptyTypes);

                // Invoke a method to call. If the currentElementName is null,
                // it means that it's an edge with no name. In practicality, this is a noop, a no operation.
                // No method to call, so we should move on to next step.
                if (nextStep.GetValue("currentElementName") != null)
                {
                    Console.WriteLine("Model and element to be called: " +
                                      nextStep.GetValue("modelName").ToString()
                                      + "." +
                                      nextStep.GetValue("currentElementName").ToString());

                    object instance = ctor.Invoke(null);

                    // Create a mapping from the element name to an actual method.
                    MethodInfo methodInfo = type.GetMethod(nextStep.GetValue("currentElementName").ToString());
                    methodInfo.Invoke(instance, new object[] {});
                }
            }

            // Get the statistics from the test
            Console.WriteLine(GraphWalkerRestClient.getStatistics());
        }