Skip to content

Instantly share code, notes, and snippets.

@taichi
taichi / Database_testing.md
Created October 4, 2012 15:35
データベースを使った自動テストについて

データベースを使った自動テストについて

データベースを使った機能テストや単体テストについて要点をまとめておきます。

筆者の経験を強く反映していますので比較的定性的な内容となります事を予めご了承下さい。

テストデータを保守する

テストの実行前に投入するテストデータは、凡そcsvファイルやxmlファイル、エクセルファイル等で管理する事になります。
仕様の変更に伴いテーブルの定義を変更する事で、それらのファイルの内容とデータベースの間に不整合が発生します。

@mala
mala / jquery_xss_patch.js
Created April 26, 2012 13:23
jQuery XSS patch
(function(){
jQuery.fn.__init = jQuery.fn.init;
var old_expr = /^(?:[^<]*(<[\w\W]+>)[^>]*$)/;
var strict_expr = /^\s*</;
jQuery.fn.init = function(selector, context, rootjQuery){
if (typeof selector === "string") {
// console.log(selector);
if (old_expr.test(selector) && !strict_expr.test(selector)) {
throw 'Syntax error, html string must start with "<"';
}
@peterhost
peterhost / node_debian_init.sh
Created November 25, 2010 11:41
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28