0.0.74 • Published 7 months ago

@spartez-software/azure-test v0.0.74

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
7 months ago

azure-tests (Beta)

Helper lib - azure integration tests

prerequisites

  • ability to run tests using jest

installation

npm install @spartez-software/azure-test --save-dev

setup

  • go get yourself an Azure devOps instance
  • setup .env
TEST_AZURE_URL=https://dev.azure.com/your-azure-site-name
TEST_AZURE_USER_TOKEN=pst! it is a secret pat, it belongs to the user that we use to make changes in Azure!

usage (jest/typescript example)

import { step } from '@spartez-software/test-utils';
import { TeamProjectReference } from 'azure-devops-node-api/interfaces/CoreInterfaces';
import { WorkItem } from 'azure-devops-node-api/interfaces/WorkItemTrackingInterfaces';
import { AzureDevOps } from '@spartez-software/azure-test/AzureDevOps';

describe('azure tests', () => {
    const azureDevOps = AzureDevOps.fromEnv();
    let teamProjectReference: TeamProjectReference;

    jest.retryTimes(5);
    jest.setTimeout(240000);

    beforeEach(async () => {
        await step('Create azure Project', async () => {
            teamProjectReference = await azureDevOps.createProject();
            expect(teamProjectReference).toBeDefined();
        });
    });

    it('should create and destroy project', async () => {
        const projectId = String(teamProjectReference.id);
        const workItemTrackingApi = await azureDevOps.connection.getWorkItemTrackingApi();
        const json = [{
            op: 'add',
            path: '/fields/System.Title',
            from: null,
            value: 'Sample task',
        }];

        let wi: WorkItem;
        await step('Create work item', async () => {
            wi = await workItemTrackingApi.createWorkItem({}, json, projectId, 'Task');
            expect(wi).toBeDefined();
        });

        await step('Verify workitem exists', async () => {
            const workItem = await workItemTrackingApi.getWorkItem(wi.id as number);
            expect(workItem).toBeDefined();
        });
    });

    afterEach(async () => {
        await step('Delete azure project', async () => {
            if (teamProjectReference.id) {
                await azureDevOps.deleteProject(teamProjectReference.id);
            }
        });
    });
});

pitfalls

  • Azure DevOps can take a long time to create a project, set up timeouts accordingly.
  • Large number of project, even deleted ones, make the create project time even longer.
0.0.74

7 months ago

0.0.73

11 months ago

0.0.72

1 year ago

0.0.71

2 years ago

0.0.70

2 years ago

0.0.68

3 years ago

0.0.69

3 years ago

0.0.67

3 years ago

0.0.66

3 years ago

0.0.64

3 years ago

0.0.65

3 years ago

0.0.62

4 years ago

0.0.63

4 years ago

0.0.61

4 years ago

0.0.60

4 years ago

0.0.59

4 years ago

0.0.57

4 years ago

0.0.58

4 years ago

0.0.56

4 years ago

0.0.55

4 years ago

0.0.53

4 years ago

0.0.54

4 years ago

0.0.52

4 years ago

0.0.51

4 years ago

0.0.50

4 years ago

0.0.49

4 years ago

0.0.48

4 years ago

0.0.47

4 years ago

0.0.46

4 years ago

0.0.45

4 years ago

0.0.44

4 years ago

0.0.43

4 years ago

0.0.41

4 years ago

0.0.42

4 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.37

4 years ago

0.0.38

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.33

4 years ago

0.0.34

4 years ago

0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago