Below are the steps
1. Create a Test Suite class where we create the Test Suites which will call all the test cases in a particular order.
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
public class TestSuite1 extends TestCase {
public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTestSuite( TestCase1.class);
suite.addTestSuite( TestCase2.class);
suite.addTestSuite( TestCase3.class);
return suite;
}
public static void main(String arg[])
{
TestRunner.run(suite());
}
}
Step 2. Create your first test case
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.*;
public class TestCase1 extends SeleneseTestCase{
Selenium selenium;
public static final String MAX_WAIT_TIME_IN_MS="60000";
private SeleniumServer seleniumServer;
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
rc.setSingleWindow(true);
seleniumServer = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com/");
seleniumServer.start();
selenium.start();
}
public void testgoogling() {
selenium.open("/");
selenium.type("q", "Niraj");
selenium.click("btnG");
selenium.waitForPageToLoad(MAX_WAIT_TIME_IN_MS);
assertTrue(selenium.isTextPresent("Niraj"));
}
public void tearDown() throws InterruptedException{
selenium.stop();
seleniumServer.stop();
}
}
Step 3. Create your second test case
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.*;
public class TestCase2 extends SeleneseTestCase{
Selenium selenium;
public static final String MAX_WAIT_TIME_IN_MS="60000";
private SeleniumServer seleniumServer;
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
rc.setSingleWindow(true);
seleniumServer = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com/");
seleniumServer.start();
selenium.start();
}
public void testgoogling() {
selenium.open("/");
selenium.type("q", "Niraj Kumar");
selenium.click("btnG");
selenium.waitForPageToLoad(MAX_WAIT_TIME_IN_MS);
assertTrue(selenium.isTextPresent("Niraj Kumar"));
}
public void tearDown() throws InterruptedException{
selenium.stop();
seleniumServer.stop();
}
}
Step 4. Create your third test case
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.*;
public class TestCase3 extends SeleneseTestCase{
Selenium selenium;
public static final String MAX_WAIT_TIME_IN_MS="60000";
private SeleniumServer seleniumServer;
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
rc.setSingleWindow(true);
seleniumServer = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com/");
seleniumServer.start();
selenium.start();
}
public void testgoogling() {
selenium.open("/");
selenium.type("q", "http://www.automationtricks.blogspot.com");
selenium.click("btnG");
selenium.waitForPageToLoad(MAX_WAIT_TIME_IN_MS);
assertTrue(selenium.isTextPresent("http://www.automationtricks.blogspot.com"));
}
public void tearDown() throws InterruptedException{
selenium.stop();
seleniumServer.stop();
}
}
Step 5. Run your Test Suite Go to your Test Suite class and right click on that and run as Junit Test.
This will run the TestCase1 then TestCase2 then TestCase3
If you want to execute your test cases in some specific order then you call them in that order like.
suite.addTestSuite( TestCase3.class);
suite.addTestSuite( TestCase2.class);
suite.addTestSuite( TestCase1.class);
Above will run the TestCase3 first then TestCase2 then TestCase1.
when i follow the same suggested steps then:::::::::::
ReplyDeletei got ..........
junit.framework.AssertionFailedError: No tests found in testsuiteforall
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestSuite$1.runTest(TestSuite.java:97)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Getting a syntax error when adding the test cases to the test suite using suite.addTestSuite, is the test suite supposed to be in the same pakage where the test cases are?, please advise
ReplyDeletei am running the following code but i get error "The method addTestSuite(Class) in the type TestSuite is not applicable for the arguments (Class)"
ReplyDeletecan i have the solution for that.
Thanks in advance.
Sanwal
.....................
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
public class TestSuite1 extends TestCase {
public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTestSuite(TestCase1.class);
suite.addTestSuite(TestCase2.class);
suite.addTestSuite(TestCase3.class);
return suite;
}
public static void main(String[] args)
{
junit.textui.TestRunner.run(suite());
}
}
Great job man! It really helped me out. Thanks a lot!
ReplyDeleteAn infοrmatiοn and instгuctiοnal site foг the
ReplyDeletehome pizza сook. When уou are bakіng
bread, уou сan rаise the brеad dough in the cold oѵen anԁ then just tuгn on the oven
to thе coгrect temperatuге once the breaԁ
іs raiѕеԁ. Roll each portiοn іnto
the thicκness of a bгοom
handle.
my weblοg http://blog.bitcomet.com/
Hi mates, its fantastic piece of writing concerning teachingand entirely explained,
ReplyDeletekeep it up all the time.
my weblog ... http://goliterature.info/
hi my name is veena, i tried the above mentioned way,i am getting the output but each test cases are executing two times. please help me to solve this problem
ReplyDeleteHi Mam,
DeletePlease tell me how you run, becouse i have error on suite.addTest( TestCase1.class);
suite.addTestSuite( TestCase2.class);
suite.addTestSuite( TestCase3.class);
analyѕt І fеeling that there are non-ratіonal fοrces at deliѵer the
ReplyDeleteresults. Тhen there arе experts аnd other anxіοus eѵeryԁаy people ωho
arе seemingly pгеѵenting а drοppіng bаttle
to ѕtem the tіԁe princіpal toward environmentаl Аrmageԁdon or as thе tіtle of this
posting calls it "Warmageddon. A full grain breakfast of outdated-fashioned oatmeal with almonds (grind them up to cover them, if necessary) will keep a kid way for a longer time than orange juice and a bagel.
my website; old stone oven
I don't know whether it's just me or if eνerуbodу elѕe еnсountering іssuеs with your webѕitе.
ReplyDeleteIt seems lіke ѕomе of thе text in youг posts are running off the sсгeen.
Сan somebodу else pleаse proviԁe fеedback аnd let me knoω if thіs is haρρening tо them toο?
This may be a problеm with mу іnternet brοwser because І've had this happen previously. Cheers
Also visit my web-site ... augenoperation
Hi Dear, are you really visiting this website regularly,
ReplyDeleteif so then you will definitely take fastidious know-how.
Look into my web page Buffbulliesamericanbulldogs.Com
Τhe USDA аnd other fоod safety eхpеrts recommenԁ leaving ρizza оut at room temρeratuгe for no more than two hours.
ReplyDeleteI сan't exactly remember why--maybe it was peer pressure from our health-driven community, who knows. Roll each portion into the thickness of a broom handle.
My site mario batali pizza pan and Griddle
Ηi there it's me, I am also visiting this web site daily, this website is genuinely good and the visitors are really sharing pleasant thoughts.
ReplyDeleteFeel free to surf to my homepage :: Chemietoilette
Thiѕ page definitely haѕ all the information
ReplyDeleteI ωаnted сonсеrning this subject and didn't know who to ask.
Here is my web blog - Chemietoilette
Waу cool! Some eхtrеmеlу ѵaliԁ points!
ReplyDeleteI аppreсiate уou ωгiting thіs
artiсle and also the rest οf the sіte
is very good.
Ηеre іs my sitе ... www.backninefinance.com
I νiѕited multіple blogs еxcеρt thе audio qualitу foг аudiо ѕongs curгеnt at
ReplyDeletethiѕ web pаgе іs rеally marvelous.
Taκe a looκ аt my webpаgе - Chemietoilette
I visited multiple blogs except the audio quality foг аudio songs current at this ωeb pagе is really marvelous.
ReplyDeleteFeel free to visit my web sіte; Chemietoilette
My site > empathyearnesty.net
Usually I don't read post on blogs, however I would like to say that this write-up very forced me to take a look at and do it! Your writing taste has been amazed me. Thank you, very great post.
ReplyDeleteFeel free to surf to my web-site: youmob.com
I was curious if you ever considered changіng the
ReplyDeletestructuгe of yοur sіte? Its verу well wгitten; I lоvе what youve got to sаy.
Βut maybe you could a lіttle morе in thе way of contеnt so people could сonnеct wіth it better.
Youve gοt an awful lot of tехt for οnlу having one
or 2 pictures. Maybe уou could space it out better?
My web-ѕitе: antivirus firewall software
Thanκs for anу other informatіѵe wеbsite.
ReplyDeleteThe place else mаy Ι am gettіng that kinԁ of informatіοn wгitten in suсh a perfect waу?
I have a mission thаt I'm just now running on, and I've been on the look
out for such informаtion.
mу wеb ѕіtе ... Chemietoilette
My relatіѵeѕ alwayѕ say that I am killing my tіmе here at
ReplyDeleteweb, but I know Ӏ am getting κnowledge dailу by reading
ѕuch pleasant articles or reviews.
Feel free to ѕurf to my web blog: Chemietoilette
Linκ exchange іѕ nothing else however it is simplу placing the other person's website link on your page at appropriate place and other person will also do similar for you.
ReplyDeleteAlso visit my weblog; augen lasern
It's really a nice and useful piece of info. I'm satisfied
ReplyDeletethat you simply shared this useful information with us.
Please stay us informed like this. Thanks for sharing.
Feel free to visit my website - depressing quotes
Howdy very nice web site!! Man .. Beautiful ..
ReplyDeleteWonderful .. I will bookmark your site and take the feeds also?
I am satisfied to find numerous useful information here in the submit, we'd like work out more techniques on this regard, thank you for sharing. . . . . .
Here is my webpage; teddy roosevelt quotes
Yes! Finally something about accident lawyers nyc.
ReplyDeleteMy web-site ... future quotes
Hi to all, for the reason that I am actually eager of reading this weblog's post to be updated regularly. It contains pleasant information.
ReplyDeleteHere is my weblog: e. e. cummings quotes
Pretty! This was a really wonderful post. Thanks for supplying this info.
ReplyDeleteLook at my page: feelings quotes
When some one searches for his necessary thing, so he/she desires to be available that
ReplyDeletein detail, thus that thing is maintained over here.
My page; william shakespeare quotes
If you are going for best contents like I do, only pay a visit this
ReplyDeleteweb site all the time since it offers feature contents, thanks
Here is my blog post :: letting go quotes
I'd like to find out more? I'd love to find out some additional information.
ReplyDeletemy blog post ... madea quotes
If some one needs to be updated with most up-to-date technologies after
ReplyDeletethat he must be visit this website and be up to date every day.
Take a look at my website - nora ephron quotes
It's awesome in favor of me to have a website, which is beneficial for my experience. thanks admin
ReplyDeleteHere is my website mistake quotes
I just could not go away your web site before suggesting that I extremely loved the
ReplyDeletestandard info an individual supply in your guests? Is going to be back incessantly in order to inspect new posts
Feel free to visit my homepage ... madea quotes
I was suggested this blog via my cousin. I'm now not sure whether or not this put up is written via him as nobody else understand such particular approximately my problem. You are incredible! Thanks!
ReplyDeletemy page; thanks quotes
I every time spent my half an hour to read this web site's content daily along with a mug of coffee.
ReplyDeletemy web-site :: genghis khan quotes
Do you mind if I quote a few of your articles as long as I provide credit and sources
ReplyDeleteback to your site? My website is in the very same area of interest as yours and my visitors would definitely
benefit from some of the information you present here. Please let me know if this alright with you.
Thanks!
my blog :: frank ocean quotes
Howdy! I just want to give you a huge thumbs up for the excellent info you have here on this post.
ReplyDeleteI will be coming back to your web site for more soon.
my weblog unusual animals
My spouse and I absolutely love your blog and find nearly all of your post's to be precisely what I'm looking for.
ReplyDeleteDoes one offer guest writers to write content to suit your
needs? I wouldn't mind publishing a post or elaborating on a few of the subjects you write related to here. Again, awesome web log!
Feel free to surf to my page - kahlil gibran quotes
Have you ever thought about publishing an e-book or guest authoring on other websites?
ReplyDeleteI have a blog based on the same information you discuss
and would really like to have you share some stories/information.
I know my audience would appreciate your work.
If you're even remotely interested, feel free to shoot me an email.
my web page: future quotes
I visited several websites except the audio feature for audio songs
ReplyDeletecurrent at this web page is truly superb.
Here is my web blog depressing quotes
There is certainly a great deal to know about this issue.
ReplyDeleteI like all of the points you have made.
Feel free to surf to my weblog; friedrich nietzsche quotes
What's up, everything is going well here and ofcourse every one is sharing data, that's truly good,
ReplyDeletekeep up writing.
my website - self esteem quotes
It's the best time to make some plans for the long run and it is time to be happy. I've learn
ReplyDeletethis publish and if I may just I want to counsel you few attention-grabbing things or suggestions.
Maybe you can write next articles referring to this article.
I desire to learn more issues about it!
Feel free to visit my web blog - rolling stones songs
You really make it seem so easy with your presentation but I find this topic to be actually
ReplyDeletesomething which I think I would never understand.
It seems too complex and extremely broad for me.
I'm looking forward for your next post, I'll try to get the hang of it!
my site: self esteem quotes
Hi! I know this is kind of off topic but I was wondering if you knew where I could find a captcha plugin for my comment
ReplyDeleteform? I'm using the same blog platform as yours and I'm having trouble finding one?
Thanks a lot!
Also visit my weblog: frank ocean quotes
It's very easy to find out any matter on net as compared to books, as I found this post at this website.
ReplyDeleteHere is my web-site :: struggle quotes
I do not know if it's just me or if everybody else experiencing problems with your site. It looks like some of the written text within your content are running off the screen. Can someone else please provide feedback and let me know if this is happening to them too? This could be a issue with my internet browser because I've had this happen before.
ReplyDeleteMany thanks
Check out my site sylvia plath quotes
all the time i used to read smaller content that also clear their motive, and that
ReplyDeleteis also happening with this paragraph which I am reading at this place.
Also visit my web page; struggle quotes
What's up mates, how is everything, and what you wish for to say about this article, in my view its actually remarkable in favor of me.
ReplyDeleteAlso visit my web blog :: ignorance quotes
Hmm is anyone else experiencing problems with the images on this blog loading?
ReplyDeleteI'm trying to figure out if its a problem on my end or if it's
the blog. Any feed-back would be greatly appreciated.
Review my web site ... douglas adams quotes
Its like you read my mind! You appear to know a lot
ReplyDeleteabout this, like you wrote the book in it or something. I think that you could do with some pics
to drive the message home a little bit, but instead of that, this is great blog.
A fantastic read. I will certainly be back.
my homepage - mistake quotes
Hello, i think that i saw you visited my blog thus i came to “return the favor”.
ReplyDeleteI'm trying to find things to enhance my website!I suppose its ok to use a few of your ideas!!
Also visit my weblog - e. e. cummings quotes
I like reading a post that will make people think.
ReplyDeleteAlso, many thanks for allowing for me to comment!
my site :: ignorance quotes
Hi there, i read your blog from time to time and i own a similar one
ReplyDeleteand i was just wondering if you get a lot of spam feedback?
If so how do you stop it, any plugin or anything you can recommend?
I get so much lately it's driving me insane so any assistance is very much appreciated.
Feel free to surf to my page rolling stones songs
Way cool! Some extremely valid points! I appreciate you penning this article and the rest of the website is very good.
ReplyDeleteAlso visit my website - tired quotes
you're really a just right webmaster. The website loading pace is amazing. It kind of feels that you're doing any unique trick.
ReplyDeleteMoreover, The contents are masterpiece. you have done
a excellent process on this subject!
Review my blog; john locke quotes
Its like you learn my thoughts! You appear to grasp so much approximately
ReplyDeletethis, like you wrote the book in it or something.
I think that you simply could do with some % to drive the message house a bit, but other than that, this is magnificent blog. An excellent read. I will certainly be back.
My website :: john locke quotes
I believe this is among the most significant information
ReplyDeletefor me. And i am satisfied studying your article. However want to statement on some basic issues, The web site style is wonderful, the articles is in reality great : D.
Good activity, cheers
My web site ... girlfriend quotes
Carefully enable go and then еstabliѕhed the spider upside down (with іtѕ legs in the aіr)
ReplyDeleteto dry. Get ready the ѕpace in whiсh уοu are heading
to be doіng the colоrng. They have lіvеԁ lives akin to thаt of great saints, sаgеѕ and Rishis who had been acknοwlеԁgeԁ for their penance аnd аusterities.
Feel free to visit mу web page; roshco pizza stone set
Hey There. I discovered your blog the usage of msn.
ReplyDeleteThat is a really smartly written article. I will be sure to bookmark it
and return to learn more of your useful information.
Thank you for the post. I'll certainly comeback.
Here is my website - leonardo da vinci quotes
I know this site presents quality based posts and extra material, is there any other web page which offers these
ReplyDeletestuff in quality?
my web page - discipline quotes
Rеmагκаble! Ӏts actually awesome piecе of ωriting, Ι have got muсh cleаг idea about from this агticle.
ReplyDeleteAlso visіt my websіte: jaimaithili.com
Hello! This is my 1st comment here so I just wanted to give a quick shout out and say I
ReplyDeletetruly enjoy reading your blog posts. Can you recommend any other blogs/websites/forums that
go over the same subjects? Thanks for your time!
Feel free to surf to my web page ... http://www.shredordie.com
I visit every day a few web sites and sites to read content,
ReplyDeleteexcept this webpage provides quality based content.
My web blog ... plus.google.com
each time i used to read smaller content that as well
ReplyDeleteclear their motive, and that is also happening with this post which I am reading at
this time.
my web site discuss
Hi there, just became alert to your blog through Google,
ReplyDeleteand found that it is truly informative. I'm gonna watch out for brussels. I'll be
grateful if you continue this in future. Many people will be benefited from
your writing. Cheers!
Have a look at my web page: this website
I will right away grasp your rss feed as I
ReplyDeletecan't find your email subscription link or e-newsletter service. Do you have any? Please allow me understand so that I may just subscribe. Thanks.
Look at my blog: Bonuses
Why people still make use of to read news papers when in this technological world all is
ReplyDeleteavailable on net?
Look at my web site; you could try these out
I do consider all of the concepts you have offered for your post.
ReplyDeleteThey are very convincing and can certainly work.
Nonetheless, the posts are too short for beginners.
May just you please prolong them a bit from subsequent time?
Thank you for the post.
Have a look at my homepage: check here
Good day! I could have sworn I've been to your blog before but after going through many of the posts I realized it's new to me.
ReplyDeleteAnyways, I'm definitely happy I came across it and I'll be book-marking it and checking back frequently!
Feel free to surf to my web-site click this link here now
I'm really impressed with your writing skills and also with the layout on your weblog. Is this a paid theme or did you modify it yourself? Anyway keep up the nice quality writing, it is rare to see a nice blog like this one today.
ReplyDeleteLook at my webpage ... www.purevolume.com
Why visitors still use to read news papers when in this
ReplyDeletetechnological world everything is existing on net?
Have a look at my blog additional reading
Make a point to check out thе mοst
ReplyDeletepopular vаrieties of bіrthdаy ѕhowеr cupсakes аt the bakеry
аnd pick up the one that seеms likе matching to youг needs.
<a href="http://mail.raetselwelt.info/php.php?a[]=%3Ca+href=%22http://korillolatino.com/blog/44/framed-rest-room-mirrors/%22%3Ekorillolatino.com%3C/a%3E>But that hatred isn't what affects the voting for Mr</a>.
Aѕ soon aѕ a ԁate is fіnalized, the guests woulԁ bе іnfoгmеd.
I am now not certain where you're getting your info, but good topic. I needs to spend a while finding out more or understanding more. Thanks for magnificent info I was searching for this info for my mission.
ReplyDeletemy site - Kindergeburtstag Mannheim
Wow! This blog looks exactly like my old one! It's on a completely different subject but it has pretty much the same layout and design. Wonderful choice of colors!
ReplyDeleteFeel free to visit my homepage: http://www.avtologic.ru/
These steps are same as configuring Junit in eclipse without selenium. Is it possible to configure the same using Maven. I mean Selenium and Junit working in sync using pom.xml.
ReplyDeleteThis page is more informative about the test suite in Junit and beginners can get the know about the selenium training. people willing to get the indepth knowledge in getting knowledge such as TestNG,jenkins,Maven and POM should get properly get selenium training in chennai
ReplyDelete
ReplyDeleteAmazing, thanks a lot my friend, I was also siting like a your banner image when I was thrown into Selenium.When I started learning then I understood it has got really cool stuff.
I can vouch webdriver has proved the best feature in Selenium framework.
Thanks a lot for taking a time to share a wonderful article.
Selenium Training in Velachery | Best Selenium Training Institute in Chennai
Amazing work. Professional Automation training in Chennai. visit our website for more info: Best Automation Anywhere Training Institute in Chennai
ReplyDelete