Stqa Mini Project 1
Stqa Mini Project 1
Engineering
STQA Mini Project No. 1
R C V T Total Dated Sign
(2) (4) (2) (2) (10)
1.1 Title
Mini-Project 1: Create a small application by selecting relevant system environment/
platform and programming languages. Narrate concise Test Plan consisting features to be tested and bug
taxonomy. Prepare Test Cases inclusive of Test Procedures for identified Test Scenarios. Perform selective
Black-box and White-box testing covering Unit and Integration test by using suitable Testing tools. Prepare
Test Reports based on Test Pass/Fail Criteria and judge the acceptance of application developed.
4. Give JunitTestProject name to the project and check use project folder as root for source and
class files
9. See the Programming hub package see in project Explorer Screen of Eclipse
Lab Practices-2 Fourth Year Computer Engineering
Engineering
10. Right Click on Programminghub Package->New->Class give the name JunitClass->Click Finish.
12 Write a small program with only two functions Add and Multiplication
14. Name test suite as AddTest and choose New Junit4 test
19. Let us run AddTest test case. Right click AddTest-> Debug As->JUnit Test
20. Result of test case is as follows. It shows 0 error and 0 failure and green color test bar which
means that test case has run successfully( Green Color Bar Indicate)
Lab Practices-2 Fourth Year Computer Engineering
Engineering
21. Let us purposely give wrong input in assertEquals method or unexpected result here we write
501 instead of 500 indicate wrong addition result
22. Now test case should fail.(Brown Color Bar Indicate) So again run AddTest as follows
Lab Practices-2 Fourth Year Computer Engineering
Engineering
23. Similarly you can Create Test case for Multiplication Function
Click on Project Explorer Screen-> Right Click on JunitClass->New->JUnit Test Case-> Give name
MulTest.
24. Click on Next ->Select Mul Check Box -> Click Finish
Lab Practices-2 Fourth Year Computer Engineering
Engineering
29. Now let us create Test Suite both add and mul test cases in one time
Lab Practices-2 Fourth Year Computer Engineering
Engineering
33. Execute Test Suite Right Click on All Test ->Debug->JUnit Test
34. Test Suite Executed successfully Test suite fails even if a single test case among all fails.
Lab Practices-2 Fourth Year Computer Engineering
Engineering
35. Now Create Test Report Using Apache Maven
If you use eclipse-java-photon-R-win32 Version it include Maven in built installed so no need to install
software via Eclipse help Install Software Option
39. Select Check Box Create Simple Project-> Click Next-> Give Group Id and Artifact name
45. after Enter keyword Junit inside Seach box then Enter->it shown another Site Maven
Repository for Junit Select that site.
Lab Practices-2 Fourth Year Computer Engineering
Engineering
47. Click on JUnit-> Open and click on latest version as shown below (here 4.12x)
50. Now Paste the above code in between <dependencies> tag then save pom.xml file
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
Lab Practices-2 Fourth Year Computer Engineering
Engineering
57. Now go to Eclipse -> Click on Maven Test Project->Right Click on src/test/java
60. It shows the manvenTest Package under src/test/java folder now rename same by right click on
mavenTest Click on Refactor->Rename->give another name com.tem.mavenDemo->Click on ok
Lab Practices-2 Fourth Year Computer Engineering
Engineering
63. after Download->go to Program File->create one folder give name maven-> now extract the
downloaded file in maven folder
C:\Program Files\maven%MAVEN_HOME%\bin;%M2_HOME%\bin;
Lab Practices-2 Fourth Year Computer Engineering
Engineering
4. Verification
Now copy Previous Created JUnit Test case java file Add Test and Mul Test Paste
Externally in E:\MavenTestProject\src\test\java
To run test suite or all test cases under project, give command mvn test
You can even run individual test cases. Give command mvn test –Dtesttestcasename
Lab Practices-2 Fourth Year Computer Engineering
Engineering
Eg. mvn test –Dtest-AllTest
1.8.8 Conclusion
In this way using JUnit and Maven Automation tool we are Perform Unit Testing and Prepare Test
Report of same.