changeset 664:efeaf92d9906

Completed State Machine
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 10 Apr 2015 15:04:53 +0100
parents ba6cc0a042d8
children 88a5278b9332
files ape.js
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Fri Apr 10 14:52:39 2015 +0100
+++ b/ape.js	Fri Apr 10 15:04:53 2015 +0100
@@ -396,10 +396,44 @@
 		// Start the test
 		var testId = currentState.substr(11,currentState.length-10);
 		currentState = 'testRun-'+testId;
+	} else if (currentState.substr(0,7) == 'testRun')
+	{
+		var testId = currentState.substr(8,currentState.length-7);
+		// Check if we have any post tests to perform
+		var postXML = testXMLSetups.find('PostTest')[testId];
+		if (postXML.children.length > 0)
+		{
+			console.log('POST TEST')
+		}
+		// else
+		
+		
+		// No post tests, check if we have another test to perform instead
+		if (testXMLSetups.length-1 > testId)
+		{
+			// Yes we have another test to perform
+			currentState = 'testRun-'+Number(testId)+1;
+			loadTest(testId+1);
+		} else {
+			console.log('Testing Completed!');
+			// Check for any post tests
+			var xmlSetup = projectXML.find('setup');
+			var postTest = xmlSetup.find('PostTest');
+			console.log(postTest);
+		}
 	}
 	console.log(currentState);
 }
 
+function buttonSubmitClick()
+{
+	// This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options
+	if (currentState.substr(0,7) == 'testRun')
+	{
+		advanceState();
+	}
+}
+
 // Only other global function which must be defined in the interface class. Determines how to create the XML document.
 function interfaceXMLSave(){
 	// Create the XML string to be exported with results