Book a Demo

Author Topic: Autogenerating Internal Tests  (Read 4558 times)

mcamack

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Autogenerating Internal Tests
« on: March 03, 2017, 10:09:04 am »
I've spent a few hours trying to figure this out... I know I'm missing something simple, but can't figure it out. I want to Generate Internal Tests for each scenario. I am obviously using the ScenarioTestType enumeration wrong, can anybody help? I am trying to use the stInternal enumeration. I'm at the point of blindly trying any combo of Repository, EnumScenarioTestType, ObjectType, .'s  , ()'s , and am totally lost now.

Excerpt of the basic code I'm using:
xmlguid = Project.GUIDtoXML(currentScenarios.GetAt(j).ScenarioGUID);
   //This returns: EAID_CF4FF1DB_0834_472e_ADD1_2A05843C12DF   
Project.GenerateTestFromScenario(xmlguid, stInternal)
   //This returns 0 indicating it failed and no tests are created



mcamack

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Autogenerating Internal Tests
« Reply #1 on: March 03, 2017, 10:28:05 am »
BTW, I am using Javascript and I have tried the line below, but it says EnumScenarioTestType is undefined... even though it changes text color to purple which means it recognizes it as something...?

Code: [Select]
var test = EnumScenarioTestType.stInternal

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Autogenerating Internal Tests
« Reply #2 on: March 03, 2017, 11:11:20 am »
In scripting just use stInternal, not EnumScenarioTestType.stInternal.  Enums such as this are defined in Local Scripts.EAConstants-JScript.

Code: [Select]
!INC Local Scripts.EAConstants-JScript
[...]
var test = stInternal;

Regarding your original problem, you need to pass the ElementGUID for the element that contains the scenarios, not the GUID of a specific scenario.  Using GUIDtoXML is also optional here - EA will recognize it either way.

Code: [Select]
Project.GenerateTestFromScenario(element.ElementGUID, stInternal);

mcamack

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Autogenerating Internal Tests
« Reply #3 on: March 04, 2017, 02:45:32 am »
It worked, thank you very much! Not sure how I would've figured that out reading the documentation.