how to write test cases using JUnit framework?
466026
You want to write unit tests with JUnit.\n4.2.2 Solution\nCreate a subclass of junit.framework.TestCase. Each unit test is represented by a\ntestXXX( ) method within the TestCase subclass.\n4.2.3 Discussion\nExample 4-1 shows an extremely simple test case. A test case is a subclass of TestCase and\ncontains a collection of unit tests. Instances of TestCase are sometimes referred to as test fixtures,\nalthough we prefer to say "test case" since that matches the class name. Each unit test is a public, noargument\nmethod beginning with "test". If you do not follow this naming convention, JUnit will not\nbe able to locate your test methods automatically. Instead, you would have to write a suite( )\nmethod and construct instances of your test case, passing the test method name to the constructor.\nExample 4-1. Simple test case\npackage com.oreilly.javaxp.common;\nimport junit.framework.TestCase;\n/**\n* Sample unit tests for the {@link Person} class.\n*/\npublic class TestPerson extends TestCase {\n/**\n* This constructor is only required in JUnit 3.7 and\nearlier.\n* @param testMethodName the name of the test method to\nexecute.\n*/\npublic TestPerson(String testMethodName) {\nsuper(testMethodName);\n}\n/**\n* A unit test to verify the name is formatted correctly.\n*/\npublic void testGetFullName( ) {\nPerson p = new Person("Aidan", "Burke");\nassertEquals("Aidan Burke", p.getFullName( ));\n}\n/**\n* A unit test to verify that nulls are handled properly.\n*/\npublic void testNullsInName( ) {\nPerson p = new Person(null, "Burke");\nassertEquals("? Burke", p.getFullName( ));\n// this code is only executed if the previous\nassertEquals passed!\np = new Person("Tanner", null);\nassertEquals("Tanner ?", p.getFullName( ));\n}\n}\n\n\ni have a e-book ...u want it ... ican send it to u mail me at \n\nunsafe_pilot1@yahoo.com
952028
testng what language, hardware or tool?
87629
go to http://www.javaalmanac.com/. You will get some examples in java
116121
http://www.java.sun.com/
515059
http://java.sun.com/docs/books/tutorial/index.html
686721
http://java.sun.com/developer/Books/JDBCTutorial/
588928
when you're designing a software/application, you want to design some or many cases for it. a case define a situation when a user is useing the software. for an example, a simple case can go like like this:\n"i want to check for my account balance. if i mistakenly entered a character in a 'numeric-only' password field, how would the system react to that input?"\n\nbuild a case for every occasion that will happen when a user is using the system. a good Test Case is the one build by a cooperation between the developer and the user.
890914
The best tool you can use for testing web apps is your own browser. That is the same tool everyone is going to be using to access the web app too, so why not make sure that it is bug free using the tool everyone is using?\n\nNow there are a few tools for testing server-side code that you wrote for a web application. I have added several links to testing "frameworks" for some common server-side languages.\n\nHope this answers your question to your satisfaction.
14263
If you have the JDK installed ( else its here : http://java.sun.com/j2ee/1.4/download.html#sdk )\nand your classpath set \n( add CLASSPATH variable in your environmnet variables - MY Comp rt click properties > Advanced> Environment Variable > new variable >\n\nVariable : CLASSPATH \nValue    : .; \n\nAlso set PATH : <path of your JDK bin folder>\n)\n\nNow write your program in notepad , open cmd, and type \njavac myfile.java \n\nthe filename = classname and is case specific.\nthen if it results in zero errors, \n\ntype:\n\njava myfile\n\nthat would run your program
53687
write like this way\n\n//code starts here\n\npublic class vehicle {\n   int num_wheels;\n   double load;\n\n  //constructor of vehicle class\n  public vehicle(){\n    num_wheels=0;\n    load=0.0;\n  }\n\n  //set methods of the class vehicle\n\n  public void setNum(int n){\n     num_wheels=n;\n  }//end of set method\n\n  public void setLoad(double l){\n     load=l;\n  }//end of load method\n\n  //get methods of the class\n  public int getNum(){\n   return num_wheels;\n  }// end of method\n\n  public double getLoad(){\n   return load;\n  }//end of method\n}//end of class\n\n//subclass starts here\n\npublic class bus extends vehicle{\n  //add extra attributes that bus have, but the vehicle does not have\n\n  int number_of_seets;\n  //constructor method starts here\n  public bus(){\n   super(); // calls constructor of the superclass\n   // so that we can use attributes of the vehicle class\n   number_of_seats=0;\n   }\n\n //add set and get methods of the sub class\n public void setNumberofSeats(int seats){\n   number_of_seats=seats;\n }//end of set method\n public int getNumberofSeats(){\n  return number_of_seats;\n }//end of get method\n}//end of class\n\nI hope this helps you
563727
Possible test cases can inclued,\n\nClient side:\n1) Test the from for the system's response to incomplete or blank mandatory fields.\n2) Test validations for minimum length of name or any other such fields and for responses for invalid special characters include\n3) Test conditions for minimum length of password.\nServer side.\n1) Check the existance of duplicates.
514671
These may help:\n\nhttp://www.google.co.uk/search?hl=en&q=types+of+software+testing&btnG=Google+Search&meta=
542925
have a look at:\nhttp://www.thanassis.com/java/java%20training%20course/index.htm\n\nIt's a quick visual and comprehensive guide for many of the \nfundamental concepts you need to know. i tried to keep the \ntext to minimum and to explain as much as possible with \npictures.
129042
If you write the test case, it is a record which can be stored somewhere. It can be reused later in several of the following cases:\n1.) you want to run the same test cases later (u don't need to remember, u can just read the document and execute)\n2.) someone else need to run those tests (he/she does not need to consult you)\n3.) you left the company and the new person who came in your place does not get enough time to take the knowledge transfer from you. (he/she can directly run if you have a good test case document)\n4.) your boss wants to see what you have done. he/she can not read your mind. if the document is there, they can see what you have done.
142743
First make sure that the class which contains ur               main (String args[])\nfunction hass got the same name as ur file name.\nIf u r using command prompt to run ur program make sure u have set the classpath properly or copy ur file to the bin directory of the jdk installation and run it from there.
801836
A question to ask would be what sort of tests are you looking to conduct? Unit testing, black/white box testing, etc.\n\nIf you're the author the application then you'll want a unit testing suite such as junit for Java.\n\nIf you're testing the application itself (if I remember correctly, this is called 'functional testing') then try finding an automated testing tool, for example IBM Rational Robot. Unfortunately Rational Robot costs a fortune, so try looking for an open source solution for this.
107183
I think this is best answered by an example (I don't know how to keep formatting in Yahoo! Answers, so the formatting of the code is lost)\n\nfile TestFile.java\n===================\n\nimport java.io.*;\n\npublic class TestFile {\n\n   public static void main(String[] args) {\n      String inFilename = args[0];\n      String outFilename = args[1];\n      try {\n         BufferedReader in = \n            new BufferedReader(new FileReader(inFilename));\n         FileWriter out = new FileWriter(outFilename);\n         \n         String line = in.readLine();\n         while(line != null) {\n            out.write(line + "&#92;n");\n            line = in.readLine();\n         }\n         \n         out.close();\n         in.close();\n      } \n      catch(IOException ioe) {\n         ioe.printStackTrace();\n      }\n   }\n}\n\nThis simply takes two String arguments.  The first is used as a source file, the second is used as a destination file.  Everthing in the source file is copied into the destination file.  Anything that existed in the destination file is overwritten.\n\nThe Buffered reader makes it really easy to read from text files.  As you can see opening a file is as easy as creating a new instance of a FileReader or FileWriter.  Take a look at the Javadocs for these classes for more information.\n\nSince Java is a cross-platform language, you should add extra code for handling a file regardless of the operating system, but this should get you started.