Saturday, 11 August 2012

Why (Why Not) Automation Testing


Automation testing is validating the application using a BOT/Program. That is, automating the process/steps, which a manual tester used to perform.

Automated testing is important due to following reasons:
   1) Manual Testing is time and cost consuming
   2) It is difficult to test for multi lingual languages  manually
   3) Automation does not require Human intervention. You can run automated test unattended (overnight)
   4) Automation increases  speed of test execution
   5) Automation helps in increasing  Test Coverage, more time for manual tester to do free testing.
   6) Manual Testing can become boring and hence error prone

Which Test Cases to Automate?
   1) High Risk - Business Critical test cases needs to executed before reaching Customer.
   2) Test cases that are executed repeatedly
   3) Test Cases that are very tedious or difficult to perform manually
   4) Test Cases which are time consuming

Which Test Cases not to Automate?
   1) Test Cases that are newly designed and not executed manually  atleast once
   2) Test Cases for which the requirements are changing frequently
   3) Test cases which are executed on ad-hoc bases.

Automation Testing Process

Below screenshot shows the flow of automation testing process.
Tool Selection-: Where you select the best suited tool for your product, Things you may need to consider here are, is my product is desktop based or web based. Is my testing required related to back end or front end and UI based testing. Can you afford a licensed tool or do you need an open source tool?

Once you decide/select the tool to use for automation testing, next thing up is defining Scope of the automation testing.

Scope Define-: Never jump to write test scripts as soon as you get the tool. Define/Select what needs to be tested in other words, select the test cases which you want to automate. May be for the starter, select cases for POC, major test cases in your application.

Script Development -: Then design your framework, and continue your script development. We will see about designing test framework in the next post.

Maintenance-: Once you are done with script development, then continue the script run and maintain your scripts for any change in the application.

Please feel free to drop a comment if you have any suggestion/issue/comment related to the above post.

Thanks!!!

Junit Test Execution Continues

In my last junit post, i have written about some basic annotations of junit.This post is just an extension to the last post, today we will learn about @BeforeClass & @AfterClass.
 
@BeforeClass annotation is used to execute method which required run before class gets executed.


@AfterClass annotation is used to execute method which required run before class gets executed.

Now we already know from the last post that, @Test method is used to execute the test case method, it holds code of your test case. Think about a scenario, if you want to do login, logout once and then want to execute 10 test case method with the same login. This can not be possible with @before and @after method. But it is possible with the use of above two annotations. How?? Lets see how we can do that.

@beforeclass method will get executed once before all the test methods and @afterclass method will get executed after all the test method completed their run.

lets see some code for the above annotations.



Ok let's run this case, Oops... there is an error, isn't it? why is that error? Now when the annotations name is beforeclass that means it must be getting executed before the class itself gets instantiated. That is not fair :(. Before instantiating the class how we can call a method, think about the most used method of java application "public static void main()". Yes, you got it right now, you need to make @beforeclass and @afterclass methods static so that they can execute themselves before the class gets loaded.

Now change the code and run.

Output of the run-:
 

As you can see in the result, beforeclass & afterclass gets executed only once for all the test methods.

Now think and use this in your selenium/Webdriver automation scripts. I will be posting about the use of asserts in the test script in my next post.

Please feel free to drop a comment if you have any suggestion/comment/issue on the above post.

Thanks!! 
 
 

Related Posts

Related Posts...