Commit 1d35b0dd authored by yancend's avatar yancend

[test]添加测试框架

parent 9a63150e
//beforeEach( function () {
// // customMatcher 例子
// this.addMatchers( {
// //用的时候这么用:
// //expect('***').customMatchers(true);
// //expect('***').not.customMatchers(true);
//// customMatchers: function ( expected ) {
//// return expected === true;
//// },
//
// } );
//} );
This diff is collapsed.
describe("command", function () {
it('',function(){
})
});
\ No newline at end of file
/**
* Created by dongyancen on 13-12-27.
*/
///import core/kityminder;
///import core/utils;
///import core/command;
///import core/node;
///import core/module;
///import core/event;
///import core/minder;
///import core/minder.data;
///import core/minder.event;
///import core/minder.module;
///import core/minder.command;
///import core/minder.node;
///import core/minder.select;
\ No newline at end of file
/**
* Created with JetBrains PhpStorm.
* User: dongyancen
* Date: 13-12-10
* Time: 下午7:24
* To change this template use File | Settings | File Templates.
/**
* Created by dongyancen on 13-12-30.
*/
describe("connect", function () {
it("KityMinder 已定义", function () {
expect(KityMinder).toBeDefined();
});
});
<?php
/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-10
* Time: 上午1:20
* To change this template use File | Settings | File Templates.
*/
require_once 'config.php';
class Kiss
{
public $projroot ;
public $name;
public $srcPath;
public $testPath;
public $empty = false;
public $case_id;
function __construct( $name = '' )
{
$this->projroot = Config::$projroot;
$this->srcPath = Config::$projroot.Config::$src_PATH;
$this->testPath = Config::$projroot.Config::$test_PATH;
$this->name = $name;
$this->case_id = 'id_case_' . join( '_' , explode( '.' , $name ) );
}
public function print_js( $cov)
{
if($cov){
$basePath = '../../spec/coverage';
}
else{
$basePath = '../../src';
}
// print "<script src='../../dist/dev.php'></script>";
print "<script type='text/javascript' src='./js/UserAction.js' ></script>\n";
/* load case and case dependents*/
$ps = explode( '/' , $this->name );
/*load helper*/
foreach(Config::$helperFiles as $f){
if ( file_exists( $this->testPath . $f ) ) {
print '<script type="text/javascript" src="' . $this->testPath . $f . '"></script>' . "\n";
}
}
//先引用kity
print "<script src='../../kity/dist/kitygraph.all.js'></script>\n";
//分成两部分:一部分默认加载(可配置),一部分针对文件加载(例如在文件头部有注释标注依赖文件,根据依赖文件动态加载)
// core里面的文件全部加载,module加载用例对应的src文件,最后加载与用例同名的原文件
$importurl = "{$this->testPath}tools/import.php?f=$this->name";
if ( $cov ) $importurl .= '^&cov=true';
print "<script type='text/javascript' src='".$importurl."' ></script>\n";
//引用测试文件
print '<script type="text/javascript" src="' .$this->testPath.$this->name. '.js"></script>' . "\n";
}
public function match( $matcher )
{
if ( $matcher == '*' )
return true;
$len = strlen( $matcher );
/**
* 处理多选分支,有一个成功则成功,filter后面参数使用|切割
* @var unknown_type
*/
$ms = explode( ',' , $matcher );
if ( sizeof( $ms ) > 1 ) {
foreach ( $ms as $matcher1 ) {
if ( $this->match( $matcher1 ) )
return true;
}
return false;
}
/**
* 处理反向选择分支
*/
if ( substr( $matcher , 0 , 1 ) == '!' ) {
$m = substr( $matcher , 1 );
if ( substr( $this->name , 0 , strlen( $m ) ) == $m )
return false;
return true;
}
if ( $len > strlen( $this->name ) ) {
return false;
}
return substr( $this->name , 0 , $len ) == $matcher;
}
public static function listcase( $matcher = "*" ,$cov)
{
require_once 'fileHelper.php';
/*get files both in src path and test path*/
$caselist = getSameFile(Config::$projroot.Config::$src_PATH , Config::$projroot.Config::$test_PATH , '' );
sort($caselist,SORT_STRING);
foreach ( $caselist as $caseitem ) {
/*remove '.js' */
$name = substr( $caseitem , 0 , -3 );
$c = new Kiss( $name );
if ( $c->empty )
continue;
if ( $c->match( $matcher ) ) {
$newName = explode( '\\.' , $name );
$newName = $newName[ count( $newName ) - 1 ];
if($cov){
$covMsg = "&cov=true";
}else{
$covMsg="";
}
print( "<a href=\"run.php?case=$name".$covMsg."\" id=\"$c->case_id\" target=\"_blank\" title=\"$name\" onclick=\"run('$name');return false;\">". $newName . "</a>" );
}
}
}
public static function listSrcOnly( $print = true )
{
$srcpath = Config::$projroot.Config::$src_PATH;
$testpath = Config::$projroot.Config::$test_PATH;
require_once 'fileHelper.php';
$caselist = getSameFile( $srcpath , $testpath , '' );
$srclist = getSrcOnlyFile( $srcpath , $testpath , '' );
$srcList = array();
foreach ( $srclist as $case ) {
if ( in_array( $case , $caselist ) )
continue;
$name = str_replace( '/' , '.' , substr( $case , 0 , -3 ) );
$tag = "<a title=\"$name\">" . ( strlen( $name ) > 20 ? substr( $name , 6 )
: $name ) . "</a>";
array_push( $srcList , $tag );
if ( $print )
echo $tag;
}
return $srcList;
}
}
\ No newline at end of file
<?php
/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-10
* Time: 上午1:50
* To change this template use File | Settings | File Templates.
*/
class Config
{
public static $projroot = "../../";
//相对于projroot的路径
public static $src_PATH = "src/" ;
public static $test_PATH = "spec/";
public static $helperFiles = array( "SpecHelper.js" );
}
\ No newline at end of file
* {
margin: 0;
padding: 0;
}
html {
border: 0;
height: 100%;
}
body {
font: 12px/1.5 Lucida Grande, Helvetica, Arial, sans-serif;
background: #F3F1F1;
color: #41464D;
}
body,#container {
width: 100%;
height: 100%;
}
.clear { /* generic container (i.e. div) for floating buttons */
overflow: hidden;
width: 100%;
}
a {
text-decoration: none;
overflow: hidden;
}
#title {
top: 0;
left: 0;
width: 100%;
padding: 5px 0;
background: #aaa;
background: #41464D;
color: #F3F1F1;
height: 30px;
}
a:link,a:visited {
color: #528CE0;
}
a:hover,a:active {
color: #41464D !important;
cursor: pointer !important;
}
#title h1 {
height: 30px;
font: 25px/1.1 Arial, sans-serif;
font-weight: bolder;
float: left;
margin: 1px 0 2px 20px;
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
}
h3 {
font-size: 14px;
padding: 3px 5px 1px;
}
.control {
background: #d5ded7;
width: 99%;
}
.testlist {
max-height: 200px;
overflow-y: scroll;
border-style: double;
}
.testlist a {
display: block;
width: 150px;
color: #657528;
background: #d5dea7;
border: 1px solid #c8dc7b;
margin: 5px 0 0 5px;
text-indent: 5px;
line-height: 24px;
font-size: 14px;
float: left;
}
a.button {
background: transparent url('bg_button_a.gif') no-repeat scroll top
right;
color: #444;
display: block;
float: left;
font: normal 12px arial, sans-serif;
height: 24px;
margin-right: 6px;
padding-right: 18px; /* sliding doors padding */
text-decoration: none;
}
a.button span {
background: transparent url('bg_button_span.gif') no-repeat;
display: block;
line-height: 14px;
padding: 5px 0 5px 18px;
}
a.button:active {
background-position: bottom right;
color: #000;
outline: none; /* hide dotted outline in Firefox */
}
a.button:active span {
background-position: bottom left;
padding: 6px 0 4px 18px; /* push text down 1px */
}
.testlist a:link {
}
.testlist a:visited {
}
.testlist a:hover {
background: #c8dc7b;
}
.testlist a.jsframe_jsspec {
background: #DDDDDD
}
.testlist a.running_case {
color: yellow;
}
.testlist a.fail_case {
color: red;
}
.testlist a.pass_case {
color: green;
}
.runningarea {
height: 60%;
}
.runningmaindiv {
height: 99%;
}
.runningframe {
height: 99.99%;
width: 99.99%;
}
.runningstatus {
clear: both;
height: 10%;
border: solid
}
.reportarea {
padding: 10px;
border: 10px blue;
max-height: 200px;
overflow-y: scroll;
}
\ No newline at end of file
<?php
/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-11
* Time: 下午5:31
* To change this template use File | Settings | File Templates.
*///获取两个目录下的相同路径的文件数
function getSameFile($src, $test, $path=''){
$result = array();
$as = listFile($src.$path);
$ts = listFile($test.$path);
$ds = array_intersect($as, $ts);
foreach($ds as $item){
$si = $src.$path.$item;
$ti = $test.$path.$item;
if(is_dir($si) && is_dir($ti)){
$result = array_merge($result, getSameFile($src, $test, $path.$item.'/'));
}else if(is_file($si) && is_file($ti)){
if(substr($si, -3) == '.js')
array_push($result, $path.$item);
}
}
return $result;
}
//获取只在src中存在的文件,防止遗漏用例
function getSrcOnlyFile($src, $test, $path=''){
$result = array();
$as = listFile($src.$path);
$ts = listFile($test.$path);
foreach($as as $item){
$si = $src.$path.$item;
$ti = $test.$path.$item;
if(is_dir($si) && is_dir($ti)){
$result = array_merge($result, getSrcOnlyFile($src, $test, $path.$item.'/'));
}else if(is_file($si) && !is_file($ti)){
if(substr($si, -3) == '.js')
array_push($result,$path.$item);
}
else{
// print("error : $si");
}
}
return $result;
}
function listFile($dir){
$as = array();
if($dh = opendir($dir)){
while(($file = readdir($dh))!==false){
if(substr(basename($file), 0, 1) == '.')
continue;
array_push($as, basename($file));
}
closedir($dh);
}
return $as;
}
<?php
/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 13-12-10
* Time: 上午1:48
* To change this template use File | Settings | File Templates.
*/
header( "Content-type: text/html; charset=utf-8" );
$import = 'import.js';
function custom_strEmpty($s){
$str = strlen(trim($s));
if(empty($str)){
return true;
}
return false;
}
function importSrc(){
require_once 'config.php';
global $import;
require_once 'config.php';
if(file_exists(Config::$projroot.Config::$test_PATH.$import)){
$cnt = file_get_contents(Config::$projroot.Config::$test_PATH.$import);
}
if($cnt == ''){
if(Config::$DEBUG)
print "fail read file : ".Config::$test_PATH.$import;
return '';
}
$is = array();
$flag_ownSrc = 1;
$caseName = $_GET[ 'f' ];
$this_src = Config::$projroot.Config::$src_PATH.$caseName.".js";
//正则匹配,提取所有(///import xxx;)中的xxx
preg_match_all('/\/\/\/import\s+([^;]+);?/ies', $cnt, $is, PREG_PATTERN_ORDER);
foreach($is[1] as $i) {
if(strcasecmp($i,$caseName)==0){
$flag_ownSrc = 0;
}
$path = $i . '.js';
$srcFile = Config::$projroot . Config::$src_PATH . $path;
if (file_exists($srcFile)) {
echo "document.write('<script charset=utf-8 src=\"$srcFile\"></script>');";
}
}
if(file_exists($this_src)){
$file=fopen($this_src,"r");
while(!feof($file))
{
$statment = fgets($file);
if(custom_strEmpty($statment)){
continue ;
}else if(preg_match('/\/\/\/import\s+([^;]+);?/ies', $statment,$r)){
echo "document.write('<script charset=utf-8 src=\"".Config::$projroot . Config::$src_PATH.$r[1].".js\"></script>');";
}else{
break;
}
}
fclose($file);
}
//加载与用例同名的原文件,并避免重复加载
if($flag_ownSrc){
echo "document.write('<script charset=utf-8 src=\"".$this_src."\"></script>');";
}
}
importSrc();
\ No newline at end of file
This diff is collapsed.
/**
* Created with JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-17
* Time: 上午2:24
* To change this template use File | Settings | File Templates.
*/
/**
* rewrite jasmine function to support batchrun
*/
(function() {
if (!jasmine)
return;
var s = jasmine.Queue.prototype.start
// ,n = jasmine.Queue.prototype.next_
,f = jasmine.Runner.prototype.finishCallback;
function _f(self,args /* failures, total */) {
//todo 写到调用HtmlReporter后
/*another way to apply:
*
* var reporterView = self.env.reporter.subReporters_[0].getReporterView();
*totalSpecCount,completeSpecCount,failedCount,passedCount
*reporterView.views.specs[0].detail
* */
var totalSpecCount = 0,failedCount = 0,passedCount = 0;
var tmpSpec = null;
for(var i=0;i<self.suites_.length;i++){
for(var j=0;j<self.suites_[i].specs_.length;j++){
totalSpecCount++;
tmpSpec = self.suites_[i].specs_[j].results_.items_;
for(var k=0;k<tmpSpec.length;k++){
if(tmpSpec[k].passed_){
passedCount++;
}else{
failedCount++;
}
}
}
}
//display failed Suite
// $('li.fail ol').toggle();
if (parent && parent.brtest) {
parent.brtest.customTrigger('done', [ new Date().getTime(), {
failed : failedCount,
passed : passedCount,
detail : self.suites_,
total : totalSpecCount
//todo jscoverage
}, window._$jscoverage || null ]);
}
}
jasmine.Runner.prototype.finishCallback = function(){
f.apply(this, arguments);
_f(this,arguments);
};
jasmine.Queue.prototype.start =function(){
//todo
/* wait for import.php return */
// var h = setInterval(function() {
// if (window && window['baidu']) {
// clearInterval(h);
s.apply(this, arguments);
// }
// }, 20);
};
// function _n(self,args /* failures, total */) {
/* // do not delete the following lines:
// the last Queue in the file has done ,there is no more Suite or Queue
if(self.index == self.blocks.length || (this.abort && !this.ensured[self.index])){
}
*/
// }
// jasmine.Queue.prototype.next_ = function() {
// _n(this,arguments);
// n.apply(this, arguments);
// };
})();
\ No newline at end of file
/**
* Created with JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-11
* Time: 下午6:52
* To change this template use File | Settings | File Templates.
*/
/**
* 为批量运行提供入口,参数携带batchrun=true
*/
function run(kiss,runnext) {
window.document.title = kiss;
var wb = window.brtest = window.brtest || {};
triggerEvent.call(wb);
wb.timeout = wb.timeout || 60000;
wb.breakOnError = /breakonerror=true/gi.test(location.search)
|| document.getElementById('id_control_breakonerror').checked;
wb.runnext = /batchrun=true/gi.test(location.search) || runnext
|| document.getElementById('id_control_runnext').checked;
wb.kiss = kiss;
var cid = 'id_case_' + kiss.split('.').join('_');
/* 只有参数有showsrconly的时候才显示div */
if (/showsrconly=true/gi.test(location.search)) {
var div = document.getElementById('id_showSrcOnly');
div.style.display = 'block';
}
/* id中由于嵌入用例名称,可能存在导致通过id直接$无法正确获取元素的情况 */
wb.kissnode = document.getElementById(cid);
wb.kisses = wb.kisses || {};
// 把没有用例的情况加入到报告中
if (!wb.kisslost) {
var as = document.getElementById('id_showSrcOnly').getElementsByTagName('a');
for (var i = 0; i < as.length; i++) {
wb.kisses[this.title] = '0;0;_;0;0';
}
wb.kisslost = true;
}
wb.kisscov = wb.kisscov || {};
var wbkiss = wb.kisses[wb.kiss] = wb.kisses[wb.kiss] || '';
/**
* 超时处理
*/
var toh = setTimeout(function () {
if (!window.brtest.breakOnError)
wb.customTrigger('done', [ new Date().getTime(), {
failed: 1,
passed: 1,
detail: null,
total: 0
}, frames[0].$_jscoverage, 'timeout' ]);
}, wb.timeout);
/**
* 为当前用例绑定一个一次性事件
*/
wb.customOne('done', function (time, result, covinfo) {
clearTimeout(toh);
var wb = window.brtest, errornum = result.failed, allnum = result.total;
wb.kissend = new Date().getTime();
//todo jscoverage
// if ( covinfo !== null )// 如果支持覆盖率
// {
// wb.kisscov[wb.kiss] = covinfo;
// }
removeClass(wb.kissnode, 'running_case');
wb.kisses[wb.kiss] = errornum + ';' + allnum + ';_;' + wb.kissstart + ';' + wb.kissend;
//todo log
// var args = kiss + ': 失败/所有:' + errornum + '/' + allnum + ',耗时:' + (wb.kissend - wb.kissstart);
// var html = upath + '../br/log.php?loginfo=' + args;
// html += '&detail='+result.detail;
// if ( errornum > 0 )
// html += '&fail=true';
if (errornum > 0) {
addClass(wb.kissnode, 'fail_case');
} else
addClass(wb.kissnode, 'pass_case');
if (wb.runnext && (!wb.breakOnError || parseInt(wb.kisses[wb.kiss].split(',')[0]) == 0)) {
var nextA = wb.kissnode.nextSibling;
if (nextA.tagName.toLowerCase() == 'a') {
if (wb.kisses[nextA.title] === undefined) {
run(nextA.title, wb.runnext);
}
// html += "&next=" + nextA.title;
} else {
//
// /* ending 提交数据到后台 */
// html += '&next=@_@end';
wb.kisses['config'] = location.search.substring(1);
var url = 'report.php';
//todo jscoverage
// covcalc();
// /**
// * 启动时间,结束时间,校验点失败数,校验点总数
// */
$.ajax({
url: url,
type: 'post',
data: wb.kisses,
success: function (msg) {
/* 展示报告区 */
// $('#id_reportarea').show().html(msg);
},
error: function (xhr, msg) {
alert('fail' + msg);
}
});
}
}
//todo log
// te.log( html );
});
/**
* 初始化执行区并通过嵌入iframe启动用例执行
*/
var url = 'run.php?case=' + kiss + '&time=' + new Date().getTime() + "&"
+ location.search.substring(1);
var fdiv = 'id_div_frame_' + kiss.split('.').join('_');
var fid = 'id_frame_' + kiss.split('.').join('_');
addClass(wb.kissnode, 'running_case');
/* 隐藏报告区 */
// $( 'div#id_reportarea' ).empty().hide();
/* 展示执行区 */
var runningarea = document.getElementById('id_runningarea');
empty(runningarea).style.display = 'block';
var iframe = document.createElement('iframe');
iframe.id = fid;
iframe.src = url;
addClass(iframe, "runningframe");
runningarea.appendChild(iframe);
wb.kissstart = new Date().getTime();
};
// 需要根据一次批量执行整合所有文件的覆盖率情况
//function covcalc() {
// function covmerge(cc, covinfo) {
// for (var key in covinfo) {//key :每个文件
// for (var idx in covinfo[key]) {
// if (idx != 'source') {
//
// cc[key] = cc[key] || [];
// cc[key][idx] = (cc[key][idx] || 0) + covinfo[key][idx];
// }
// }
// }
// return cc;
// }
//
// var cc = {};
// var brkisses = window.brtest.kisses;
// for (var key in window.brtest.kisscov) {
// covmerge(cc, window.brtest.kisscov[key]);//key:每个用例
//// brkisses[kiss]= brkisses[kiss] + ',' + key;
// }
// var file;
// var files = [];
// var filter = '';
// var ls = location.search.split('&');
// for (var i = 0; i < ls.length; i++) {
// if (ls[i].indexOf('filter') != -1) {
// filter = ls[i].split('=')[1];
// }
//
// }
// for (file in cc) {
// if (!cc.hasOwnProperty(file)) {
// continue;
// }
// if (file.indexOf(filter) != -1)
// files.push(file);
// }
// files.sort();
// for (var f = 0; f < files.length; f++) {
// file = files[f];
// var lineNumber;
// var num_statements = 0;
// var num_executed = 0;
// var missing = [];
// var fileCC = cc[file];
// var length = fileCC.length;
// var currentConditionalEnd = 0;
// var conditionals = null;
//
// if (fileCC.conditionals) {
// conditionals = fileCC.conditionals;
// }
// var recordCovForBrowser = null;//
// for (lineNumber = 0; lineNumber < length; lineNumber++) {
// var n = fileCC[lineNumber];
//
// if (lineNumber === currentConditionalEnd) {
// currentConditionalEnd = 0;
// } else if (currentConditionalEnd === 0 && conditionals
// && conditionals[lineNumber]) {
// currentConditionalEnd = conditionals[lineNumber];
// }
//
// if (currentConditionalEnd !== 0) {
// (recordCovForBrowser == null) ? (recordCovForBrowser = '2') : (recordCovForBrowser += ',2');
//
// continue;
// }
//
// if (n === undefined || n === null) {
// (recordCovForBrowser == null) ? (recordCovForBrowser = '2') : (recordCovForBrowser += ',2');
// continue;
// }
//
// if (n === 0) {
// (recordCovForBrowser == null) ? (recordCovForBrowser = '0') : (recordCovForBrowser += ',0');
// missing.push(lineNumber);
// } else {
// (recordCovForBrowser == null) ? (recordCovForBrowser = '1') : (recordCovForBrowser += ',1');
// num_executed++;
// }
// num_statements++;
// }
//
// var percentage = (num_statements === 0 ? 0 : ( 100 * num_executed / num_statements ).toFixed(1));
// var kiss = file.replace('.js', '');
// // 统计所有用例的覆盖率信息和测试结果
//
// if (brkisses[kiss] == undefined)
// brkisses[kiss] = '0;0;_;0;0';
// var info = brkisses[kiss].split(';_;');// 覆盖率的处理在最后环节加入到用例的测试结果中
// brkisses[kiss] = info[0] + ';' + percentage + ';' + info[1] + ';' + recordCovForBrowser;
// }
//}
window.onload =
function () {
if (location.href.search("[?&,]batchrun=true") > 0
|| document.getElementById('id_control_runnext').checked) {
run(document.getElementById('id_testlist').getElementsByTagName('a')[0].getAttribute('title'), true);
}
};
\ No newline at end of file
/**
* Created with JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-11
* Time: 下午5:34
* To change this template use File | Settings | File Templates.
*/
function hasClass(obj, cls) {
return obj.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
}
function addClass(ele,cls) {
if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(obj, cls) {
var clsArray= cls.split( " ");
for(var i=0;i<clsArray.length;i++){
if (hasClass(obj, clsArray[i])) {
var reg = new RegExp('(\\s|^)' + clsArray[i] + '(\\s|$)');
obj.className = obj.className.replace(reg, ' ');
}
}
}
function empty(obj){
var childs = obj.childNodes;
if(childs.length==0)return obj;
for(var i=0;i<childs.length;i++){
obj.removeChild(childs[i]);
}
return obj
}
function slideToggle(obj){
//todo 先写个大意,待完成
if(obj.style.display=='none'){
}else{
obj.style.display='block';
}
}
var triggerEvent = function () {
this.listeners = [];
this.customOne = function (type, listener) {
this.listeners[type] = listener;
for (var i = 0, l = this.listeners.length; i < l; i++) {
if (this.listeners[i] === this.listeners[type]) {
this.listeners.splice(i, 1);
i--;
}
}
},
this.customTrigger = function (type,arguments) {
if(this.listeners[type]){
return this.listeners[type].apply(this, arguments);
}
return false;
}
};
@echo off
jscoverage.exe --encoding=UTF-8 ../../../src ../../coverage
\ No newline at end of file
Copyright (c) 2008-2011 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This diff is collapsed.
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
#HTMLReporter a { text-decoration: none; }
#HTMLReporter a:hover { text-decoration: underline; }
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
#HTMLReporter .version { color: #aaaaaa; }
#HTMLReporter .banner { margin-top: 14px; }
#HTMLReporter .duration { color: #aaaaaa; float: right; }
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
#HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
#HTMLReporter .runningAlert { background-color: #666666; }
#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
#HTMLReporter .passingAlert { background-color: #a6b779; }
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
#HTMLReporter .failingAlert { background-color: #cf867e; }
#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
#HTMLReporter .results { margin-top: 14px; }
#HTMLReporter #details { display: none; }
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter.showDetails .summary { display: none; }
#HTMLReporter.showDetails #details { display: block; }
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter .summary { margin-top: 14px; }
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
#HTMLReporter .description + .suite { margin-top: 0; }
#HTMLReporter .suite { margin-top: 14px; }
#HTMLReporter .suite a { color: #333333; }
#HTMLReporter #details .specDetail { margin-bottom: 28px; }
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
#HTMLReporter .resultMessage span.result { display: block; }
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
#TrivialReporter a:visited, #TrivialReporter a { color: #303; }
#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
#TrivialReporter .runner.running { background-color: yellow; }
#TrivialReporter .options { text-align: right; font-size: .8em; }
#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
#TrivialReporter .suite .suite { margin: 5px; }
#TrivialReporter .suite.passed { background-color: #dfd; }
#TrivialReporter .suite.failed { background-color: #fdd; }
#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
#TrivialReporter .spec.skipped { background-color: #bbb; }
#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
#TrivialReporter .passed { background-color: #cfc; display: none; }
#TrivialReporter .failed { background-color: #fbb; }
#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
#TrivialReporter .resultMessage .mismatch { color: black; }
#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
#TrivialReporter #jasmine_content { position: fixed; right: 100%; }
#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }
This diff is collapsed.
<?php
/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-11
* Time: 下午5:17
* To change this template use File | Settings | File Templates.
*/
header( "Content-type: text/html; charset=utf-8" );
$filter = array_key_exists( 'filter' , $_GET ) ? $_GET[ 'filter' ] : '*';
$quirk = array_key_exists( 'quirk' , $_GET );
$cov = array_key_exists( 'cov' , $_GET );
if ( !$quirk ) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php } ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Kity Test Index Page</title>
<script type="text/javascript" src="js/tools.js"></script>
<!-- <script type="text/javascript" src="js/UserAction.js"></script>-->
<script type="text/javascript" src="js/run.js"></script>
<link media="screen" href="css/test.css" type="text/css"
rel="stylesheet"/>
</head>
<body>
<div id="title">
<h1>Kity Test Index Page</h1>
</div>
<!--浏览器插件,可调用windows api-->
<div>
<object id="plugin" type="application/x-plugintest" width="1" height="1">
<param name="onload" value="pluginLoaded"/>
</object>
</div>
<div id="id_control" class="control">
<input id="id_control_runnext" type="checkbox"/>自动下一个
<input id="id_control_breakonerror" type="checkbox"/>出错时终止
<input id="id_control_clearstatus" type="button" value="清除用例状态"
onclick="removeClass(document.getElementById('id_testlist'),'running_case pass_case fail_case');"/>
</div>
<div>
<a id="id_testlist_status" class="button"> <span
onclick="slideToggle(document.getElementById('id_testlist');"> 折叠用例 </span> </a>
<a id="id_srconly" class="button"><span
onclick="slideToggle(document.getElementById('id_runningarea');">折叠执行</span> </a>
</div>
<div style="clear: both"></div>
<div id="id_testlist" class="testlist">
<?php
/*分析所有源码与测试代码js文件一一对应的文件并追加到当前列表中*/
require_once "caseSource.php";
Kiss::listcase( $filter ,$cov);
?>
<div style="clear: both; overflow: hidden"></div>
</div>
<div id="id_runningarea" class="runningarea"
style="border: solid; display: none"></div>
<div id="id_reportarea" class="reportarea" style="display: none;"></div>
<div class='clear'></div>
<div id="id_showSrcOnly" class="testlist" style="display: none;">
<?php
require_once "caseSource.php";
Kiss::listSrcOnly( true );
?>
<div class="clear"></div>
</div>
</body>
</html>
\ No newline at end of file
<?php
/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-17
* Time: 下午6:28
* To change this template use File | Settings | File Templates.
*/
error_reporting(E_ERROR|E_WARNING);
function report()
{
return;
}
report();
\ No newline at end of file
<?php
/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 13-10-10
* Time: 上午1:17
* To change this template use File | Settings | File Templates.
*/
header( "Content-type: text/html; charset=utf-8" );
header( "Cache-Control: no-cache, max-age=10, must-revalidate" );
if ( !array_key_exists( 'quirk' , $_GET ) ) {
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
}
;
require_once "caseSource.php";
$c = new Kiss( $_GET[ 'case' ] );
$title = $c->name;
$cov = array_key_exists( 'cov' , $_GET );
?>
<html>
<head>
<title>Jasmine Spec Runner</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.3.0/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.0/jasmine.css">
<script type="text/javascript" src="lib/jasmine-1.3.0/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.3.0/jasmine-html.js"></script>
<script type="text/javascript" src="js/ext_jasmine.js"></script>
<?php $c->print_js($cov); ?>
</head>
<script type="text/javascript">
//todo
// if (parent && parent.brtest) {
// parent.$(parent.brtest).trigger('done', [ new Date().getTime(), {
// failed : args[0],
// passed : args[1],
// detail:args[2]
// }, window._$jscoverage || null ]);
// }
(function() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};
var currentWindowOnload = window.onload;
window.onload = function() {
if (currentWindowOnload) {
currentWindowOnload();
}
execJasmine();
};
function execJasmine() {
jasmineEnv.execute();
}
})();
</script>
<body>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment