Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding some support for require syntax in Aria Templates tests.

A future version of Aria Templates will integrate noder-js and
allow the use of require in any module (when using the new syntax).
This commit makes attester compatible with the use of this
new syntax inside tests.
It is needed because, before this commit, attester extracted
the classpath from a test file by executing that file in a special
environment (containing a fake Aria.classDefinition method to extract
the class definition, but with no require function available). This
is no longer possible with the new syntax, and adding a fake require
function to that special environment would not be easy.
The new algorithm, which is only used when the new syntax is detected,
parses the file with Uglify-JS and extracts the required information
(classpath of the current class and logical path of the parent class),
without executing the file.
In case the file is detected to be a test suite, extending directly
from require("ariatemplates/jsunit/TestSuite"), only the constructor
function is executed, in a special environment, to get the classpaths
of the tests included in the test suite.
  • Loading branch information...
commit 7773e716cbe2215da8a40bbe2f460e312e1af8f8 1 parent 05cf7a9
@divdavem divdavem authored
Showing with 459 additions and 45 deletions.
  1. +220 −41 lib/test-type/aria-templates/at-file-reader.js
  2. +2 −0  package.json
  3. +64 −4 spec/test-type/aria-templates/at-file-reader.spec.js
  4. 0  spec/test-type/aria-templates/{sample-tests → legacy-sample-tests}/MainTestSuite.js
  5. +15 −0 spec/test-type/aria-templates/legacy-sample-tests/MissingClasspathError.js
  6. +27 −0 spec/test-type/aria-templates/legacy-sample-tests/MultipleTestCasesError.js
  7. 0  spec/test-type/aria-templates/{sample-tests → legacy-sample-tests}/OtherSimpleTestSuite.js
  8. +8 −0 spec/test-type/aria-templates/legacy-sample-tests/OtherTestSuite.js
  9. 0  spec/test-type/aria-templates/{sample-tests → legacy-sample-tests}/SimpleTestCase.js
  10. 0  spec/test-type/aria-templates/{sample-tests → legacy-sample-tests}/SimpleTestSuite.js
  11. +1 −0  spec/test-type/aria-templates/legacy-sample-tests/SyntaxError.js
  12. 0  spec/test-type/aria-templates/{sample-tests → legacy-sample-tests}/TestSuiteUsingPackage.js
  13. +3 −0  spec/test-type/aria-templates/legacy-sample-tests/ZeroClassDefError.js
  14. +12 −0 spec/test-type/aria-templates/require-sample-tests/MainTestSuite.js
  15. +17 −0 spec/test-type/aria-templates/require-sample-tests/MissingClasspathError.js
  16. +30 −0 spec/test-type/aria-templates/require-sample-tests/MultipleTestCasesError.js
  17. +11 −0 spec/test-type/aria-templates/require-sample-tests/OtherSimpleTestSuite.js
  18. +8 −0 spec/test-type/aria-templates/require-sample-tests/OtherTestSuite.js
  19. +18 −0 spec/test-type/aria-templates/require-sample-tests/SimpleTestCase.js
  20. +11 −0 spec/test-type/aria-templates/require-sample-tests/SimpleTestSuite.js
  21. 0  spec/test-type/aria-templates/{sample-tests → require-sample-tests}/SyntaxError.js
  22. +12 −0 spec/test-type/aria-templates/require-sample-tests/TestSuiteUsingPackage.js
  23. 0  spec/test-type/aria-templates/require-sample-tests/ZeroClassDefError.js
