Hi Mukesh its really a fantastic job you are doing..Now am spending my time in watching your videos I really fell in Love and found curiosity in learning selenium,Its actually boosting my career too Thanks and God bless you:)
Hi Mukesh, I have been working on selenium from few days now. I am a beginner in selenium. Thanks a lot for all the videos you have uploaded on selenium. helped me a lot. If possible please help me with below : 1. How can we check actual vs expected results through selenium? 2. I create test cases and execute on my system. How can i share it with the team and then they test it on their system? Do they have to install eclipse? is there any way to just use the jar file or something and run the test case in multiple tester systems? Thanks, Ganesh
Hi Mukesh , It really helped me a lot. Thank you for all your efforts. I have a question like if I have to run multiple XML files using runner then how can I get the testNG results within one report. As we know one XML file have one suite. but in my case I want multiple XML file to run within one suite..please suggest me. Thanks
Hi Mukesh, Thankyou so much for sharing your knowledge with us..May I know how to capture screenshot for failed tests using TestNG listners. Thanks in advance.
Hi Mukesh Frist of all deeply Thanking you so much to uploaded this type useful videos, I learned a lot from your videos. I faced some interviews a few days back still I'm searching for Automation job but when I faced in interview on java concepts most off Interviewer asking on java I would like to know where we use Method overloading and Method overriding concepts in selenium during writing scripts
Overloading we used in iFrame topics and Overridding used in Listener learn-automation.com/handle-frames-in-selenium/ learn-automation.com/what-is-testng-listener-and-how-to-implement-in-selenium/ learn-automation.com/what-is-listeners-in-selenium-webdriver/
Hi mukesh, I like the above topic but has simple question.If one test case hs been failed an d it depends on other test case then at that how can re execute the failed test case without opening browser
Thanks Mukesh! I have a doubt Like 1 out of 3 TCs is failing initially, so 1 testng-failed.xml file gets created. i did correction in my the failed test case(which is correct now - i.e - i wrote Assert.assertTrue(true) - pass condition) i did refresh the package an created a Test-Runner class and run that class. now it should show me the "Total tests run: 1, Pass: 1, Skips: 0" but its showing "Total tests run: 1, Failures: 1, Skips: 0" is this the correct behavior, Yes/No - Kindly explain?
Hi Mukesh, Thanks for the video! In the video at 16.10 you mentioned that code will check if TestNG-failed.xml file is present or NOT but IT IS NOT CHECKING. Observed below error when I ran the code using TestNG ITestListener :- [TestNG] [ERROR] No test suite found. Nothing to run java.io.FileNotFoundException: D:\Java\Eclipse_java\TestNGFailedProject\test-output\TestNGFailed\testng-failed.xml (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(Unknown Source) at java.io.FileInputStream.(Unknown Source) at org.testng.xml.Parser.parse(Parser.java:163) at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311) at org.testng.TestNG.run(TestNG.java:1030) at TestNGFailedRunner.Runner.TestNGFailedRunnerscript(Runner.java:24) at Listeners.TestNGListeners.onFinish(TestNGListeners.java:14) at org.testng.TestRunner.fireEvent(TestRunner.java:1241) at org.testng.TestRunner.afterRun(TestRunner.java:1032) at org.testng.TestRunner.run(TestRunner.java:621) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) Usage: [options] The XML suite files to run Thanks
Hi Mukesh, thanks for your great work! I'm a new comer to Selenium. I installed Java, Eclipse and added selenium jar files. I tried to write my first program using webdriver for IE browser (as this is only browser at my work) I downloaded IE driverserver.exe and added a code for System.setproperty etc.. but when i wrote 'Web Driver driver = new InternetExplorerDriver();' I'm not seeing 'Import InternetExplorerDriver from the down yellow box.. and also not seeing 'Import Webdriver' too. so i cannot import 'Webdriver' and 'InternetExplorerDriver'. Under the package name, i manually tried to write 'import org.openqa.Selenium WebDriver' also, but it is not recognizing and shows red cross mark.. Why is it happening? what could be the problem? can you pls help me..
Hi Anuradha have you downloaded Selenium 3 beta or any other jar.. You can download Selenium 3 server from below location docs.seleniumhq.org/download/
hi mukesh I wanted to know that from a list of test cases, for eg: 100 test cases are there among them i want to run first 10 an then last 20 test cases .....how can we do it , please explain...?
Hi Mukesh, Just a doubt for this approach. By running this TestRunner class we can't get the class names which are failed. we just found in console output that 1 TC is failed. So how can we know which TC is failed. Can you explain this.
Hi Mukesh, you have executed the failed test case initially, so again one folder gets created, so everytime if you run a failed test case then a new folder will get created every time?
No , butyou have to follow the same steps as mention during the execution, and it will ask to replace the existing *.xml and html say yes if you want to over write else no and hence you utilize the existing path.I hope it helps
if I add this runner class to my framework and just execute my test cases in normal way then all failed test cases will be rerun ? how testng will know I have to run this class post test execution ?
Hi Mukesh, I have a query here. Suppose I execute my nightly builds and check the status the next day. Now the first test case has failed due to which my whole build got failed. In that case how will you trigger this logic? Since you have manually ran your runner class. Is it possible to execute the runner class as soon as the test case failed. In that case I guess IRetryAnalyser will come into picture. Kindly suggest if I'm going in the right direction. Thanks Ankit
Thanks a lot mukesh for your quick response. Another question that came into my mind that the restriction in using IRetryAnalyser is that every class may needs to implement this. So if i am having 100 classes then everytime i would need to write the code logic in order to run the failed tests in each class. Wouldn't the code be reduntant then. What could be the solution for this? Pls correct me if i'm going in wrong direction. And thanks a lot for ur efforts in putting up such great videos.
+Mukesh otwani mmmm can you pls post a very small snippet. i got your point though but snippet would b very helpful if you can.. thanku so much Mukesh :-)
I have one question, When the failed test cases are stored in failed xml folder. Can we trigger this in a script where we dont have to run manually from the tester runner page?
Superb Explanation. I just tried to run failed test scripts as you shown in the video. But I am facing below error: [TestNG] [ERROR] No test suite found. Nothing to run Usage: [options] The XML suite files to run Options: -configfailurepolicy Configuration failure policy (skip or continue) -d Output directory -dataproviderthreadcount Number of threads to use when running data providers -excludegroups Comma-separated list of group names to exclude -groups Comma-separated list of group names to be run -junit JUnit mode Default: false -listener List of .class files or list of class names implementing ITestListener or ISuiteListener -methods Comma separated of test methods Default: [] -methodselectors List of .class files or list of class names implementing IMethodSelector -mixed Mixed mode - autodetect the type of current test and run it with appropriate runner Default: false -objectfactory List of .class files or list of class names implementing ITestRunnerFactory -parallel Parallel mode (methods, tests or classes) Possible Values: [tests, methods, classes, instances, none, true, false] -port The port -reporter Extended configuration for custom report listener -suitename Default name of test suite, if not specified in suite definition file or source code -suitethreadpoolsize Size of the thread pool to use to run suites Default: 1 -testclass The list of test classes -testjar A jar file containing the tests -testname Default name of test, if not specified in suitedefinition file or source code -testnames The list of test names to run -testrunfactory, -testRunFactory The factory used to create tests -threadcount Number of threads to use when running tests in parallel -usedefaultlisteners Whether to use the default listeners Default: true -log, -verbose Level of verbosity -xmlpathinjar The full path to the xml file inside the jar file (only valid if -testjar was specified) Default: testng.xml Could you please let me know how to fix it.
I got know the resolution. I had written 'runner.setTestNames(lst);' instead of 'runner.setTestSuites(lst); ' thats why It was not running. Now my script is running fine. Thanks a lot for providing such a helpful videos.
Hi, I am getting the below error while executing TestRunner class... Exception in thread "main" java.lang.NoClassDefFoundError: org/testng/TestNG at com.testng.TestRunner1.main(TestRunner1.java:12) Caused by: java.lang.ClassNotFoundException: org.testng.TestNG at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
It is working fine when run testng-failed.xml directly. But when create TestRunner class to run testng-failed.xml. It is giving the above error.. Please suggest what to do... Please find my TestRunner code below. import java.util.ArrayList; import java.util.List; import org.testng.TestNG; public class TestRunner1 { public static void main(String[] args) { TestNG test = new TestNG(); List list = new ArrayList(); list.add("D:\\Selenium\\PractiseWorkSpace\\WebdriverProject\\test-output\\Sanity testing\\testng-failed.xml"); test.setTestSuites(list); test.run(); } }
Yes, correct but this requirement is different. If you want to run failed test cases (using testng-failed.xml)manually then you dont need any main method. If you want to trigger the xml automatically ten you can use main method or @Test to run the xml file.
@@Mukeshotwani Hi Sir I want to implement these at my framework level where I need to call these method either aftersuite or at listener please can you tell me
HI Suresh, You can do this in 2 ways 1- Using Jenkins email plugins th-cam.com/video/zGeL5vJnE40/w-d-xo.html 2-Using Java Library th-cam.com/video/qGq9K85mGyA/w-d-xo.html
i am very sorry to say this but information given here is wrong. We have listeners in testng which we have to use not this way. Please update your video might give wrong information to beginners.
Hi Srikant we have different ways to execute failed test cases in testng. We have listeners too but how can you say this information is wrong. Can you explain here?
Hi Alla, This is the code Below code will run 5 times @Test(invocationCount=5) public void test1() { System.out.println("Hello"); System.out.println(Thread.currentThread().getId()); }
i dont know you... but i am a biggest fan of yours..
i am watching everyday..hats off sir..
i wish i could learn from you directly..
Hey Sandeep you made my day. Feel free to contact in case any help required from my side.
Hi Mukesh its really a fantastic job you are doing..Now am spending my time in watching your videos I really fell in Love and found curiosity in learning selenium,Its actually boosting my career too Thanks and God bless you:)
Hey Veda thank a ton. Your comment made my day. Keep learning and let me know if you need any help from my side.
nice explanation sir...
i have faced this question in my one of the interview
thanks.
Thanks
I am looking for this option. It was great help to me. Awesome explanation .. Thank you Mukesh
Hey Kiran I am glad to know that you find it useful. Let me know if any help from my side.
Very clear explanation.Easy to follow.Thanks
Thanks Nithya. Keep visiting.
Hi Mukesh,
I have been working on selenium from few days now. I am a beginner in selenium. Thanks a lot for all the videos you have uploaded on selenium. helped me a lot.
If possible please help me with below :
1. How can we check actual vs expected results through selenium?
2. I create test cases and execute on my system. How can i share it with the team and then they test it on their system? Do they have to install eclipse? is there any way to just use the jar file or something and run the test case in multiple tester systems?
Thanks,
Ganesh
Hi Mukesh. Thanks for this awesome video. Very much Thankful to you for the second example.
Welcome Girija. Keep learning
Hi Mukesh ,
It really helped me a lot. Thank you for all your efforts.
I have a question like if I have to run multiple XML files using runner then how can I get the testNG results within one report. As we know one XML file have one suite. but in my case I want multiple XML file to run within one suite..please suggest me. Thanks
Hello Mukesh....
Awesome explanation......
Thank you Mukesh
Welcome Rupesh Hope it helped.
I am a big fan of your... You are too good dude
+Heena Gandhi thanks Heena :) your comment made me happy.
Let me know if any help required in Selenium
Happy long weekend.
Hey Mukesh, thanks for such amazing explanation, i have one question, which is the special feature of List you are using which is not in Array List?
Hi Farheen, Arraylist has all feature of List too. Since Selenium returns List so we have to accept as list only.
Hi Mukesh, Whats the difference between this and iRetry Analyzer?
Awesome mukesh bhai :) Thanks for the video !! Keep sharing
Thanks Yash 🤗
Hi Mukesh, Thankyou so much for sharing your knowledge with us..May I know how to capture screenshot for failed tests using TestNG listners. Thanks in advance.
Hi Veda,
Here is the sample code for the Listener learn-automation.com/what-is-listeners-in-selenium-webdriver/
Hi Mukesh Frist of all deeply Thanking you so much to uploaded this type useful videos, I learned a lot from your videos.
I faced some interviews a few days back still I'm searching for Automation job but when I faced in interview on java concepts most off Interviewer asking on java I would like to know where we use Method overloading and Method overriding concepts in selenium during writing scripts
Overloading we used in iFrame topics and Overridding used in Listener
learn-automation.com/handle-frames-in-selenium/
learn-automation.com/what-is-testng-listener-and-how-to-implement-in-selenium/
learn-automation.com/what-is-listeners-in-selenium-webdriver/
Thanks Mukesh.
Thank you Sir for your kind information related to this.....
Most welcome Abhinash
This is great! U are a great teacher! Thanks!
Thank you 🙏 Rial
Thanks sir for such nice video.
I want to know in second scenario is it nessesary to use main method ?
Or can we use testNg annotation instead?
Hi Vilas, in order to use this feature you have to use TestNG only.
Thanks a lot, Great help.
Thanks
Hi mukesh,
I like the above topic but has simple question.If one test case hs been failed an d it depends on other test case then at that how can re execute the failed test case without opening browser
Thanks. Really useful Mukesh.
Thanks a lot dear for your great effort.
Hi mukesh in which video tutorial you used ItestResults....
Thank you so much.... To give reply
Most welcome Sachin
Hi Mukesh, if there 100 of methods that are failing, then every time I have to give path for 100 of my methods in the array list?
Hi Mukesh , nice explanation , thanks
Thanks Harman
thanks vai.I will never get bored of watching ur video. how can I do the same thing with JUnit???
Hey Khaled thanks mate :) For junit I am not sure because I have not worked on Junit much... I can give a try and will let u know soon.
thanks for reply. i found it for junit. let me know if u have anything about allure reporting.
Hi Khaled I have not used Allure reporting. You can try with extent report
Thanks Mukesh!
I have a doubt
Like
1 out of 3 TCs is failing initially,
so 1 testng-failed.xml file gets created.
i did correction in my the failed test case(which is correct now - i.e - i wrote Assert.assertTrue(true) - pass condition)
i did refresh the package an created a Test-Runner class and run that class.
now it should show me the "Total tests run: 1, Pass: 1, Skips: 0"
but its showing "Total tests run: 1, Failures: 1, Skips: 0"
is this the correct behavior, Yes/No - Kindly explain?
Hi Minaxi,
Ideally, this should show "Total tests run: 1, Pass: 1, Skips: 0" after correction
Please rerun the test all should pass
Hi Mukesh, Thanks for the video!
In the video at 16.10 you mentioned that code will check if TestNG-failed.xml file is present or NOT but IT IS NOT CHECKING.
Observed below error when I ran the code using TestNG ITestListener :-
[TestNG] [ERROR] No test suite found. Nothing to run
java.io.FileNotFoundException: D:\Java\Eclipse_java\TestNGFailedProject\test-output\TestNGFailed\testng-failed.xml (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at org.testng.xml.Parser.parse(Parser.java:163)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311)
at org.testng.TestNG.run(TestNG.java:1030)
at TestNGFailedRunner.Runner.TestNGFailedRunnerscript(Runner.java:24)
at Listeners.TestNGListeners.onFinish(TestNGListeners.java:14)
at org.testng.TestRunner.fireEvent(TestRunner.java:1241)
at org.testng.TestRunner.afterRun(TestRunner.java:1032)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Usage: [options] The XML suite files to run
Thanks
is it fixed?
Hi Mukesh, How to Trigger TestRunner class programatically And that too Only When there are failed Test cases ?
Hi Mukesh, thanks for your great work!
I'm a new comer to Selenium.
I installed Java, Eclipse and added selenium jar files.
I tried to write my first program using webdriver for IE browser (as this is only browser at my work)
I downloaded IE driverserver.exe and added a code for System.setproperty etc..
but when i wrote 'Web Driver driver = new InternetExplorerDriver();'
I'm not seeing 'Import InternetExplorerDriver from the down yellow box.. and also not seeing 'Import Webdriver' too.
so i cannot import 'Webdriver' and 'InternetExplorerDriver'.
Under the package name, i manually tried to write 'import org.openqa.Selenium WebDriver' also, but it is not recognizing and shows red cross mark..
Why is it happening? what could be the problem? can you pls help me..
Hi Anuradha have you downloaded Selenium 3 beta or any other jar.. You can download Selenium 3 server from below location docs.seleniumhq.org/download/
Can't we do via IRetryAnalyzer ? Which approach is recommended ?
Use IRetryAnalyzer which is more effective and structured...
hi mukesh I wanted to know that from a list of test cases, for eg: 100 test cases are there among them i want to run first 10 an then last 20 test cases .....how can we do it , please explain...?
You can use Group feature in this case.
Hi Mukesh,
Just a doubt for this approach. By running this TestRunner class we can't get the class names which are failed. we just found in console output that 1 TC is failed. So how can we know which TC is failed. Can you explain this.
Hi Nitya when you open failed-testcase.xml file you will get all details about class and methods
Hi Mukesh, you have executed the failed test case initially, so again one folder gets created, so everytime if you run a failed test case then a new folder will get created every time?
No , butyou have to follow the same steps as mention during the execution, and it will ask to replace the existing *.xml and html say yes if you want to over write else no and hence you utilize the existing path.I hope it helps
if I add this runner class to my framework and just execute my test cases in normal way then all failed test cases will be rerun ?
how testng will know I have to run this class post test execution ?
Hi Mukesh,
I have a query here. Suppose I execute my nightly builds and check the status the next day. Now the first test case has failed due to which my whole build got failed. In that case how will you trigger this logic? Since you have manually ran your runner class. Is it possible to execute the runner class as soon as the test case failed. In that case I guess IRetryAnalyser will come into picture. Kindly suggest if I'm going in the right direction.
Thanks
Ankit
Hi Ankit yes in running via Jenkins then IRetryAnalyser will help.
Thanks a lot mukesh for your quick response. Another question that came into my mind that the restriction in using IRetryAnalyser is that every class may needs to implement this. So if i am having 100 classes then everytime i would need to write the code logic in order to run the failed tests in each class. Wouldn't the code be reduntant then. What could be the solution for this? Pls correct me if i'm going in wrong direction.
And thanks a lot for ur efforts in putting up such great videos.
+ANKIT SAXENA Hi Ankit no you can keep in testng.xml file so it will take care of all this..
+Mukesh otwani mmmm can you pls post a very small snippet. i got your point though but snippet would b very helpful if you can.. thanku so much Mukesh :-)
+ANKIT SAXENA will upload soon
I have one question, When the failed test cases are stored in failed xml folder. Can we trigger this in a script where we dont have to run manually from the tester runner page?
Yes Harjo, why not you can run testng.failed.xml from script as well.
When this Code will execute if any testscript fail? means on what conditions it will run and for how many times it will run?
Awesome ...Excellent info
hi mukesh i have one doubt?how to generate testng.xml file automatically? ididnt find the option "convert testng"could you guide me please?
+Sandeep Nagireddy hi Sandeep you have to add testng plugin in eclipse then only testng options will come.
You can download testng from market place
How to build only failed test cases in jenkins? Example i have 200 test cases and 25 has failed. so how to build only failed test case?
Superb Explanation. I just tried to run failed test scripts as you shown in the video. But I am facing below error:
[TestNG] [ERROR] No test suite found. Nothing to run
Usage: [options] The XML suite files to run
Options:
-configfailurepolicy
Configuration failure policy (skip or continue)
-d
Output directory
-dataproviderthreadcount
Number of threads to use when running data providers
-excludegroups
Comma-separated list of group names to exclude
-groups
Comma-separated list of group names to be run
-junit
JUnit mode
Default: false
-listener
List of .class files or list of class names implementing ITestListener or
ISuiteListener
-methods
Comma separated of test methods
Default: []
-methodselectors
List of .class files or list of class names implementing IMethodSelector
-mixed
Mixed mode - autodetect the type of current test and run it with
appropriate runner
Default: false
-objectfactory
List of .class files or list of class names implementing
ITestRunnerFactory
-parallel
Parallel mode (methods, tests or classes)
Possible Values: [tests, methods, classes, instances, none, true, false]
-port
The port
-reporter
Extended configuration for custom report listener
-suitename
Default name of test suite, if not specified in suite definition file or
source code
-suitethreadpoolsize
Size of the thread pool to use to run suites
Default: 1
-testclass
The list of test classes
-testjar
A jar file containing the tests
-testname
Default name of test, if not specified in suitedefinition file or source
code
-testnames
The list of test names to run
-testrunfactory, -testRunFactory
The factory used to create tests
-threadcount
Number of threads to use when running tests in parallel
-usedefaultlisteners
Whether to use the default listeners
Default: true
-log, -verbose
Level of verbosity
-xmlpathinjar
The full path to the xml file inside the jar file (only valid if -testjar
was specified)
Default: testng.xml
Could you please let me know how to fix it.
Hey Deepika this error comes when no xml to run. It means all test are passed or no xml generated.
Thanks mukesh for your reply. I have failed xml file which is generated under test-output folder and I given correct path as well.
I got know the resolution. I had written 'runner.setTestNames(lst);' instead of 'runner.setTestSuites(lst); ' thats why It was not running. Now my script is running fine. Thanks a lot for providing such a helpful videos.
can t we execute Testng .xml instead also observed that now no need to put double slash in the path for testng.xml in the example
How do you trigger this script in an Automation Framework using Selenium Webdriver and testNG ??
In framework you can use Listeners to re run test cases.
hi mukesh
please make video for this
how to test from 25 to 35 testcases out of 100 testcases i selenium
Hi Sachin,
You can mention all test in xml and you can run
hello sir, I am not getting test folder afer refreshing my test folder (html file), can you help me regarding this
Hi Mukesh, please close all the unwanted tabs in Eclipse while explaining.
Thank you 😊
You're welcome 😊
What about skipped testcases ? what if i want to run skipped and failed testcases together ? please reply
HI Swanand skipped and failed both can be executed with same xml file.
will it run the testcases after this assert code testcase??
Hi Sanket, Sorry I did not get your question. Can you brief more about it?
15:55 you are running the failed test but its again failed right ?
Yes Krishna because we havent fixed the script. Once you get failed test you have to fix it and then run the test again.
Hi,
I am getting the below error while executing TestRunner class...
Exception in thread "main" java.lang.NoClassDefFoundError: org/testng/TestNG
at com.testng.TestRunner1.main(TestRunner1.java:12)
Caused by: java.lang.ClassNotFoundException: org.testng.TestNG
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
Kindly run testng-failed.xml file
It is working fine when run testng-failed.xml directly. But when create TestRunner class to run testng-failed.xml. It is giving the above error.. Please suggest what to do... Please find my TestRunner code below.
import java.util.ArrayList;
import java.util.List;
import org.testng.TestNG;
public class TestRunner1 {
public static void main(String[] args) {
TestNG test = new TestNG();
List list = new ArrayList();
list.add("D:\\Selenium\\PractiseWorkSpace\\WebdriverProject\\test-output\\Sanity testing\\testng-failed.xml");
test.setTestSuites(list);
test.run();
}
}
Sir y we r using main method in testng,in testng annotations will be plays major role na sir
Yes, correct but this requirement is different. If you want to run failed test cases (using testng-failed.xml)manually then you dont need any main method.
If you want to trigger the xml automatically ten you can use main method or @Test to run the xml file.
@@Mukeshotwani Hi Sir
I want to implement these at my framework level where I need to call these method either aftersuite or at listener please can you tell me
Awesome!
Thank you Shanku
really helpful
Thanks Supriya
Hi Sir, how can we execute failed test case for JUnit?
Hello Sezeen, you can do using TestRule
junit.org/junit4/javadoc/4.12/org/junit/rules/TestRule.html
i handle 50 test case but the 25 case only failed other case need for run so how to write code
HI Karthi, you have to fix the failed test cases and run the tesng-failed.xml file
what is threadpoolsize in selenium ???
fabulous :)
Thanks AMit
Then how to send the report of pass and mail through mail using selenium in pictorial format?
HI Suresh,
You can do this in 2 ways
1- Using Jenkins email plugins th-cam.com/video/zGeL5vJnE40/w-d-xo.html
2-Using Java Library th-cam.com/video/qGq9K85mGyA/w-d-xo.html
How to differentiate failed ans passed testcases without reports
You can get this information in console.
super video
Thanks Prasanna
i am very sorry to say this but information given here is wrong. We have listeners in testng which we have to use not this way. Please update your video might give wrong information to beginners.
Hi Srikant we have different ways to execute failed test cases in testng.
We have listeners too but how can you say this information is wrong. Can you explain here?
How to do it in Nunit?
Then how to execute single testcase 10000 times???
Hi Alla,
This is the code
Below code will run 5 times
@Test(invocationCount=5)
public void test1()
{
System.out.println("Hello");
System.out.println(Thread.currentThread().getId());
}
code:
TestNG = new TestNG();
List=new ArrayList();
list.add("C:\Workspace\project_name\test_output\Test_suite_name\tenstng-failed.xml");
runner.setTestSuits(list);
runner.run();
Hi Dror what is issue here?
No issue. I didn't see the code from the video, so wrote it here in case people want to copy it :)