Selenium Framework for Beginners 9 | What is TestNG | How to install TestNG for Selenium

  Рет қаралды 160,380

Automation Step by Step

Automation Step by Step

Күн бұрын

New link for TestNG: dl.bintray.com/testng-team/te...
After watching take this QUIZ - automationstepbystep.com/2021...
All FREE courses - automationstepbystep.com/
Today we will learn:
Add TestNG plugin
Add testng library (Java and Maven project)
Create and run TestNG tests
Create run configuration for TestNG
How to create TestNg reports
Create testng.xml file
STEPS: TestNG on Intellij IDEA
Step 1 - Open IntelliJ IDEA
Step 2 - Goto Settings > Plugins (check if testng is available)
Step 3 - Add TestNG jar OR Maven dependency
Step 4 - Create class and test methods - Add testng annotations > Run
To Create configuration - Run > Edit Configurations
To create testng.xml - add plugin Create TestNg XML
Stories by Raghav - automationstepbystep.com/stor...
My Udemy Courses - automationstepbystep.com/udem...
Every LIKE & SUBSCRIPTION gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can.
Never Stop Learning
Raghav
Today we will learn - What is TestNG | How to install TestNG
1. What is TestNG
2. How to install TestNG in eclipse
3. How to add TestNG libraries in Selenium Project
What is TestNG
TestNG is a testing framework for the Java programming language created by Cédric Beust and inspired by JUnit and NUnit.
Makes test creation, execution and reporting efficient
Uses annotations like
@BeforeTest, @AfterTest,
@BeforeSuite, @AfterSuite
@BeforeMethod, @AfterMethos
@BeforeClass, @AfterClass
NG = Next Generation
Step 1 : Add TestNG plugin in Eclipse
Step 2 : Add TestNG libraries
Step 3 : Validate
Advantages of TestNG
Makes test creation, execution and reporting efficient
Helps in Grouping of tests
Helps in Prioritizing of tests
Parallel execution
Reporting
REFERENCES
testng.org/doc/index.html
github.com/cbeust/testng-ecli...
en.wikipedia.org/wiki/TestNG
mvnrepository.com/
#SeleniumJavaFramework #SeleniumTutorials #SeleniumTraining #SeleniumFramework #SeleniumJavaTutorial #SeleniumBeginnerTraining
FREE Courses - automationstepbystep.com/
Like, Subscribe & Share
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping animalaidunlimited.org/ or any animal welfare group near you
Never Stop Learning
Raghav
automationstepbystep.com/

