WebDriverIO – Run Single Test File in WebDriverIO
This Article is about to run a single test file when there are multiple test files available in “test/specs/” folder.
Pre-requisite: Have ‘Visual Studio Code’ IDE installed in your machine (Click here to install if not installed in your machine)
Run Single Test File
In This Article we will use two test files from our previous articles and then we will run one test file out of those two test files present in same folder.
Pre-requisite: Download the Project from here (Click here to Download) and Unzip it.
1) Open Visual Studio Code on your system
2) Click on File and Select Open Folder. Select the project folder on which your workspace is present.
3) Click on ‘wdio.conf.js’ to open in the IDE, and make sure the Test file name is updated properly in this file as shown below and save it:
4) Click on Terminal and Open New Terminal.
5) By Default, Powershell Terminal will open as shown below:
6) Run geckodriver.exe in the Powershell terminal as shown below to run Geckodriver in background.
7) Open Another Terminal in the same way we did in the step 4 and run below command in terminal
.\node_modules\.bin\wdio .\wdio.conf.js –spec .\test\specs\DragAndDrop_test.js
Observe that single test file as mentioned in above command i.e., ‘DragAndDrop_test.js’ will get executed successfully, the Firefox Browser will launch and respective action will be taken by WebDriverIO Automation code.
And also, the result will be displayed as ‘Passed’ in the terminal as shown below:
> To learn more about WebDriverIO, continue to the next post (Click on Next Post link below)
> Check complete WebDriverIO Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning 🙂
On a mission to contribute to the Software Testing Community in all possible ways.