2
votes

Following this Microsoft tutorial (Run unit tests with your builds), I was expecting to be able to run my unit-tests automatically when a build is triggered, such as a Pull request.

However, when I look in the Pipeline / Builds tab and try to edit my pipeline, there is nothing that allows me to add a new task (see screenshot below). enter image description here

However, there doesn't appear to be any way of adding a task. I can't even switch to the YMAL without navigating to the source via the Repo. I was hoping to use the GUI though as my YMAL is non-existent.

I have created a test solution with the following structure, which is held in the repo:

Core Solution
    |_ Class Library Project (.NET Core)
    |_ MSTest Test Project (.NET Core)

I was hoping to have a build step followed by a Unit Test step using the tests in my MSTest Test Project (.NET Core) project once they were built.

There appears to be a Tasks option in the Releases tab by the way, but I was expecting to be able to add tasks for builds as well, especially Unit Tests.

Being new at this, perhaps I have missed or misunderstood something. I would be grateful for any help and to be pointed in the right direction.

2

2 Answers

3
votes

It seems that there is an obscure link that takes you through to the correct process, found it quite by accident, see screenshot below:

Choose the **Use the visual designer** option

It turns out that there is a little link titled Use the visual designer that I'd missed. Seems a little odd that most of the tutorials discuss this process and yet it's partially obscured. I guess that this shows that the platform is a work in process and still being added to and improved.

Another few caveats for those descending this little rabbit hole, after selecting the Use the visual designer link, be sure to select the Empty pipeline template, or whatever is appropriate to your project/solution type, and not the YAML option at the top of the list, otherwise you'll be back where you started.

Select the **Empty pipeline** template

Finally, it seems that automated Unit Tests don't work on Agents other than Hosted VS2017 Agents (that said, I haven't tried the Hosted option). This is set in the very next screen by selecting the Pipeline and selecting the Agent pool from the drop-down.

One last thing... The pipeline won't run automatically unless you check the Enable continuous integration checkbox on the Triggers tab.

Once this is all done, I simply chose the tasks needed for the build by clicking the plus symbol on the Agent job 1 item.

Good luck

Kaine

2
votes

You have created a new YAML style of build configuration. Currently Azure DevOps does not support of having YAML & GUI editor at the same time (this is upcoming feature in Q1/2019).

To get a GUI editor, create new build pipeline.

In this selection click "Use the visual designer".

enter image description here

Then at template phase, don't select YAML. Any other template will do. You can easily delete all the build steps after selecting template, so don't be afraid to choose any. enter image description here