Javascript测试框架Jasmine(三):Setup、Teardown、嵌套describe等

测试报告会自动追加到页尾

describe("测试嵌套describe:level1", function() {
    var foo;

    beforeEach(function() {
        alert('level1:Setup');
    });

    afterEach(function() {
        alert('level1:Teardown');
    });

    it("level1:测试", function() {
        alert('level1:测试');
    });

    describe("测试嵌套describe:level2", function() {
        beforeEach(function() {
            alert('level2:Setup');
        });

        afterEach(function() {
            alert('level2:Teardown');
        });

        it("level2:测试", function() {
            alert('level2:测试');
        });
    });
});