HomeVitaq AI

Power of JavaScript and Python in a single test environment

Power of JavaScript and Python in a single test environment

<<Complete Vitaq AI Tutorial>>                                         Next Post>>

Power of JavaScript and Python in a single test environment

In this next article of the Vitaq AI Test Automation Tutorial Series, I will demonstrate how we can use the ‘feature-rich’ JavaScript and Python languages together to achieve our Test Automation Goals in a single test environment.

To understand it in a much better way, let’s follow an exercise where we will compare the item price of a product present on the “saucedemo.com” web shopping app with a separate reference price list of all of the products. In our example, we have this reference price list created as a separate CSV file that can be used by our ‘Oracle’ (golden reference model) Test Action which we have called CheckPrice.  This ‘checking’ action has a test script written in python code to take advantage of the powerful data manipulation of Python that is so popular with data scientists. All of the rest of our Test Activity test action scripts are implemented in JavaScript code, to keep the native language of the web and its versatility to use with Selenium (or Appium). Wow! Yes, we are using both of these really powerful languages together in ONE and the same test environment. Are you getting excited?

Let’s Visualise it:-

1) Open SauceDemo.com.

2) Login with Accepted usernames and password given below on SauceDemo.com Home Page.

3) After login, you will land to the Products page. Now click on any of the products. I am clicking on Sauce Labs Bolt T-shirt.

4) Now compare Item Price of Sauce Labs Bolt T-Shirt with the Price present in CSV file correspond to the Same Product. it should match and print “The price is correct” in Vitaq Console Script Output.

Let’s Perform the same in Vitaq AI Test Automation Tool:-

1) Open Vitaq AI Test Automation Tool.

2) Open “SwagLabsJavascriptPython.vtq” from Example Folder and observe that all of the Test Actions are present in JavaScript except the CheckPrice Test Action which is acting as Test Oracle which has been written in Python Code.

3) Now let’s run Individual UserJourney for tshirt_bolt by clicking on Run Button present alongside with UserJourney name under the Sequence Tab. 

4) After Run completion of User Journey for Tshirt Bolt. Open Script output of Vitaq AI and verify message should appear as The Price is correct.

This is how we can use the power of both JavaScript and Python language and use their feature-rich libraries and achieve our Test Automation Goals.

Stay tuned for more Articles on Vitaq AI Test Automation Tool.

Next Steps:

> To learn more about Vitaq AI, continue to the next post (Click on Next Post link below)

> Check complete Vitaq AI Tutorial Contents here (Click here)

Please leave your questions/comments/feedback below.

Happy Learning?

About Me > Ajay Lunia 

Connect to me on LinkedIn (Click here)

On a mission to help the Software Testing Community in all possible ways.

<<Complete Vitaq AI Tutorial>>                                        Next Post>>

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

Open chat
Contact Us on Whatsapp