Can You Write a Simple Class for JUnit Testing in 1 Minute?
Submitted by: AdministratorYou need to write a class with less than 10 lines. Here is a nice example provided in the article "Writing a JUnit Test in 5 minutes" by Kamal Mettananda with some minor changes:
package com.parcelhouse.myproj;
public class Calc {
public int add(int a, int b) {
// errorneous method
return a+b+1;
}
public int multiply(int a, int b) {
return a*b;
}
}
Submitted by: Administrator
package com.parcelhouse.myproj;
public class Calc {
public int add(int a, int b) {
// errorneous method
return a+b+1;
}
public int multiply(int a, int b) {
return a*b;
}
}
Submitted by: Administrator
Read Online JUnit Job Interview Questions And Answers
Top JUnit Questions
☺ | What Is JUnit? |
☺ | Why Does Poeple Import org.junit.Assert Statically? |
☺ | How To Wirte a Simple JUnit Test Class? |
☺ | Why Do You Use JUnit to Test Your Code? |
☺ | How Do You Launch a Debugger When a Test Fails? |
Top Testing Categories
☺ | Manual Testing Interview Questions. |
☺ | Rational TestSuite Interview Questions. |
☺ | QTP Interview Questions. |
☺ | Database Testing Interview Questions. |
☺ | Software QA Interview Questions. |