Javascript and Quality Assurance Engineer

►►unittesting

    objective:unittest can make the result of code clear to developer

    assertlibrary:mak sure the least unit way of normally running

    teststyle: TDD(Test Driven Development) && BDD(Behavior-DrivenDevelopment)


    ►►unitframework

        better-assert(TDDassert library)

        should.js(BDD)

        expect.js(BDD)

        chai.js(TDD&& BDD)

        Jasmine(BDD)

        node.jsitintegrate require(‘assert’)

        Intern(bigan complete unit test framework)

        Qunit(like jquery)

        Macaca(fromalibaba)

    

    ►►unit test procedure of running

        

    

    ►►automatedunit test

            karmaautomated runner integrate PhontomJs not refresh.

             Npm install -g karma

            npm install karma-cli –save-dev

            npm install karma-chrome-launcher –save-dev

            npm install karma-phantomjs-lancher –save-dev

            npm install karma-mocha –save-dev

            npm install karma-chai –save-dev

    

    ►►displaythe report of unit test Coverage rate

            npm install karma-coverage –save-dev

            coverageReport:{type:’html’,dir:‘coverage’}//setup result of code coverage rate

►►e2etesting

        Selenium-webdriver(Seleniumis a browser automation library. Most often used for testingweb-applications, Selenium may be         used for any task that requiresautomating interaction with the browser.)

                 npm install selenium-webdriver
            

           Usage(rememberthe download the driver Browser)

                The sample below and others are included in the example directory. Youmay also find the tests for selenium-webdriver             informative.

        const{Builder, By, Key, until} = require('selenium-webdriver');

            (asyncfunction example() {

                letdriver = await new Builder().forBrowser('firefox').build();

                try {

                    awaitdriver.get('http://www.google.com/ncr');

                    awaitdriver.findElement(By.name('q'));.sendKeys('webdriver',Key.RETURN);

                    await driver.wait(until.titleIs('webdriver - Google Search'), 1000);

                }finally {

                    await driver.quit();

                }

            })();

►►UI Testing

        npminstall -g backstopjs

        backstopinit

        backstoptest


►►performanceTesting

        benchmark(https://github.com/bestiejs/benchmark.js)

            ps:robust benchmarkinglibrary that supports high-resolution timers & returnsstatistically significant results. As seen                     on jsPerf.

        Usage:npm i --save benchmark


►►serverTesting

        npm install supertest –save-dev

        npm install mocha

        npm install mochawesome(thisis graphic componet base on mocha )


►►e2eTesting(baseon rize)

 npm install --save-dev puppeteer rize


►►f2etest















猜你喜欢

转载自blog.csdn.net/sunrunning/article/details/80171954