Let us start write a simple test case, launching the website and verifying it's title.
Step 2: On the next window enter sample package and sample
test name, as shown below. Click Finish
Step 3: User should see the TestNG test created. The @Test is a TestNG annotation that denotes main function of the test case.
Step 4: Copy and paste the below code in the test
created and save it
Step 5: Right click on the test SampleSeleniumTest.java à
Run As à TestNG Test. User should see execution started.
Step 6: Three different Results reports
Console Report: In the console user can see number of tests Run, Passed and Failed
TestNG
Results: If the test passed it will be in green color otherwise in red.
TestNG HTML Results Report: Right click on the project and Refresh it. User will see now test-output folder, expand it. Now open index.html as web browser to see the html reports in TestNG.
That’s it, we successfully completed writing our first selenium test
with TestNG. Hope this information is helpful to you, please share with your friends.
#HappyTesting #HappyLearning
#HappyTesting #HappyLearning
No comments:
Post a Comment