Forum Discussion

Nikolayev's avatar
Nikolayev
Contributor
3 years ago

SCENARIO tags Features - How doing it with Python language ?

Hello Smartbear Community,  Maybe you can help for this question.

I'm am interesseted with the Scenario and tags features, but I don't know how to start.

I have downloaded the samples the TestComplete 15 Samples 

I have found .JS samples of simple sentences started with basic words like WHEN, GIVEN, THEN: 

 

When("I launch website {arg}", function (url){
Browsers.Item(btIExplorer).Run(url)
});

Given("I have launched the website {arg}", function (url){
aqObject.CheckProperty(Aliases.Browser.WaitPage(url), "Exists", cmpEqual, true);
});

 

Then("the item {arg} must be added to cart", function (product){
//Check that contentText property value contains the expected product
aqObject.CheckProperty(Aliases.Browser.ProductPage.Cart, "contentText", cmpContains, product, false);
});

 

I don't know if it is possible to make them in Python , which is the language I use.

 

Thanks for help ! 

 

Kinds Regards

 

NIKO

  • Thanks mattb      We have found how it is Working  !   It was just a Syntaxe issue.

    I change the scenario with : 

     

     

    then a Generate and completed steps definitions with a "right clic" like this  : 

     

     

    then the website is open , the checkpoind is done ans I have the good complete logs now

    It's easy now !  thank you very much for your help ! This can be very usefull to describe our user stories 

     

      

     

     

  • Thanks mattb      We have found how it is Working  !   It was just a Syntaxe issue.

    I change the scenario with : 

     

     

    then a Generate and completed steps definitions with a "right clic" like this  : 

     

     

    then the website is open , the checkpoind is done ans I have the good complete logs now

    It's easy now !  thank you very much for your help ! This can be very usefull to describe our user stories 

     

      

     

     

    • Nikolayev's avatar
      Nikolayev
      Contributor

      Thank you Matt for your answer.

      Yes, All my project are with Python. It's a good news because it seems to be possible to do this with Python and I don't have to make new ones.

      My question is now : How to make the sentences. I am trying to move this .JS code :  

         When("I launch website {arg}", function (url){
         Browsers.Item(btIExplorer).Run(url)
         });   

       

      into  a Python code ?

  • Thanks Matt I'm close to achieve this with the good document to start.

     

    So, if I understand, the lines bellow @When("I launch website")

    are always the step to do the action "I launch t?   I mean the name of the function that is  " step_imp()"  could be "step_abcd()" and with this it will do the same ?

     

    • mattb's avatar
      mattb
      Staff

      the step_imp can be changed to be any function name like step_abcd, 
      Here is a picture to help