private StepInstance CreateStepInstance(Profile profile, ProfileCounters counters, StepInstance parentStepInstance, AndStep step) { var stepInstance = new AndStepInstance(this, parentStepInstance, step); CreateChildStepInstances(stepInstance, step, profile, counters); return(stepInstance); }
private static ProfileCounters CreateCounters(ScenarioCounters scenarioCounters, Profile profile) { var counters = new ProfileCounters(scenarioCounters, profile.Name, profile.Enabled); foreach (var step in profile.Steps) { AddCounters(counters, profile, step); } return(counters); }
private StepInstance CreateStepInstance(Profile profile, ProfileCounters counters, StepInstance parentStepInstance, Step step) { if (step is ComponentStep) { return(CreateStepInstance(counters, parentStepInstance, (ComponentStep)step)); } if (step is OrStep) { return(CreateStepInstance(profile, counters, parentStepInstance, (OrStep)step)); } if (step is AndStep) { return(CreateStepInstance(profile, counters, parentStepInstance, (AndStep)step)); } return(null); }
public ProfileInstance(Profile profile, ProfileCounters counters, int user, int totalUsers) { _profile = profile; _user = user; _totalUsers = totalUsers; _counters = counters; _iteration = counters.NextIteration; // Create the test fixture to run the profile. _testFixture = Container.Current.Resolve <IProfileTestFixture>(_profile.TestFixture); // Create the step hierarchy. var rootStep = new AndStepInstance(this, null, new AndStep()); CreateChildStepInstances(rootStep, profile.Steps, profile, counters); CurrentStep = rootStep; }
private static void AddCounters(ProfileCounters profileCounters, Profile profile, Step step) { var componentStep = step as ComponentStep; if (componentStep != null) { profileCounters.Add(componentStep.Name, new StepCounters(profileCounters, profile.Name, componentStep.Name, step.Enabled)); return; } var stepList = step as StepList; if (stepList != null) { foreach (var childStep in stepList) { AddCounters(profileCounters, profile, childStep); } } }
private StepInstance CreateStepInstance(ProfileCounters counters, StepInstance parentStepInstance, ComponentStep step) { // Look for the method. MethodInfo endMethod = null; var beginMethod = _testFixture.GetType().GetMethod(step.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding); if (beginMethod == null) { // Look for a Begin-End pair. beginMethod = _testFixture.GetType().GetMethod("Begin" + step.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding); if (beginMethod == null) { throw new ApplicationException("Method '" + step.Name + "' not found on profile '" + _testFixture.GetType().FullName + "."); } endMethod = _testFixture.GetType().GetMethod("End" + step.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding); } return(new ComponentStepInstance(this, parentStepInstance, step, beginMethod, endMethod, counters.StepCounters[step.Name])); }
public StepCounters(ProfileCounters profileCounters, string profile, string name, bool enabled) { _profileCounters = profileCounters; var instance = profile + ":" + name; _enabled = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.Enabled, instance); _currentlyExecuting = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.CurrentlyExecuting, instance); _totalCalls = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.TotalCalls, instance); _totalErrors = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.TotalErrors, instance); _callsPerSecond = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.CallsPerSecond, instance); _averageTime = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.AverageExecutionTime, instance); _averageTimeBase = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.AverageExecutionTimeBase, instance); _lastTime = GetPerformanceCounter(Constants.Counters.Step.Name, Constants.Counters.Step.LastExecutionTime, instance); _enabled.RawValue = enabled ? 1 : 0; _currentlyExecuting.RawValue = 0; _totalCalls.RawValue = 0; _totalErrors.RawValue = 0; _callsPerSecond.RawValue = 0; _averageTime.RawValue = 0; _averageTimeBase.RawValue = 0; _lastTime.RawValue = 0; }
public ProfileData(Profile profile, ProfileCounters counters, int percentage) { _profile = profile; _counters = counters; _percentage = percentage; }
private void CreateChildStepInstances(StepInstanceList stepInstance, IEnumerable <Step> steps, Profile profile, ProfileCounters counters) { foreach (var step in steps) { var childStepInstance = CreateStepInstance(profile, counters, stepInstance, step); if (stepInstance != null) { stepInstance.Add(childStepInstance); } } }