Coder Social home page Coder Social logo

jh61b's Introduction

Background

This repo is forked from UCSB, who pulled out the jh61b library for JUnit annotations from Gradescope's inital autograder package. My changes are only in the POM file:

  • Changed from JUnit 4.12 to JUnit 5.7.2.
  • Changed maven-compiler-plugin from 3.5.1 to 3.8.1.
  • Changed maven target from Java 1.8 to 11. (Supposedly needed for JUnit 5.)

-RA

Repo to separately compile jh61b-1.0.jar

This repo pulls out the code for the jh61b-1.0 library so that it can be separately compiled into a jar that can then be pulled into other Maven or Ant based Java project for Gradescope autograding.

See intlist in this same organization for an example of how to use it.

To build the jar, run mvn package then find the jar in the target directory.

To install jar for jh61b, use:

Use:

mvn install:install-file -Dfile=../jh61b/target/jh61b-1.0.jar
mvn package
mvn -q exec:java

The install command is described here, and is the way you get a third party JAR into Maven.

The rest is described below.

You also need to adjust this part of the pom.xml. The main class needs to be a RunTests class (sample source code below.)

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.4.0</version>
        <executions>
          <execution>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <mainClass>com.gradescope.intlist.tests.RunTests</mainClass>
          <arguments>
          </arguments>
        </configuration>
      </plugin>

Sample Source for RunTests (which can be in any package you like):

The part you have to modify is the list of test classes in the @Suite.SuiteClasses annotation. Only those classes get picked up by the grading stuff.

Then you also need to annotate your classes as shown in the sample classes in this repo.

package com.gradescope.intlist.tests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
// import junit.tests.framework.TestListenerTest
import com.gradescope.intlist.tests.IntListTest;
import com.gradescope.jh61b.grader.GradedTestListenerJSON;

@RunWith(Suite.class)
@Suite.SuiteClasses({
        IntListTest.class,
        IntListPredicates.class,
})
public class RunTests {
    public static void main(String[] args) {
        JUnitCore runner = new JUnitCore();
        runner.addListener(new GradedTestListenerJSON());
        // runner.addListener(new TestListenerTest());
        Result r = runner.run(RunTests.class);
    }
}

jh61b's People

Contributors

pconrad avatar racuna1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.