標籤:一、對一個方法進行測試private static void printPrimes(int n){ int curPrime; int numPrimes; boolean isPrime; int [] primes = new int [43]; primes[0]=2; numPrimes = 1; curPrime = 2; while ( numPrimes
標籤:軟體測試的第一次上機課上,第一次使用JUint對項目進行測試。安裝是最開始要進行的工作,JUint的安裝是比較容易的,只需將需要的jar包引入到項目中即可最開始的Triangle代碼如下:package com.tju.scs;public class Triangle { int a, b, c; public Triangle(){ a = 0; b = 0; c = 0; } public Triangle(int
標籤:要求:寫程式判斷3個整數組成的邊圍成的圖形是否為三角形,且判斷出等邊三角形,等腰三角形,不等邊三角形。編寫的java代碼如下:public class triangle { public String f(int a, int b, int c){ if(a==0||b==0||c==0||a+b<=c||a+c<=b||b+c<=a) return
標籤:Description of triangle problem:Function triangle takes three integers a,b,c which are length of triangle sides; calculates whether the triangle is equilateral, isosceles, or scalene. 簡單地判斷一個三角形的形狀軟體結構如下:Triangle的內容:判斷三角形的形狀的代碼如下:public
標籤:一、Eclipse下安裝junit, hamcrest and eclemma。 由於現在版本的Eclipse都已經整合了JUnit Test Case,所以不必再匯入JUnit和hamcrest的jar包了,只需要在需要測試的類中,右鍵點擊New,選擇建立一個JUnit Test Case即可,Eclipse會自動匯入所需要的兩個jar包。 安裝eclemma,在Eclipse中,選擇Help->Eclipse
標籤:Lab 1 Junit and Eclemma一. 實驗要求:Install Junit(4.12), Hamcrest(1.3) with EclipseInstall Eclemma with EclipseWrite a java program for the triangle problem and test the program with Junit.a) Description of triangle