don't run tests by starting server with app anymore, let's do it all from desired caps

This commit is contained in:
Jonathan Lipps
2013-01-25 10:00:12 -08:00
committed by Sebastian Tiedtke
parent e6cde7c0e1
commit 241f9884cc
2 changed files with 21 additions and 16 deletions

View File

@@ -11,9 +11,14 @@ var _ = require("underscore")
, spawn = require('child_process').spawn;
module.exports.startAppium = function(appName, verbose, readyCb, doneCb) {
var app = (fs.existsSync(appName)) ? appName:
path.resolve(__dirname,
"./sample-code/apps/"+appName+"/build/Release-iphonesimulator/"+appName+".app");
var app;
if (appName) {
app = (fs.existsSync(appName)) ? appName:
path.resolve(__dirname,
"./sample-code/apps/"+appName+"/build/Release-iphonesimulator/"+appName+".app");
} else {
app = null;
}
return server.run({
app: app
, udid: null
@@ -57,12 +62,16 @@ module.exports.runMochaTests = function(grunt, appName, testType, cb) {
}
var args = ['-t', options.timeout, '-R', options.reporter, '--colors'];
var fileConfig = grunt.config(['mochaTestWithServer']);
_.each(fileConfig[appName], function(testFiles, testKey) {
if (testType == "*" || testType == testKey) {
_.each(testFiles, function(file) {
_.each(grunt.file.expandFiles(file), function(file) {
args.push(file);
});
_.each(fileConfig, function(config, configApp) {
if (!appName || appName === configApp) {
_.each(config, function(testFiles, testKey) {
if (testType == "*" || testType == testKey) {
_.each(testFiles, function(file) {
_.each(grunt.file.expandFiles(file), function(file) {
args.push(file);
});
});
}
});
}
});

View File

@@ -35,10 +35,9 @@ module.exports = function(grunt) {
, mochaTestWithServer: {
TestApp: {
functional: ['test/functional/*.js']
, unit: ['app/test/unit/*.js']
}
, UICatalog: {
uicatalog: ['test/uicatalog/*.js']
functional: ['test/uicatalog/*.js']
}
}
, mochaTestConfig: {
@@ -51,12 +50,9 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('functional', "Run functional tests", function(log) {
runTestsWithServer(grunt, 'TestApp', 'functional', log === "log", this.async());
runTestsWithServer(grunt, null, 'functional', log === "log", this.async());
});
grunt.registerTask('uicatalog', "Run UICatalog tests", function(log) {
runTestsWithServer(grunt, 'UICatalog', 'uicatalog', log === "log", this.async());
});
grunt.registerTask('test', 'lint buildApp:TestApp buildApp:UICatalog unit appiumutils functional uicatalog');
grunt.registerTask('test', 'lint buildApp:TestApp buildApp:UICatalog unit appiumutils functional');
grunt.registerTask('unit', 'mochaTest:unit');
grunt.registerTask('appiumutils', 'mochaTest:appiumutils');
grunt.registerTask('default', 'lint test');