SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Showing posts with label JUnit. Show all posts
Showing posts with label JUnit. Show all posts

Sometimes you need to set time out for your webdriver test or you need to set expected exception condition for your test. Supposing you have written test for one module and you wants to set timeout for your test. Here timeout means allowed maximum time to complete full test. Same way, You are expecting some exception during your webdriver test execution and that exception is acceptable.If you are using junit framework for your webdriver test then you can do it very easily. We have seen example of - how to Ignore specific webdriver test using junit's @Ignore annotation in THIS POST. Now let me describe how to write timeout test and exception test in junit with examples.

Many readers are asking me the difference between JUnit annotations @Before VS @BeforeClass and @After VS @AfterClass in webdriver software automation test. If you have read my JUNIT ANNOTATIONS POST, I have clearly described difference between @Before and @BeforeClass annotations and @After and @AfterClass annotations in bold text. Now let me describe once more and then we will look at practical example for both of them to use them in software automation test.

As described in my previous post, We can create junit test suite to execute multiple test cases from one place. See example of my previous post. junittest2 class have two @Test methods. Now If I wants to exclude/Ignore 1st @Test method from execution and wants to execute only 2nd @Test method then how can I do It? Ignoring specific test in junit test is very easy.

If you are planning to perform regression testing of any software web application using webdriver software testing then obviously there will be multiple test cases or test classes under your webdriver project. Example - There are 2 junit test cases of software web application under your project's package. Now if you wants to run both of them then how will you do it? Simple and easy solution is creating JUnit test suite. If your project has more than 2 test cases of software web application then you can create test suite for all those test cases to run all test cases from one place.

We have seen how to configure system and eclipse in configuration part 1 and configuration part 2 posts to generate Selenium webdriver HTML test report. Now we have a test case and build.xml file in our project tree. Let me describe you few steps of configuring and running build.xml file in eclipse. Now follow the bellow given build.xml file configuration steps to generate HTML report

Webdriver test result generation is very important and essential part of automation testing and for that you need to configure your eclipse accordingly. Before eclipse and ant configuration, you need to configure your system as described in Part - 1. Now let me describe you the steps of eclipse configuration to generate web driver test execution report using JUnit. Perform bellow given steps.

Many people facing issues in JUnit report generation configuration using ant and eclipse. If every thing is not setup properly then it will give you one or another error and you will be not able to generate JUnit software test case execution report for your webdriver test case. Let me describe you few system configuration steps in this post and eclipse configuration steps in my next post to generate JUnit test execution report very easily and without any error.

Unit testing framework JUnit has many annotations to control the flow and activity of code execution of selenium webdriver software test cases. You must need to insert JUnit annotation inside the java code to execute your software test case as junit test case. You can look in my previous post where i have used JUnit @Test annotation before software test method. Let me describe you mostly used 3 JUnit Annotations with example. You can view more details on JUnit at http://junit.org/.

We have already discussed about how to download and install junit in eclipse to run webdriver automation software test in my previous post. Please note that you need to add junit jar file only if it is not available in webdriver software testing tool's jar file folder. If it is already there with webdriver jar file folder then you not need to do anything to create and run junit test. Now let me describe you how to create webdriver test case using junit.

We have already learn how to configure eclipse for webdriver, Creating new project, new package and then adding new class in my one of the previous post. In that post you can see how to add external jars of webdriver software testing tool in eclipse to install junit in eclipse. Also you can view how to run your first webdriver test in eclipse for better understanding.