Filter on tag of scenario outline example
- 4 years ago
Ah, I see. This is going to be a bit tricky in any automation framework since the tag isn't necessarily part of the input data for whatever routine is executed. There is a way to capture that in TestComplete however, using the Project.TestItems.Current object.
Below is a way of evaluating a tag for a predetermined value and setting a temporary project variable of Boolean type, based on the tag itself;
Given("some precondition", function (){ Log.Message(Project.TestItems.Current.ElementToBeRun.Caption); Log.Message("Store The Timings? " + aqString.StrMatches("examples2", Project.TestItems.Current.ElementToBeRun.Caption)); Project.Variables.Exporttimings = aqString.StrMatches("examples2", Project.TestItems.Current.ElementToBeRun.Caption); Log.Message("Executing First Step"); /* * Calls to Project.KeywordTests tests or Script functions go here */ });
( I used JavaScript, but the concept would be the same for any of the supported languages in TestComplete ).
If you're using an After Scenario Hook that can evaluate the Project Variable, then you can perform the timing export just for that particular tag;AfterScenario(function (scenario){ // Perform some action after executing a scenario, for example: Log.Message("The " + scenario.Name + " scenario has been executed"); Log.Message("Return The Timings? " + Project.Variables.Exporttimings ); if (Project.Variables.ExportTimings){ exportTimings(Project.Variables.TimingData ); } })
This results in a Test Log that looks like this;
and if we use the other tag, our test log looks like this;
Do you think that may handle your requirements?