When you know a thing, to hold that you know it, and when you do not know a thing, to allow that you do not know it - this is knowledge. -Confucius-

Wednesday, July 31, 2013

Test Driven Development example - Part 4 (Simple Unit Testing for Java with NetBeans)

Lets code the all tests in the to do list. (this should be done one by, for the tutorial i used it just to show how to do it) The FibonacciTest.java file will be look like package tdd; import org.junit.Test; import static org.junit.Assert.*; public class FibonacciTest { @Test public void testGetFibonacci_0() { int x = 0; Fibonacci instance = new Fibonacci(); int expResult =...

Test Driven Development example - Part 3 (Simple Unit Testing for Java with NetBeans)

Our 2nd task in the to do list is, [2] getFibonacci(1) ==> 1 now we have a passing code. we have to make it fail. to that we can ask it the 1st Fibonacci number. change the FibonacciTest.java file as below. Here i have introduced a new method for check the result for input 1. Then it will be easy to identify what is going on. package tdd; import org.junit.Test; import static org.junit.Assert.*; public...

Test Driven Development example - Part 2 (Simple Unit Testing for Java with NetBeans)

After following the  previous work now we are good to code :) First of all lets edit the Fibonacci.java file. lets add a new method. package tdd; public class Fibonacci { public void getFibonacci(int x) { } } Now edit the FibonacciTest.java file like below. package tdd; import org.junit.Test; import static org.junit.Assert.*; public class FibonacciTest { public FibonacciTest() { } ...

Saturday, July 20, 2013

Test Driven Development example (Getting started)

There was a workshop in our university to give us an introduction about TDD by OrangeHRM. The followings are based on those experience.  You can read about TDD here . Simply the TDD coding process has 3 rules.(for more details refer this)  1) You are not allowed to write any production code unless it is to make a failing unit test pass.    2) You are not allowed to write any more of a unit...

Tuesday, July 16, 2013

Create a Chrome extenstion to highlight paragraphs on user click event

I started to create a Google chrome extension to highlight the web content. As the first step i was able to create this extension which highlight the whole "p" tag when a user click on it. There are 4 file. (manifest.json, tabcolor.js ,color.js,popup.html (to call the js files,but not necessary,there are other ways )) the manifest.json file looks like { "name": " page color 2.", "version": "1.0", "permissions":...