Package au.edu.mq.comp.junitGrading

Examples of au.edu.mq.comp.junitGrading.CollectionOfAssignments


    {
        Configuration config = new  Configuration(automarkFile);
        if(true == config.checkAllFiles())
        {
            //prepare the assignemnt to be graded
            CollectionOfAssignments ca = new CollectionOfAssignments(config.pathToAssignments(), config.outputDirectoryPath());

            if(true == config.isSingleFileAssignment)
                ca.preprocessingSingleFileAssignment(config.targetClassNameToTest);
           
            Log.message("fileNamePattern -->" + config.fileNamePattern());
            ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer(config.fileNamePattern()));
           
            // prepare header for CSVFormatter
            // add standard header
            java.util.List<String> outputHeader = new java.util.ArrayList<String>();
            outputHeader.add("useridnumber");
            outputHeader.add("username");
            outputHeader.add("userid");
            outputHeader.add("runResult");
            outputHeader.add("total");
            outputHeader.add("numberOfTests");
            // add header from each junit test  --> @Graded
            java.util.List<String> testNameList = JavaGrader.liftTestNameFromJUnitTestSourceFile(config.junitTestClassName(),
                                                                                                 config.junitTestSourceFiles().get(0));
            // adding all of them to a list of string
            Log.message("going to run the following test:");
            for(String testName : testNameList)
            {
                Log.message("-> " + testName);
                outputHeader.add(testName);
            }
           
            CSVFormatter dataFormatter = new CSVFormatter(outputHeader);
           
            //start working
            WorkGroup<Assignment, TestResult> workGroup = new WorkGroup<Assignment, TestResult>();
        for(int i = 0; i < config.numberOfWorkers(); i++)
            workGroup.addWorker(this.makeGrader(config));
        this.listOfAssignment = new LinkedList<Assignment>();
        while(true == ca.hasMoreAssignment())
        {
          Assignment assignment = ca.nextAssignment();
          if(null != assignment)
          {
              this.listOfAssignment().add(assignment);
            workGroup.pushWorkData(assignment);
          }
View Full Code Here


  public void simpleExample()
  {
    try
    {
      // construct our data source
      CollectionOfAssignments ca = new CollectionOfAssignments("comp125Classroom.zip", "");
      //preprocessing comp125Classroom.zip into correct directory structure
      ca.preprocessingSingleFileAssignment("comp125.Classroom");
      // this will be used by JavaGrader when construct TestResult
      ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer());
      // construct our data processor
      JavaGrader grader = new JavaGrader("comp125.ClassroomTest");
      // add the zip of test source with package structure specified as comp125.ClassroomTest
      // The zip MUST have the directory structure like below
      //  comp125+
      //         |
      //         +-ClassroomTest.java
      grader.addJUnitTestSource("comp125.zip");
     
      // start processing(using single thread)
      while(true == ca.hasMoreAssignment())
      {
        TestResult result = grader.gradeAnAssignment(ca.nextAssignment());
        System.out.println(result);
      }
     
      // done
      System.out.println("done");
View Full Code Here

  public void multhreadedExample()
  {
    try
    {
      // construct our data source
      CollectionOfAssignments ca = new CollectionOfAssignments("comp125Classroom.zip", "");
      //preprocessing comp125Classroom.zip into correct directory structure
      ca.preprocessingSingleFileAssignment("comp125.Classroom");
      // this will be used by JavaGrader when construct TestResult
      ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer());
      // construct our data processor
      JavaGrader grader = new JavaGrader("comp125.ClassroomTest");
      // add the zip of test source with package structure specified as comp125.ClassroomTest
      // The zip MUST have the directory structure like below
      //  comp125+
      //         |
      //         +-ClassroomTest.java
      grader.addJUnitTestSource("comp125.zip");
     
      // start processing(using 4 threads)
      WorkGroup<Assignment, TestResult> workGroup = new WorkGroup<Assignment, TestResult>();
        workGroup.addWorker(grader);
        workGroup.addWorker(grader.clone());
        workGroup.addWorker(grader.clone());
        workGroup.addWorker(grader.clone());
       
        //pushing assignments into workgroup
        while(true == ca.hasMoreAssignment())
        {
          Assignment assignment = ca.nextAssignment();
          if(null != assignment)
            workGroup.pushWorkData(assignment);
        }

        CSVFormatter dataFormatter = new CSVFormatter();
View Full Code Here

    {
        Configuration config = new  Configuration(automarkFile);
        if(true == config.checkAllFiles())
        {
            //prepare the assignemnt to be graded
            CollectionOfAssignments ca = new CollectionOfAssignments(config.pathToAssignments(), config.outputDirectoryPath());

            if(true == config.isSingleFileAssignment)
                ca.preprocessingSingleFileAssignment(config.targetClassNameToTest);
           
            Log.message("fileNamePattern -->" + config.fileNamePattern());
            ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer(config.fileNamePattern()));
           
            // prepare header for CSVFormatter
            // add standard header
            java.util.List<String> outputHeader = new java.util.ArrayList<String>();
            outputHeader.add("useridnumber");
            outputHeader.add("username");
            outputHeader.add("userid");
            outputHeader.add("runResult");
            outputHeader.add("total");
            outputHeader.add("numberOfTests");
            // add header from each junit test  --> @Graded
            java.util.List<String> testNameList = JavaGrader.liftTestNameFromJUnitTestSourceFile(config.junitTestClassName(),
                                                                                                 config.junitTestSourceFiles().get(0));
            // adding all of them to a list of string
            Log.message("going to run the following test:");
            for(String testName : testNameList)
            {
                Log.message("-> " + testName);
                outputHeader.add(testName);
            }
           
            CSVFormatter dataFormatter = new CSVFormatter(outputHeader);
           
            //start working
            WorkGroup<Assignment, TestResult> workGroup = new WorkGroup<Assignment, TestResult>();
        for(int i = 0; i < config.numberOfWorkers(); i++)
            workGroup.addWorker(this.makeGrader(config));
        this.listOfAssignment = new LinkedList<Assignment>();
        while(true == ca.hasMoreAssignment())
        {
          Assignment assignment = ca.nextAssignment();
          if(null != assignment)
          {
              this.listOfAssignment().add(assignment);
            workGroup.pushWorkData(assignment);
          }
View Full Code Here

    public String run(java.io.File automarkFile, TableDataFormatter dataFormatter) throws Exception
    {
        Configuration config = new  Configuration(automarkFile);
        if(true == config.checkAllFiles())
        {
            CollectionOfAssignments ca = new CollectionOfAssignments(config.pathToAssignments(), config.outputDirectoryPath());

            if(true == config.isSingleFileAssignment)
                ca.preprocessingSingleFileAssignment(config.targetClassNameToTest);
           
            ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer());
           
            WorkGroup<Assignment, TestResult> workGroup = new WorkGroup<Assignment, TestResult>();
        for(int i = 0; i < config.numberOfWorkers(); i++)
            workGroup.addWorker(this.makeGrader(config));
       
        while(true == ca.hasMoreAssignment())
        {
          Assignment assignment = ca.nextAssignment();
          if(null != assignment)
            workGroup.pushWorkData(assignment);
        }

        while(0 < workGroup.currentDataCount())
View Full Code Here

    {
        Configuration config = new  Configuration(automarkFile);
        if(true == config.checkAllFiles())
        {
            //prepare the assignemnt to be graded
            CollectionOfAssignments ca = new CollectionOfAssignments(config.pathToAssignments(), config.outputDirectoryPath());

            if(true == config.isSingleFileAssignment)
                ca.preprocessingSingleFileAssignment(config.targetClassNameToTest);
           
            System.out.println("fileNamePattern -->" + config.fileNamePattern());
            ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer(config.fileNamePattern()));
           
            // prepare header for CSVFormatter
            // add standard header
            java.util.List<String> outputHeader = new java.util.ArrayList<String>();
            outputHeader.add("useridnumber");
            outputHeader.add("username");
            outputHeader.add("userid");
            outputHeader.add("runResult");
            outputHeader.add("total");
            outputHeader.add("numberOfTests");
            // add header from each junit test  --> @Graded
            java.util.List<String> testNameList = JavaGrader.liftTestNameFromJUnitTestSourceFile(config.junitTestClassName(),
                                                                                                 config.junitTestSourceFiles().get(0));
            // adding all of them to a list of string
            Log.message("going to run the following test:");
            for(String testName : testNameList)
            {
                Log.message("-> " + testName);
                outputHeader.add(testName);
            }
           
            CSVFormatter dataFormatter = new CSVFormatter(outputHeader);
           
            //start working
            WorkGroup<Assignment, TestResult> workGroup = new WorkGroup<Assignment, TestResult>();
        for(int i = 0; i < config.numberOfWorkers(); i++)
            workGroup.addWorker(this.makeGrader(config));
        this.listOfAssignment = new LinkedList<Assignment>();
        while(true == ca.hasMoreAssignment())
        {
          Assignment assignment = ca.nextAssignment();
          if(null != assignment)
          {
              this.listOfAssignment().add(assignment);
            workGroup.pushWorkData(assignment);
          }
View Full Code Here

    {
        Configuration config = new  Configuration(automarkFile);
        if(true == config.checkAllFiles())
        {
            //prepare the assignemnt to be graded
            CollectionOfAssignments ca = new CollectionOfAssignments(config.pathToAssignments(), config.outputDirectoryPath());

            if(true == config.isSingleFileAssignment)
                ca.preprocessingSingleFileAssignment(config.targetClassNameToTest);
           
            System.out.println("fileNamePattern -->" + config.fileNamePattern());
            ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer(config.fileNamePattern()));
           
            // prepare header for CSVFormatter
            // add standard header
            java.util.List<String> outputHeader = new java.util.ArrayList<String>();
            outputHeader.add("useridnumber");
            outputHeader.add("username");
            outputHeader.add("userid");
            outputHeader.add("runResult");
            outputHeader.add("total");
            outputHeader.add("numberOfTests");
            // add header from each junit test  --> @Graded
            java.util.List<String> testNameList = JavaGrader.liftTestNameFromJUnitTestSourceFile(config.junitTestClassName(),
                                                                                                 config.junitTestSourceFiles().get(0));
            // adding all of them to a list of string
            Log.message("going to run the following test:");
            for(String testName : testNameList)
            {
                Log.message("-> " + testName);
                outputHeader.add(testName);
            }
           
            CSVFormatter dataFormatter = new CSVFormatter(outputHeader);
           
            //start working
            WorkGroup<Assignment, TestResult> workGroup = new WorkGroup<Assignment, TestResult>();
        for(int i = 0; i < config.numberOfWorkers(); i++)
            workGroup.addWorker(this.makeGrader(config));
       
        while(true == ca.hasMoreAssignment())
        {
          Assignment assignment = ca.nextAssignment();
          if(null != assignment)
            workGroup.pushWorkData(assignment);
        }

        while(0 < workGroup.currentDataCount())
View Full Code Here

TOP

Related Classes of au.edu.mq.comp.junitGrading.CollectionOfAssignments

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.