View
261 lib/test-type/aria-templates/at-file-reader.js
@@ -14,9 +14,23 @@
*/
var vm = require('vm');
+var UglifyJS = require("uglify-js");
+var findRequires = require('noder-js/findRequires');
+var oldSyntaxRegexp = /Aria\s*\.\s*(class|interface|bean|tplScript)Definition(s?)\s*\(/;
-var readATFileContent = function (fileContent, fileName) {
- var res = {};
+/**
+ * Reads the content of a test which uses the old Aria Templates syntax (without require), and fills res with the following properties: <ul>
+ * <li>classpath (string) classpath</li>
+ * <li>testSuite (boolean) whether the class is a test suite</li>
+ * <li>subTests (array of strings) in case testSuite is true, classpaths of the tests which are part of the suite</li>
+ * <li>error (object with message, args and object properties) in case there is an error</li>
+ * </ul>
+ * @param {Object} res object receiving the results
+ * @param {String} fileContent file content
+ * @param {String} fileName file name
+ */
+
+function readATOldFileContent(res, fileContent, fileName) {
var classDef = null;
var classDefinitionCalls = 0;
var sandbox = {
@@ -32,47 +46,213 @@ var readATFileContent = function (fileContent, fileName) {
}
}
};
- try {
- vm.runInNewContext(fileContent, sandbox, fileName);
- if (classDefinitionCalls != 1) {
- res.error = {
- message: "In %s: there is not exactly one call to Aria.classDefinition.",
- args: [fileName]
- };
- return res;
+ vm.runInNewContext(fileContent, sandbox, fileName);
+ if (classDefinitionCalls != 1) {
+ res.error = {
+ message: "In %s: there is not exactly one call to Aria.classDefinition.",
+ args: [fileName]
+ };
+ return;
+ }
+ res.classpath = classDef.$classpath;
+ if (typeof res.classpath != "string") {
+ res.error = {
+ message: "In %s: missing classpath in Aria.classDefinition.",
+ args: [fileName]
+ };
+ return;
+ }
+ res.testSuite = (classDef.$extends == 'aria.jsunit.TestSuite');
+ if (res.testSuite) {
+ readTestSuite(res, classDef.$constructor);
+ }
+}
+
+/**
+ * Executes the given test suite constructor in an appropriate environment, and fills res with the subTests property.
+ * @param {Object} res object receiving the results
+ * @param {Function} constructor test suite constructor
+ */
+
+function readTestSuite(res, constructor) {
+ var classpath = res.classpath;
+ var lastDot = classpath.lastIndexOf('.');
+ var testSuiteObject = {
+ $TestSuite: {
+ constructor: function () {},
+ $constructor: function () {}
+ },
+ $classpath: classpath,
+ $package: classpath.substring(0, lastDot),
+ $class: classpath.substring(lastDot + 1),
+ _tests: [],
+ addTests: function () {
+ var args = arguments;
+ for (var i = 0, l = args.length; i < l; i++) {
+ var testClassPath = args[i];
+ if (typeof testClassPath == "string") {
+ this._tests.push(testClassPath);
+ }
+ }
}
- res.classpath = classDef.$classpath;
- if (typeof res.classpath != "string") {
+ };
+ constructor.call(testSuiteObject);
+ res.subTests = testSuiteObject._tests.slice(0);
+}
+
+/**
+ * Reads the content of a test which uses the new Aria Templates syntax (with require), and fills res with the following properties: <ul>
+ * <li>classpath (string) classpath</li>
+ * <li>testSuite (boolean) whether the class is a test suite</li>
+ * <li>subTests (array of strings) in case testSuite is true, classpaths of the tests which are part of the suite</li>
+ * <li>error (object with message, args and object properties) in case there is an error</li>
+ * </ul>
+ * This method reads the file by parsing it with Uglify-JS and recognising the calls to Aria.classDefinition.
+ * @param {Object} res object receiving the results
+ * @param {String} fileContent file content
+ * @param {String} fileName file name
+ */
+
+function readATNewFileContent(res, fileContent, fileName) {
+ var foundClassDef = null;
+ var walker = new UglifyJS.TreeWalker(function (node) {
+ var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
+ if (!isAssignment) return;
+ var moduleExports = node.left;
+ var isDotExports = moduleExports instanceof UglifyJS.AST_Dot && moduleExports.property == "exports";
+ if (!isDotExports) return;
+ var moduleVar = moduleExports.expression;
+ var isModuleDotExports = moduleVar instanceof UglifyJS.AST_SymbolRef && moduleVar.name == "module" && moduleVar.thedef.undeclared;
+ if (!isModuleDotExports) return;
+ var callAriaClassDefinition = node.right;
+ var isFnCallWithParam = callAriaClassDefinition instanceof UglifyJS.AST_Call && callAriaClassDefinition.args.length >= 1;
+ if (!isFnCallWithParam) return;
+ var ariaClassDefinition = callAriaClassDefinition.expression;
+ var isDotClassDefinition = ariaClassDefinition instanceof UglifyJS.AST_Dot && ariaClassDefinition.property == "classDefinition";
+ if (!isDotClassDefinition) return;
+ var ariaRef = readRequire(ariaClassDefinition.expression);
+ if (!(ariaRef && /^aria(templates)?\/Aria(\.js)?$/.test(ariaRef))) return;
+ var classDefArg = callAriaClassDefinition.args[0];
+ var isObjectLitteral = classDefArg instanceof UglifyJS.AST_Object;
+ if (!isObjectLitteral) return;
+ if (foundClassDef) {
res.error = {
- message: "In %s: missing classpath in Aria.classDefinition.",
- args: [fileName]
+ message: "Found several 'module.exports = Aria.classDefinition({...});' in %s: lines %s and %s.",
+ args: [fileName, foundClassDef.start.line, classDefArg.start.line]
};
- return res;
+ return;
}
- res.testSuite = (classDef.$extends == 'aria.jsunit.TestSuite');
- if (res.testSuite) {
- var lastDot = res.classpath.lastIndexOf('.');
- var testSuiteObject = {
- $TestSuite: {
- constructor: function () {},
- $constructor: function () {}
- },
- $classpath: res.classpath,
- $package: res.classpath.substring(0, lastDot),
- $class: res.classpath.substring(lastDot + 1),
- _tests: [],
- addTests: function () {
- var args = arguments;
- for (var i = 0, l = args.length; i < l; i++) {
- var testClassPath = args[i];
- if (typeof testClassPath == "string") {
- this._tests.push(testClassPath);
- }
- }
- }
- };
- classDef.$constructor.call(testSuiteObject);
- res.subTests = testSuiteObject._tests.slice(0);
+ foundClassDef = classDefArg;
+ return true;
+ });
+ var ast = UglifyJS.parse(fileContent, fileName);
+ ast.figure_out_scope();
+ ast.walk(walker);
+ if (res.error) return;
+ if (!foundClassDef) {
+ res.error = {
+ message: "Could not find 'var Aria = require(\"ariatemplates/Aria\"); module.exports = Aria.classDefinition({...});' in %s.",
+ args: [fileName]
+ };
+ return;
+ }
+ var constructor = null;
+ var parentClass = null;
+ foundClassDef.properties.forEach(function (property) {
+ if (property.key == "$classpath" && property.value instanceof UglifyJS.AST_String) {
+ res.classpath = property.value.value;
+ } else if (property.key == "$extends") {
+ parentClass = readRequire(property.value);
+ } else if (property.key == "$constructor" && property.value instanceof UglifyJS.AST_Function) {
+ constructor = property.value;
+ }
+ });
+ if (typeof res.classpath != "string") {
+ res.error = {
+ message: "In %s: missing classpath in Aria.classDefinition.",
+ args: [fileName]
+ };
+ return res;
+ }
+ res.testSuite = parentClass && /^aria(templates)?\/jsunit\/TestSuite(\.js)?$/.test(parentClass);
+ if (res.testSuite && constructor) {
+ var sandbox = {};
+ vm.runInNewContext("$constructor=" + constructor.print_to_string(), sandbox, fileName);
+ readTestSuite(res, sandbox.$constructor);
+ }
+}
+
+/**
+ * Returns the dependency the given expression refers to, using the following algorithm:
+ * If the given expression contains a call to require with a single string parameter, this method returns that string.
+ * Otherwise, if the given expression contains a reference to a variable, this method reads the initial definition of that variable
+ * and calls itself recursively with that definition.
+ * For example, considering the following code:
+ * <code>
+ * var a = require("myDependency");
+ * var b = a;
+ * var c = b;
+ * c.classDefinition({...});
+ * </code>
+ * When called with the expression "c" from the last line, this method returns "myDependency" (as it goes from "c" to "b", then from "b" to "a"
+ * and detects that "a" contains a reference to "myDependency").
+ * In practise, this method allows to cover the following two main use cases:
+ * <code>
+ * module.exports = require("ariatemplates/Aria").classDefinition({...}); // inline usage of require
+ * </code>
+ * and
+ * <code>
+ * var Aria = require("ariatemplates/Aria"); // definition of the Aria variable
+ * module.exports = Aria.classDefinition({...}); // using the previously defined variable
+ * </code>
+ * @param {UglifyJS.AST_Node} expression (node of the abstract syntax tree provided by UglifyJS)
+ * @return {String|null} the dependency the expression is refering to, or null if the variable is not refering to a dependency loaded with
+ * require (or if it was not possible to detect it with this simple algorithm)
+ */
+
+function readRequire(expression) {
+ if (expression instanceof UglifyJS.AST_Call && expression.args.length == 1) {
+ var requireVar = expression.expression;
+ if (requireVar instanceof UglifyJS.AST_SymbolRef && requireVar.name == "require" && requireVar.thedef.undeclared) {
+ var param = expression.args[0];
+ if (param instanceof UglifyJS.AST_String) {
+ return param.value;
+ }
+ }
+ } else if (expression instanceof UglifyJS.AST_SymbolRef) {
+ var def = expression.thedef.init;
+ if (def && def.end.endpos < expression.start.pos) {
+ return readRequire(def);
+ }
+ }
+ return null;
+}
+
+/**
+ * Reads the content of a test which uses either the new or the old Aria Templates syntax (with or without require),
+ * and fills res with the following properties: <ul>
+ * <li>classpath (string) classpath</li>
+ * <li>testSuite (boolean) whether the class is a test suite</li>
+ * <li>subTests (array of strings) in case testSuite is true, classpaths of the tests which are part of the suite</li>
+ * <li>error (object with message, args and object properties) in case there is an error</li>
+ * </ul>
+ * The detection algorithm of the old or the new syntax is done in the same way as it is done in Aria Templates: the
+ * file is considered to be using the old syntax if there is no require and there is a call to Aria.xDefinition. Otherwise,
+ * it is using the new syntax (with require).
+ * @param {Object} res object receiving the results
+ * @param {String} fileContent file content
+ * @param {String} fileName file name
+ */
+
+function readATFileContent(fileContent, fileName) {
+ var res = {};
+ try {
+ var requires = findRequires(fileContent);
+ var oldSyntax = !requires.length && oldSyntaxRegexp.test(fileContent);
+ if (oldSyntax) {
+ readATOldFileContent(res, fileContent, fileName);
+ } else {
+ readATNewFileContent(res, fileContent, fileName);
}
} catch (e) {
res.error = {
@@ -80,9 +260,8 @@ var readATFileContent = function (fileContent, fileName) {
args: [fileName, e + ""],
object: e
};
- return res;
}
return res;
-};
+}
module.exports = readATFileContent;
View
2  package.json
@@ -24,6 +24,8 @@
"send": "0.1.0",
"socket.io": "0.9.16",
"ua-parser": "0.3.3",
+ "noder-js": "1.2.0-rc1",
+ "uglify-js": "2.4.12",
"eventemitter2": "git+https://github.com/piuccio/EventEmitter2.git#wildcard_listeners"
},
"devDependencies": {
View
68 spec/test-type/aria-templates/at-file-reader.spec.js
@@ -17,18 +17,28 @@ describe('ATFileReader', function () {
var readATFile = require('../../../lib/test-type/aria-templates/at-file-reader.js');
var fs = require('fs');
var path = require('path');
+ var identity = function (value) {
+ return value;
+ };
- var itShouldInterpret = function (fileName, expectedResult) {
- it('should correctly interpret ' + fileName, function (done) {
- fs.readFile(path.join(__dirname, 'sample-tests', fileName), 'utf8', function (err, data) {
+ var itShouldInterpretSpecifically = function (folder, fileName, expectedResult, processResult) {
+ processResult = processResult || identity;
+ it('should correctly interpret ' + folder + '/' + fileName, function (done) {
+ fs.readFile(path.join(__dirname, folder, fileName), 'utf8', function (err, data) {
expect(err).toBeNull();
var res = readATFile(data, fileName);
+ res = processResult(res);
expect(res).toEqual(expectedResult);
done();
});
});
};
+ var itShouldInterpret = function (fileName, expectedResult, processResult) {
+ itShouldInterpretSpecifically('require-sample-tests', fileName, expectedResult, processResult);
+ itShouldInterpretSpecifically('legacy-sample-tests', fileName, expectedResult, processResult);
+ };
+
itShouldInterpret('SimpleTestSuite.js', {
classpath: 'test.myCompany.MyTestSuite',
testSuite: true,
@@ -53,16 +63,66 @@ describe('ATFileReader', function () {
subTests: ['MainTestSuiteTest1', 'Test2', 'MainTestSuiteTest3']
});
+ itShouldInterpret('OtherTestSuite.js', {
+ classpath: 'MainTestSuite',
+ testSuite: true,
+ subTests: ['x.y.z.MyTest1', 'y.z.MyOtherTest2']
+ });
+
itShouldInterpret('SimpleTestCase.js', {
classpath: 'test.myCompany.MyTestCase',
testSuite: false
});
+ itShouldInterpret('MissingClasspathError.js', {
+ error: {
+ message: 'In %s: missing classpath in Aria.classDefinition.',
+ args: ['MissingClasspathError.js']
+ }
+ });
+
itShouldInterpret('SyntaxError.js', {
error: {
message: 'An exception occurred in %s: %s',
- args: ['SyntaxError.js', 'SyntaxError: Unexpected identifier'],
+ args: ['SyntaxError.js', 'ERROR'],
object: {}
}
+ }, function (value) {
+ if (value.error && value.error.args && value.error.object) {
+ // Don't check the exact error message:
+ value.error.object = {};
+ value.error.args[1] = 'ERROR';
+ }
+ return value;
+ });
+
+ itShouldInterpretSpecifically('legacy-sample-tests', 'MultipleTestCasesError.js', {
+ error: {
+ message: 'In %s: there is not exactly one call to Aria.classDefinition.',
+ args: ['MultipleTestCasesError.js']
+ }
+ });
+
+ itShouldInterpretSpecifically('legacy-sample-tests', 'ZeroClassDefError.js', {
+ error: {
+ message: 'In %s: there is not exactly one call to Aria.classDefinition.',
+ args: ['ZeroClassDefError.js']
+ }
});
+
+ itShouldInterpretSpecifically('require-sample-tests', 'MultipleTestCasesError.js', {
+ error: {
+ message: "Found several 'module.exports = Aria.classDefinition({...});' in %s: lines %s and %s.",
+ args: ['MultipleTestCasesError.js', 4, 18]
+ }
+ });
+
+ itShouldInterpretSpecifically('require-sample-tests', 'ZeroClassDefError.js', {
+ error: {
+ message: "Could not find 'var Aria = require(\"ariatemplates/Aria\"); module.exports = Aria.classDefinition({...});' in %s.",
+ args: ['ZeroClassDefError.js']
+ }
+
+ });
+
});
View
0  ...a-templates/sample-tests/MainTestSuite.js → ...ates/legacy-sample-tests/MainTestSuite.js
File renamed without changes
View
15 spec/test-type/aria-templates/legacy-sample-tests/MissingClasspathError.js
@@ -0,0 +1,15 @@
+Aria.classDefinition({
+ $extends : 'aria.jsunit.TestCase',
+ $constructor : function () {
+ this.$TestCase.constructor.call(this);
+ },
+ $prototype : {
+ testOne : function () {
+
+ },
+
+ testAsyncTwo : function () {
+
+ }
+ }
+});
View
27 spec/test-type/aria-templates/legacy-sample-tests/MultipleTestCasesError.js
@@ -0,0 +1,27 @@
+Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestCase1',
+ $extends : 'aria.jsunit.TestCase',
+ $prototype : {
+ testOne : function () {
+
+ },
+
+ testAsyncTwo : function () {
+
+ }
+ }
+});
+
+Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestCase2',
+ $extends : 'aria.jsunit.TestCase',
+ $prototype : {
+ testOne : function () {
+
+ },
+
+ testAsyncTwo : function () {
+
+ }
+ }
+});
View
0  ...ates/sample-tests/OtherSimpleTestSuite.js → ...gacy-sample-tests/OtherSimpleTestSuite.js
File renamed without changes
View
8 spec/test-type/aria-templates/legacy-sample-tests/OtherTestSuite.js
@@ -0,0 +1,8 @@
+Aria.classDefinition({
+ $classpath : 'MainTestSuite',
+ $extends : 'aria.jsunit.TestSuite',
+ $constructor : function () {
+ this.$TestSuite.constructor.call(this);
+ this._tests = ["x.y.z.MyTest1","y.z.MyOtherTest2"];
+ }
+});
View
0  ...-templates/sample-tests/SimpleTestCase.js → ...tes/legacy-sample-tests/SimpleTestCase.js
File renamed without changes
View
0  ...templates/sample-tests/SimpleTestSuite.js → ...es/legacy-sample-tests/SimpleTestSuite.js
File renamed without changes
View
1  spec/test-type/aria-templates/legacy-sample-tests/SyntaxError.js
@@ -0,0 +1 @@
+Aria.classDefinition(this file is wrong()
View
0  ...tes/sample-tests/TestSuiteUsingPackage.js → ...acy-sample-tests/TestSuiteUsingPackage.js
File renamed without changes
View
3  spec/test-type/aria-templates/legacy-sample-tests/ZeroClassDefError.js
@@ -0,0 +1,3 @@
+/*
+ Aria.classDefinition({})
+*/
View
12 spec/test-type/aria-templates/require-sample-tests/MainTestSuite.js
@@ -0,0 +1,12 @@
+var Aria = require("ariatemplates/Aria");
+var ariaJsunitTestSuite = require("ariatemplates/jsunit/TestSuite");
+module.exports = Aria.classDefinition({
+ $classpath : 'MainTestSuite',
+ $extends : ariaJsunitTestSuite,
+ $constructor : function () {
+ this.$TestSuite.constructor.call(this);
+ this.addTests(this.$classpath + "Test1");
+ this.addTests(this.$package + "Test2");
+ this.addTests(this.$class + "Test3");
+ }
+});
View
17 spec/test-type/aria-templates/require-sample-tests/MissingClasspathError.js
@@ -0,0 +1,17 @@
+var Aria = require("ariatemplates/Aria");
+var ariaJsunitTestCase = require("ariatemplates/jsunit/TestCase");
+module.exports = Aria.classDefinition({
+ $extends : ariaJsunitTestCase,
+ $constructor : function () {
+ this.$TestCase.constructor.call(this);
+ },
+ $prototype : {
+ testOne : function () {
+
+ },
+
+ testAsyncTwo : function () {
+
+ }
+ }
+});
View
30 spec/test-type/aria-templates/require-sample-tests/MultipleTestCasesError.js
@@ -0,0 +1,30 @@
+var Aria = require("ariatemplates/Aria");
+var ariaJsunitTestCase = require("ariatemplates/jsunit/TestCase");
+
+module.exports = Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestCase1',
+ $extends : ariaJsunitTestCase,
+ $prototype : {
+ testOne : function () {
+
+ },
+
+ testAsyncTwo : function () {
+
+ }
+ }
+});
+
+module.exports = Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestCase2',
+ $extends : ariaJsunitTestCase,
+ $prototype : {
+ testOne : function () {
+
+ },
+
+ testAsyncTwo : function () {
+
+ }
+ }
+});
View
11 spec/test-type/aria-templates/require-sample-tests/OtherSimpleTestSuite.js
@@ -0,0 +1,11 @@
+var Aria = require("ariatemplates/Aria");
+var ariaJsunitTestSuite = require("ariatemplates/jsunit/TestSuite");
+module.exports = Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestSuite',
+ $extends : ariaJsunitTestSuite,
+ $constructor : function () {
+ this.$TestSuite.$constructor.call(this);
+
+ this.addTests("test.myCompany.firstModule.FirstModuleTestSuite", "test.myCompany.secondModule.SearchTestCase", "test.myCompany.secondModule.RetrieveTestCase");
+ }
+});
View
8 spec/test-type/aria-templates/require-sample-tests/OtherTestSuite.js
@@ -0,0 +1,8 @@
+module.exports = require("ariatemplates/Aria").classDefinition({
+ $classpath : 'MainTestSuite',
+ $extends : require("ariatemplates/jsunit/TestSuite"),
+ $constructor : function () {
+ this.$TestSuite.constructor.call(this);
+ this._tests = ["x.y.z.MyTest1","y.z.MyOtherTest2"];
+ }
+});
View
18 spec/test-type/aria-templates/require-sample-tests/SimpleTestCase.js
@@ -0,0 +1,18 @@
+var Aria = require("ariatemplates/Aria");
+var ariaJsunitTestCase = require("ariatemplates/jsunit/TestCase");
+module.exports = Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestCase',
+ $extends : ariaJsunitTestCase,
+ $constructor : function () {
+ this.$TestCase.constructor.call(this);
+ },
+ $prototype : {
+ testOne : function () {
+
+ },
+
+ testAsyncTwo : function () {
+
+ }
+ }
+});
View
11 spec/test-type/aria-templates/require-sample-tests/SimpleTestSuite.js
@@ -0,0 +1,11 @@
+var Aria = require("ariatemplates/Aria");
+var ariaJsunitTestSuite = require("ariatemplates/jsunit/TestSuite");
+module.exports = Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestSuite',
+ $extends : ariaJsunitTestSuite,
+ $constructor : function () {
+ this.$TestSuite.constructor.call(this);
+
+ this.addTests("test.myCompany.firstModule.FirstModuleTestSuite", "test.myCompany.secondModule.SearchTestCase", "test.myCompany.secondModule.RetrieveTestCase");
+ }
+});
View
0  ...ria-templates/sample-tests/SyntaxError.js → ...lates/require-sample-tests/SyntaxError.js
File renamed without changes
View
12 spec/test-type/aria-templates/require-sample-tests/TestSuiteUsingPackage.js
@@ -0,0 +1,12 @@
+var Aria = require("ariatemplates/Aria");
+var ariaJsunitTestSuite = require("ariatemplates/jsunit/TestSuite");
+module.exports = Aria.classDefinition({
+ $classpath : 'test.myCompany.MyTestSuite',
+ $extends : ariaJsunitTestSuite,
+ $constructor : function () {
+ this.$TestSuite.constructor.call(this);
+ this.addTests(this.$package + '.MyTest1');
+ this.addTests(this.$package + '.MyTest2');
+ this.addTests(this.$package + '.MyTest3');
+ }
+});
View
0  spec/test-type/aria-templates/require-sample-tests/ZeroClassDefError.js
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.