Book a Demo

Author Topic: ScenarioSteps in automation  (Read 4292 times)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
ScenarioSteps in automation
« on: June 25, 2012, 08:35:37 pm »
I'm currently trying to manipulate scenario steps via automation but to no avail. I can create steps and the update succeeds, but looking into the GUI there is nothing (the t_objectscenarios is also empty).

Vice versa when I look into a manually created scenario with steps via automation EA tells me that Steps.Count is zero.

Is it me doing something completely stupid or is the Steps collection not working at all?

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: ScenarioSteps in automation
« Reply #1 on: June 26, 2012, 08:30:16 am »
It might be easier to say what you're doing wrong if you include a code sample.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioSteps in automation
« Reply #2 on: June 26, 2012, 09:07:28 am »
Yes. Might be a bit more helpful:
Code: [Select]
$e = $rep->GetElementByGUID ($guid);
$scenario = $e->Scenarios->AddNew ("abc", "Basic");
$scenario->Update;
$s = $scenario->Steps->AddNew ("step1", "1");
$s->Update();
After that I don't see any new steps. The scenario is created.

Now, I just ran the reverse code to retrieve a manually created step. This failed before but now does work.

However, above code still does not work.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: ScenarioSteps in automation
« Reply #3 on: June 27, 2012, 09:00:24 am »
Add a call to $scenario->Update; at the end.

If fact in this case (I know, unlike everywhere else) you don't need the update before calling AddNew to create the child.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioSteps in automation
« Reply #4 on: June 27, 2012, 09:53:22 am »
Thanks Simon, that worked. Well, I will not start arguing about EAUI ;-)
Instead this comes handy as another little chest for my book.

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioSteps in automation
« Reply #5 on: July 13, 2012, 08:35:26 am »
Hi Simon,
hope you read this one. I went on and tried to populate the scenario steps:
Code: [Select]
$s = $scenario->Steps->AddNew ("step1", "1");
$s->{Uses} = "use";
$s->{State} = "state";
$s->{Results} = "results";
$s->Update();
After that Uses and State contain the passed values. But Result is empty. I looked in the debugger which showed me that all values were set correctly. But EA seems to throw away Results. Doing it from the GUI works.

What's wrong here?

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioSteps in automation
« Reply #6 on: July 15, 2012, 06:36:05 am »
I guess it's simply once again EA...

q.