當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript mock-test.MockTestRunner類代碼示例

本文整理匯總了TypeScript中vsts-task-lib/mock-test.MockTestRunner的典型用法代碼示例。如果您正苦於以下問題:TypeScript MockTestRunner類的具體用法?TypeScript MockTestRunner怎麽用?TypeScript MockTestRunner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MockTestRunner類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

    it('roots patterns', (done: MochaDone) => {
        this.timeout(1000);

        let testPath = path.join(__dirname, 'L0rootsPatterns.js');
        let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath);
        runner.run();

        assert(
            runner.succeeded,
            'should have succeeded');
        assert(
            runner.stdOutContained(`copying ${path.normalize('/srcDir/someOtherDir/file1.file')} to ${path.normalize('/destDir/someOtherDir/file1.file')}`),
            'should have copied file1');
        assert(
            runner.stdOutContained(`copying ${path.normalize('/srcDir/someOtherDir/file2.file')} to ${path.normalize('/destDir/someOtherDir/file2.file')}`),
            'should have copied file2');
        assert(
            runner.stdOutContained(`copying ${path.normalize('/srcDir/someOtherDir2/file2.file')} to ${path.normalize('/destDir/someOtherDir2/file2.file')}`),
            'should have copied file1');
        done();
    });
開發者ID:DarqueWarrior,項目名稱:vsts-tasks,代碼行數:21,代碼來源:L0.ts

示例2: it

    it('run gradle with all default inputs', (done) => {
        let tp: string = path.join(__dirname, 'L0AllDefaultInputs.js');
        let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

        try {
            tr.run();

            assert(tr.ran(gradleWrapper + ' build'), 'it should have run gradlew build');
            assert(tr.invokedToolCount === 1, 'should have only run gradle 1 time');
            assert(tr.stderr.length === 0, 'should not have written to stderr');
            assert(tr.succeeded, 'task should have succeeded');
            assert(tr.stdout.indexOf('GRADLE_OPTS is now set to -Xmx2048m') > 0);

            done();
        } catch (err) {
            console.log(tr.stdout);
            console.log(tr.stderr);
            console.log(err);
            done(err);
        }
    });
開發者ID:DarqueWarrior,項目名稱:vsts-tasks,代碼行數:21,代碼來源:L0.ts

示例3: it

    it('Positive path: upload Calabash test with service endpoint', function () {
        this.timeout(4000);

        let tp = path.join(__dirname, 'L0CalabashPass.js');
        let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

        tr.run();
        assert(tr.succeeded, 'task should have succeeded');
        assert(tr.invokedToolCount === 2, 'Should have run test prepare and test run');
        assert(tr.ran("/path/to/appcenter test prepare calabash --artifacts-dir " +
            "/path/to/artifactsDir --app-path /test/path/to/my.ipa --project-dir " +
            "/path/to/project --sign-info SignInfo --config-path /path/to/configfile " +
            "--profile myProfile --quiet"),
            "Should have run prepare");

        assert(tr.ran("/path/to/appcenter test run manifest " +
            "--manifest-path /path/to/artifactsDir/manifest.json --app-path /test/path/to/my.ipa " +
            "--app testuser/testapp --devices 1234abcd --test-series master --dsym-dir /path/to/dsym " +
            "--async --locale nl_NL --myRunOpts abc --quiet --token mytoken123"),
            "Should have run test run");
    });
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:21,代碼來源:L0.ts

示例4: it

    it('Should have the correct url if the job is under folder', (done) => {
        const tp: string = path.join(__dirname, 'L0FolderJobShouldHaveCorrectUrl.js');
        const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

        try {
            tr.run();

            let expectedMessage: string = "Found Jenkins job details jobName:folder1/folder2/testmultibranchproject, jobType:org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject, buildId:20, IsMultiBranchPipeline:true, MultiBranchPipelineName:master";
            assert(tr.stdout.indexOf(expectedMessage) != -1, "Should correctly find the Latest job is inside a folder");

            let buildIndexApi: string = "http://url/job/folder1/job/folder2/job/testmultibranchproject//job/master/20/api/json?tree=number,result,actions[remoteUrls],changeSet[kind,items[commitId,date,msg,author[fullName]]]";
            assert(tr.stdout.indexOf(buildIndexApi) != -1, "Url for folder job should be correct");

            done();
        } catch(err) {
            console.log(tr.stdout);
            console.log(tr.stderr);
            console.log(err);
            done(err);
        }
    });
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:21,代碼來源:L0.ts

