Budgeting is a tough thing to do. In a world where we are bombarded with products to spend our money on and access to credit, it is increasingly harder to maintain a balanced financial outlook. As…
One of the challenges I faced automating was to use different datasets from two different environments on the same test scripts.
How I addressed this challenge:
Read files at run time based on NODE environment passed through command line.
Steps to follow:
To address this challenge, I created test data directories for two different environments and named it as ‘dev’ and ‘test’. Under each of this directory, I created a json file containing different test data to be used
Update the dev/LoginPage.json file with the following attributes
Update the test/LoginPage.json file with the following attributes
Now create a js file under ‘testdata’ folder to read and export all data files from the ‘dev’ environment as shown below: for instance, testdata/dev.js
Note: *someMoreData is a reference to indicate additional test data files could be read and exported.
Now create a js file under ‘testdata’ folder to read and export all data files from the ‘test’ environment as shown below: for instance, testdata/test.js
Note: *someMoreData is a reference to indicate additional test data files could be read and exported.
Test data folder structure after creation of respective files is as seen below,
Create login.spec.js test script file, which would use the test data attributes defined in the Json file. Import the index.js file, in order to use the test data values in the login.spec.js file. Below is an example of login.spec.js file that would take url and login details.
This should trigger https://<dev-env.com> and login using values defined under dev/LoginPage.json file.
This should trigger https://<test-env.com> and login using values defined under test/LoginPage.json file.
Iterate over an array of promises in sequence, one after another:. “Sequential Iteration of Promise based tasks” is published by artze.
On my travel Sabbatical, I took a much-needed break from reading business books, and even as I’ve started working on a business the last few months, I haven’t really gone back. But I just finished…
When we started working remotely after COVID19, Slack became our office. All conversations were integrated into Slack, and for the first few months, it seemed to work fine. However, many people felt…