Expertiza documentation: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
(Added a link to the "Broken Links" page under Misc)
 
(27 intermediate revisions by 8 users not shown)
Line 1: Line 1:
Plenty of Testing framework exist for Java. JUnit has been the de facto standard for unit testing. However, other frameworks such as TestNG, JTIGER have been built to address various faults and deficiencies with JUnit.  Our primary objective is to compare the various testing frameworks that exist for object oriented languages based on the primary purpose of the framework, strength, platforms that are supported by them, etc and thus help in choosing the best testing framework that fits in a particular suitable environment.
[[Image:715px-EXPERTIZA.png|715px]]


= Welcome to the Expertiza project! =


== TestNG Framework ==
The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.


TestNG is a testing framework which can help to meet a broad range of testing such as unit testing, integration testing, functional testing, end-to -end testing.
== Short Powerpoint introductions ==
*My [http://research.csc.ncsu.edu/efg/expertiza/presentations/ELI_11_wiki_textbook.ppt presentation] on using Expertiza to support wiki-textbook creation, at the 2011 EDUCAUSE Learning Initiative conference, February 15, 2011
*My [http://research.csc.ncsu.edu/efg/expertiza/presentations/Purdue_TLT_2009.ppt plenary talk] at the Purdue TLT Conference on April 22, 2009
*We invite you to view the original [http://research.csc.ncsu.edu/efg/expertiza/presentations/Expertiza-short.htm rationale] for the system.
*You can walk through a [http://research.csc.ncsu.edu/efg/expertiza/presentations/Expertiza%20in%20Action.ppt virtual demo] of the system.


To write a TESTNG test, we need to:
== Papers ==
Write the business logic of the test, and insert the TestNG annotations in them.
*A [http://innovateonline.info/index.php?view=article&id=365 prose rendition] of the rationale was published in [http://innovateonline.info/ Innovate] in 2007. (To view it, you need to register, and you will receive e-mail each time a new issue of this very interesting and useful journal is published.)
Add the information about our test (such as: the class name, the groups we wish to run, etc) in a testing.xml file or in build.xml.  
*Other papers on Expertiza can be found [http://research.csc.ncsu.edu/efg/expertiza/papers/ here].
Run the test.
TestNG supports data driven testing


TestNG is invoked in several different ways:
== Video presentations ==
With a testing.xml file
ANT
Command line


*An [http://connectpro86502729.na6.acrobat.com/p99048610/ overview] of Expertiza ("Software support for teamwork and authentic assessment [http://research.csc.ncsu.edu/efg/expertiza/presentations/TLT_Live.ppt  (slides)]") from the TLT Group's Friday Live, September 24, 2010
*[https://sas.elluminate.com/site/external/recording/playback/link/dropin.jnlp?sid=2008350&suid=D.2D2E269EE524FD263F89DA6872A41E Student-authored wiki textbooks: Composition and review] from the 2011 Global Education Consortium, November 18, 2011
*This [http://educause.mediasite.com/mediasite/SilverlightPlayer/Default.aspx?peid=cdeebca6d1a34610923bcabd4c2d2fd91d session from EDUCAUSE ELI 2011] describes how Expertiza can be used to review wiki-textbook contributions.  It is an earlier version of the presentation above that includes a live demo.
*This Innovate [http://breeze.uliveandlearn.com/p10263667/ Webcast] from July 2007 includes the rationale and a demo of the system.
*A six-minute [http://www.youtube.com/watch?v=hVpS7qvC5Zs interview] from the 2009 Lilly Conference on College Teaching describes the goals and realization of the project.  (<i>Note:</i> Background noise may be distracting.)
*This Innovate [http://breeze.uliveandlearn.com/p84785847/ Ideagora] discussion from January 2009 describes the social-networking features planned for Expertiza.
*[https://sas.elluminate.com/site/external/jwsdetect/playback.jnlp?psid=2009-03-17.1032.M.F13AAE88367AEE982449E713075D42.vcr Forming and managing student teams and peer feedback in Expertiza], a presentation at the UNC TLT conference in March 2009.


It is possible to group the test methods of TestNG.  We can declare methods that belong to these groups and specify groups that contain other groups. It is very flexible as it can help in choosing one set of regular expression and excluding the other sets. This splits the various test groups and there is no need to recompile again if we want to run two different tests back to back.
== Documentation ==


Requirements:
*An [http://research.csc.ncsu.edu/efg/expertiza/reports/Instructor_documentation.doc instructor manual], explaining how to create an deploy an assignment in Expertiza.
JDK 1.4, 1.5
*An [http://research.csc.ncsu.edu/efg/expertiza/presentations/videos/instructor.swf instructor video], slightly dated, showing how to create and deploy an assignment
Invoked in many environments such as command line, ant, ECLIPSE, IDEA, MAVEN, etc
*A [http://rajanalwan.com/ui_guidelines/ design document] for the application.
* A guide for [[Creating_Custom_Rubric]]
*For students, a [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_documentation.ppt Powerpoint] or [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_documentation.pdf PDF] presentation explaining how to submit and review an assignment with Expertiza.
*For students, a [http://research.csc.ncsu.edu/efg/expertiza/presentations/videos/student.swf video] showing how to use the system to submit and review an assignment.
*For students, a [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_wiki_documentation.ppt Powerpoint] or [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_wiki_documentation.pdf PDF] presentation explaining how to submit and review wiki pages with Expertiza.
*For students, a [http://courses.ncsu.edu/csc517/common/homework/topic-signup-team-formation.ppt Powerpoint] or [http://courses.ncsu.edu/csc517/common/homework/topic-signup-team-formation.pdf PDF] presentation explaining how to form teams and sign up for topics.


The annotations available in TestNG can be found at:
== Developers section ==
http://testng.org/doc/documentation-main.html#annotations
''Expertiza now has a Java dependency, so the machine you are using to develop Expertiza on should have the JVM installed.''
=== Development Environment Setup Guides ===
* [[Creating a Linux Development Environment for Expertiza - Installation Guide]]
**[http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian Development setup for Ubuntu/Debian]
* [[Development:Setup:OSX]]
*[http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:RHEL  Development setup for Linux RHEL ]
*[[Developing Expertiza on the VCL]]
*Developing Expertiza on Virtual Box
** [https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uEUmNKVncxRUhUVVE/view?usp=sharing Download the VirtualBox Ubuntu image here]
** [https://drive.google.com/open?id=1YlqiSsbZl8TfPuQmIFG7TYo2npWzqqu4 or try the Lubuntu image here if the Ubuntu image is too heavy for your PC/Laptop ]
*Docker image (Only if you are familiar with docker. You will need it if you choose Expertiza to do OSS project.)
** Please follow the instruction in https://hub.docker.com/r/winbobob/expertiza-fall2016/


TestNG is inspired from JUnit and Nunit, with additional functionalities such as Flexible test configuration, support for data driven testing, etc.
=== Database Guides ===
*[[Deploying and importing production data with capistrano]]
*[[Documentation on Database Tables]]
*[[Documentation for Database Anonymization]]


== Cactus ==
=== Security Guidelines ===
*[[Security guidelines for Expertiza]]
=== Git ===
*[[Version Control with the Git repository]]
*[http://wiki.expertiza.ncsu.edu/index.php/How_to_Begin_a_Project_from_the_Current_Expertiza_Repository How to Begin a Project from the Current Expertiza Repository]


=== Ruby and Rails ===
*[[Restart Instructions for Expertiza]]
*[[Deploying Expertiza to Production]]
*[[Gem dependencies]]
*[[http://wiki.expertiza.ncsu.edu/index.php?title=Using_Cucumber_with_Expertiza Using Cucumber with Expertiza]]


(source : http://jakarta.apache.org/cactus/index.html)
=== Misc ===
Cactus is a test framework for testing server-side java code such as Servlets, EJB, etc. It extends J Unit.
*[[Setting up and using TA functionality]]
Cactus implements an in-container strategy which means that tests are executed inside the container.
*[[Restart instructions for Wiki]]
The Cactus testing unit can be viewed as a system that consists of the following components:
*[[Scoring & Grading Methods (Fall '21)]]
Cactus Framework:  This provides the API to write Cactus tests.
*[[Broken Links]]
Cactus Integration Modules: They are front ends and frameworks that provide easy ways of using the Cactus Framework. Eg: Eclipse plugin
Cactus Samples: They demonstrate how to write Cactus tests and how to use a few Integration Modules.


A useful testing framework provided by Cactus is  integration unit testing( type 2). The tests written for this framework will exercise the interactions with the container. Cactus also provides other frameworks such as code logic unit testing (type 1) ,functional unit testing( type 3).
=== Final Projects on Expertiza for Fall 2015 ===
[https://docs.google.com/document/d/1t0keeNQ2kP0NmcgIrtQXGi5K_GhQYcKzEVWJPPRBOHE/edit?pli=1 The Expertiza Final Project Submission] <br>


Cactus was developed to fit Type 2 but also to be a very good compromise for types 1 and 3, with the idea that it is much easier to have to write tests for a single framework than for several. It is believed that Cactus provides a middle ground that provides a high confidence that your code will run when deployed .
== Links ==
[http://expertiza.ncsu.edu The Expertiza application] <br>
[http://research.csc.ncsu.edu/efg/expertiza/papers Papers on Expertiza] <br>
[http://research.csc.ncsu.edu/efg/expertiza/presentations/Expertiza-short.htm PowerPoint Presentation - The Expertiza platform]<br>
[http://www.csc.ncsu.edu/news/463 Expertiza Platform Takes Honorable Mention in Gertrude Cox Awards]


== Acknowledgments ==


 
This material is based upon work supported by the National Science Foundation under Grant No. 0536558Additional funding from the NCSU Learning in a Technology-Rich Environment (LITRE) program, the NCSU Faculty Center for Teaching and Learning, the NCSU STEM Initiative, and the Center for Advanced Computing and Communication.
To know how it works, click here :
http://jakarta.apache.org/cactus/how_it_works.html
 
 
 
COMPARISON BETWEEN JUnit,TestNG and Cactus frameworks
 
 
{| {{table}}
| align="center" style="background:#f0f0f0;"|''''''
| align="center" style="background:#f0f0f0;"|'''JUnit4'''
| align="center" style="background:#f0f0f0;"|'''TestNG'''
| align="center" style="background:#f0f0f0;"|'''Cactus'''
|-
| Supporting Type of Testing||Suitable more for Unit testing||Supports Unit testing,Functional testing, end-to-end testing, integration testing ||Primarily unit testing. Also have frameworks for code logic unit testing , functional logic unit testing
|-
| Conventions||Rigid Example: ||Flexible||Not as flexible as TestNG
|-
| Derived from JUnit||Yes, from the previous versions||Inspired from Junit,with  added functionalities ||Extends JUnit
|-
| Init () ||Init() has to be declared static||Not necessary||
|-
| Flexibility for large suites||Not flexible for large test suites, ||Flexible for running large test suites of code  and thus one test\'s failure shouldn\'t mean having to rerun a suite of thousands. || No, it is suitable for unit testing.
|-
| Suitable for ||Best for a single object||Best for a higher level testing||Best for server-side java code such as Servlets, EJB, etc.
|-
| Runs on||Command line, ANT,ECLIPSE||Command line,ANT, ECLIPSE, IDEA,MAVEN||ECLIPSE
|-
| ||||||
|-
|
|}
 
 
 
== An example comparing JUNIT 4 and TestNG ==
 
 
'''JUnit 4  v/s TestNG'''
 
(source: http://www.ibm.com/developerworks/java/library/j-cq08296/)
 
 
The frameworks differ is in their core design. JUnit has always been an effective unit-testing framework, meaning that it was built to facilitate testing single objects. TestNG, on the other hand, was built to address testing at higher levels, and consequently, has some features not available in JUnit
JUnit 4 makes clever use of annotations. JUnit no longer requires you to define a test as a method whose name starts with test, and we can now run fixtures just once as opposed to for each test.  However TestNG established itself as an annotations-based framework long before Junit 4. TestNG pioneered testing with annotations in Java programming, which made it a formidable alternative to JUnit.
 
 
Sample J Unit 4 code
 
package test.com.acme.dona.dep;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.BeforeClass;
import org.junit.Test;
public class DependencyFinderTest {
private static DependencyFinder finder;
@BeforeClass
public static void init() throws Exception {
  finder = new DependencyFinder();
}
@Test
public void verifyDependencies()
  throws Exception {
  String targetClss =
    "test.com.acme.dona.dep.DependencyFind";
Filter[] filtr = new Filter[] {
      new RegexPackageFilter("java|junit|org")};
Dependency[] deps =
      finder.findDependencies(targetClss, filtr);
assertNotNull("deps was null", deps);
  assertEquals("should be 5 large", 5, deps.length); 
  }
}
(source: http://www.ibm.com/developerworks/java/library/j-cq08296/)
 
 
Sample TestNG code
 
package test.com.acme.dona.dep;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Configuration;
import org.testng.annotations.Test;
public class DependencyFinderTest {
private DependencyFinder finder;
@BeforeClass
private void init(){
  this.finder = new DependencyFinder();
}
@Test
public void verifyDependencies()
  throws Exception {
  String targetClss =
    "test.com.acme.dona.dep.DependencyFind";
  Filter[] filtr = new Filter[] {
      new RegexPackageFilter("java|junit|org")};
  Dependency[] deps =
      finder.findDependencies(targetClss, filtr);
  assertNotNull(deps, "deps was null" );
  assertEquals(5, deps.length, "should be 5 large");         
  }
}
(source: http://www.ibm.com/developerworks/java/library/j-cq08296/)
 
Both the codes may look a lot similar. However TestNG coding conventions are more flexible than JUnit 4.
 
JUnit forces us to declare the @BeforeClass method as static, which consequently requires us to also declare the fixture, finder, as static. We also have to declare the init() method as public. Looking at the TestNG code, you can find that such conventions aren't required. Its init() method is neither static nor public.
Flexibility has been one of the strong points of TestNG right from the start. JUnit works well for a unit of code, whereas TestNG is better suited for high-level testing. Its flexibility is especially useful with large test suites.
 
== Some other JAVA testing units ==
 
{| {{table}}
| align="center" style="background:#f0f0f0;"|''''''
| align="center" style="background:#f0f0f0;"|'''JEasyTest'''
| align="center" style="background:#f0f0f0;"|'''J2ME Unit Testing Toolkit'''
| align="center" style="background:#f0f0f0;"|'''Jailer'''
| align="center" style="background:#f0f0f0;"|'''Mockrunner'''
|-
| Features||Generates coverage report Allows virtual mock object||Is a  Java 2 Micro Edition (J2ME) library containing a unit testing framework for J2ME||Does test data exporting.  JDBC agnostic  Generates DbUnit datasets, hierarchically structured XML, and topologically sorted SQL-DML.||A lightweight framework for unit testing applications in the J2EE environment.
|-
| Integrates with:||ECLIPSE 3.3||ANT ||Platform Independent||OS independent
|-
|
|}
 
 
 
 
== Testing units for C++ ==
 
 
When it comes to unit testing in Java, a unanimous choice would be JUnit. However for C++, there is no one clear winner.  CppUnit is the most widely used tool for C++ which is a part of the XUnit family.
 
Following is a few basic factors to judge a good testing unit in C++ :
 
{| {{table}}
| align="center" style="background:#f0f0f0;"|'''Features'''
| align="center" style="background:#f0f0f0;"|'''CppUnit'''
| align="center" style="background:#f0f0f0;"|'''BOOST.test'''
| align="center" style="background:#f0f0f0;"|'''CxxUnit'''
|-
| Minimal amount of work needed to add new tests ||No, and thus a major downfall.||Yes||Yes, very good.
|-
| Easy to modify and port ||Medium||Medium||Simplest
|-
| Supports setup/teardown steps ||Yes||||Best
|-
| Handles exceptions and crashes well.||Yes||Yes, above others||Great support.
|-
| Good assert functionality.||Pretty decent.||Yes||Best
|-
| Supports different outputs. ||Yes. Comes with IDE friendly output.||Probably, Not trivial to change.||Yes
|-
| Supports  suites||Yes.||Yes, but with a big catch. ||Yes
|-
|
|}
 
 
CppUnit passes most of the above tests , except for the first point and thus needs a lot of code typing.
Boost.Test isn’t exclusively a unit-testing framework, and is not X Unit based.
 
Out of the above three , cxxUnit turns out to be a favourite.
 
It comes close to the requirements of an ideal framework by leveraging the power of an external scripting language. It provides some nifty advanced features and great assert functionality. It does require the use of a scripting language as part of the build process, so those uncomfortable with that requirement, might want to look at one of the other two frameworks.
 
For work restricted to the PC,  where modifying the framework is not required Boost.Test could  be a very good choice.
CppUnit , which has come a long way in years is a solid, complete framework  The major drawbacks are the relative verbosity for adding new tests and fixtures.
 
http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle

Latest revision as of 16:56, 26 October 2024

Welcome to the Expertiza project!

The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.

Short Powerpoint introductions

  • My presentation on using Expertiza to support wiki-textbook creation, at the 2011 EDUCAUSE Learning Initiative conference, February 15, 2011
  • My plenary talk at the Purdue TLT Conference on April 22, 2009
  • We invite you to view the original rationale for the system.
  • You can walk through a virtual demo of the system.

Papers

  • A prose rendition of the rationale was published in Innovate in 2007. (To view it, you need to register, and you will receive e-mail each time a new issue of this very interesting and useful journal is published.)
  • Other papers on Expertiza can be found here.

Video presentations

Documentation

  • An instructor manual, explaining how to create an deploy an assignment in Expertiza.
  • An instructor video, slightly dated, showing how to create and deploy an assignment
  • A design document for the application.
  • A guide for Creating_Custom_Rubric
  • For students, a Powerpoint or PDF presentation explaining how to submit and review an assignment with Expertiza.
  • For students, a video showing how to use the system to submit and review an assignment.
  • For students, a Powerpoint or PDF presentation explaining how to submit and review wiki pages with Expertiza.
  • For students, a Powerpoint or PDF presentation explaining how to form teams and sign up for topics.

Developers section

Expertiza now has a Java dependency, so the machine you are using to develop Expertiza on should have the JVM installed.

Development Environment Setup Guides

Database Guides

Security Guidelines

Git

Ruby and Rails

Misc

Final Projects on Expertiza for Fall 2015

The Expertiza Final Project Submission

Links

The Expertiza application
Papers on Expertiza
PowerPoint Presentation - The Expertiza platform
Expertiza Platform Takes Honorable Mention in Gertrude Cox Awards

Acknowledgments

This material is based upon work supported by the National Science Foundation under Grant No. 0536558. Additional funding from the NCSU Learning in a Technology-Rich Environment (LITRE) program, the NCSU Faculty Center for Teaching and Learning, the NCSU STEM Initiative, and the Center for Advanced Computing and Communication.