示例5: it

        it('Downloads packer for linux agent if packer of lower version exists', (done:MochaDone) => {
            process.env["__packer_exists__"] = "true";
            process.env["__lower_version__"] = "true";

            let tp = path.join(__dirname, 'L0LinuxInstallPacker.js');
            let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
            tr.run();
            process.env["__packer_exists__"] = "false";
            process.env["__lower_version__"] = "false";

            assert(tr.invokedToolCount == 4, 'should have invoked tool four times. actual: ' + tr.invokedToolCount);
            assert(tr.stderr.length == 0 || tr.errorIssues.length, 'should not have written to stderr');
            assert(tr.succeeded, 'task should have succeeded');
            assert(tr.stdout.indexOf("loc_mock_DownloadingPackerRequired") != -1, "should show message that packer will be downloaded");
            assert(tr.stdout.indexOf("Downloading packer from url: https://releases.hashicorp.com/packer/0.12.3/packer_0.12.3_linux_amd64.zip") != -1, "should download from correct url");
            assert(tr.stdout.indexOf("downloading from url https://releases.hashicorp.com/packer/0.12.3/packer_0.12.3_linux_amd64.zip to /tmp/tempdir/100/packer.zip") != -1, "should download to correct staging dir");
            assert(tr.stdout.indexOf("extracting from zip /tmp/tempdir/100/packer.zip to /tmp/tempdir/100/packer") != -1, "should extract from and to correct path");
            assert(tr.stdout.indexOf("Packer path to be used by task: /tmp/tempdir/100/packer/packer") != -1, "should show message that packer will be downloaded");
            assert(tr.stdout.indexOf("##vso[task.setvariable variable=imageUri;issecret=false;]https://bishalpackerimages.blob.core.windows.net/system/Microsoft.Compute/Images/packer/packer-osDisk.e2e08a75-2d73-49ad-97c2-77f8070b65f5.vhd") != -1, "image uri output variable not set");
            done();
        });
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:21,代碼來源:L0.ts

示例6: it

    it('Run successfully when the user provides the version for kubectl with checkLatest as true', (done:MochaDone) => {
        let tp = path.join(__dirname, 'TestSetup.js');
        let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
        process.env[shared.TestEnvVars.command] = shared.Commands.get;
        process.env[shared.TestEnvVars.arguments] = "pods";    
        process.env[shared.TestEnvVars.versionOrLocation] = "version";
        process.env[shared.TestEnvVars.versionSpec] = "1.5.0";
        process.env[shared.TestEnvVars.checkLatest] = "true";
        process.env[shared.isKubectlPresentOnMachine] = "false";
        tr.run();

        assert(tr.invokedToolCount == 1, 'should have invoked tool one times. actual: ' + tr.invokedToolCount);
        assert(tr.stderr.length == 0 || tr.errorIssues.length, 'should not have written to stderr');
        assert(tr.succeeded, 'task should have succeeded');
        assert(tr.stdout.indexOf(`Get stable kubectl version`) != -1, "Stable version of kubectl is downloaded");
        assert(tr.stdout.indexOf(`Got kubectl version v1.6.6`) != -1, "Got the latest version of kubectl");
        assert(tr.stdout.indexOf(`Downloaded kubectl version v1.6.6`) != -1, "Downloaded correct version of kubectl");
        assert(tr.stdout.indexOf(`[command]${shared.formatPath("newUserDir/kubectl.exe")} get pods -o json`) != -1, "kubectl get should run");
        console.log(tr.stderr);
        done();
    });
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:21,代碼來源:L0.ts


注:本文中的vsts-task-lib/mock-test.MockTestRunner類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。