J'utilise karma
angular-cli
pour exécuter testcase en utilisant jasmine
et javascript
.karma-htmlfile-reporter sur le karma ne commence pas à donner la sortie html
Dans mon fichier karma.config
j'ai ajouté ces lignes.
reporters: ['progress','html'],
htmlReporter: {
outputFile: 'test/units.html'
},
Et je suis en cours d'exécution dans cette commande invite de commande
karma start --reporters html
Mais au lieu d'obtenir testcase résultat que je reçois seulement ceux-ci.
Modifié: Ajouté karma.conf.js
// Karma configuration
// Generated on Tue Sep 26 2017 18:46:51 GMT+0530 (India Standard Time)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files/patterns to load in the browser
files: [
'test-main.js',
'js/*.js',
'test/*.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
client: {
clearContext: false
},
reporters: ['kjhtml','html'],
plugins: ['karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-jasmine-html-reporter'],
// web server port
port: 9876,
// enable/disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable/disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
Ajouté package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "karma.conf.js",
"directories": {
"test": "test"
},
"dependencies": {
"jasmine": "^2.7.0",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.0.1",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "^1.1.0",
"karma-requirejs": "^1.1.0"
},
"devDependencies": {
"jasmine": "^2.8.0",
"jasmine-core": "^2.8.0",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-htmlfile-reporter": "~0.3",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.1.8",
"karma-requirejs": "^1.1.0",
"karma-spec-reporter": "0.0.31"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Et j'obtenu le résultat que Quelqu'un peut-il aider à comment produire le testcase Résultats en html?
Quelle structure de test unitaire utilisez-vous? (Qunit, Jasmine ??), Le htmlReporter est supposé vider les résultats des tests dans un fichier html. – Raj
J'utilise le cadre de jasmin –
Je pense que la raison, vous ne voyez pas les spécifications sous la bannière du karma, c'est que le karma ne charge pas le fichier jasmine.css, vous pouvez le charger via le fichier karma.conf.js avant l'autre recherchez les fichiers source et de test, recherchez jasmine.css dans votre karma-core node_modules. – Raj