Пікірлер: 276
@akidapratama44
@akidapratama44 4 жыл бұрын
God bless you Sir ! Thanks for the lesson. I've been struggling with selenium learning and now I've found my go-to place
@RaghavPal
@RaghavPal 4 жыл бұрын
Happy to know this Akida, you will find all here automationstepbystep.com/
@Concerned_Indianz
@Concerned_Indianz 4 жыл бұрын
Hi Raghav Thanks for your videos,, Great explanation, All of your courses really helps the beginners. Your time, patience and dedication in making this videos really deserve a salute from me from NZ.
@RaghavPal
@RaghavPal 4 жыл бұрын
So happy and humbled to see your message Ayyub
@rakeshbhardwaj2191
@rakeshbhardwaj2191 4 жыл бұрын
Hello Raghav, Many Many CONGRATULATIONS for Silver Play Button Award.. you deserve it man ! Proud moment, You are really an inspirational. your videos helped me and many others in up scaling. Take care and stay healthy :) I have a request for Playlist for cucumber framework in selenium. Pls invest some time in creating it. THANK YOU !
@RaghavPal
@RaghavPal 4 жыл бұрын
Thanks a lot Rakesh, I will definitely do Selenium with Cucumber soon
@fnfentertainment552
@fnfentertainment552 5 жыл бұрын
Thank you very much for this kind of video... it is very easy to understand & learn very quickly. I wish Mr.Raghav Pal keep in good health
@RaghavPal
@RaghavPal 5 жыл бұрын
Thanks for your message and wishes
@icebluebear
@icebluebear 2 жыл бұрын
This is the best Selenium tutorial i have ever seen so far!
@RaghavPal
@RaghavPal 2 жыл бұрын
Glad it was helpful!
@artcraftrishitaumathe4597
@artcraftrishitaumathe4597 10 ай бұрын
I have been told about this sites by one of my friends and I am extremely happy to watch and implement the frame work.Thanks so much.
@RaghavPal
@RaghavPal 10 ай бұрын
You are most welcome Rishita
@prachimuddapur
@prachimuddapur 4 жыл бұрын
Thank you for introducing TestNG in such a well prepared and easy to understand manner Raghav!
@RaghavPal
@RaghavPal 4 жыл бұрын
Glad you liked it Prachi
@tasha6397
@tasha6397 4 жыл бұрын
Thank you very much for the excellent course!
@RaghavPal
@RaghavPal 4 жыл бұрын
You're welcome Tasha
@nistan5404
@nistan5404 4 жыл бұрын
Your videos are very helpful for beginners like us thank you so much :) for uploading such kind of useful videos...Please also upload videos for cracking interview questions for automation QAs in ( Selenium + C#) or (Selenium +Java).
@RaghavPal
@RaghavPal 4 жыл бұрын
I will do. Thanks for the message
@orlandodelacruz4027
@orlandodelacruz4027 4 жыл бұрын
Really nice all your videos! Thanks for share! 😎👌
@RaghavPal
@RaghavPal 4 жыл бұрын
You're welcome Orlando
@apurvajagannatha7761
@apurvajagannatha7761 Жыл бұрын
Thank you so much... This saved my Day.
@vishwamacharya5742
@vishwamacharya5742 2 жыл бұрын
Thank you for this series!!!! Very helpfull.
@RaghavPal
@RaghavPal 2 жыл бұрын
You're very welcome Vishvam
@zarkostepanov
@zarkostepanov Жыл бұрын
Thanks, Ragav, you are just amazing!!!! Thank you for all these videos!!!!
@RaghavPal
@RaghavPal Жыл бұрын
Glad you like them Zarko
@cherkaouikhaoulacoachpnl
@cherkaouikhaoulacoachpnl 4 жыл бұрын
you are great that what i can say about all , thank youu so much for your help
@RaghavPal
@RaghavPal 4 жыл бұрын
Humbled to see your message.
@neildeleon9810
@neildeleon9810 4 жыл бұрын
testNG have new links now. :) Thanks raghav!
@RaghavPal
@RaghavPal 4 жыл бұрын
Yes, I will try to update soon
@starSha1982
@starSha1982 4 жыл бұрын
This video was very useful. Thanks
@RaghavPal
@RaghavPal 4 жыл бұрын
You're welcome Shaji
@umeshbp1913
@umeshbp1913 2 жыл бұрын
Hi Raghav thanks for the videos, I am beginner for these it is grate helpful to me.
@RaghavPal
@RaghavPal 2 жыл бұрын
Most welcome Umesh
@PritishRastogi
@PritishRastogi 5 жыл бұрын
Hi Raghav, How to run the java file using TestNG after adding Jar files in my project. I don't have configured Maven in my project and I don't have any POM.XML file. I'm not getting any option in "Run As"
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Pritish, I will suggest you to create a maven project and use pom.xml. Else its going to be difficult to maintain and enhance your project. You can get the playlist here - kzfaq.info/sun/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa
@radhikabnarayan
@radhikabnarayan 4 жыл бұрын
Hello Raghav, Thanks so much for making these videos. They are super helpful! In this video we are installing TestNG separately, could you please explain why adding the dependency in pom.xml not be enough.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Radhika, by adding TestNG dependency, you can use testng annotations in your functions, However to run your scripts as TestNG tests in Eclipse, you will need to add the extension.
@udaybhaskar3897
@udaybhaskar3897 3 жыл бұрын
Very helpful... Thank you so much sir
@RaghavPal
@RaghavPal 3 жыл бұрын
Most welcome Uday
@bhagyashreeyede6784
@bhagyashreeyede6784 3 жыл бұрын
Hi Raghav...... Thank you for all videos. It is very helpful to me. Thanks alotzz 😇
@RaghavPal
@RaghavPal 3 жыл бұрын
Most welcome Bhagyashree
@mushfiquazaman9597
@mushfiquazaman9597 3 жыл бұрын
Very Helpful, Thank you Raghav.
@RaghavPal
@RaghavPal 3 жыл бұрын
Most welcome Mushfiqua
@arslanali6944
@arslanali6944 6 жыл бұрын
Hi sir I am big fan of your.... Please make videos on docker also.... Thanks God bless you
@RaghavPal
@RaghavPal 6 жыл бұрын
Hi Arslan, thanks a lot. I am humbled. You can check Docker playlist here - kzfaq.info/sun/PLhW3qG5bs-L99pQsZ74f-LC-tOEsBp2rK
@om1206
@om1206 4 жыл бұрын
Thank you! 👍👍👍
@RaghavPal
@RaghavPal 4 жыл бұрын
You're welcome
@sajithas6991
@sajithas6991 3 жыл бұрын
Thank you so much for the video. What ever we get the latest version....we have to download it right!!!
@RaghavPal
@RaghavPal 3 жыл бұрын
Yes Sajitha, can go with the latest stable ver
@sathishkumar-if1iz
@sathishkumar-if1iz 4 жыл бұрын
Very useful...thanks
@RaghavPal
@RaghavPal 4 жыл бұрын
You're welcome Sathish
@samarendrapatel2040
@samarendrapatel2040 2 жыл бұрын
Nice Video and the concept is welll explained.
@RaghavPal
@RaghavPal 2 жыл бұрын
Glad you liked it
@aloksharma1426
@aloksharma1426 5 жыл бұрын
Very Nice Sir...👍
@RaghavPal
@RaghavPal 5 жыл бұрын
Thanks for watching
@meditationandrelaxationmus741
@meditationandrelaxationmus741 2 жыл бұрын
This video is really good and helpful
@RaghavPal
@RaghavPal 2 жыл бұрын
Most welcome Ashwini
@nirmalrawtani4961
@nirmalrawtani4961 3 жыл бұрын
Very helpful. 🙂
@RaghavPal
@RaghavPal 3 жыл бұрын
Glad it was helpful Nirmal
@vipinsha
@vipinsha 3 жыл бұрын
Very nice session well explained
@RaghavPal
@RaghavPal 3 жыл бұрын
Thanks Vipin
@MIKEYSREVIEWS
@MIKEYSREVIEWS 5 жыл бұрын
Hi Raghav, For some reason I have the same Test_GoogleSearch.java file word for word. When I run it the browser opens but nothing happens. I checked it many times but it's the same. Message reads "No tests found. Nothing was run", but there is a test.
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi James, pls check if you have added the annotation @Test above your test method
@Aliislamic-j3y
@Aliislamic-j3y 2 жыл бұрын
thank you very much
@RaghavPal
@RaghavPal 2 жыл бұрын
Most welcome Nawid
@andrelaguerre586
@andrelaguerre586 4 жыл бұрын
Thanks for this lesson, would be nice to make the same with IntelliJ Idea and the latest Selenium 4
@RaghavPal
@RaghavPal 4 жыл бұрын
Great suggestion André
@sreelathatharigonda8306
@sreelathatharigonda8306 6 жыл бұрын
Hi Raghav, your explanation for all videos are very nice like Selenium,Log4j. If possible please share playlist url for TestNG.
@RaghavPal
@RaghavPal 6 жыл бұрын
Hi Sreelatha, you can check this playlist. I will add more videos soon to this SELENIUM JAVA FRAMEWORK BEGINNERSkzfaq.info/sun/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa
@poojanaik4356
@poojanaik4356 2 жыл бұрын
thanks for your lesson
@RaghavPal
@RaghavPal 2 жыл бұрын
You are welcome Pooja
@natasasuteva7969
@natasasuteva7969 3 жыл бұрын
Thank you :)
@RaghavPal
@RaghavPal 3 жыл бұрын
You're welcome Natasa
@zhengzixiang7052
@zhengzixiang7052 5 жыл бұрын
Thank you
@RaghavPal
@RaghavPal 5 жыл бұрын
You're welcome Zheng
@bharatpatare2830
@bharatpatare2830 10 ай бұрын
Thank You Very much sir
@RaghavPal
@RaghavPal 10 ай бұрын
Most welcome Bharat
@dheerajkumar-rd5jt
@dheerajkumar-rd5jt 4 жыл бұрын
Hi raghav Thanks for explaining.just one doubt. If i create a maven project and added testng dependency without adding testng plugin. I am able to see testng annoations but run as tetng is not visible.For sure i have to add testng plugin in my eclipse Ide?can you please explain on this?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Dheeraj, when you add testng maven dependency, you can use TestNG annotations in your test, but to run your tests as TestNG you will need testng plugin in Eclipse
@safiatakeem1943
@safiatakeem1943 5 жыл бұрын
Hey, I followed your all the steps from start, no error and exception in the run. But it is giving me the option "Run as -> Junit Test". i have added all the TestNG dependencies and they can be seen in Maven dependcies but its is not giving me thr Run option with TestNG why?
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Safia, just check the import statements. Pls make sure you import from testng and not from junit.
@jobinjoseph1788
@jobinjoseph1788 4 жыл бұрын
Hi Raghav, Thanks for your videos. These are really helpful and easy to follow. In this video you are opening index.html to see the results from inside eclipse. However when I open index.html from inside eclipse, it is displaying html code only. I can only see the page when i open it using system editor. How do I display the page from inside eclipse as well ?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Jobin, you can either right click on the file and open as system editor, this will use your default browser to open the file. You can also add a browser extension in eclipse stackoverflow.com/questions/8528454/how-do-you-open-the-eclipse-web-browser
@ahmettemel8245
@ahmettemel8245 3 жыл бұрын
thank you
@RaghavPal
@RaghavPal 3 жыл бұрын
You're welcome
@samdanibaig7605
@samdanibaig7605 4 жыл бұрын
Hi good morning!I have a dought Why we need testNG Plugin and libraries both . I am thinking those act like client and server is it correct
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Samdani, testNG library enables to use the testng functionalities, annotations in your project and TestNG plugin on eclipse enables to run our scripts as TestNG
@princejain9220
@princejain9220 5 жыл бұрын
Hello Raghav, Yours videos are really very helpful. Can you please arrange in sequence i.e. numbering as you did from 1 to 8. After 8 there is no sequence in "Selenium Java Framework Step by Step" video series. Thanks for your kind effort.
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Prince, I have updated this . Please check - kzfaq.info/sun/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa
@princejain9220
@princejain9220 5 жыл бұрын
@@RaghavPal Hi Raghav. Now I believe all videos are logically correct with respect to sequence. Thanks for your kind effort.
@RaghavPal
@RaghavPal 5 жыл бұрын
You're welcome Prince
@Alavistaven2012
@Alavistaven2012 4 жыл бұрын
@12:52 If you can't find TestNG, MAKE SURE you are adding @Test, @BeforeTest, and @Aftertest ANNOTATIONS. I accidentally added JUnit of which TestNG didn't show when I wanted to run. -,- So simple yet so annoying and time consuming. Also if you have an issue with maven, go to the project, right click maven and Update the project. Make sure to include the snapshots as well
@RaghavPal
@RaghavPal 4 жыл бұрын
Thanks for the information
@neildeleon9810
@neildeleon9810 4 жыл бұрын
Thanks raghav!
@RaghavPal
@RaghavPal 4 жыл бұрын
You're welcome Neil
@nasrs3901
@nasrs3901 5 жыл бұрын
Sir , firstly thank you for the tutorial.. Is there any tutorial for JBehave Selenium..? Our Project Using that
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Nasr, not yet on JBehave
@sainiranjan40
@sainiranjan40 3 жыл бұрын
Hi Raghav, If I am running LoginPageTest Class that has testCase, I have no issues. As I create another class (MaintenanceClass) within the same package and call loginPageTest class I get NullPointerException. Any thoughts ?
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Sai, looks like you are referring an object that has null value, Some issue in your class and object creation, pls check again
@sainiranjan40
@sainiranjan40 3 жыл бұрын
​@@RaghavPal I extended BasePage class yet I was getting NullPointerException. So I have accessed test case method by making it static and access using Class name rather than creating class object. I still don't understand but I was able to achieve. Thanks though!
@SwapnilChakote
@SwapnilChakote 11 ай бұрын
Nice sir ji
@RaghavPal
@RaghavPal 11 ай бұрын
Thanks Swapnil
@nsprajapati06
@nsprajapati06 4 жыл бұрын
Hey Raghav... Thank you so much for sharing such knowledge. Can you pls provide a video link for code you mentioned in set up function Thanks again
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Narendra, check this github.com/Raghav-Pal/SeleniumJavaFramework1
@nsprajapati06
@nsprajapati06 4 жыл бұрын
@@RaghavPal Thanks Raghav for replying.... I am a very beginner at this point of time. actually I wanted to understand that code part through video if you have created for it. Because what you have shared is git, I am not sure what to look. Please share a video link if you have.
@RaghavPal
@RaghavPal 4 жыл бұрын
Okay, using github repo url you can actually clone the project and see my complete code. You can also find tutorials on how to clone project from github. In case you want to understand the coding, I will suggest that you see the Java Beginners playlist here - automationstepbystep.com/
@narminetouihri3105
@narminetouihri3105 2 жыл бұрын
Hello I had to change looking for the button by xpath because it wasn't working by name do you know why ? thanks
@RaghavPal
@RaghavPal 2 жыл бұрын
I will need to check logs
@saragoodarzi888
@saragoodarzi888 3 жыл бұрын
Thank you dear Raghav. i have a question if you don't mind, i am using java intelij version 14 and maven 3.6.3 and also add testNg dependencies, after running my project i get this error message Error:java: error: release version 5 not supported could you please help me by this? @raghav
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi, this can help stackoverflow.com/questions/59601077/intellij-errorjava-error-release-version-5-not-supported
@aartiriat7590
@aartiriat7590 3 жыл бұрын
Hi Raghav, i followed all the steps as mentioned. But when i try to run it doesn't display Run as : Test NG case. I have installed the plugin as well as dependencies. but still nothing is working for me. Can you please suggest what could be the possible reason? Thanks in advance
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Aarti, did you restart eclipse after adding testng plugin, try to install again & also check ver compatibility
@rajendranavale8613
@rajendranavale8613 3 жыл бұрын
Hello Sir, plz make video on framework level work that is being implemented in companies. Plz try to show it with small project on automation....so that we will be clear about how selenium webdriver with java works in actual.
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Rajendra, I will do
@rajendranavale8613
@rajendranavale8613 3 жыл бұрын
@@RaghavPal Thank you Sir....
@mushfiquazaman9597
@mushfiquazaman9597 3 жыл бұрын
Very Helpful, Thank you Raghav
@RaghavPal
@RaghavPal 3 жыл бұрын
Most welcome Mushfiqua
@mushfiquazaman9597
@mushfiquazaman9597 3 жыл бұрын
​@@RaghavPal Hi Raghav, On yesterdays meeting, my company said, we will not run Selenium Test on Jenkins. We will run on AWS. Please let me know, what tools do we need to run Selenium on AWS? which Tutorial I will start to learn?
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Mushfiqua, I believe they are referring to AWS ec2 machines, If that is true pls ask where exactly they plan to run on AWS, ec2
@mushfiquazaman9597
@mushfiquazaman9597 3 жыл бұрын
@@RaghavPal Hi Raghav, I haven't got that answer yet. But guessing, Yes.
@mushfiquazaman9597
@mushfiquazaman9597 3 жыл бұрын
@@RaghavPal Would you pleeeeease make a video/series on Running Selenium Tests on AWS.
@sathisha4456
@sathisha4456 4 жыл бұрын
Hi Raghav, I have used to Microsoft Online Excel Sheet. How to use online excel sheets at data-driven testing?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Sathish, if you have some url where it can be accessed and data can be retrieved, it will work. I have not used it so will need to check more online
@RuchiSingh-jo7dc
@RuchiSingh-jo7dc 5 жыл бұрын
Sir please make video on keyword driven and data driven frame work
@RaghavPal
@RaghavPal 5 жыл бұрын
I will Ruchi, definitely
@PriyankaMohanraj
@PriyankaMohanraj Жыл бұрын
hi sir- i could see a folder name drivers below maven dependencies- can you please tell how to add that- because it throws an error on my code on webelement and driver( i tried importing- it still shows error) And also i have followed all the steps you have mentioned- but not getting run as - testng option can you assist please
@RaghavPal
@RaghavPal Жыл бұрын
Hi Priyanka, Sure, I can help you with that. Adding drivers folder in Maven project: You can add the drivers folder to your Maven project by following these steps: Create a new folder named drivers in the root directory of your project. Inside the drivers folder, create subfolders for the different drivers you want to use, for example, chromedriver, geckodriver, etc. Download the corresponding driver executable files and save them in their respective subfolders. You can download the latest driver versions from the official websites of the browser vendors. In your Maven project, open the pom.xml file and add the following code: org.apache.maven.plugins maven-resources-plugin 3.1.0 copy-resources validate copy-resources ${project.build.directory}/classes ${project.basedir}/drivers
@PriyankaMohanraj
@PriyankaMohanraj Жыл бұрын
@@RaghavPal thanks alot for your kind help
@salimlakhani3701
@salimlakhani3701 4 жыл бұрын
I have question can we use TestNG IN Project Object Model? Because i tried but kept giving me error thats why
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Salim, you can use, What is the error you are getting
@user-jz1no7jm8d
@user-jz1no7jm8d 6 ай бұрын
Is it possible to just add dependency in pom? For IDEA IntelliJ? Because it works for me like that? :)
@RaghavPal
@RaghavPal 6 ай бұрын
It is possible to just add the TestNG dependency in your pom.xml file for IntelliJ IDEA, and it should work as expected. There's no need for any additional configuration unless you have specific customizations in mind. Here's a breakdown of the process: 1. Open your project's `pom.xml` file. 2. Navigate to the `dependencies` section. 3. Add the following dependency snippet: ```xml org.testng testng 7.4.0 test ``` 4. Save the `pom.xml` file. 5. Refresh your project dependencies in IntelliJ IDEA (usually by right-clicking on the project in the Project tool window and selecting "Maven -> Reimport"). After these steps, TestNG should be recognized and ready for use in your project. You can create TestNG test classes with the `@Test` annotation and run them directly within IntelliJ IDEA.
@nirmalanirmi8988
@nirmalanirmi8988 5 жыл бұрын
Hi Raghav, I followed the steps in the video but the test did not run. I am getting this error: java.lang.NoSuchMethodError: org.testng.TestRunner.addListener(Ljava/lang/Object;) How to solve this? Please help
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Nirmala, will have to see your code, In the logs pls check if you get more information like from which line in code is this error thrown etc.
@rakeshbhardwaj2191
@rakeshbhardwaj2191 4 жыл бұрын
Hi Nirmala, I tried with below solution and it worked for me in Eclipse : Go to Project -> Properties -> Java Build path -> Libraries -> Click on Add Library and select TestNG -> Next and Finish
@amanuelg6342
@amanuelg6342 5 жыл бұрын
is there any way i can take your class in person since i live in US
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Amanuel, As of now there are no personal classes planned. You can follow and ask your queries here. Can see all courses here automationstepbystep.com/online-courses/
@amitsmart4u
@amitsmart4u 5 жыл бұрын
Hello Raghav sir, To add TestNG libraries, you are using POM.xml which I don't have. I have watched your other video and installed maven on my machine but I am not sure how to create dependencies and create this pom.xml. I did not find it under Maven folder either (it only has up to installation). Do you have a video that describes how we can create pom.xml and add maven dependencies? Appreciate your efforts and response. Thank you
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Amit, this is a complete series, not sure if you missed any video. Here is the playlist - kzfaq.info/sun/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa
@amitsmart4u
@amitsmart4u 5 жыл бұрын
@@RaghavPal Hi Raghav, I am so sorry for bothering you for this Thank you
@manalcheema9616
@manalcheema9616 3 жыл бұрын
hello. i have a question why do we use maven project?
@RaghavPal
@RaghavPal 3 жыл бұрын
So we can manage dependency effectively
@rajeshrao5099
@rajeshrao5099 2 жыл бұрын
Hi Raghav could you please let us know difference between Before Suite Before Test After Suite After Test annotations.I know it's executed only once but I need to know exactly how and when it's used. Thanks in advance
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Rajesh, I will plan to add a session on that. For now this can help www.browserstack.com/guide/testng-listeners
@trambaksinha
@trambaksinha 4 жыл бұрын
Hi Raghav sir, i didnt understand how the pom xml came how to understand that.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Trambak, Have you watched the earlier videos. Pls check the playlist automationstepbystep.com/
@albinks7320
@albinks7320 5 жыл бұрын
Hi raghav, I have searched for TestNG in the marketplace, but not listed there in the result section. When I tried through Install New Software options, it doesn't display testNG icon in the list. Is there any solution for this or any alternate way to install?
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Albin, what is your eclipse ver. Maybe you can try searching for eclipse specific ver.
@albinks7320
@albinks7320 5 жыл бұрын
@@RaghavPal its eclipse 2018-12
@albinks7320
@albinks7320 5 жыл бұрын
@@RaghavPalI got it. I tried with install option again
@animeshgiri8350
@animeshgiri8350 4 жыл бұрын
Hi @Raghav Sir, I have followed the same steps, but while running the java, run as I can only see junit not TestNG. Kindly suggest. Thanks.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Animesh, that means you have not added TestNG PLUGIN in Eclipse or have not restarted after adding
@kalpakakamakshisreenivasan1621
@kalpakakamakshisreenivasan1621 3 жыл бұрын
@@RaghavPal Sir, thank you for the wonderful tutorials. I had a similar issue and it showed up a Run as JUnit Test - I found it had imported import org.junit.Test instead of import org.testng.annotations.Test. After the change, the test worked as expected. Thank you once again!
@Bell4Fun
@Bell4Fun 5 жыл бұрын
Can we say that TestNG is used for Generating test reports as well.
@RaghavPal
@RaghavPal 5 жыл бұрын
Yes testng can generate reports, You can use extent reports also, that is explained in later videos
@101_twentySomethings
@101_twentySomethings Жыл бұрын
Hello Raghav, When i am downloading TestNG in my mac for eclipse IDE, i'm getting error "An error occurred while collecting items to be installed" . Can you help in identifying the issue?
@101_twentySomethings
@101_twentySomethings Жыл бұрын
Please ignore this i downloaded it from Eclipse marketplace
@RaghavPal
@RaghavPal Жыл бұрын
Great, thnx for posting Deepali
@rupalimagar3344
@rupalimagar3344 2 жыл бұрын
Hello, I have followed all your steps but I am not getting the TestNG option in the run configuration.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Rupali, Try to restart Eclipse after installing TestNG plugin
@disha9876
@disha9876 2 жыл бұрын
Sir hindi me bhi banaya kijiye. fast samajh me aata h. Thank you. Jai Hind!!
@RaghavPal
@RaghavPal 2 жыл бұрын
I will try
@rkslounge8117
@rkslounge8117 4 жыл бұрын
Videos on Intelli J selenium, please!
@RaghavPal
@RaghavPal 4 жыл бұрын
Sure, I will
@sanketjoshi1714
@sanketjoshi1714 4 жыл бұрын
Hello Sir, When I run exactly the same code, I am getting the error "[TestNG] No tests found. Nothing was run " I have installed TestNG plugin & Libraries correctly and I have also added annotation @Test before the method.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Sanket, pls check your import statments. The @Test annotation should be imported from import org.testng.annotations.Test; and not junit or any other lib. check this too - stackoverflow.com/questions/56769978/testng-no-tests-found-nothing-was-run-while-executing-automated-tests-using-s
@mohammednawaz8019
@mohammednawaz8019 3 жыл бұрын
@@RaghavPal Thank you so much Raghav sir. I was mistakenly imported from junit lib, by seeing this comment I can able to resolve my error.
@rajarathinam1965
@rajarathinam1965 2 жыл бұрын
Cannot perform operation computing alternate solutions may take a while nu varudhu correcta
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Raja, pls explain your issue in detail
@screenjunkies1603
@screenjunkies1603 11 ай бұрын
Sir can you please create two more classes with POM and create a testng suite?
@RaghavPal
@RaghavPal 11 ай бұрын
I will plan in a new series Peter
@A.B.00007
@A.B.00007 5 жыл бұрын
@Test and @AfterTest throws Null Pointer exception!! !! trying binding them with some referred jars still no better response!!
@A.B.00007
@A.B.00007 5 жыл бұрын
nullpointer exception on WebDriver object to be specific!!
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Asif, pls confirm if the null pointer exception is thrown from annotation or some other statement. Check if the annotations are imported from testng and not any other library. Error details with logs will help.
@A.B.00007
@A.B.00007 5 жыл бұрын
@@RaghavPal Yeah Error logs does help to make a sense of what went wrong and all that. Exception was thrown from the annotated section of the code. I actually solved it. it was quite straight forward really. I was trying to call the @BeforeTest webDriver but was calling the class variable with null pointer. Rookie mistake. Thank you for responding.
@RaghavPal
@RaghavPal 5 жыл бұрын
Glad to know its resolved. Keep learning.
@pankajsahu1657
@pankajsahu1657 10 ай бұрын
how to take screenshot of failed test cases and how to make method in utility package to capture screenshot in tesNG. Sir is there any video please let me know.
@RaghavPal
@RaghavPal 10 ай бұрын
Pankaj Capturing screenshots of failed test cases in Selenium with TestNG in Java is a valuable practice for debugging and reporting. You can create a utility method to take screenshots when a test case fails. Below are the steps to achieve this: 1. **Create a Utility Class:** - Start by creating a utility class that will contain the screenshot capture method. You can name it something like `ScreenshotUtility.java`. 2. **Add Dependencies:** - Make sure you have the necessary dependencies in your project. You need Selenium WebDriver, TestNG, and any required image manipulation libraries (e.g., Apache Commons Imaging). 3. **Capture Screenshots in the Utility Class:** - In your utility class, create a method to capture a screenshot. Here's an example: ```java import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.testng.ITestResult; import org.apache.commons.io.FileUtils; public class ScreenshotUtility { public static void captureScreenshot(WebDriver driver, ITestResult result) { if (result.getStatus() == ITestResult.FAILURE) { try { // Capture the screenshot as a file File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); // Define the destination path for the screenshot String destination = "path/to/save/screenshots/" + result.getName() + ".png"; // Copy the screenshot file to the specified location FileUtils.copyFile(screenshot, new File(destination)); System.out.println("Screenshot taken at: " + destination); } catch (Exception e) { e.printStackTrace(); } } } } ``` Replace `"path/to/save/screenshots/"` with the actual path where you want to save the screenshots. 4. **Use the Utility Method in TestNG Listener:** - To automatically capture screenshots on test failures, you can use a TestNG listener. Create a listener class (e.g., `ScreenshotListener.java`) that implements the `ITestListener` interface and calls the `captureScreenshot` method when a test fails. ```java import org.testng.ITestListener; import org.testng.ITestResult; import org.openqa.selenium.WebDriver; public class ScreenshotListener implements ITestListener { @Override public void onTestFailure(ITestResult result) { Object currentClass = result.getInstance(); WebDriver driver = ((YourTestClass) currentClass).getDriver(); // Replace YourTestClass with your test class name ScreenshotUtility.captureScreenshot(driver, result); } // Implement other ITestListener methods as needed } ``` Ensure that you replace `YourTestClass` with the name of your test class that has the WebDriver instance. 5. **Configure TestNG XML:** - In your TestNG XML file, configure the listener to use the `ScreenshotListener`: ```xml ``` Replace `"your.package.name"` with the actual package name where your `ScreenshotListener` class is located. With these steps, TestNG will automatically trigger the `captureScreenshot` method when a test case fails, and the screenshot will be saved to the specified location. You can then include the captured screenshots in your test reports or use them for debugging. For video tutorials, I recommend searching on platforms like KZfaq or online course platforms for "Selenium TestNG screenshot capture" or similar keywords to find relevant tutorials that demonstrate this process visually.
@dilipn8613
@dilipn8613 8 ай бұрын
Hi i am following ur channel for Selenium I am stuck with an issue. Please let me know how can i reach you.
@RaghavPal
@RaghavPal 8 ай бұрын
Sure Dilip, explain your issue here
@dilipn8613
@dilipn8613 8 ай бұрын
@@RaghavPal It was my bad. i had given annotations of Junit instead of TestNG. Thanks for replying back. I will reach out to you if i face any issues. Thank you.
@jeevanpoojary9780
@jeevanpoojary9780 2 жыл бұрын
Sir , i am facing one problem, after converting test scripts into convert to testNG , Convert Refactoring wizard is not opening. AND testng.xml is not generated.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Jeevan, have you added testng plugin
@jeevanpoojary7879
@jeevanpoojary7879 2 жыл бұрын
@@RaghavPal yes sir , script is also executed but TESTNG.XML is not generated.
@201101120
@201101120 5 жыл бұрын
Hello Raghav, How can we use testNG in page object model ?
@RaghavPal
@RaghavPal 5 жыл бұрын
Yes, we can Sanket
@201101120
@201101120 5 жыл бұрын
@@RaghavPal Sir How can we test login page with encrypted password? . please help sir
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Sanket, you can use some encoding libraries like base64 - www.quora.com/How-do-I-encrypt-the-password-while-programming-in-Java-for-automating-an-application-in-Selenium
@vanitharadhakrishnan1769
@vanitharadhakrishnan1769 2 жыл бұрын
I’m unable to install testNG in eclipse as the url is not found,can you help?
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Vanitha, check if the url is changed, You can see documentation here github.com/cbeust/testng-eclipse/
@vanitharadhakrishnan1769
@vanitharadhakrishnan1769 2 жыл бұрын
I had to upgrade my eclipse from oxygen to latest version. I could then install testNG successfully.Thank you.
@farukhalvi1988
@farukhalvi1988 3 жыл бұрын
Whats is testng equivalent for python raghav?
@RaghavPal
@RaghavPal 3 жыл бұрын
This can help stackoverflow.com/questions/45323248/how-to-achieve-testng-like-feature-in-python-selenium-or-add-multiple-unit-test
@nistan5404
@nistan5404 4 жыл бұрын
Hi Raghav Sir, I m using java project instead of maven project for all your examples and I didn't get any problem during TestNG installation and execution, but at point 13:54 I followed all steps Refresh project-> test_output folder-> clicked on "index.html" as per your instruction it open up like BELOW HTML DOC instead of proper test report like yours and I also tried to open test results html in default text editor but the result was same as below. Please Help. -------------------------------------------------------------------- TestNG reports google.load('visualization', '1', {packages:['table']}); google.setOnLoadCallback(drawTable); var suiteTableInitFunctions = new Array(); var suiteTableData = new Array();
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi, that's okay, May be your eclipse does not have an in built browser. You can get one from Help > Eclipse marketplace Or just right click and open with system editor (i.e. your system's default browser)
@nistan5404
@nistan5404 4 жыл бұрын
@@RaghavPal It is working fine with "System editor"..Thankyou :)
@shreyanshprajapati2022
@shreyanshprajapati2022 Жыл бұрын
sir pls help , i am getting this error "java.nio.file.FileAlreadyExistsException"
@RaghavPal
@RaghavPal Жыл бұрын
Hi Shreyansh, pls check if the file mentioned is saved and closed
@shreyanshprajapati2022
@shreyanshprajapati2022 Жыл бұрын
@@RaghavPal ok thank you ji
@faizanahmed3131
@faizanahmed3131 4 жыл бұрын
Plzz help me that How to run my Java Selenium program automatically every hour .
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Faizan, If you are on windows, you can create a bat file for your commands and then schedule using Task Scheduler - www.computerhope.com/jargon/t/tasksced.htm You can also use a CI tool like Jenkins. There are videos on this in the playlist - kzfaq.info/sun/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa
@faizanahmed3131
@faizanahmed3131 4 жыл бұрын
@@RaghavPal Thanks for your reply on behalf of all the learner I would request you to make a video on "How to run my Java Selenium program automatically every hour " because the link you mentioned I don't find the exact way how to do this I'm new in automation also I really appreciate your work towards automation.
@RaghavPal
@RaghavPal 4 жыл бұрын
Sure, I will plan Faizan
@arjunmr9811
@arjunmr9811 3 жыл бұрын
pom.xml is missing
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Arjun, hope you created a maven project and followed all steps as shown in earlier videos
@Arunganesan1
@Arunganesan1 3 жыл бұрын
Hi Raghav, when I run the code in TestNG I'm getting following erros: Error-1) org.testng.TestNGException: TestNG by default disables loading DTD from unsecured Urls. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true] Error-2) [TestNGContentHandler] [WARN] It is strongly recommended to add "" at the top of your file, otherwise TestNG may fail or not work as expected. java.lang.NoSuchMethodError: org.testng.remote.AbstractRemoteTestNG.addListener(Lorg/testng/ISuiteListener;)V But in my Xml file "" is already there. Plz advice me. Thanks
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Rahul, pls check the syntax again in the xml file, just in case some typo or spaces etc. Can also try a diff ver
@Deniz-ss1sv
@Deniz-ss1sv 3 жыл бұрын
:)
@muktasangale6232
@muktasangale6232 2 жыл бұрын
Not able to click on hyperlink and select drop down values
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Mukta, what is the issue you are facing, You can check some online examples and try
@muktasangale6232
@muktasangale6232 2 жыл бұрын
@@RaghavPal I have try online example but not able to click on sidebar element
@RaghavPal
@RaghavPal 2 жыл бұрын
I will check this Mukta
@rohinimahajan9759
@rohinimahajan9759 4 жыл бұрын
Sir i do all same process just like you but "java.lang.NoSuchMethodError: org.testng.remote.AbstractRemoteTestNG.addListener(Lorg/testng/ISuiteListener;)V at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:128) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)" This problem occur please sir give mi solution for this
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Rohini, pls check the testng plugin is the latest and compatible with your eclipse github.com/cbeust/testng-eclipse/
@sainikhilaureshi5944
@sainikhilaureshi5944 4 жыл бұрын
Try to add TestNG jar files manually, refer to this video may be it will be helpful kzfaq.info/get/bejne/gZ-TpKmk2rrbpHk.html
@zitounineda1428
@zitounineda1428 3 жыл бұрын
Hello Raghav, Thanks for tutorials. i have installed Testng on eclipse and dependencies but when i excute code the browser is open but tests are not excuted. code : package TEST; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class TestNG_Demo { WebDriver driver = null; // should run before test @BeforeTest public void setUpTest(){ String projectPath = System.getProperty("user.dir"); System.setProperty("webdriver.chrome.driver",projectPath+"\\drivers\\chromedriver\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); } // current test @Test public void googleSearch(){ // goto google.com driver.get("google.com"); // enter text in search text box driver.findElement(By.name("q")).sendKeys("automation step by step"); // click on search button //driver.findElement(By.name("btnK")).click(); driver.findElement(By.name("btnK")).sendKeys(Keys.RETURN); } // should run after test @AfterTest public void tearDownTest(){ //close browser driver.close(); driver.quit(); System.out.println("test completed successfully"); } } Error: Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 36672 Only local connections are allowed. oct. 05, 2020 1:35:51 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFOS: Detected dialect: OSS can you help me please
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Zitouni, Pls check if the chromedriver.exe ver is same as the chrome ver on your system.
@zitounineda1428
@zitounineda1428 3 жыл бұрын
@@RaghavPal google chrome version Version 85.0.4183.121 et chromewebridver 2.36.540470. thanks for help
@zitounineda1428
@zitounineda1428 3 жыл бұрын
tests are excuted without problem but with TestNG the browser is open but test is not excuted
@RaghavPal
@RaghavPal 3 жыл бұрын
Will need to check the setup, Do you get any error in logs
@zitounineda1428
@zitounineda1428 3 жыл бұрын
@@RaghavPal ​ @Automation Step by Step - Raghav Pal i had changed the version of testNG to the version which work in your tutorial but the same error appear: [RemoteTestNG] detected TestNG version 6.14.3 Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 42775 Only local connections are allowed. oct. 06, 2020 4:23:33 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFOS: Detected dialect: OSS FAILED CONFIGURATION: @AfterTest tearDownTest java.lang.NullPointerException at TEST.TestNG_Demo.tearDownTest(TestNG_Demo.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142) at org.testng.TestRunner.afterRun(TestRunner.java:725) at org.testng.TestRunner.run(TestRunner.java:509) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) FAILED: googleSearch java.lang.NullPointerException at TEST.TestNG_Demo.googleSearch(TestNG_Demo.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:583) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) =============================================== Default test Tests run: 1, Failures: 1, Skips: 0 Configuration Failures: 1, Skips: 0 =============================================== =============================================== Default suite Total tests run: 1, Failures: 1, Skips: 0 Configuration Failures: 1, Skips: 0 ===============================================
@Abcdddd2023
@Abcdddd2023 4 жыл бұрын
TestNG plugin download link is updated. New Link: dl.bintray.com/testng-team/testng-eclipse-release
@RaghavPal
@RaghavPal 4 жыл бұрын
Thanks Ramiz
@sharrifhussain2784
@sharrifhussain2784 5 жыл бұрын
FAILED CONFIGURATION: @AfterTest tearDownTest org.openqa.selenium.NoSuchSessionException: Tried to run command without establishing a connection Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'DESKTOP-CO6P907', ip: '192.168.1.3', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191' Driver info: org.openqa.selenium.firefox.FirefoxDriver sir TestNG use krta huoa ya error ahta han Teaddown ma test pass ho jata han but ya error ku ahta han sir kindly bata ga
@RaghavPal
@RaghavPal 5 жыл бұрын
Looks like your driver is not visible to the script. Try to follow the same steps from the video.
@rakeshbhardwaj2191
@rakeshbhardwaj2191 4 жыл бұрын
Hi Shariff. Try only with close() . . it worked for me stackoverflow.com/questions/46902102/error-in-fire-fox-selenium-web-driver
@amazonwinds
@amazonwinds 3 жыл бұрын
Sorry you did not give TestNG overview very well in the beginning part of video. Instead you were showing how to google it and read on wiki site.
@RaghavPal
@RaghavPal 3 жыл бұрын
Sorry to hear this. I tried to keep the 1st video like a basic intro. I hope next videos in this series will be more helpful. Pls watch and let me know
@muktasangale6232
@muktasangale6232 2 жыл бұрын
Hi
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Mukta
@af-ozen-garon3177
@af-ozen-garon3177 4 жыл бұрын
TestNG - installation url dl.bintray.com/testng-team/testng-eclipse-release/
@RaghavPal
@RaghavPal 4 жыл бұрын
Thanks for adding
@pankajsahu1657
@pankajsahu1657 10 ай бұрын
Sir is it compulsory to use @AfterMethod or @AfterClass for TestNG CrossBrowser Testing class, if we have used @BeforeClass and @BeforeMethods..??
@RaghavPal
@RaghavPal 10 ай бұрын
Pankaj It is not compulsory to use @AfterMethod or @AfterClass for TestNG CrossBrowser Testing class, if you have used @BeforeClass and @BeforeMethods. However, it is generally considered to be best practice to use @AfterMethod and @AfterClass to clean up after your tests. @AfterMethod is executed after each test method, and @AfterClass is executed after all of the test methods in a class have been executed. This gives you an opportunity to close any open resources, such as web browsers or database connections. For example, the following test class uses @BeforeClass to set up a web browser, and @AfterClass to close the web browser: ``` @Test public class CrossBrowserTest { private WebDriver driver; @BeforeClass public void setUp() { driver = new ChromeDriver(); } @Test public void test1() { // ... } @Test public void test2() { // ... } @AfterClass public void tearDown() { driver.quit(); } } ``` It is important to note that @AfterMethod and @AfterClass are executed even if a test fails. This ensures that your resources are always cleaned up, regardless of the outcome of your tests. Whether or not to use @AfterMethod and @AfterClass is a matter of personal preference. However, using @AfterMethod and @AfterClass can help to make your test code more robust and maintainable
@pankajsahu1657
@pankajsahu1657 10 ай бұрын
@@RaghavPal thankyou sir for your helpful & valuable response. But there is a test case for login functionality with wrong credentials, as we know if we enter wrong credentials so we should not to be on Home Page. If i use login in @BeforeMethod and @AfterMethod there will be Only option i have that is close the browser and @Test i will Only apply assertion actual results= expected result that means we should get same page URL. In case of login with correct credentials I did not faced any issue and test case result is pass. So what approach i can follow to pass the test case. If you can refer me a video login with wrong credentials in testNG class it will be very helpful and I will be thankful to you. If you create video on it it will definitely helpful to all of us. Thankyou so much sir❤️
@RaghavPal
@RaghavPal 10 ай бұрын
To pass the test case for login functionality with wrong credentials in Selenium Java, you can follow the following approach: 1. In the `@BeforeMethod`, create a new WebDriver instance and navigate to the login page. 2. In the `@Test`, enter the wrong credentials and click the login button. 3. Assert that the user is not logged in by checking the current URL. The user should not be able to navigate to the home page with wrong credentials. 4. In the `@AfterMethod`, close the WebDriver instance. Here is an example of a test case for login functionality with wrong credentials in Selenium Java: ```java import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class LoginTest { private WebDriver driver; @BeforeMethod public void setUp() { driver = new ChromeDriver(); driver.get("example.com/login"); } @Test public void testLoginWithWrongCredentials() { // Enter the wrong credentials driver.findElement(By.id("username")).sendKeys("invalid_username"); driver.findElement(By.id("password")).sendKeys("invalid_password"); driver.findElement(By.id("login_button")).click(); // Assert that the user is not logged in String currentUrl = driver.getCurrentUrl(); assertEquals(currentUrl, "example.com/login"); } @AfterMethod public void tearDown() { driver.quit(); } } ``` This test case will first create a new Chrome WebDriver instance and navigate to the login page. Then, it will enter the wrong credentials and click the login button. Finally, it will assert that the user is not logged in by checking the current URL. The user should not be able to navigate to the home page with wrong credentials. If the test case passes, it means that the login functionality is working correctly. If the test case fails, it means that there is a bug in the login functionality
@pankajsahu1657
@pankajsahu1657 10 ай бұрын
@@RaghavPal once again thankyou for your valuable response. I will try and add no of possible @Test with wrong credentials in same testNG crossBrowser class & i will let you know. Thankyou❤
These Coding Projects Give You An Unfair Advantage
14:39
Harkirat Singh
Рет қаралды 341 М.
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 110 МЛН
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
How to Use Selenium, TestNG With Gradle (Build Automation Tool)
33:52
Naveen AutomationLabs
Рет қаралды 13 М.
What is a Monad? - Computerphile
21:50
Computerphile
Рет қаралды 598 М.
Cypress Complete Beginners Masterclass 1 | Step by Step | Raghav Pal |
1:20:54
Automation Step by Step
Рет қаралды 194 М.
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 110 МЛН