Professional Documents
Culture Documents
APPR6312MM
APPR6312MM
APPLIED PROGRAMMING
MODULE MANUAL 2023
(First Edition: 2020)
This manual enjoys copyright under the Berne Convention. In terms of the Copyright
Act, no 98 of 1978, no part of this manual may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying, recording or
by any other information storage and retrieval system without permission in writing
from the proprietor.
Student Portal
The full-service Student Portal provides you with access to your academic
administrative information, including:
• an online calendar,
• timetable,
• academic results,
• module content,
• financial account, and so much more!
When you log into the Student Portal, the ‘Module Information’ page displays the
‘Module Purpose’ and ‘Textbook Information’ including the online ‘Module Guides or
‘Module Manuals’ and assignments for each module for which you are registered.
Supplementary Materials
For certain modules, electronic supplementary material is available to you via the
‘Supplementary Module Material’ link.
The ‘Module Discussion Forum’ may be used by your lecturer to discuss any topics
with you related to any supplementary materials and activities such as ICE, etc.
To view, print and annotate these related PDF documents, download Adobe
Reader at following link below:
www.adobe.com/products/reader.html
The following Library Online Databases are available. These links will prompt you for
a username and password. Use the same username and password as for student
portal. Please contact your librarian if you are unable to access any of these. Here
are links to some of the databases:
Table of Contents
Introduction………………………………………………………………………………….11
This Module at a Glance ......................................................................................... 12
Conventions Used in this Manual ............................................................................ 13
Glossary……………………………………………………………………………………..14
Learning Unit 1: Software Development Methodologies……………………………….17
1 Introduction…………………………………………………………………………….17
1.1.1 Advantages ........................................................................................ 20
1.1.2 Disadvantages ................................................................................... 20
1.2 Rational Unified Process ........................................................................... 20
1.2.1 Advantages ........................................................................................ 21
1.2.2 Disadvantages ................................................................................... 21
1.3 Agile Manifesto ......................................................................................... 21
1.4 Extreme Programming .............................................................................. 23
1.4.1 Advantages ........................................................................................ 24
1.4.2 Disadvantages ................................................................................... 25
1.5 Other Agile Methodologies ........................................................................ 25
2 Scrum…………………………………………………………………………………..26
2.1 Framework, Not a Methodology ................................................................ 26
2.2 Values ....................................................................................................... 27
2.3 Principles .................................................................................................. 27
2.3.1 Empirical Process Control .................................................................. 28
2.3.2 Self-Organisation ............................................................................... 28
2.3.3 Collaboration ...................................................................................... 28
2.3.4 Value-based Prioritisation ................................................................... 28
2.3.5 Time-boxing ....................................................................................... 28
2.3.6 Iterative Development ........................................................................ 29
2.4 Team......................................................................................................... 29
2.4.1 Product Owner ................................................................................... 29
2.4.2 Development Team ............................................................................ 29
2.4.3 Scrum Master ..................................................................................... 29
2.5 Events ....................................................................................................... 30
2.5.1 Sprint Planning ................................................................................... 31
2.5.2 Daily Stand-up/Daily Scrum ............................................................... 31
2.5.3 Sprint Review Meeting ....................................................................... 31
2.5.4 Sprint Retrospective Meeting ............................................................. 31
2.6 Artifacts ..................................................................................................... 32
3 Kanban…………………………………………………………………………………32
3.1 Principles .................................................................................................. 32
3.2 Practices ................................................................................................... 33
3.2.1 Visualise............................................................................................. 33
3.2.2 Make Policies Explicit ......................................................................... 34
3.2.3 Implement Feedback Loops ............................................................... 34
3.2.4 Limit Work-in-Progress (WIP) ............................................................. 34
3.2.5 Improve Collaboratively, Evolve Experimentally ................................. 34
3.2.6 Manage Flow ..................................................................................... 34
Bibliography………………………………………………………………………………..273
Various activities and revision questions are included in the learning units of this
manual. These are designed to help you engage with the subject matter and help you
prepare for your assessments.
Introduction
Software development is an ever-changing field of work. With the advent of cloud
technologies, the software enterprises want to develop changed dramatically, and so
have the tools we use to develop these systems. Increasingly, the tools used by
software developers and testers are also cloud-based.
Microsoft understands this is a real need and has made available a suite of cloud-
based tools known collectively as Microsoft Azure DevOps. In this module, we will
explore how to use the following Microsoft Azure DevOps tools:
All the Microsoft Azure DevOps tools can be used for any software development.
These tools are also not limited to the traditional Microsoft development .NET
development ecosystem. But the tools really shine when used to develop Azure
Cloud applications. In this module, we will learn how to create web applications using
Visual Studio 2022 and deploy these applications to the Azure Cloud – the first
primary cloud provider with data centres in Africa. We will learn about the following
Azure Cloud components:
By the end of this module, you will have all the skills to build, automatically test and
deploy the cloud-based web applications of the future.
You will need to sign up for a student account for Microsoft Azure services. (This is
ideal – only get the free account if the student account process does not work.)
Student accounts can be renewed for a second year if necessary.
Microsoft Azure for Students Starter is also an option, although that won’t include
access to Azure SQL Server. You can make use of MySQL, though, which will still
allow you to do most things in this module (but this module manual will not help you
with how to do that).
If you struggle with both student options, you can still sign up for a free account for
Microsoft Azure services (a credit card is required). If you sign up for the free edition,
note that certain services are only free for 12 months. Remember to disable those
services at the end of the semester to avoid being billed for services you are
not using!
Read more about what is included in the 12-month free period on the Azure free
account FAQ available here: https://azure.microsoft.com/en-us/free/free-account-faq/
For more information about preventing unexpected charges, read this page:
https://docs.microsoft.com/en-us/azure/billing/billing-getting-started
Each learning unit will contain some theory and practical guidelines for how to do the
various tasks. It is highly recommended that you follow along with the steps.
Where you see this icon, you will find a freely available online resource
such as an e-book.
Where you see this icon, there will be information about how the
software development aspects of enterprise systems link up with other
disciplines.
Where you see this icon, there will be an opportunity to think about a
real-world example that links to the theory.
Glossary
Term Definition
Term Definition
Load Tests Load tests “[t]est whether the app can handle a
specified load of users for a certain scenario while
still satisfying the response goal. The app is run
under normal conditions.” (Anderson, et al., 2019b)
Term Definition
Unit Testing Frameworks “[S]oftware tools to support writing and running unit
tests, including a foundation on which to build tests
and the functionality to execute the tests and
report their results.” (Hamill, 2004)
1 Introduction
In this module, you will gain the knowledge and skills to develop enterprise software
systems within the Microsoft Cloud ecosystem effectively. This module builds on the
programming skills that you already have and
focuses on the application of those skills.
Enterprise software systems are large systems that require many people to work together
to make
them a reality. To coordinate the efforts of many people, sometimes across different
teams,
methodologies and tools are needed to keep track of what is happening.
That is the focus of this learning unit.
This section (up to the end of 2.4) is adapted from (The Independent Institute of Education,
2018),
Learning Unit 5.
We will cover the basics of several critical methodologies here, but this is a partial list of all
the
methodologies. The following two sections will examine Scrum and Kanban in detail.
Waterfall
The waterfall methodology was invented in 1970. It was based on the work of Henry Ford
on his car
assembly lines in 1913. (Sacolick, 2018)
In the waterfall methodology, the different phases (see Figure 2) in the software
development lifecycle (SDLC) are followed linearly. Each step must be completed before
moving on to the next one. (Korkishko, 2017) All the requirements are gathered up front and
documented in detail.
Once the specification is set in stone, the software can be designed. And so on.
Waterfall works well with traditional project management, where everything is planned
upfront and tightly managed.
This is the same process used in engineering projects such as bridge construction. (Roseke,
2012) It is a sensible methodology for a bridge where the requirements are fixed, and you
get only one shot at building the right thing. Getting halfway through making the bridge only
to realise that it won’t be able to carry the required weight is an expensive mistake to fix.
When waterfall was first introduced, software was very different from today's. Things
changed slowly, and the computers and their software were large and complex. (Sacolick,
2018) Today, everything changes rapidly, including requirements.
Even though the waterfall is generally considered outdated, there are still cases where it is
used successfully. Waterfall is a simple and straightforward process for small projects (that
take less than 100 hours of development). (Kuprenko, 2017)
The aerospace and defence industries also still heavily rely on the waterfall process. In this
instance, the motivation behind using the waterfall process is the safety requirements of the
developed software. Imagine, for example, how dire the consequences could be if the
passenger liner's navigation system malfunctioned.
1.1.1 Advantages
1.1.2 Disadvantages
• Waterfall only works if the requirements are well understood up front or are likely to
change. (TatvaSoft, 2015)
• The process needs more flexibility, making it complex and expensive to cope with
changes. (Lvivity, 2018)
• Functional software is only available at the end of the project. (TatvaSoft, 2015)
• The client is not involved in the development and only gets to use the product when
it is complete. (Lvivity, 2018)
In RUP, there are also phases like in Waterfall. Moreover, the four phases (inception,
elaboration, construction and transition) occur in order. But unlike waterfall, this process is
completed in multiple iterations. Each iteration only deals with a part of the more extensive
system, and functional software is delivered at the end of each iteration. (Ambler, 2005)
1.2.1 Advantages
1.2.2 Disadvantages
This section is the odd one among the methodologies since agile is not a software
development methodology. Agile has four values, shown in Figure 4, and 12 principles
(see Figure 5).
However, agile development does not prescribe practices, so it is not a methodology.
(Gratis, 2018)
There are, however, several agile methodologies that all strive to adhere to the values and
principles in their own unique ways. Examples of agile methodologies are:
XP also has its own set of values: “communication, simplicity, feedback, courage, and
respect”.
(Agile Alliance, 2018b)
XP is meant to be used in a small team that works in the same physical office, using a
technology that can have automated unit and functional tests. It is ideal in the situation
where requirements change often.
(Agile Alliance, 2018b)
1.4.1 Advantages
1.4.2 Disadvantages
• Not all people can work in an environment that is so unstructured. (Green, 2016)
• XP requires many face-to-face meetings with the customer, which can be
expensive. (TatvaSoft, 2015)
• The full project scope has yet to be discovered, making it impossible to provide a
price for the whole project. (TatvaSoft, 2015)
Scrumban is used by 9% of respondents, and Kanban by 6%. Only 1% use Lean Start-up.
Before moving on to Scrum and Kanban, it is worthwhile to look at Lean Start-up briefly.
Here is the definition by Eric Ries, creator of Lean Start-up:
“The Lean Start-up provides a scientific approach to creating and managing start-ups and
getting customers a desired product faster. The Lean Start-up method teaches you how to
drive a start-up, steer when to turn and persevere, and grow a business with maximum
acceleration. It is a principled approach to new product development.” (Ries, n.d.)
The focus of Lean Start-up is very much on how to get a product into the market as quickly
as possible. It is designed for start-up companies whose continued existence depends on
getting that product into the market. Lean Start-up is more of an agile business process
than specifically a software development methodology. A convincing argument is made by
(Mantini, 2018) that it is ideal to combine Lean Start-up with the Design Thinking
methodology to define the customer’s problem and agile software development to create
the software.
2 Scrum
2.1 Framework, Not a Methodology
Hirotaka Takeuchi and Ikujiro Nonaka first described the concepts of Scrum in the 1980s.
Ken Schwaber and Jeff Sutherland elaborated on Scrum in the 1990s. (SCRUMstudy,
2017) Here is their definition of Scrum:
Scrum is “[a] framework within which people can address complex adaptive problems
while productively and creatively delivering products of the highest possible value.”
(Schwaber & Sutherland, 2017)
Before we can make sense of the title of this subsection, we need to know what a
methodology is. Here is one definition:
Methodologies are typically very prescriptive. The software must be developed in this way,
and the team must produce the following artefacts, and so on.
In contrast, Scrum was developed from the start to be a framework. It provides basic
guidelines for developing software but needs to be more prescriptive. What Scrum does
prescribe has become more about what needs to be done rather than how to accomplish it
over time. (Verheyen, 2013) This explains why it is possible to use Extreme Programming
(XP) in combination with Scrum – XP provides the how.
2.2 Values
If Scrum is a framework and needs to be more prescriptive, what makes it Scrum? The first
topic to discuss is the set of values on which the framework is based since the principles
of Scrum all tie back to these values. These values should give direction to the actions of
team members. (Verheyen, 2013b)
2.3 Principles
There are six principles that form the core guidelines for applying Scrum. All these principles
are mandatory – if these are not used, it is not Scrum. (SCRUMstudy, 2017)
Empirical process control theory forms the basis of Scrum. This means that we learn from
experience and then make decisions based on what we have learned. There are three main
ideas behind empirical process control: transparency (linked to the value of openness),
inspection (measuring how well things are going), and adaptation (changing what doesn’t
work). (Schwaber & Sutherland, 2017)
In practice, Scrum encourages teams to evaluate processes and change what doesn’t work
regularly.
2.3.2 Self-Organisation
In traditional teams, a manager tells the team working under them what to do. This can work
well in some circumstances, for example, in the military, where the chain of command is
important. However, there are better solutions than this when managing creative problem
solvers such as software developers.
In a self-organising Scrum team, the team members collaborate rather than being told what
to do. There is a servant leader that facilitates the process, which is very different from
traditional management. Such a leader focuses on the team's needs; when those are met,
the team can function well. (Visual Paradigm, n.d.)
2.3.3 Collaboration
Collaboration is about the team working well together to create something more significant
than just the sum of all the work done. It also implies interacting with other stakeholders.
(SCRUMstudy, 2017)
Whatever features will provide the best business value will be implemented first. Risks and
dependencies should also be considered when prioritising items since these affect a
specific feature's value. (SCRUMstudy, 2017)
When we consider the team members later, you will see how this is done.
2.3.5 Time-boxing
Time is an essential constraint in any project, and Scrum recognises this. Activities are time-
boxed, which means there is a limit on the amount of time spent on each activity.
(SCRUMstudy, 2017)
We will look at this concept again when we get to the section on events.
This ties in with value-based prioritisation. If we develop the high-value features first but
don’t deliver them, we might as well be doing waterfall development. Scrum makes use of
iterative development with frequent delivery of usable features. (SCRUMstudy, 2017)
2.4 Team
We have already seen that Scrum teams are self-organising and have servant-leaders. But
there is more to it than that.
The first role defined by Scrum is the Product Owner. This person is responsible for making
sure that the best possible value is achieved for the business. (Schwaber & Sutherland,
2017) Who this is varies from organisation to organisation. However, it is ideally somebody
from the business who understands the needs of the business and has some authority to
make decisions.
The Product Owner prioritises features according to business value – they can decide what
is done first. And a single person (not a group of people) ultimately has the say. They can
be advised by others, but the buck stops at the Product Owner. (Schwaber & Sutherland,
2017)
The development team consists of all the people working towards developing the software.
This group of people is cross-functional – there can be people with a wide variety of skills
working on the same project. (Schwaber & Sutherland, 2017)
Optimal team sizes range from three to nine developers. With smaller teams, there needs
to be more interaction. With more than nine developers, the coordination becomes too
challenging to manage. (Schwaber & Sutherland, 2017)
The scrum master is the servant-leader in the team. They are responsible for helping
everyone (on the team and outside of it) understand the values, practices and rules of
Scrum. The Scrum Master facilitates events as needed, helps the team remove any
obstacles to their progress, and helps the organisation adopt Scrum. (Schwaber &
Sutherland, 2017)
2.5 Events
We have explored many topics around Scrum, but we have yet to learn how it works. That
is where the events come in. Figure 9 shows all the events long before developers even
become involved for the first time.
When the need for a new software system arises, the case typically needs to be made to
management, explaining why money should be spent on this. Once approved, a project
vision statement is often created to describe at a very high level what the project is trying to
achieve.
The first activity that developers may be aware of is the creation of a prioritised product
backlog. The Product Owner puts together a wish list of everything that can be implemented
(as understood at that point) and prioritises the items. This is called the Prioritised Product
Backlog.
In parallel with this, release planning may be done. Big organisations often have set dates
to release new software already, and releases of the new software will need to be planned
accordingly.
After all of that, the first Sprint starts. A sprint is a time-boxed period (typically one month or
less) during which the development team works on a releasable product. The product should
meet the definition of “Done” as agreed between the team and the Product Owner.
(Schwaber & Sutherland, 2017)
The first step in a Sprint is Sprint Planning – a time-boxed meeting (maximum of eight hours)
during which the Sprint Backlog is created. The team works together to determine how
much work from the complete Product Backlog can fit into the Sprint. It is here that the
definition of “Done” is also agreed on.
During the sprint, no changes should be made to the backlog that will endanger the success
of a sprint. (Schwaber & Sutherland, 2017)
During a Sprint, there is a daily meeting called Daily Stand-up (the meeting is short and
usually conducted standing up) or Daily Scrum. This is a 15-minute meeting for everybody
to chat. Every team member typically answers only the following three questions:
(Schwaber & Sutherland, 2017)
These meetings are very useful for collaboration. You may recall that one of the aspects of
collaboration is awareness. It will be hard to collaborate effectively if you do not know what
your fellow team members are doing.
At the end of the Sprint, there are two meetings. The first is the Sprint Review Meeting (time-
boxed to four hours). During this meeting, all the work done is reviewed, and it is determined
whether the “Done” requirement was met. The development team often does a
demonstration during this meeting. (Schwaber & Sutherland, 2017)
This meeting can also discuss Steps for future work, which can serve as input for an
updated Product Backlog. (Schwaber & Sutherland, 2017)
The last meeting during a Sprint is the Sprint Retrospective Meeting. This is where the
empirical process control comes in – this is the inspection to measure how things are going.
It is an aspect of project management where software projects are ahead of many other
types of project, where reflecting on practices are often a very foreign idea.
In this meeting, the team gets together to determine what worked well and what didn’t work.
This can include things related to people, relationships, processes and tools. Improvements
should be suggested for how to fix the things that did not work as well as they could have.
(Schwaber & Sutherland, 2017)
This meeting takes courage, especially to admit if you were doing something that didn’t
work well.
In the next sprint, the process improvements can be implemented. It is highly disruptive to
change too many things simultaneously, so it is recommended to choose the most important
item and only change that single thing.
2.6 Artifacts
We have already come across the concepts of the Product Backlog and Sprint Backlog –
the two most important artifacts in Scrum. So far, we have been intentionally vague about
the nature of items in these backlogs.
The Product Backlog contains user stories. A user story is a requirement written from a
user's perspective that will use the feature once it is developed. (Rehkopf, n.d.) It could be
something like, “As a user, I would like to be able to change my profile picture.”
Sometimes Product Owners also come up with what is called epics. Epics are large stories
that can be broken down into smaller stories. (Rehkopf, n.d.) An example is, “As a user, I
would like to be able to do online shopping.” That could include numerous smaller stories
such as “As a user, I would like to be able to sign up for a new account.”
During a Sprint Planning Meeting, each User Story that forms a part of the Sprint Backlog
needs to be broken down into actionable tasks. (Schwaber & Sutherland, 2017) The tasks
should be roughly half a day’s work in size. Not too small since that creates too much
management overhead. And not too large, since then, tracking progress has become
difficult.
A lot more can be said about Scrum. Have a look at the Recommended Additional Reading
section as well as the Recommended Digital Engagement and Activities section for more
information.
3 Kanban
3.1 Principles
Kanban was first used by Toyota in the late 1940s to manage its car manufacturing. Only
in 2007 was Kanban in its current form applied to software development. (Kanbanize,
2019)
“Kanban is a workflow management method designed to help you visualise your work,
maximise efficiency and be agile. From Japanese, kanban is literally translated as
billboard or signboard.” (Kanbanize, 2019)
• “Start with what you do now.” Not requiring huge up-front changes makes Kanban
becomes easy to adopt. (Kanbanize, 2019)
• “Agree to Pursue Incremental, Evolutionary Change.” Kanban encourages small
changes to counter resistance to change. (Kanbanize, 2019)
• “Respect the Current Process, Roles and Responsi-
bilities.” By acknowledging that what exists does have
value, resistance to change is again overcome.
(Kanbanize, 2019)
• “Encourage Acts of Leadership at All Levels.”
What would a
Continuous improvement (Kaizen in Japanese) can only
software
happen if people at all levels participate. (Kanbanize, development
2019) methodology
based on
As we can see, the principles are thoroughly grounded in the African culture
very respectful Japanese culture where it originated. look like?
3.2 Practices
All this is interesting but has yet to be useful. How does Kanban work? There are six core
practices that form part of Kanban. (Meiling, 2019)
3.2.1 Visualise
An example of a Kanban board is shown in Figure 10. You can see what is still to be done,
who is currently working on which task, and what is done. Tasks are moved from one column
to the next as they progress through the process.
It is important to be clear about policies, such as what criteria a task should meet to be
complete, and whether clients should be informed when new work is started. (Meiling, 2019)
It is tempting to continue working on work items without ever touching base. But just like in
Scrum, stand-up meetings are recommended to ensure everyone is on the same page.
(Meiling, 2019)
There is no equivalent to a Sprint in Kanban to limit the work done over a period. So, a
different way must be found to maintain balance. This is done by limiting the number of tasks
that can be in the work-in-progress state at the same time. (Meiling, 2019)
Just as with Scrum, the idea is to improve processes continuously. However, in Kanban,
there is no specific point in time when this is scheduled, so it requires collaboration to
happen.
There should be a process that manages the tasks that flow into the board to ensure that
customer needs are met.
3.3 Benefits
The main benefits of Kanban are (The Independent Institute of Education, 2018):
Kanban allows for greater flexibility in terms of releases because you don’t have to wait until
the end of a Sprint to release. This is useful when releasing features very quickly is
important, and there is no requirement for fixed release schedules and approvals. (Rehkopf,
2019) Kanban can often be used very successfully for teams that are focused on software
maintenance (production support), while Scrum is best suited for product and system
development. (Pahuja, n.d.)
Scrumban uses the Scrum processes but with the Kanban principles applied on top of that.
The first principle is to visualise. Here you can use a Kanban-like board to imagine what you
are doing in the sprint. (Singh, 2018) An example of a Scrumban board is shown in Figure
11.
The second principle is to define work-in-progress limits, typically one to two times the
number of team members. The third principle is to improve flow by addressing bottlenecks.
(Singh, 2018)
Scrumban can be used as a process of its own, or it can be used on a migration path from
Scrum to Kanban. (Singh, 2018)
4 Azure Boards
4.1 Why use Azure Boards?
Azure DevOps is a collection of tools used by entire software development teams. The tools
integrate well with existing tools such as Visual Studio. (Microsoft, 2019)
A little history will be useful to explain the various product names that you are likely to come
across online. Microsoft used to have a tool called Team Foundation Server (TFS). It was
an on-premises software management tool that included features such as source control,
automated builds and project management tools.
By 2018, there was also a cloud-based version with the same features, called Visual Studio
Team Services (VSTS). (Grammatikos, 2018)
Azure DevOps was announced on 10 September 2018. It was not just a rebranding of the
existing tools but also included an updated user experience. (Cool, 2018) After the name
change, TFS became Azure DevOps Server, and VSTS became Azure DevOps Services.
Companies can and do still choose to use the on-premises Azure DevOps Server if they
want to keep their data protected within their own network or customise their work tracking
beyond what is possible in the cloud version. (Sherer, et al., 2019)
The five main Azure DevOps services are shown in Figure 12.
“Azure Boards delivers a suite of Agile tools to support planning and tracking work, code
defects, and issues using Kanban and Scrum methods.” (Sherer, et al., 2019)
Scrum and Kanban have inspired many software tools to be created to support task tracking
and planning. One of the questions in the 15th Annual State of Agile Report was which tools
are used to manage agile projects.
In this question, respondents could pick multiple answers. Jira came out at the top with 81%,
followed by Digital.ai Agility at 70% and then Azure DevOps at 66%. Microsoft Project was
used by 35% of respondents, and Microsoft Excel by 32% (Digital.ai, 2021)
There are numerous comparisons between Jira and Azure DevOps, for example,
(Automation Consultants, 2019) and (IT Central Station, 2019). There is no easy answer for
the best tool; in practice, the choice between the various tools will often come down to what
the organisation is already using.
For the purpose of this module, we focus on Azure DevOps since it is part of the well-
integrated suite of Microsoft tools.
Throughout this module, we will use Azure DevOps Services – the online service.
Specifically, we will use Azure Boards in this learning unit.
Microsoft provides these services, and you will need to sign up for a free account. To sign
up for a student account, visit https://azure.microsoft.com/en-us/free/students/. You will
need your student email address and a phone number to sign up – no credit card is required.
If you experience issues with signing up for the student account, you can also sign up for
the generally available free tier of the services. For more information about the sign up
process for Azure DevOps, read QuickStart: Sign up, sign in to Azure DevOps, available at
https://docs.microsoft.com/en-us/azure/devops/user-guide/sign-up-invite-
teammates?view=azure-devops. If you sign up in this way, you will have to sign up
separately for Azure Cloud here (credit card required even though it is free):
https://azure.microsoft.com/en-us/. Remember to disable services once you stop using
them to avoid getting changed after 12 months of free usage!
4.2.2 Organisations
Once you have signed up, you will see that an organisation has been created that is linked
to the user that you signed up with.
An organisation is a way to group related projects together.
In a large company, an organisation could, for example, be used for a business division. Or
a single organisation could be created for the whole company.
The choice is up to the user. What is important to note is that each organisation gets its free
tier of services. (Danielson, et al., 2019)
1. Browse to http://dev.azure.com. You might need to login again, and it will redirect to your
default organisation’s page.
3. You can read the Terms of Service, Privacy Statement and Code of Conduct on the
next screen.
Once you are happy with those, click Continue to agree to these items.
5. Click Continue.
Continue reading the projects section below. We will get back to what happens next.
4.2.3 Projects
The next thing we need is to create a project – without a project, there is no point in using
Azure DevOps. A project is exactly what the term sounds like – it represents a project being
worked on. Each project has its boards and backlogs, pipelines, repos and continuous
testing. (Danielson, et al., 2019)
It gets more complicated when we also introduce teams, but let us first look at how to create
a project
before we get to that.
Following on from the steps in the Organisations section to create the first project:
To create a new project later, click New Project in the organisation view (see Figure 18).
When this method is used to create a project, the dialog looks a little different (as shown in
Figure 19).
• Version control. This specifies which version control system will be used for the
project
– Git or Team Foundation Version Control. We will look at the options in Learning
Unit 3. For now, use Git.
• Work item process. This specifies which types of work items can be created and how
they are linked together by default. We will look at this in more detail in Section 4.4.1
below.
Once the project is created, the project’s summary page will be displayed, as shown in
Figure 20.
This view has a couple of interesting features. On the left-hand side of the page is a
navigation pane.
Here we can see all the services that are available to the project. In addition to the main
Azure DevOps services that we have mentioned before (all available by default), there is
also a dashboard feature and
a built-in wiki for information sharing. Both are available under Overview.
At the top of the page, there are breadcrumbs. It shows at a glance where the current
page fits in
– organisation, project, and which service and page. When only one organisation has one
project,
this might not seem very useful. But it will be useful when working with multiple projects
and/or teams.
Azure DevOps, like most other agile project management tools, distinguishes between
the day-to-day operational tasks and things that are considered settings.
It is a sensible distinction since it would often not be desirable for all the team members to
have access to buttons like Delete project. Plus, there are many things that you might
change only every now and again that would otherwise clutter the day-to-day user
interface.
With Azure DevOps, the project window shows details that are common to all projects, but
also, the settings for each service for the current project. We will get into more details about
those settings later in the module.
On the overview page, the name and description of the project can be changed, and a
project profile image can be selected.
1. Click the square button to the right of the project name (outlined in green in Figure 22 –
letters will vary).
Take note of the information message displayed here. You must have the right to
distribute the picture to use it as a profile image. For example, it would not be allowed to
use a trademark of another company, or a copyrighted image.
The image might not appear until you close the Azure DevOps page and load it again.
But eventually the image will appear as in Figure 24. The image will be used in quite small sizes,
so don’t pick something with too much detail.
The process used by the project can be changed (more about this later), and the visibility
can be updated to the public if desired. New administrators can be added, and DevOps
services can be enabled and disabled.
4.2.5 Teams
A default team with the same name (with Team at the end) was also created when the
project was
created. But it is possible to create multiple teams under one project.
1. In Project Settings, under General and then Teams, click New Team. (The dialog
in Figure 26, on the next page, will be displayed.)
2. Choose a Team Avatar Image (if desired) by clicking on the icon above the team
name text field.
3. Specify a team name.
4. Add members if there are already other users in the organisation that should be
added here.
5. Provide a short description.
6. Choose who the administrators should be for the project.
7. Choose the permissions that the new project should inherit.
8. Click Create.
The new team will now also appear on the list of teams within the project.
We have now seen that a team has team members (these are direct members).
Additionally, teams also have their own backlogs. (Danielson, et al., 2019)
If we view the team’s settings, there are links to configuring notifications, dashboards and
iterations and area paths for the team.
Now that we have two teams let’s see what happens when we invite somebody to the
team.
3. Enter the email address (or GitHub ID) of the person that you want to invite.
4. Choose which team(s) to add the person to.
5. Click Add.
For a different approach to adding users, have a look at (KathrynEE, et al., 2019b).
We can now start to see how the different entities are related. Think back to databases –
we can draw an entity relationship diagram (ERD) to capture what we learned.
This is not by any means the original ERD used by the developers but merely a
representation of what we have seen so far ourselves.
We now know how to create an organisation, a project, and a team, and how to invite team
members. The remaining question to be answered here is when (or maybe why) we should
create each of these. The answer is: that it depends.
It is possible to have a single project for a huge organisation. This means all the teams
share the same repositories, builds, etc. This works well if many teams work on a large
product, and if the teams are all synchronised in terms of iteration schedule. (Danielson, et
al., 2019)
The other option is to create many projects. This allows teams to operate more
autonomously and provides better access control since everybody does not need access
to all the projects. This is useful to separate different business units that use very differently
and thus need custom work tracking processes. (Danielson, et al., 2019)
The last option is to have multiple organisations. This is useful for establishing hard
security boundaries, but it does mean that there needs to be better collaboration and reuse.
(Danielson, et al., 2019)
This is quite a complex question, and for the most part, one that graduates software
developers will not have to answer independently. It is useful to know about the possibilities
when these come up in conversations.
To create an iteration:
5. Enter a name for the iteration, and optionally specify a Start date and End date.
6. Click Save and Close.
The iteration will now appear under the project, as shown in Figure 32.
6. Click Iterations.
8. Select the iteration to add. In this case, let’s use the recently created Iteration Two.
9. Click Save and close.
On the same configuration page, it is also possible to set the default iteration and backlog
iteration for the team.
A work item is anything that will be worked on at varying levels of abstraction. Which work
item types are available to a project depends on the project's process. By default, new
projects are assigned the basic process – we saw that in our project earlier.
Figure 38 shows the work item types for the basic process: Epic, Issue, Task, Test Case,
Test Plan and Test Suite. The Agile, Scrum and CMMI (Capability Maturity Model
Integration) processes all have more types of work items.
The process used by a project can be changed after a project has been created. But it is
well hidden since this should not happen during normal use of Azure Boards. If the project
already has work items, a lot of manual fixing will be involved.
It is best to create the project with the correct process. Now that you know the various
options, you can make an informed decision when creating the next project.
To change the process used by a project (continuing from the steps to view the work item
types):
1. Click Projects.
2. Hover over the project to change, and a button with three dots (…) will appear. Click
the button.
4. Choose the Agile target process and read the warning that is displayed.
5. Click Save.
6. If your project does have work items, carefully note the information on this dialog.
Then click Close.
Now you might wonder which process to choose. It depends on the needs of the team.
Figure 42 compares which work items will be available for each type of process.
Note that both the Agile and Scrum processes include the concept of a feature that is a
child of an epic. Epics don’t get displayed in the backlog view. So, if an item needs to be
displayed in the backlog, it is advisable to use a feature instead of an epic.
For more information about the processes, including the transitions between the various
states that work items can be in, read (KathrynEE, et al., 2019c).
The moment has finally arrived when the first work item can be created. This is one of the
day-to-day activities that form part of the normal (non-administrative) use of Azure Boards.
3. Click New Work Item and click Task on the drop-down list that appears.
4. Enter a title for the task. Make it descriptive enough but keep it short.
5. Enter a description with as much detail as possible about the task at hand.
6. Under Area, select the team working on the work item.
7. Under Iteration, select the iteration (if known at this point).
8. Specify the Priority and any other details that are available.
9. Click Save.
10. Under Boards in the navigation pane, click Work items to return to the list. The new
item should now appear on the list, as in Figure 45.
Think back to the section about Scrum earlier in this learning unit. In Scrum we have epics
which are broken down into user stories, and the user stories are in turn broken up into
tasks. Our first task is a little out of place since it doesn’t have a parent user story.
Create a user story, following the same steps as for the work item above (except choosing
to create a User Story in Step 3, of course). Then proceed with the next set of
instructions to allocate the parent to our original work item.
5. On the Link type drop-down list, scroll down to the Work category and choose
Parent.
6. Click the Work items to link box and choose the User Story from the drop-down
list that appears.
7. Click OK.
8. Click Save on the work item.
Create one more work item with the same parent before continuing the following process.
We can see the work items in several different views, each with a specific focus. The Work
items list we have been looking at so far shows a flat list of all the items created in the
project. Various filters can be applied, but this list is not the easiest way to see which tasks
are in which sprint and so on. And there is also an easier way to create a job under a user
story.
• Drag user stories on the list to change the order in which the items should be done
(1 being the highest priority item).
• Click the + to the left of a user story (marked in green in 59) to add a task that has
that user story as a parent.
• Click New Work Item to add a new user story to the team.
• Drag and drop items onto a sprint to include them in the sprint.
• Click on the name of the sprint to the right to view the sprint backlog.
4. For each team member, choose an activity and specify the capacity per day.
5. Optionally, hover over an activity to display the (…) button. This provides access to
actions such as Add an activity, which adds another activity for the same user.
6. Click Save.
Now that we have set up the capacities for the team members, this information can be
used to know who has the capacity to perform specific tasks.
To assign tasks to team members (continuing from the previous set of steps):
If you forget to set the Remaining effort, the hours will not appear on the Work details
page later in these steps.
10. Drag and drop a task onto a team member to assign it to that person. Notice how
the allocated number of hours for the person changes.
11. Another way to change the activity associated with a task is to drag the task to the
activity.
This is great, but what is the value of this feature? Let us create a big task (100 hours of
effort), allocate it to the same team member, and see what the effect is.
Not only does the bar turn red, but it also extends beyond the black vertical line, which is
the maximum capacity of the team. This shows that, given the capacity that was defined,
the work will not be completed during this sprint.
If more team members were available, the work could be split up between them.
Remember, real tasks should never be that huge. A big task like that should be split into
smaller tasks of half a day or maybe one day in size.
We can see at a glance that we have two user stories, and the first one has three tasks. All
of these are in the New state, meaning work has not yet begun.
In Kanban board terminology, each of these columns is called a swim lane. Each swim
lane, by default represents a state that the items can be in.
When work is started on the user story’s tasks, drag the user story to the Active swim lane.
1. Click the task button (with the icon) on the user story.
2. The list of tasks associated with the user story will be displayed. Click the checkbox
to the left of the task that is complete.
Continue completing tasks until everything is done. Eventually, the user story will get
moved on to the next lane. When this happens depends on how the team uses the swim
lanes and the definition of done.
There are lots of customisations that can be done for boards for each specific team. Here
we will focus on how to create more columns, but you can explore the rest of the settings
yourself.
1. Click the Configure team settings button (with the icon) at the top right of the
board.
To view the project’s dashboard, click Dashboards under Overview on the navigation
pane.
When a new project is created, the dashboard doesn’t have any widgets yet. This is up to
the users to configure exactly as they want.
1. Click Edit.
2. Drag and drop any of the widgets into a position in the grid of grey squares. The
sizes of the widgets differ according to how much space each needs to display its
information.
3. When you are satisfied with the layout, click Done Editing.
If you want to add something you do not see, browse the Extension Gallery (link at the
bottom of Figure 65). There are many available extensions, some free and some paid.
1. At the top of the dashboard, click the down arrow next to the dashboard name.
2. Click New dashboard.
5.2 Scrum
Schwaber, K. & Sutherland, J., 2017. The Scrum Guide. The
Definitive Guide to Scrum: The Rules of the Game. [Online]
Available at: E-book
https://www.scrumguides.org/docs/scrumguide/v2017/2017-
Scrum-Guide-US.pdf#zoom=100 [Accessed 12 July 2021].
5.3 Kanban
Kanbanize, (2019). Kanban Explained for Beginners. [Online]. Available at:
https://kanbanize.com/kanban-resources/getting-started/what-is-kanban/ [Accessed 12
July 2021].
Karaivanov, D., n.d. Project Manager’s Guide to Kanban. [eBook] Available at:
https://universe.kanbanize.com/project-managers-guide-to-kanban/?cm=PMbookdownl&
cn=whatiskanban [Accessed 12 July 2021].
5.4 Scrumban
Pahuja, S., n.d. What is Scrumban? [Online]. Available at:
https://www.agilealliance.org/what-is-scrumban/
[Accessed 12 July 2021].
Azure DevOps Labs, (2019). Agile Planning and Portfolio Management with Azure
Boards. [Online]. Available at:
https://www.azuredevopslabs.com/labs/azuredevops/agile/#prerequisites [Accessed 12
July 2021].
Danielson, S. et al., 2019. Plan your organisational structure. [Online]. Available at:
https://docs.microsoft.com/en-us/azure/devops/user-guide/plan-your-azure-devops-org-
structure?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&bc=%2Fazure%2Fde
vops%2Forganizations%2Fbreadcrumb%2Ftoc.json&view=azure-devops [Accessed 12
July 2021].
IT Central Station, 2019. Compare JIRA vs. Microsoft Azure DevOps. [Online]. Available
at: https://www.itcentralstation.com/products/comparisons/jira_vs_microsoft-azure-devops
[Accessed 12 July 2021].
KathrynEE et al., 2019. What are Azure Boards? [Online]. Available at:
https://docs.microsoft.com/en-us/azure/devops/boards/get-started/what-is-azure-
boards?view=azure-devops&tabs=basic-process [Accessed 12 July 2021].
Watch the video How to pronounce the name of Microsoft’s cloud: Azure, available at
https://www.youtube.com/watch?v=AmP11EgEM4g
Watch the video Plan your work with Azure Boards at https://sec.ch9.ms/ch9/6f7f/424c1d79-4896-
4b8e-9034-0aa80ecb6f7f/AzureBoards_high.mp4
1 Introduction
In this learning unit, we will learn how to develop a web application for the Microsoft Azure
platform. You already have much of the knowledge required for this task. You know how to
design a database, you know how to create a web service, and you know how to create a
web front end. Here we will be applying all that knowledge to creating a cloud application.
2 Cloud Terminology
Before we jump into the how of it, there is some cloud terminology that you will need to
know to understand where things fit in.
“Cloud computing, often referred to as simply ‘the cloud,’ is the delivery of on-demand
computing resources — everything from applications to data centres — over the internet on
a pay-for-use basis.” (IBM, n.d.)
The cloud provider is responsible for buying servers, maintaining server rooms, and
providing enough bandwidth. If a company needs a new database, it is as easy as just
signing up and requesting the resource. And, of course, paying for the service. Minutes
later, the new database is up and running.
“Simply put, cloud computing is the delivery of computing services – including servers,
storage, databases, networking, software, analytics, and intelligence – over the Internet
(“the cloud”) to offer faster innovation, flexible resources, and economies of scale. You
typically pay only for cloud services you use, helping you lower your operating costs, run
your infrastructure more efficiently, and scale as your business needs change.” (Microsoft,
2019b)
Microsoft’s definition adds a little more information. We have already seen that cloud
computing provides flexible resources. But added to that, Microsoft says that it also
encourages “faster innovation” and that it makes it possible to take advantage of
“economies of scale”. This means that by providing cloud services on a large scale, a cloud
provider can do it cheaper than a company would have been able to on their own.
Another point in the Microsoft definition mentions that cloud computing allows businesses
to scale as their needs change. Consider a Black Friday sale. An online retailer that offers
Black Friday specials can expect many times the normal volume of traffic over a period of
a couple of days. It would be great if the infrastructure can scale with this sudden increase
in demand. And cloud computing does precisely that.
• Microsoft Azure opened data centres in Johannesburg and Cape Town in March
2019. (Moyo, 2019)
• Huawei also opened a data centre in Johannesburg in March 2019. (McKane, 2019)
• Amazon has a data centre for Amazon Web Services (AWS) in Cape Town.
(Amazon, 2022)
• Oracle opened a cloud data centre in Johannesburg in January 2022. (Oracle,
2022)
The second deployment model is a private cloud. It is a model where the resources are
used by only a single organisation, and it can be located on the client’s own data centre or
located in a dedicated third-party data centre. (Microsoft, 2019b) But this sounds a lot like
the traditional on-site situation – why would you even consider going this route? Some
companies have security and regulatory requirements that make storing data in a public
cloud impossible. In that case, a private cloud means that they can still take advantage of
the technologies but of course at the cost of maintaining a data centre.
The third deployment model is hybrid cloud. In this model, a private and public cloud is
used together, and they can exchange data. (Microsoft, 2019b) The most sensitive data can
be stored on the private cloud, but the processing resources of the public cloud can still be
used.
The difference between these three types of cloud computing is all about which parts are
managed by the cloud provider, as shown in Figure 68.
Figure 68: Aspects managed by the cloud provider in IaaS, PaaS and SaaS. (Based
on (Microsoft, 2019c))
This is the type of cloud computing that we are most interested in for this learning unit since
the web application that we will create will make use of the Microsoft Azure PaaS offering.
PaaS means that the service provider takes care of a lot of things for us. We don’t need to
worry about installing and keeping an up-to-date an operating system or even the database
management system (DBMS) we will use. We can instead focus on developing the
application software that will add business value. (Microsoft, 2019b)
With SaaS, software applications are delivered on a subscription basis. The cloud provider
manages everything, including the hosted applications. (Microsoft, 2019b) Microsoft Azure
DevOps is an example of SaaS. In the first learning unit, we made use of the software
functionality without ever needing to know any of the underlying infrastructure or even the
details of the software implementation. It is an end-user application, even though, in this
case the end users are sometimes software developers themselves.
No single module could even touch on all these categories, let alone all the available
products. And in addition to the Microsoft offerings, there is also a marketplace where
third parties offer many more apps and even services. So, we will focus on creating a web
application.
Let’s look at the reference architecture components for a basic web application, as shown
in Figure 69.
A resource group is a way to group several related items so that they can be managed
together and, more importantly, the cost of the resource group can be controlled. (Owen,
2019)
The dotted boundary in Figure 69 indicates that two items fall outside the scope of the
specific resource group: Azure DNS and Azure Active Directory.
Azure DNS is a Domain Name System (DNS) that makes it possible for domain names to
resolve to domains hosted in Azure. To use this, a domain name must be registered first,
and then Azure DNS can be used for the address resolution. (Horne, et al., 2019)
What does this mean in practice? By default, when you work with Azure services, you get
assigned a subdomain on one of the existing Azure domains. For a database, for example,
it could be mynewamazingdatabase.database.windows.net where the part in bold is the
existing Azure domain. (Microsoft, n.d.) But what if you wanted the database to be reachable
by mynewamazingdatabase.co.za instead? You would configure that in Azure DNS.
The other element outside the resource group is Azure Active Directory (AD). It is a cloud-
based identity service – users can sign in and be granted access to internal or external
resources based on their logins that are configured in Azure AD. (Ross, et al., 2019) Using
Azure AD is beyond the scope of this module.
With those two things out, let us look at the items inside the resource group – and within
our control.
Azure Storage, specifically the blob storage service, is used in this reference architecture
to store diagnostic logs. (Wasson, et al., 2017)
Azure Blob storage is “optimised for storing massive amounts of unstructured data, such
as text or binary data.” (Myers, et al., 2019) Diagnostic logs fit the bill perfectly – it is
unstructured text data. Diagnostic logs can be generated at various levels, from the
database to the web front end.
Figure 70 shows just the database part of the bigger diagram. We can see that there are
two parts to it – a logical server and some databases. The logical server hosts one or
more databases. (Wasson, et al., 2017) The logical server will have its own subdomain
that we can use to access it.
“Azure App Service enables you to build and host web apps, mobile back ends, and
RESTful APIs in the programming language of your choice without managing
infrastructure. It offers auto scaling and high availability, supports both Windows and
Linux, and enables automated deployments from GitHub, Azure DevOps, or any Git repo.”
(Microsoft, n.d. c)
Azure App Service is the cloud product where the web application will be hosted. It is
very flexible in terms of what you can host there – applications can range from .NET to
Node.js to PHP and even Java. (Microsoft, n.d. c) For our purposes, we will be creating
C# .NET web applications since that is what we know already.
Figure 71 shows just the App Service part of the bigger picture. Like the SQL Database
picture, this consists of two parts: App Service plan and App Service web app.
Web apps run within an App Service plan, which defines the resources available to a
web app when it is running. Multiple apps can be configured to run on the same
resources. (Lin, et al., 2017)
It is important to note that there are different pricing tiers for an App Service plan. This
ranges from Free to Shared (inexpensive but paid per hour) all the way to Isolated which
provides dedicated VMs at a premium. Free should be more than enough for our
purposes.
We see a few familiar products in this architecture: Azure Active Directory, Azure DNS,
Azure App Service, Azure Blob storage and Azure SQL Database. Read Section 3.1
again for information about those.
Let’s briefly consider the new items that we will not discuss in detail:
• Azure Front Door is a load balancer, that also includes a web application firewall.
(Wasson, et al., 2019)
• Azure Content Delivery Network (CDN) is a product that caches publicly available
content as close to the end user as possible. (Wasson, et al., 2019)
• Azure Cache for Redis stores data that changes infrequently, to avoid reading that
from the database and thus improve performance. (Wasson, et al., 2019)
• Azure Search used with one or more data stores, provides search suggestions,
language-specific search and more. (Wasson, et al., 2019)
• Azure Cosmos DB can be used for non-relational data. (Wasson, et al., 2019) It is a
highly scalable database accessed through NoSQL application programming
interfaces (APIs) such as MongoDB, Cassandra, or Gremlin. And it can even be
accessed using Structured Query Language (SQL). (Gentz, et al., 2019)
• Azure Queue storage is a mechanism that is used to queue background tasks.
(Wasson, et al., 2019)
The Azure Functions app in Figure 72 is used to run background tasks. (Wasson, et al.,
2019)
This is the definition of Azure Functions from the initial product announcement, but it still
captures the essence well. Firstly, it is event-driven – something happens that triggers the
code. Secondly, it is a compute-on-demand product. Let’s unpack these two facts more,
starting with the second one.
A function is what it sounds like – it is a small piece of code that can run in the cloud.
Applications developed using Functions are considered serverless – no infrastructure or
even an application needs to be managed. It is just a piece of code that has a specific job.
(Gailey, et al., 2017)
There are different pricing plans for Functions: consumption (pay just when the function
runs), premium (pre-warmed instances can run immediately) and app service plan (run
functions as part of an existing App Service). (Gailey, et al., 2017)
There are several different triggers that can start the execution of a function, including
(Gailey, et al., 2017):
• SQL Virtual Machines is an IaaS option for hosting a SQL server in the cloud. This
option gives complete access to the virtual machine where a SQL server instance is
installed. This is a good option when migrating to the cloud, if operating system-level
access is required. (Rabeler, et al., 2019)
• SQL Managed Instance is a PaaS option. This means that it provides the benefits
of PaaS such as automatic updates of the database engine. However, it does allow
more control of the database engine. This means it is also a good option for many
migrations to the cloud. (Rabeler, et al., 2019)
• SQL Databases is the deployment option that we have already seen. It is the best
PaaS solution for modern cloud applications. In fact, this is also called a relational
database-as-a-service (DBaaS). Three options falls under this: single database
with its resources, elastic pool with resources shared between databases, and a
database server (the logical server that we saw before) that is the central
management point for databases and pools. (Rabeler, et al., 2019)
Related to the deployment options are the two purchase models for SQL Databases:
The purchasing model can be changed without taking the database offline. A rule of
thumb is that if a database or elastic pool consumes more than 300 DTUs, it may be
cheaper to change from DTU to vCore-based purchasing. (Oslake, 2019)
A group of DJs (disk jockeys) has approached you to build a website to promote
themselves. They want to have a dynamic site where their fans can see when they are
scheduled to play at which venue. Past events should automatically be removed from the
site.
Throughout the rest of this learning unit, we will build a web application based on this
scenario.
We are going to be storing some relational data in an Azure SQL Database. Figure 74
shows an entity relationship diagram (ERD) that was drawn for the business rules
specified by the DJs.
Revision Question
What type of relationship is depicted in this ERD? Why?
We will be using a single SQL database – the PaaS version. This means that the
database is somewhere in the cloud, and we don’t have access to the virtual machine or
the database engine instance. So, how do we access this then?
There are multiple ways in which one can interact with a SQL database in Azure:
For this module, we will use the Azure Portal to create and manage the database. This is
the most user-friendly way of interacting with the database. Note that if you ever need to
create many databases, however, using a command line script will be more efficient.
1. Browse to the Azure Portal at https://portal.azure.com/ (you will need to log in with
your credentials).
2. On the home page of the portal, under the Azure services category, click Create a
resource.
5. On the Basics page, under Project details, select a subscription. You should have
only one subscription available.
6. If you don’t have a Resource group yet, click Create new.
8. Enter a Database name. Note that the name is validated as you type – make sure
that all the checks pass (show green check marks).
9. If you don’t have a Server yet, click Create new. This is where you create the
logical server that will contain the database.
10. Enter a Server name. This must be a globally unique name, so you must choose
your own name here.
11. Enter the Server admin login name, again paying attention to the validation as you
type. You will need to log in with this username later, so make a note of it.
12. Enter a strong Password for the admin user. Again, you will need to know this
password later, so don’t lose it.
13. Enter the same password again under Confirm password.
14. For the Location, choose (Africa) South Africa North. This means that the
database will be stored in the Johannesburg data centre.
15. Click OK.
16. Click Review + create.
17. Click Create.
19. Once the deployment is complete, a notification will be displayed to that effect. And
the details of what was deployed is displayed.
Note that none of the R3 050 free credit of the free account was used, even though a cost
was displayed during the creation process. This is because the created server is within the
limits of the free 12 months of SQL Database access.
Tip: Now that the resource has been created, it will also appear under Recent resources
on the home page of the Azure Portal. If you want to return later to the page shown in
Figure 87, that is the easiest way to find it again.
Security is an important concern when it comes to anything in the cloud. To provide security,
there is a firewall that is activated at the logical database server level. By default, the firewall
doesn’t allow any connections to the database. So, we need to set it up so that we can
access it.
3. Enter the admin username and password that you specified when you created the
database.
4. You will see an error message that contains the IP address that you tried to connect
with. This is the address that you will need to allow access for.
When we connect to the internet, our Internet Service Provider (ISP) assigns us a
dynamically allocated address within their address range. This means that our public IP
address probably will change over time.
4. Click Add client IP. This will add a rule to allow the device that you are currently
browsing from.
5. Click Save.
6. Go back to the database and try to connect again. This time the connection should
succeed.
In Figure 91, we see what the Query Editor that is built into the Azure Portal looks like
with the Tables, Views and Stored Procedures categories expanded. It is a very useful
tool to quickly access the database, but we don’t exactly have anything to look at.
As an exercise, you might want to write the CREATE TABLE SQL script yourself based
on the ERD provided in Section 4.2.2 before continuing.
1. Copy the below SQL commands into the query editor area.
CREATE TABLE DJ (
DJID INT NOT NULL IDENTITY PRIMARY KEY,
Stage Name NVARCHAR(200)
);
2. Click Run.
3. You should see a message indicating that the query was successful, with 0 affected
rows.
4. Above the tree on the left, click the Refresh button (the one with the icon).
Exercise: Insert some data into the tables using INSERT statements before continuing to
the next section.
Once you have inserted some data, run a SELECT query on one of table tables. You will
see that the results are displayed in the results pane, as shown in Figure 95.
So far, we have created a database, set up the firewall to allow access from our public IP
address, and executed a couple of SQL statements. This is good progress, but it is not quite
satisfying to know the database exists out there now. It would be great to see the data in
use. So, let us create a simple console application that displays the list of all the DJs as
proof of concept.
As we saw in Programming 2B, we need to tell .NET where to find the database when we
want to access data using ADO.NET or Entity Framework. This is done by means of a
connection string. The good news is that getting the correct connection string for our
database is easy, straight from the Azure Portal.
3. Make sure that the ADO.NET tab is active and copy the connection string.
The PHP and Go tabs provide more than just connection strings – those provide code that
can be used to connect to the database.
You will notice that everything has been filled in except for the password. So, be sure to
replace {your password} with your actual password that you used to create the admin user.
Note that in real-world applications, it is not advisable to use the administrator login
details for database access since that will provide the application (and by extension the user
access) to everything. Users can be created with the CREATE USER SQL statement. For
more information, read (Rabeler, et al., 2019b).
2. On the start window, under Get started, click Create a new project.
try
{
string connectionString = "";
Console.WriteLine("=========================================");
Console.WriteLine("DJs in da house!");
Console.WriteLine("=========================================\n");
When you create a new project in Visual Studio, you may have noticed that there is a
distinction between .NET Framework, .NET Core and .NET Standard projects (see Figure
100). What are the differences?
.NET Framework was the original platform for Windows only, developed by Microsoft. The
latest version is 4.8, which was released in 2019. (Microsoft, 2022) By tech standards, 2019
was a very long time ago. So, what had happened since?
Microsoft decided to create a new cross-platform framework and called it .NET Core. The
fact that .NET Core is cross-platform is a big advantage over the older .NET Framework.
But not all the technologies available for the .NET Framework are yet (or maybe will ever
be) available for .NET Core. So, there are several factors to weigh up when choosing which
one to use. Read (Carter, et al., 2018) for more guidance on when to choose which runtime.
So, we have two different run-times provided by Microsoft – but what then is .NET
Standard? .NET Standard is the name for the common APIs that work across all the different
runtimes. (Bisson, 2017)
Figure 101 shows a representation of the .NET ecosystem, including the Mono cross-
platform runtime that is used for Xamarin mobile apps. (Luijbregts, 2018)
Read (Luijbregts, 2018) for more information about the .NET ecosystem.
With the release of .NET 5, Microsoft decided to unify .NET Framework and .NET Core.
(Michaelis, 2019) The new .NET 5 would be based on .NET Core 3, but the number was
chosen to be larger than the last version .NET Framework.
In November 2021, Microsoft released .NET 6. This is a long-term support release and the
culmination of the work done to unify the previous two platforms. (L, 2021)
In the rest of the manual, we will refer to simply to .NET, meaning this new incarnation of
.NET Core that no longer has Core in the name.
Azure App Service supports both .NET Framework and .NET. When you create a new web
app in Azure App Service, one of the options that you choose is the operating system that
the code will be running on. Choose .NET if you want to run the app on Linux.
For this learning unit, we will be creating an ASP.NET Core web application that displays
data from our Azure SQL database.
5. Enter DJPromoWebApp for the Project name and choose a Location for the
project.
6. Click Next.
© The Independent Institute of Education (Pty) Ltd 2023 Page 100 of 290
IIE Module Manual APPR6312
So far, we haven’t done anything new yet – this should feel quite familiar from
Programming 2B (PROG6212).
To run the web app locally, click the run button on the toolbar in Visual Studio.
The new web app should be displayed in your default browser, looking something like
Figure 107.
When creating the project, we chose to use Model-View-Controller (MVC). We will need to
implement a model to access data from the database. Then Entity Framework (EF) Core
will be able to retrieve the data.
© The Independent Institute of Education (Pty) Ltd 2023 Page 101 of 290
IIE Module Manual APPR6312
1. In the Solution Explorer, right-click the project, choose Add and then New Folder.
2. Name the folder Models and press Enter.
© The Independent Institute of Education (Pty) Ltd 2023 Page 102 of 290
IIE Module Manual APPR6312
public class DJ
{
[Key]
public int DJID { get; set; }
public string StageName { get; set; }
}
© The Independent Institute of Education (Pty) Ltd 2023 Page 103 of 290
IIE Module Manual APPR6312
The project that we created doesn’t come with Entity Framework (EF) support out of the
box. We need to add it using NuGet.
© The Independent Institute of Education (Pty) Ltd 2023 Page 104 of 290
IIE Module Manual APPR6312
4. In the search field at the top of the tab, enter Entity Framework.
5. Select Microsoft.EntityFrameworkCore.SqlServer.
6. Choose Version 5.0.16.
7. Click Install.
8. If the Preview Changes dialog is displayed, review the changes and click OK.
9. On the License Acceptance window, click I Accept.
Note that for production software, you should ensure the license agreement will work for
your project. See legal counsel if you are unsure about license agreements in a
professional context.
12. When the dependencies have been added, they will be visible in the Solution
Explorer.
13. Close the NuGet Package Manager window.
© The Independent Institute of Education (Pty) Ltd 2023 Page 105 of 290
IIE Module Manual APPR6312
namespace DJPromoWebApp.Data
{
public class DJContext : DbContext
{
public DJContext(DbContextOptions<DJContext> options)
: base(options)
{
}
services.AddDbContext<DJContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DJContext")));
8. We also need to add the connection string to the settings file. Open
appsettings.json.
© The Independent Institute of Education (Pty) Ltd 2023 Page 106 of 290
IIE Module Manual APPR6312
9. Change the file so it looks like this (bold part was added):
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DJContext": "<your connection string here>"
}
}
10. Insert the connection string to your database. Remember the password!
2. Right-click the Gigs folder, choose Add and then New Scaffolded Item.
3. Under the Razor Pages category, choose Razor Page using Entity Framework.
4. Click Add.
© The Independent Institute of Education (Pty) Ltd 2023 Page 107 of 290
IIE Module Manual APPR6312
5. Set up all the configuration for the new page as shown in Figure 116.
6. Click Add.
7. Once the process completes, open the Gigs.cshtml file.
8. Delete the @page line from the file (if it exists) and save the file.
9. Open the Index.cshtml file, and change the contents of the file to look like this:
@page
@model DJPromoWebApp.Pages.Gigs.GigsModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
@await Html.PartialAsync("/Pages/Gigs/Gigs.cshtml", Model)
</div>
If you can’t connect to the database, double check that your IP address is allowed by the
logical database server firewall.
© The Independent Institute of Education (Pty) Ltd 2023 Page 108 of 290
IIE Module Manual APPR6312
Exercises
For this learning unit, we will use the tools built into Visual Studio. In Learning Unit 5, we
will learn more about the other options.
To publish the web app to Azure App Service for the first time:
© The Independent Institute of Education (Pty) Ltd 2023 Page 109 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 110 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 111 of 290
IIE Module Manual APPR6312
17. The Publish window will automatically be opened, with the Azure App Service
destination picked.
18. Click Publish.
19. Wait for the process to complete.
© The Independent Institute of Education (Pty) Ltd 2023 Page 112 of 290
IIE Module Manual APPR6312
A browser window will be opened with your app, displaying a (not so useful) error
message. To fix the issue, we need to configure the firewall to allow the app access to the
database.
4. On the Firewall settings page, toggle Allow Azure services and resources to
access this server to ON.
5. Click Save.
6. You should see a message indicating that the firewall rules were successfully updated.
Click OK.
Now you can reload the browser page with your app, and everything should work just as it
did on your local computer.
© The Independent Institute of Education (Pty) Ltd 2023 Page 113 of 290
IIE Module Manual APPR6312
What we did here was to allow all the Azure servers access to the database on the
networking (firewall) level. Remember that you still need login credentials for the specific
database, too, so this is not as unsafe as it might sound at first.
But what about deploying those changes to the live version on the Azure Cloud? Luckily,
that is also easy.
Make some small changes to Index. Cshtml and try them out locally. When you are
happy with the changes, continue reading.
© The Independent Institute of Education (Pty) Ltd 2023 Page 114 of 290
IIE Module Manual APPR6312
And that is it. The page should load in a browser, and you will see your changes.
Tip: The publish window is also a convenient place to see the site Universal Resource
Locator (URL).
2. Click the Show Portal menu button (with the icon ) in the top-left corner of the
Portal.
© The Independent Institute of Education (Pty) Ltd 2023 Page 115 of 290
IIE Module Manual APPR6312
Just like the SQL server is a logical container where you can manage one or more SQL
databases, the App Service plan is a central place to manage one or more deployed App
Service resources and more importantly, the cost of running them.
© The Independent Institute of Education (Pty) Ltd 2023 Page 116 of 290
IIE Module Manual APPR6312
Under properties, you can see the status, location, pricing tier, and instance size. If you
want to scale up or out, there are pages available under the Settings category to do that.
Changes that you make here will apply to all the apps in the plan.
If you look at the App Service entry, you will see many more options related to
deployment, site certificates and even usage quotas.
New apps can also be created using the portal, as well as the command line. We will look
at the command line options later in this module.
© The Independent Institute of Education (Pty) Ltd 2023 Page 117 of 290
IIE Module Manual APPR6312
6 Azure Functions
6.1 Serverless Computing
When we consider scaling in Azure App Service, there are two options (Lin, et al., 2019c):
• Scaling up – adding more resources such as CPU, memory and disk space.
• Scaling out – added more virtual machine (VM) instances to run the app.
This points to the fact that there are in fact still VMs involved in hosting the App Service.
The VMs are managed without much involvement from us, but they still exist. What if we
want seriously elastic scaling – paying only for compute power that we use, and with the
ability to scale to huge traffic volumes? That is where serverless computing comes in.
Let’s have a look at Microsoft’s definition.
“In understanding the definition of serverless computing, it is important to note that servers
are still running the code. The serverless name comes from the fact that the tasks
associated with infrastructure provisioning and management are invisible to the
developer.” (Microsoft, 2019e)
Serverless computing hides from the developer where the code is executed. It is running
somewhere in the region that was picked for hosting the code, and that is all that we need
to know. The server that is doing the work is entirely unimportant, since there is
sophisticated software that manages all that in the background.
Several serverless options are available on the Azure platform, including Event Grid,
Logic Apps and Functions. (Likness, 2018) Let us have a brief look at each one.
Event Grid makes it possible to create serverless event-based applications. Events can
be published from and consumed by any platform. It is useful for integrating various
applications and building serverless apps from the ground up. (Likness, 2018)
Logic Apps is a design-first workflow engine that allows people to build workflows with a
visual designer. (Likness, 2018) This is useful for implementing business processes that
have steps that interact with various systems.
Azure Functions is a serverless way to run functions in the cloud. A function in this
context is a small piece of code that typically contains business logic. There are lots of
© The Independent Institute of Education (Pty) Ltd 2023 Page 118 of 290
IIE Module Manual APPR6312
In this learning unit, we will create Azure Functions in C# using the first two methods.
You may have noticed that the Azure App Service web app we created before was just a
normal ASP.NET Core MVC app, hosted in the cloud. You could take that same app and
deploy it in a Docker container, or to an Internet Information Services (IIS) server, without
any changes to the code.
When we create a function in Section 6.2, you will notice this looks like a very different
situation. You must define the function in a specific way, with attributes (or a configuration
file for languages other than C#) specifying when the function will run.
At first glance, it looks like this means that we are forever locked in to running our code on
the Microsoft Azure platform. However, we haven't mentioned a key feature of Azure
Functions yet – the runtime is open-source and available on GitHub. (Gailey, et al., 2017)
This means that if you are willing to spend the money (on infrastructure) and time, you
could absolutely run Azure Functions on your own servers. Or in a virtual machine on a
different cloud.
An important factor in choosing to use Functions is the fact that you can pay only for the
computational resources that you use. But as with all things in Azure, there are multiple
options for pricing plans here too (Gailey, et al., 2017):
• Consumption plan – pay only for the time when your code is running.
• Premium plan – some instances of the function are pre-warmed and ready to
respond very fast. You pay for these instances that are always effectively running
though.
© The Independent Institute of Education (Pty) Ltd 2023 Page 119 of 290
IIE Module Manual APPR6312
• App Service plan – run the functions as part of an existing App Service plan, using
the same resources and without paying anything extra.
© The Independent Institute of Education (Pty) Ltd 2023 Page 120 of 290
IIE Module Manual APPR6312
Before we create our first Azure Function, we need to know about triggers and bindings.
Think about a method in a plain old C# class for a moment. If you don’t call the method, it
won’t ever run. The same kind of thing is true for a function too – it is only executed when
something triggers it. But now the piece of code is a small, isolated thing, so how do we
do that?
Each function has a trigger – something that causes the function to run. Here are some
common triggers (Microsoft, n.d. d):
• Timer: Used when you want something to run on a schedule, for example, every
Monday at 08:00.
• Hypertext Transfer Protocol (HTTP): Just like web services can get called using
HTTP, functions can also be called in this way.
• Blob: Useful for monitoring files that are uploaded to Azure Blob storage.
• Queue: There is a queue implementation in Azure Storage that can trigger a
function when a message is added to the queue.
• Azure Cosmos DB: When something changes in the database, a function can be
triggered.
• Event Hub: A new event that is published to the Event Hub can trigger a function.
We will see shortly how to define these triggers. It is important to note, though, that each
function can only have exactly one trigger.
Bindings are used to provide data to a function and can also be used to output data
from a function (or can even be both input and output). Examples of output bindings are
things like publishing an event to the Event Hub, sending an email, and creating a file in
Azure Blob storage. (Dykstra, et al., 2019)
If you don’t see the Visual Studio features described here, you probably need to install
the Azure development workload. (Gailey, et al., 2019)
© The Independent Institute of Education (Pty) Ltd 2023 Page 121 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 122 of 290
IIE Module Manual APPR6312
If you look at the list of options here, you will see only .NET Framework and .NET Core.
This is perfect for our current purpose, but if you wanted to use another language you
would have to make a different plan. More about that in Section 6.6.
What is the authorisation level all about? Azure Functions uses API keys to make sure
that unauthorised people cannot call functions using HTTP requests. There are three
possible levels (Microsoft, n.d. e):
• Anonymous: Anybody can call the function – no API key is required. Use only for
things that you intend to have publicly accessible.
• Function: To call the function, you need to know the API key for this specific
function.
• Admin: A master API key is required. This grants elevated permissions, so use with
care! (Gailey, et al., 2017b)
As with many project templates in Visual Studio, a sample class is created as part of the
Azure Functions project. The code is quite useful in this case, for us to learn how to create
our own functions in C#.
© The Independent Institute of Education (Pty) Ltd 2023 Page 123 of 290
IIE Module Manual APPR6312
The Function Name attribute specifies the name that we will use to call the function and
the HTTP Trigger attribute tells it that an HTTP request should trigger the function. Notice
that both GET and POST requests are enabled by default.
With GET, the parameters are passed as part of the Universal Resource Locator (URL).
This is useful for testing. But if the data that is passed in is sensitive, disable the GET
option.
The sample code looks for a parameter called name, either in the URL or in the post data,
and then sends back a message saying hello to that name if it is found.
Before we create our own function, let’s first see how we can run the function locally.
Azure Functions Core Tools can be used to run functions on your local computer. This is
integrated into Visual Studio to make running your functions very easy.
© The Independent Institute of Education (Pty) Ltd 2023 Page 124 of 290
IIE Module Manual APPR6312
1. With the project open in Visual Studio, press F5. (Or click Debug menu and then
Start Debugging.)
3. A Functions runtime window will be displayed, and it will show the address of
Function1. Copy the URL.
4. Open a new browser window and browse to the URL.
© The Independent Institute of Education (Pty) Ltd 2023 Page 125 of 290
IIE Module Manual APPR6312
5. You should see an error message indicating that you were supposed to send a
name. To do this, append ?name=<YOUR_NAME> to the URL.
Note that authorisation levels are ignored when you run the function locally, so there is
no need to specify an API key.
© The Independent Institute of Education (Pty) Ltd 2023 Page 126 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 127 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 128 of 290
IIE Module Manual APPR6312
For the purpose of this implementation, we won’t be using Entity Framework. If you want
to know how to use Entity Framework with Functions, read (Hollan, 2019).
For the purpose of our function, if the DJ or venue doesn’t exist we will return an error
message.
[FunctionName("AddGig")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HTTP Request req,
ILogger log)
{
log.LogInformation("Add Gig: C# HTTP trigger function processed a request.");
As an exercise, write the code for the CreateNewGigEntry method yourself before
continuing.
© The Independent Institute of Education (Pty) Ltd 2023 Page 129 of 290
IIE Module Manual APPR6312
connection.Open();
sql = $"INSERT INTO Gig(DJID, VenueID, Date, Time) VALUES ({djID}, " +
$"{venueID}, '{date}', '{time}');";
using (SqlCommand command = new SqlCommand(sql, connection))
{
command.ExecuteNonQuery();
return (ActionResult)new OkObjectResult($"Created gig for {stagename} " +
$"at {venuename} on {date} at {time}");
}
}
}
catch (SqlException e)
{
Console.WriteLine(e.ToString());
}
return new BadRequestObjectResult("Error: An unexpected error " +
"occurred while creating the gig");
}
Exercise: Under what circumstances will this method not work correctly? Can this be
used by attackers to gain access where they shouldn’t be able to?
© The Independent Institute of Education (Pty) Ltd 2023 Page 130 of 290
IIE Module Manual APPR6312
http://localhost:7071/api/AddGig?stagename=shohiwa&venuename=ultra%20coo
l&date=2020-06-12&time=18:00
Note that ‘&’ separates the parameters, and ‘%20’ is used to present a space.
If you get error messages (look in the console window for more information):
Before we publish a function, we need a function app first. It is a logical container for one
or more functions. The Visual Studio wizard can create this for us too.
© The Independent Institute of Education (Pty) Ltd 2023 Page 131 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 132 of 290
IIE Module Manual APPR6312
10. Delete the last two digits of the proposed Account name.
11. Choose the Location South Africa North.
12. Click OK.
13. Click Create.
14. Wait for the process to complete.
15. When the process completes, you should see the Publish window. Click Publish.
16. Wait for the process to complete. Then click the Site URL link to view the home
page of the function app in your browser, as shown in Figure 150.
© The Independent Institute of Education (Pty) Ltd 2023 Page 133 of 290
IIE Module Manual APPR6312
We chose to set the authorisation level of the functions (Function1 and AddGig) to
function. This means that we need to know the API key to be able to call these functions
now that they have been published. We can see these in Azure Portal.
© The Independent Institute of Education (Pty) Ltd 2023 Page 134 of 290
IIE Module Manual APPR6312
Look at the URL that you copied. It will include a code parameter with a generated value.
That is the API key for this specific function. Add the normal parameters at the end of the
URL that includes the code. Remember, separate parameters with ‘&’ .
“Don't mix local development and portal development for a single-function app. When
you publish from a local project to a function app, the deployment process overwrites any
functions you developed in the portal.” (Gailey, et al., 2019d)
When we looked at our Visual Studio-created functions app in the Azure Portal, you might
have noticed that it said that the “app is currently in read-only mode because you are
© The Independent Institute of Education (Pty) Ltd 2023 Page 135 of 290
IIE Module Manual APPR6312
running from a package file.” That means it is unlikely that you will run into issues with
mixing local and portal development.
For this section, we will create a new functions app using Azure portal to explore its
features. Note that it may use a small amount of your free credit.
© The Independent Institute of Education (Pty) Ltd 2023 Page 136 of 290
IIE Module Manual APPR6312
5. Select the DJPromoWebsite Resource group that we have been using all along.
6. Enter a unique Function app name. Using the current date and time could help to
make it unique.
7. Choose to Publish Code.
8. Choose the Runtime stack .NET Core.
9. Choose the Region South Africa North.
10. Click Next: Hosting.
11. Choose the Storage account that we created before for our Visual Studio created
functions.
12. Choose the Operating System Windows.
13. Choose the Plan type Consumption.
14. Click Review + create.
15. Review the settings, and then click Create.
16. You will see a page indicating, "Your deployment is underway.” Wait for the process
to complete.
17. Click Go to resource.
© The Independent Institute of Education (Pty) Ltd 2023 Page 137 of 290
IIE Module Manual APPR6312
18. Click the Create new button (with the icon) next to Functions.
© The Independent Institute of Education (Pty) Ltd 2023 Page 138 of 290
IIE Module Manual APPR6312
25. Enter a Name for the new function. Let’s call it GetDJs.
26. Choose the Authorisation level Anonymous this time – anybody can view the list of
DJs.
27. Click Create.
The Azure portal contains all the features necessary to develop and test a function.
When we click on the function that we created in the portal, the source code for the
function is displayed. If you think back to the code generated by Visual Studio, you will
see that it looks familiar.
There are differences though. The most obvious one is that this time, there are no
attributes in the code to specify the trigger properties. So, how does the runtime know
what to do then?
© The Independent Institute of Education (Pty) Ltd 2023 Page 139 of 290
IIE Module Manual APPR6312
The values specified here are the same ones that were specified in the attributes in Visual
Studio.
• Newtonsoft.Json
• Microsoft.WindowsAzure.Storage
• Microsoft.ServiceBus
• Microsoft.AspNet.WebHooks.Receivers
• Microsoft.AspNet.WebHooks.Common
• Microsoft.Azure.NotificationHubs
There are two ways to edit the trigger and binding properties for a function.
We have already seen the config file that you can edit manually.
But there is also a graphical editor. Click Integrate under the function to open the editor.
© The Independent Institute of Education (Pty) Ltd 2023 Page 140 of 290
IIE Module Manual APPR6312
When we developed a function using Visual Studio, we could run it locally to test it.
The Azure Portal provides similar functionality.
© The Independent Institute of Education (Pty) Ltd 2023 Page 141 of 290
IIE Module Manual APPR6312
Here, the default HTTP method was POST, instead of the GET we have been using.
So, we have now seen that the method really works using both methods.
If you are no longer using a function, it is a good idea to disable (or even delete) it so that
it won’t cost money for no reason.
To disable a function:
To delete a function:
© The Independent Institute of Education (Pty) Ltd 2023 Page 142 of 290
IIE Module Manual APPR6312
Here is a method that calls AddGig, based on the code from (Lazar, 2018).
For more examples, see the Recommended Additional Reading section below.
© The Independent Institute of Education (Pty) Ltd 2023 Page 143 of 290
IIE Module Manual APPR6312
6.8 Cleaning Up
When you are done with this learning unit, disable or delete any Azure resources that
you will no
longer be using. This will ensure that it doesn’t consume your free credit for no good
reason.
© The Independent Institute of Education (Pty) Ltd 2023 Page 144 of 290
IIE Module Manual APPR6312
Gailey, G. et. al, 2019b. Choose the right integration and automation services in Azure.
[Online]. Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
compare-logic-apps-ms-flow-webjobs
[Accessed 12 July 2021].
© The Independent Institute of Education (Pty) Ltd 2023 Page 145 of 290
IIE Module Manual APPR6312
Hollan, J., 2019. Using Entity Framework with Azure Functions. [Online]. Available at:
https://dev.to/azure/using-entity-framework-with-azure-functions-50aa [Accessed 12 July
2021].
Sbeeh, M., 2019. Create And Consume Azure Function From ASP.NET Core. [Online].
Available at: https://www.c-sharpcorner.com/article/create-and-consume-azure-function-
from-asp-net-core/ [Accessed 12 July 2021].
© The Independent Institute of Education (Pty) Ltd 2023 Page 146 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 147 of 290
IIE Module Manual APPR6312
1 Introduction
In Learning Unit 1, we looked at the software development methodologies used by teams.
But we also saw that there are tools that are used by software development teams in their
processes.
We have already explored Azure Boards, used to track project tasks.
2 Distributed Repositories
2.1 Shared Code Repositories
The main artifact that a software development team produces is the source code of the
software that they develop. And so, it makes sense that there should be tools that help
teams to manage this.
© The Independent Institute of Education (Pty) Ltd 2023 Page 148 of 290
IIE Module Manual APPR6312
Imagine for a moment a team of 10 developers working on the same code base. There
are hundreds
of files that form part of the source code already. And now the team is working together to
add a new
feature to the software. This means that they are working on closely related files, and it is
likely that
more than one person will want to make changes to the same files. This is called a
conflict, and a
version control system will help to merge these changes in a sensible way.
Version control systems store the history of all the changes ever made to the source
code. When new
bugs are unintentionally introduced during development, looking at the history of changes
can be a
very useful tool in discovering what caused the bug.
Additionally, storing the history means that the software as it was at a specific time can be
reproduced.
There are several best practices that will ensure that a version control system is used as
effectively
as possible:
• Commit frequently. The more often changes are committed, the better. (Atlassian,
n.d.)
• Don’t commit work that is not complete. Split up features into smaller parts, so that
you can
commit one complete part at a time. (Wallin, 2019)
• Generated sources and binaries should not be committed. Anything that contains
computer
specific files or items that are regenerated at compile time, should not be committed.
(Wallin, 2019)
• Pull before you make changes. If you work with the latest source code, it will help to
minimise
conflicts when you merge. (Atlassian, n.d.)
• Added detailed commit messages. If somebody looks at the history, the commit
messages will
make it easier to find a specific change. (Atlassian, n.d.)
• Check changes before committing. (Atlassian, n.d.)
© The Independent Institute of Education (Pty) Ltd 2023 Page 149 of 290
IIE Module Manual APPR6312
• Branch. Decide on a branching strategy, and then use it to isolate new features.
(Atlassian, n.d.)
• Work with a common process. The whole team should agree on how the source
process should
work, when to branch, etc. (Atlassian, n.d.)
2.2 Centralised vs Distributed Version Control
There are two types of version control systems: centralised and distributed. Some of the
most frequently used version control systems are shown in Figure 165, but this is by no
means an exhaustive list.
© The Independent Institute of Education (Pty) Ltd 2023 Page 150 of 290
IIE Module Manual APPR6312
A centralised version control system uses a client-server model. The server hosts a
single, central
copy of the source code. When a developer uses client software to check out a file for
modification,
it is locked and nobody else can check it out until that developer checks it back in.
(Cheshire, 2018)
The exact implementation of how this works vary from system to system, and that is
beyond the scope
of this module.
In centralised version control, each developer has a local working copy of the central
repository.
To contribute changes to the central repository, a developer needs to commit a change to
the
repository. All the other developers then need to update their source code to be in sync
with what is
now in the central repository. (Ernst, 2018)
Having local working copies means that developers can still view the source code even
while it is
locked. And in most cases, there is no technology in place to prohibit developers from
making
local changes. So, it is still possible to have local conflicts. Consider this scenario. Bob
checks out a
file and is busy modifying it. Sarah meanwhile also has a local working folder where she is
busy
making some experimental changes to the same file. Bob commits his change, and the
next time
Sarah updates to the latest from the server, she will have to resolve the conflicts between
her changes
and the incoming ones.
© The Independent Institute of Education (Pty) Ltd 2023 Page 151 of 290
IIE Module Manual APPR6312
Centralised version control systems are typically older systems, that are not used as often
anymore.
However, these systems do have some benefits (Cheshire, 2018):
• Centralised version control is easy to understand and use, since the process is
quite simple.
• It is easy to control access to source code since it is only necessary to configure
access at the
central server.
• It is possible to avoid merging different versions of the same file, by means of
processes
agreed on by the team.
In a distributed version control system, there are multiple repositories. Each workstation
has both a
local repository and a working copy of the source code. (Ernst, 2018)
The process to share changes with other developers is a little more complex. The exact
details differ
from system to system, so this will only be a general discussion. Details about Git will
follow in the next
section.
The typical process of sharing changes with the rest of the developers on a project starts
with first
committing to your local repository. Then you push the changes from your local repository
to a server
that has the master copy of the repository. The other developers pull the changes to their
local
© The Independent Institute of Education (Pty) Ltd 2023 Page 152 of 290
IIE Module Manual APPR6312
repositories, and then update their working folders. As you can see from this description
and
Figure 167, there is a whole additional level of activities involved here.
Distributed version control systems are more modern and have more features. (Ernst,
2018)
The main benefits of distributed version control systems are (Lubański, 2019):
• Better performance.
• No need to be connected to the network all the time.
• Improved handling of branching and merging.
For this module, we will only use Git. However, if you are interested in learning more
about the
differences between these two version control systems, read (Danielson, et al., 2017).
© The Independent Institute of Education (Pty) Ltd 2023 Page 153 of 290
IIE Module Manual APPR6312
The web interface provides a lot of useful information. We will look at the different aspects
in more
detail as we explore how to use the features. For now, it is useful to note that it is possible
to create
and access more repositories than just the default one that was created with the project.
© The Independent Institute of Education (Pty) Ltd 2023 Page 154 of 290
IIE Module Manual APPR6312
.gitignore is a file that specifies which files to exclude from the repository. The templates
provided here
will add, for example, the binary file location, to ensure that those files will never
accidentally get
committed. You can edit this later.
7. Click Create.
8. The existing and new repositories now both appear on the list under the
breadcrumbs.
© The Independent Institute of Education (Pty) Ltd 2023 Page 155 of 290
IIE Module Manual APPR6312
When working with Azure Repos Git repositories, there are two standard sets of tools that
can be used
to work with the repositories:
Whether to use the command-line tools or integrated Visual Studio user interface is
largely a matter of
developer preference. In this module manual, we will present both ways of working.
Beyond these standard tools, there are also numerous other graphical user interfaces
(GUIs) such as
TortoiseGit (a Windows shell extension for Git, available from https://tortoisegit.org). See
(Git, n.d.) for
a list of these tools. The use of these tools is beyond the scope of this module.
The command-line tools require separate installation from Visual Studio. However, Visual
Studio does
make it easy to download these tools.
© The Independent Institute of Education (Pty) Ltd 2023 Page 156 of 290
IIE Module Manual APPR6312
4. The license terms for the third-party tools will be displayed. Read it carefully and
then click Install.
5. The Git download page will be opened in your browser, and the download will start
automatically.
Wait for it to complete.
6. Once the download is complete, run the installer and follow the prompts. Use the
default settings
except for the default text editor, if you want to choose something else.
Once the tools are installed, the Install 3rd-party Git tools link will no longer appear in
Visual Studio.
Now we can access the command prompt for the project.
© The Independent Institute of Education (Pty) Ltd 2023 Page 157 of 290
IIE Module Manual APPR6312
1. In the Team Explorer, click the drop-down box where the project name appears.
2. Click Projects and then Manage Connections.
© The Independent Institute of Education (Pty) Ltd 2023 Page 158 of 290
IIE Module Manual APPR6312
4. A command prompt window will be opened in the folder where the project source
code is stored.
This is the command prompt window that you will need to use to execute all the
commands
described later in this learning unit.
“A Git Workflow is a recipe or recommendation for how to use Git to accomplish work in a
consistent and productive manner.” (Atlassian, n.d. b)
There are several different workflows that have been described. And remember that the
definition
above says that it is only a recommendation. That means that teams can and do decide to
make
changes to the basic processes.
If there are so many possible options, how do we evaluate them? There are three points
to consider
(Atlassian, n.d. b):
In the centralised workflow, all the changes are made to the development branch master.
If two developers are working on the same code, they start by both cloning the central
repository.
Both developers then make changes and commit their changes to their local
repositories.
(Atlassian, n.d. b)
So far, this will seem quite familiar. It is exactly what we described in the distributed
version control
discussion. Figure 177 shows again what that process looked like.
© The Independent Institute of Education (Pty) Ltd 2023 Page 159 of 290
IIE Module Manual APPR6312
When the first developer decides to share their changes, they push to the master branch
in the central
repository. No other changes have been made yet, so there are no conflicts to resolve.
(Atlassian, n.d. b)
When the second developer now decides to also push, Git will indicate that there is a
conflict.
The second developer first needs to pull the changes from the central repository.
Git has the option to also rebase, which means that the second developer’s changes will
get applied
after all the changes that were pulled. After resolving any conflicts caused by the incoming
changes,
the changes can then also be pushed to the master branch of the central repository.
(Atlassian, n.d. b)
The feature branching workflow builds on the centralised workflow. The difference is that
feature
development is done on a branch that is dedicated to that feature. The code will only get
merged to the
master branch when it is done, which means that the master branch should never contain
broken code.
(Atlassian, n.d. c)
In this workflow, a branch with a descriptive name is created for each feature (or bug) that
is worked on
Developers can commit and push in the same way to this new branch as they would on
the master
branch.
When the development is done, a pull request is created. This invites feedback from the
team before
© The Independent Institute of Education (Pty) Ltd 2023 Page 160 of 290
IIE Module Manual APPR6312
This is the recommended workflow to get started with in Azure Repos. (Danielson, 2018)
The GitFlow workflow defines several specific branches and how they interact, including
hotfixes, release branches, develop and then finally the feature branches that we know
already. (Driessen, 2010)
© The Independent Institute of Education (Pty) Ltd 2023 Page 161 of 290
IIE Module Manual APPR6312
In the forking workflow, each developer also has their own server-side repository.
This adds an extra layer to the process. To start working, a developer first creates a fork
(which is essentially just a server-side clone) of the central repository. Then a local clone
is created,
and everything proceeds as before with the feature branching workflow. Once the feature
is complete
and pushed to the developer’s own server-side repository, a pull request is created from
the feature
branch on the server to the official central repository. (Atlassian, n.b. d)
This workflow is often seen in open-source projects, where developers can contribute to
public
repositories in this way. (Atlassian, n.b. d)
We will be focussing on the feature branching workflow in this module. But since that is
based on the
centralised workflow, the first steps are the same.
3. Go to the Files view for the repository and click Clone (top-right corner of the page).
© The Independent Institute of Education (Pty) Ltd 2023 Page 162 of 290
IIE Module Manual APPR6312
You will be prompted to log in with the account that you are using for Azure DevOps.
1. Create the folder where you want to store the clone (the parent folder, not including
the name of
the actual repository).
2. Open a command prompt (or PowerShell) window and change to the folder.
3. Run the following command (replacing <repository URL> with the URL that you
copied earlier):
© The Independent Institute of Education (Pty) Ltd 2023 Page 163 of 290
IIE Module Manual APPR6312
• If your repository is completely empty, expect to see the warning message as shown
in
Figure 181.
• If you have trouble with authentication using this method for the first time,
read (Danielson, et al., 2018b).
• For more information about the other parameters that you can pass to the git clone
command,
read (Atlassian, n.d. e).
Let’s look at the contents of the folder where we checked out Second Repository. If you
show hidden
files and folders, you will see the contents as in Figure 182, including the hidden folder
called. git.
This is the folder where the local repository with all the version history is stored. You never
need to
interact directly with the contents of that folder. But it is useful know what it is.
The working copy of the files that are in the repository are located next to the. git folder.
Our newly
created repository at this point only contains the README.md file that was created as part
of the
repository creation process.
According to the feature branching workflow, the next step is to create a branch. And that
makes
© The Independent Institute of Education (Pty) Ltd 2023 Page 164 of 290
IIE Module Manual APPR6312
perfect sense unless the repository is still empty. So, lets create a project first before we
branch for
the first time.
There are two ways to get a new project into the central repository for the first time:
• Create the project, initialise a local repository, and connect that to the Azure Repos
Git
repository. See (Danielson, et al., 2018b) for more details.
• Clone the empty repository, create, and commit the project, and push it to the Azure
Repos Git
repository.
Since we have already cloned the repository, let’s do the second option here. That also
gives us the
perfect opportunity for looking at staging, committing and rollback.
If you cloned your repository using the command-line tools, you can still open it in Visual
Studio and
continue working with it there too. Both the command-line tools and Visual Studio end up
writing the
changes to the same. git folder. So, you can use them interchangeably.
© The Independent Institute of Education (Pty) Ltd 2023 Page 165 of 290
IIE Module Manual APPR6312
Now I have two repositories in Visual Studio, since I cloned Some Company Project
using the
command-line tools and Second Repository using Visual Studio.
Tip: If you have multiple repositories, especially if they are both empty (or very similar),
make sure that
you are working with the right one!
© The Independent Institute of Education (Pty) Ltd 2023 Page 166 of 290
IIE Module Manual APPR6312
A .gitignore file is necessary to avoid committing files that should only be stored on the
local machine,
including binary files. If you didn’t add one when you created the repository using Azure
Boards, it is very easy to do in Visual Studio.
3. Under Ignore & Attribute Files, next to Ignore File, click Add.
If you want to see what is in the file, click Edit. The file will be opened in Visual Studio, in
a new editor window.
© The Independent Institute of Education (Pty) Ltd 2023 Page 167 of 290
IIE Module Manual APPR6312
2.6.4 Staging
“The staging area is best described as a preview of your next commit. Meaning, when you
do a git
commit, git will take the changes that are in the staging area and make the new commit out
of those
changes.” (Spajic, 2018)
When new files are added, or changes are made to existing files, the changes are first
added as a part
of the staged changes. This means that you can choose which of the changes to the local
working
folder need to be included for the next commit.
© The Independent Institute of Education (Pty) Ltd 2023 Page 168 of 290
IIE Module Manual APPR6312
You might have some changes that are not ready to be committed or are even not
supposed to be
committed ever. Those can be excluded by not staging them.
Note that Visual Studio has automatically staged the .gitignore file that we created
earlier.
© The Independent Institute of Education (Pty) Ltd 2023 Page 169 of 290
IIE Module Manual APPR6312
You can also choose to unstage files, either one by one by right-clicking, or all by clicking
Unstage all
(with the icon next to Staged Changes).
There is also a stash facility (sometimes called shelving). This is useful when you are
working on
something and then must change to a different task. You can keep the changes in your
stash and get
them back again later. (Atlassian, n.d. f)
1. Run the following command to see what the status of the repository is:
git status
Here we also see that Visual Studio has automatically staged the .gitignore file that we
created
earlier.
2. To add all the files in the MyPrettyWebApp folder, run the following command:
3. Now run git status again, and you will see a long list of files that have been
staged.
In these steps, we simply added all the files for our newly created project. But remember,
usually you
want to be specific about which changes to include. It is better to check carefully what you
stage than
having to revert changes later.
© The Independent Institute of Education (Pty) Ltd 2023 Page 170 of 290
IIE Module Manual APPR6312
There is also an interactive command-line tool used for staging. Read (Git, n.d. b) for
information about
this tool.
To stash changes from the command-line, use the command git stash. Read
(Atlassian, n.d. f) for
more information.
2.6.5 Committing
Now that we have all the changes staged, we are ready to make a commit. What is a
commit?
“The git commit command captures a snapshot of the project’s currently staged changes.
Committed
snapshots can be thought of as ‘safe’ versions of a project – Git will never change them
unless you
explicitly ask it to.” (Atlassian, n.d. g)
We see that a commit contains a snapshot of the files that are being committed. This
makes it different
to other version control systems such as Subversion, which saves only the differences.
(Atlassian, n.d. g)
2. Enter a commit message with enough detail for future developers to understand
what you did.
3. Click Commit Staged.
© The Independent Institute of Education (Pty) Ltd 2023 Page 171 of 290
IIE Module Manual APPR6312
To continue working with the same folder for the command-line instructions, I modified the
Index.cshtml file and staged it.
2. You will see a message indicating how many files and changes are included in the
commit.
3. If you now run git status again, you will see that we now have two commits.
2.6.6 Rollback
If you decide that a commit needs to be removed for some reason, you can revert it. What
git does in
this process is to create a new commit that undoes the changes. (Costa, 2018)
© The Independent Institute of Education (Pty) Ltd 2023 Page 172 of 290
IIE Module Manual APPR6312
3. In the History window, right-click the commit that you want to revert and click
Revert.
4. A message will ask you whether you are sure you want to revert. Click Yes.
5. Click Refresh (with the icon) to update the history.
For this discussed, I added another commit so that we can revert that using the
command-line tools.
© The Independent Institute of Education (Pty) Ltd 2023 Page 173 of 290
IIE Module Manual APPR6312
1. Run the following command to find the hash of the commit that you want to revert:
If we want to revert the first commit, we will use hash 5456cec. Note that this will very likely
be different
for your repository – so run the log command, don’t try to use my hash.
3. The default editor will be opened. Edit the commit comment if you want to and close
the editor.
(How to do this depends on your chosen editor.)
4. Run git log –oneline again to see the revert commit.
Everything that we have done so far was only on the local clone of the repository. Now it
is time to
share our changes with the central repository hosted at Azure DevOps.
1. Open the Sync (Synchronization for full) view of the Team Explorer.
© The Independent Institute of Education (Pty) Ltd 2023 Page 174 of 290
IIE Module Manual APPR6312
3. During synchronisation, a progress bar will be displayed. Wait for the process to
complete.
Now we can go have a look at the Git repository in the Azure Repos web interface.
And we will see all our commits there!
© The Independent Institute of Education (Pty) Ltd 2023 Page 175 of 290
IIE Module Manual APPR6312
This is all great if nobody else is working on the source code. But in practice that is very
unlikely.
How do we get the changes made by the rest of the team? By pulling their commits from
the central
repository.
1. Open the Sync (Synchronization for full) view of the Team Explorer.
2. Under Incoming Commits, click Fetch.
3. A list of all the incoming commits will be displayed. Click Pull to pull these commits
to the local
© The Independent Institute of Education (Pty) Ltd 2023 Page 176 of 290
IIE Module Manual APPR6312
Now if we refresh the History tab, we will see that the new change that was made by
somebody else,
appears in our local history.
And if we look at the contents of the readme file, we will see that we have the changes
made in the
changeset in our working copy.
To pull commits using the command-line tools:
1. Run the following command to fetch the remote commits and merge it into the local
working copy
(Atlassian, n.d. h):
For more information about the git pull command, read (Atlassian, n.d. h).
It is recommended to always pull the latest before starting any new work. This will help
to avoid conflicts.
2.7.3 Rebasing
What happens when you have made commits and somebody else has already pushed
changes to the
central repository? When you try to push, you will get an error message indicating that you
must pull
first.
© The Independent Institute of Education (Pty) Ltd 2023 Page 177 of 290
IIE Module Manual APPR6312
If you just pull using Visual Studio, it will automatically merge changes, creating another
commit to
merge the changes. This results in the most complete history, as shown in Figure 207. But
it is more
complex than it could have been.
To avoid this, you can rebase your changes. Rebasing gets the latest commits, and then
apply your
local commits after that. It is important that the whole team agrees when to rebase, since
it can cause
loss of history. A good guideline is to only rebase commits that you haven’t pushed yet.
(Danielson, et al., 2018c)
1. Open the Sync (Synchronization for full) view of the Team Explorer.
2. Under Incoming Commits, click Fetch. (Don’t pull!)
3. Open the Branches view of the Team Explorer.
© The Independent Institute of Education (Pty) Ltd 2023 Page 178 of 290
IIE Module Manual APPR6312
4. Click Rebase.
5. Choose to base Onto branch origin/master.
6. Click Rebase.
7. Switch back to the Sync view and Push your change.
To rebase using the command-line tools, you can use the command git pull --
rebase.
© The Independent Institute of Education (Pty) Ltd 2023 Page 179 of 290
IIE Module Manual APPR6312
2.8.1 Branching
You will see that the new branch now appears under the repository and is bold. This
means that you
are working on this branch.
To create a new branch using the command-line tools:
1. Run the following command to create a branch with the name home-page-revamp
2. (Atlassian, n.d. i):
3. This doesn’t checkout the branch. To do that, run the following command:
© The Independent Institute of Education (Pty) Ltd 2023 Page 180 of 290
IIE Module Manual APPR6312
For more information about git branch read (Atlassian, n.d. i).
Now that we have the branch created and checked out, we can work on our local copy.
And stage and commit as usual. When we commit, we can now see in the history that the
change is on
the home-page-revamp feature branch.
When we push our changes, the branch also gets created in the central repository. And
the changes
are not in the master branch at this point.
© The Independent Institute of Education (Pty) Ltd 2023 Page 181 of 290
IIE Module Manual APPR6312
2.8.3 Merging
There are two ways to get the changes made on a branch into the master branch:
merging and
creating pull requests. Both end up with the changes getting merged to the master branch,
but the pull
requests process allows for review of the changes before they get merged.
The pull requests method is better, since it provides the team with more control over when
things get
merged. So, we will only briefly discuss the merge method here.
1. In the Branches view of the Team Explorer, checkout the master branch by
double-clicking on it.
2. Right-click the master branch and click Merge From.
3. Choose the branch to merge from (in our case home-page-revamp) and click
Merge.
Now the change from the branch appears in the master branch in the Azure Repos Git
repository.
The process from starting to work on a feature to merging with the command-line tools is
shown in
Figure 215.
For this discussion, I have created a new branch called first-feature, with a single
commit.
This has been pushed to the central repository.
© The Independent Institute of Education (Pty) Ltd 2023 Page 182 of 290
IIE Module Manual APPR6312
4. You will see a message about updating a branch. Click Create a pull request next
to it.
5. Edit the Title and Description if you want to provide more information.
6. (Optional) Specify Reviewers and related Work Items.
7. Click Create.
© The Independent Institute of Education (Pty) Ltd 2023 Page 183 of 290
IIE Module Manual APPR6312
The purpose of pull requests is to allow for a review process before the code is merged to
the master
branch. This is particularly useful for open-source projects but can be used to good effect
in any
software development team.
There are a few options when reviewing pull requests. You can add comments, including
things that
need to be fixed before the changes will be allowed to be merged. You can choose to
approve the
request, approve it with suggestions, wait for the author or reject it outright.
Furthermore, you can complete the request (meaning that the merge will happen), mark it
as a draft or
abandon the request.
Let’s assume that we are happy with the changes and want to proceed with the merge.
© The Independent Institute of Education (Pty) Ltd 2023 Page 184 of 290
IIE Module Manual APPR6312
merging.
5. Click Complete merge.
After the completion of the pull request, we now see the result of the merge in the master
branch.
We can see which pull request was involved, so there is a complete history of how and
when this
happened.
Click on the pull request number in the Pull Request column of the Commits page to
access the
information.
© The Independent Institute of Education (Pty) Ltd 2023 Page 185 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 186 of 290
IIE Module Manual APPR6312
3 Continuous Builds
3.1 What is Continuous Integration?
This section was adapted from Learning Unit 5 of (The Independent Institute of Education,
2018).
Before DevOps, the development team typically developed and tested their software on
independent
environments. And once the software is done, the operations team would take over and
deploy the
software to the live servers. (TechTarget, 2017)
In DevOps, the idea is to bring development and operations closer together, so that the
same team
does the development and deployment. Typically, these deployments are automated as
much as
possible. (TechTarget, 2017)
On the DevOps continuum, there are three different levels: continuous integration,
continuous delivery.
and continuous deployment. (CollabNet, 2018b) In this learning unit, we are focussing
only on
continuous integration. We will look at the other two in Learning Unit 5. So, what is
continuous
integration?
If you haven’t worked on a large project with many developers before, you may not
appreciate the
value of continuous integration yet. In Section 2, we have already seen how to work with a
shared
repository. But even though we know how to branch and merge, we avoided for the most
part the
issues that can arise with merge conflicts.
Imagine for a moment a team of five developers all working on the same code base. If one
developer
© The Independent Institute of Education (Pty) Ltd 2023 Page 187 of 290
IIE Module Manual APPR6312
makes a change to an Application Programming Interface (API) but doesn’t check in that
change to the
repository for a couple of days, the next time that they commit code a lot of other people’s
work is likely
to no longer compile, let alone work.
Because they were still blissfully unaware of the change in API and were coding against
the old version.
The longer a developer neglects to push code, the more likely conflicts become when the
code is
merged. And while modern source control tools do help with merging, it is not a position
that
developers should get themselves into in the first place.
The second part of the definition mentions that check-ins (commits that are pushed in Git)
are checked
using an automated build. Building the source code using an automated build tool
eliminates the type
of problems that can happen where “it works on my PC!” For example, if a developer
forgets to check
in a new file, the build will work perfectly well on the developer’s own PC. But when the
build server
tries to build it, the missing file will cause the build to fail.
© The Independent Institute of Education (Pty) Ltd 2023 Page 188 of 290
IIE Module Manual APPR6312
Figure 221 shows the basic steps taken by a developer, the build agent (automated build
process) and
the release agent (automated deployment process) to develop, continuously integrate and
continuously deploy software.
3.2 Benefits of Continuous Integration
We have already seen some of the benefits of continuous integration in the discussion of
the definition
above. Here is a more complete list. Some of these items assume that we have
continuous automated
testing in place too. (We will look at the details of this in Learning Unit 4. For now, assume
that we
have automated tests.)
Included in the free offering for Azure Pipelines (as of 1 January 2020), is one Microsoft-
hosted CI/CD
© The Independent Institute of Education (Pty) Ltd 2023 Page 189 of 290
IIE Module Manual APPR6312
agent, with 1 800 minutes per month with one parallel job. (See Figure 222 for a
screenshot of the
relevant pricing page.) This should be more than enough for our purposes.
© The Independent Institute of Education (Pty) Ltd 2023 Page 190 of 290
IIE Module Manual APPR6312
6. Select the repository with the source code that we want to build – Second
Repository.
7. Lots of predefined configuration are available, including a configuration that works
perfectly for
us – ASP.NET Core. Choose that as the configuration.
8. The pipeline configuration will be displayed. Edit the script line to include the
location of the
solution file in the repository.
© The Independent Institute of Education (Pty) Ltd 2023 Page 191 of 290
IIE Module Manual APPR6312
You will see the below page displaying the status of the build job as it progresses.
After a while (one minute, 23 seconds in this case), the build should complete
successfully.
Click Job to see the detailed results, including the command line output of the various
tasks.
To edit a pipeline:
This editor (shown in Figure 228) provides the possibility of editing the configuration
manually,
or to select a task to perform during the build from a long list of tasks that have been
predefined.
© The Independent Institute of Education (Pty) Ltd 2023 Page 192 of 290
IIE Module Manual APPR6312
To add a task:
1. Put your cursor at the location where you want to insert the task.
2. Click the desired task on the Tasks list.
3. Specify any parameters required by the task.
4. Click Add.
The details of the many tasks are beyond the scope of this module. Search online if you
need more
information about any specific task.
A build can be triggered manually, by clicking Run pipeline on the pipeline’s page in
Azure DevOps.
© The Independent Institute of Education (Pty) Ltd 2023 Page 193 of 290
IIE Module Manual APPR6312
Here we can see that the pipeline will indeed run when code is pushed to the Second
Repository.
It is also possible to set up scheduled builds. This is often used to create a nightly build.
And it is also possible to start this build when another build completes.
© The Independent Institute of Education (Pty) Ltd 2023 Page 194 of 290
IIE Module Manual APPR6312
A build agent is an installable piece of software that performs build job tasks. There are
two options for
agents: Microsoft-hosted or self-hosted. The Microsoft-hosted option makes it easy.
Every time a job is started, a new VM is automatically created for the duration, and
destroyed at the
end of the job execution. (Staheli, et al., 2019)
It is also possible to host your own build agent. The software is available for macOS,
Linux, Windows
and as a Docker image. This provides a great deal of flexibility since you control
everything on the
environment where the build agent runs. But in turn, it adds the complexity of having to
manage
everything yourself. (Staheli, et al., 2019)
Each agent has a set of capabilities that are either automatically defined by the system or
explicitly
added by the user. When you create a pipeline, it will require specific capabilities. And
Azure Pipelines
will match the agent that has the right capabilities with each pipeline. (Staheli, et al., 2019)
The agent pools can be set up in the organisation settings in Azure DevOps. For more
information
about how to do that, read (Staheli, et al., 2019).
© The Independent Institute of Education (Pty) Ltd 2023 Page 195 of 290
IIE Module Manual APPR6312
4 Package Hosting
4.1 What are Azure Artifacts?
When we were using SqlClient and Entity Framework in Learning Unit 2, we made use of
NuGet to get
these packages. But have you ever wondered what happens when you do that?
“NuGet is the package manager for .NET. The NuGet client tools provide the ability to
produce and
consume packages.” (Microsoft, n.d. h)
It is also useful to note that each NuGet package has a license under which it is released.
Make sure
that the license is compatible with how you intend to use the package. Get legal advice if
you are unsure about a software license.
© The Independent Institute of Education (Pty) Ltd 2023 Page 196 of 290
IIE Module Manual APPR6312
The point of having a central repository of packages is to make the packages easily
accessible to
everybody. You don’t need to keep local copies of packages because they are always
available.
But there are two cases that go beyond this simple statement.
What if you are building software that is absolutely critical to the operation of your
business, and one
day one of the packages are just no longer available from the central NuGet repository?
Or the central
repository is not accessible for some reason. This scenario is unlikely, but not impossible.
Some
organisations would choose to keep their own copies of critical packages for this reason.
(Microsoft, n.d. j)
The second reason why it may be desirable to have a private repository for packages, is if
you want to
share packages between various projects internal to the company. These packages are
not suitable
for hosting publicly in most cases, so having a private repository is the way to go.
(Microsoft, n.d. j)
Azure Artifacts is a package repository that can handle both use cases. NuGet packages
can be
stored in Azure Artifacts, and then the Azure Pipelines get any packages from there
instead of from the
central NuGet repository. (Microsoft, n.d. j)
Azure Artifacts goes beyond just NuGet though. It can also store Maven, npm and Python
packages.
And you can host your own packages, which will simplify builds.
© The Independent Institute of Education (Pty) Ltd 2023 Page 197 of 290
IIE Module Manual APPR6312
Note that there is a limit on the free storage provided in Azure Artifacts – 2GB as of
January 2020.
(Wilson & chcomley, 2019) This should be more than enough for our purposes.
• Public packages are safely stored, so that builds don’t need to depend on third party
sources.
(Microsoft, n.d. j)
• Sharing packages between projects can simplify the build process. (Microsoft, n.d. j)
• Packages can selectively be shared with third parties. (Dixon, 2018)
• One feed can host artefacts from multiple sources. (Microsoft, n.d. j)
© The Independent Institute of Education (Pty) Ltd 2023 Page 198 of 290
IIE Module Manual APPR6312
Before we jump into the best practices, there are two definitions that we need first.
“Views enable you to share subsets of the NuGet, npm, Maven, and Python package-
versions in your
feed with consumers.” (Batkoski, et al., 2017)
The best practices for creating packages are (Danielson, et al., 2018d):
The best practices for consuming packages are (Danielson, et al., 2018d):
© The Independent Institute of Education (Pty) Ltd 2023 Page 199 of 290
IIE Module Manual APPR6312
When we created our feed, we chose to add the common public sources, which includes
NuGet.
This means that adding upstream sources will likely only be necessary if we want to
include feeds
from elsewhere in our organisation.
2. Select the feed that you want to edit and click Settings (with the icon).
3. Click Feed settings.
© The Independent Institute of Education (Pty) Ltd 2023 Page 200 of 290
IIE Module Manual APPR6312
The Azure Artifacts web interface provides us with a lot of information about consuming
packages from
a feed. Click Connect to feed and then choose Visual Studio.
The instructions as displayed in Figure 236 will be displayed, with the source URL for your
repository
of course.
© The Independent Institute of Education (Pty) Ltd 2023 Page 201 of 290
IIE Module Manual APPR6312
Follow these instructions to set up the feed. Read (Wilson, et al., 2018) if you need more
details.
1. In Solution Explorer, right-click the project and choose Manage NuGet Packages.
2. In the top-right corner of the NuGet window, change the Package source to be the
newly configured source.
Any existing packages should be handled seamlessly since we saw that NuGet was
included as one of the upstream sources.
© The Independent Institute of Education (Pty) Ltd 2023 Page 202 of 290
IIE Module Manual APPR6312
There is one gotcha with using packages from upstream sources in Visual Studio. The
first time you use a package, it gets added to the feed. And from that point, you can
browse for the package just as you would have with the central NuGet repository. The
trick is that the first usage requires installing the package using the command line.
(Wilson, et al., 2018)
1. Browse to the upstream source and copy the Install-Package command. For NuGet,
it appears in the dark blue block close to the title of the page. (See Figure 231 for an
example.) For this discussion, let’s say we want to install Newtonsoft.Json. The
Install-Package command is:
2. In Visual Studio on the main menu click Tools, then NuGet Package Manager and
then Package Manager Console.
3. Paste the command and press Enter to run it.
2. Add a blank line before the script step and put the cursor on that line.
3. Under Tasks, search for NuGet.
4. Click the task that is just named NuGet.
© The Independent Institute of Education (Pty) Ltd 2023 Page 203 of 290
IIE Module Manual APPR6312
The NuGetCommand@2 restore will not complete within the one-hour time limit that
there is on a build. But what this has provided us is the vstsFeed variable. Continue with
the steps on the next page to change this to a DotNetCoreCLI@2 task instead.
10. Edit the newly created task to look like the below but using your vstsFeed variable
(make sure to keep that!). Configuration from (Shigihalli, 2019).
- task: DotNetCoreCLI@2
displayName: 'dotnet restore from feed'
inputs:
command: restore
© The Independent Institute of Education (Pty) Ltd 2023 Page 204 of 290
IIE Module Manual APPR6312
projects: '**/*.csproj'
vstsFeed: '<your feed here>'
includeNuGetOrg: false
versioningScheme: byBuildNumber
Tip: If you run into version incompatibility issues in your build after this change, remove
the Microsoft package.AspNetCode. Razor. Design from the project.
Just like we can consume different types of packages from Azure Artifacts, it is also
possible to publish different types of artifacts. We will look at two types: NuGet packages
and Universal packages. Universal packages are the Azure Artifacts' way to store any files
regardless of type.
There are two ways to build a .NET Core project using Azure pipelines. The way that the
Azure Pipeline template uses the script step. Another way, which is more flexible, is to use
DotNetCoreCLI@2 tasks. Read (Cokely, 2019) for information about how to do that.
NuGet packages contain reusable code. So, for this purpose, the web app that we have
been working with so far is not the best thing to work with. Let’s create a new project for
this purpose.
1. Using Visual Studio, create a new Class Library (.NET Core) project called
Company Library in the same solution that we have worked with so far.
2. In the Solution Explorer, right-click the CompanyLibrary project and click
Properties.
3. Change the Target framework to .NET Core 5.0.
4. Click the Package category.
5. Click to select the Generate NuGet package on build checkbox.
6. Change any of the package properties such as Authors if you want to.
7. Save the changes and close the project properties window.
8. Commit and push the changes to the master branch.
9. Check that the existing Azure Pipeline build still passes.
When the script step is called in the pipeline, the NuGet package will automatically also be
built. But you can also see it when you build the project from Visual Studio.
© The Independent Institute of Education (Pty) Ltd 2023 Page 205 of 290
IIE Module Manual APPR6312
Now we need to update the pipeline to push the NuGet package to Azure Artifacts. Open
the configuration and add the following task at the end of the file. Task configuration
adapted from (Cokely, 2019).
- task: NuGetCommand@2
displayName: 'nuget push'
inputs:
command: 'push'
feedsToUse: 'select'
packagesToPush:
'$(Build.SourcesDirectory)/**/*.nupkg;!$(Build.SourcesDirectory)/**/*.symbols.n
upkg'
nuGetFeedType: 'internal'
publishVstsFeed: '<your feed here>'
versioningScheme: 'off'
allowPackageConflicts: true
Note that packagesToPush needs to be all on one line after you copy it, as shown in
Figure 241. And remember to put that long identifier of your feed in too.
Save the configuration and wait for the build job to complete. Check that the build is still
succeeding.
Browse to your Azure Artifacts feed and you will see that the new artifact is now available
as shown in Figure 242. Notice how the source is This feed, which distinguishes it from
the packages that were pulled from the NuGet Gallery – the public NuGet repository.
As mentioned earlier, there is also the possibility of publishing anything that you want as a
Universal package. As an example, let’s publish the README.md file from the source
code.
© The Independent Institute of Education (Pty) Ltd 2023 Page 206 of 290
IIE Module Manual APPR6312
Add the following task to the pipeline configuration. Configuration based on (KathrynEE, et
al., 2019d).
- task: UniversalPackages@0
displayName: Universal Publish
inputs:
command: publish
publishDirectory: '$(Build.SourcesDirectory)/README.md'
feedsToUsePublish: internal
vstsFeedPublish: '<your feed here>'
vstsFeedPackagePublish: 'company-website-readme'
packagePublishDescription: 'Readme file'
Note that the package name must be lowercase alphanumeric and may contain dots and
dashes.
© The Independent Institute of Education (Pty) Ltd 2023 Page 207 of 290
IIE Module Manual APPR6312
You might have noticed that there are variables like $(Build.SourcesDirectory) that
are used in these configurations. Read (Staheli, et al., 2019b) for the full list.
Danielson, S. et al. 2018. Adopt a Git branching strategy. [Online]. Available at:
https://docs.microsoft.com/en-us/azure/devops/repos/git/git-branching-
guidance?view=azure-devops [Accessed 13 July 2021].
Ernst, M., 2018. Version control concepts and best practices. [Online]. Available at:
https://homes.cs.washington.edu/~mernst/advice/version-control.html [Accessed 13 July
2021].
It is recommended that you complete the Build applications with Azure DevOps learning
path on Microsoft Learn, available at https://docs.microsoft.com/en-gb/learn/paths/build-
applications-with-azure-devops/
It is recommended that you complete the Manage build dependencies with Azure Artifacts
module on Microsoft Learn, available at https://docs.microsoft.com/en-gb/learn/modules/
manage-build-dependencies/
© The Independent Institute of Education (Pty) Ltd 2023 Page 208 of 290
IIE Module Manual APPR6312
1 Introduction
In Learning Unit 3, we mentioned that quite a few of the benefits of continuous integration
depend on continuous testing being in place. In this learning unit, we will explore various
types of automated testing:
• Unit testing;
• Integration testing;
• Load and stress testing; and
• User interface testing.
© The Independent Institute of Education (Pty) Ltd 2023 Page 209 of 290
IIE Module Manual APPR6312
2 Unit Testing
2.1 What is a Unit Test?
Unit tests have been around for a long time, and as Martin Fowler points out, there have
been many definitions that have been used. Here are the common elements that he lists
across all the definitions that he has come across (Fowler, 2014):
• Unit tests are designed to test only a small part of the system.
• Software developers write the unit tests using a unit testing framework inside their
normal tools.
• Unit tests should be much faster to run than higher-level tests.
The idea is to test a small, isolated part of the software to see if it works as expected. This
makes it easier to find errors, since there are as few as possible complex interactions in a
small piece of code. (Novoseltseva, 2019)
Exactly what the boundary is of such a small part of a system that is called a unit,
depends on the technology and the decisions made by a software development team.
(Fowler, 2014) The fact that the tests should be running very fast does provide some
guidelines, though. For example, calling a service or accessing a database are notoriously
slow operations. That would be more appropriate in an integration test (see the next
section of this learning unit for more information).
A good unit test should be repeatable. Multiple runs of the test should always return the
same result. (Reese, et al., 2018) This is important since the order in which tests are
executed is not guaranteed. And if you write good tests, that shouldn’t matter.
© The Independent Institute of Education (Pty) Ltd 2023 Page 210 of 290
IIE Module Manual APPR6312
We have already established that software developers write the unit tests. There are two
possibilities in terms of timing: writing tests before or after writing the code that it tests.
Writing the tests first might sound very strange. But in Test Driven Development (TDD)
that is precisely the approach. You write the unit test first to reflect the requirement you
want to implement. And then you execute the code until the unit test passes. (Farcic,
2013)
Badly designed code can be hard or even impossible to unit test. Read (Kolodiy, n.d.) for
an excellent discussion about how to write testable code.
Remember in Scrum, we mentioned that there is a definition of done that is agreed on?
If a team commits to doing unit testing, it is a good idea to include unit tests in the
definition of done for both new features and fixing bugs. (Riggins, 2017) Developers
should run the unit tests before they push changes to ensure that they haven’t caused
any regressions. And the unit tests should be executed during all builds.
The definition also mentioned that there are unit testing frameworks that are used to
create unit tests.
Unit testing frameworks “are software tools to support writing and running unit tests,
including a foundation on which to build tests and the functionality to execute the tests and
report their results.” (Hamill, 2004)
It is possible, of course, to do everything yourself, from the details of the tests to creating
a webpage with the test results. But that would be a large amount of unnecessary effort
for no good reason, since testing frameworks exist that will greatly simplify the process.
Unit test frameworks have been around for a long time, and there are different possibilities
to choose from when working with C# (Dietrich, 2017):
Which framework to choose depends on the requirements of the project. Read (Mathurin,
2018) for an interesting discussion about what influenced their team’s decision.
For the purpose of this module, we will use MSTest since it is the Microsoft product, and it
will illustrate the concepts around unit testing that can be applied to other frameworks too.
© The Independent Institute of Education (Pty) Ltd 2023 Page 211 of 290
IIE Module Manual APPR6312
• Developers can refactor code without fear of breaking something, since the unit
tests will catch any issues. (Novoseltseva, 2019)
• Writing tests with the code will improve code quality since it will make you think
about all the use cases for the code. (Novoseltseva, 2019)
• Bugs in the code are found very early, before they impact other parts of the
system. (Novoseltseva, 2019)
• Finding bugs early in the development process means the cost of writing software is
lower. (Novoseltseva, 2019)
• Unit tests are automated tests, which means that unlike manual testing, they can
be run as often as necessary once they have been written. (Grantz, 2017)
• Unit test code can be viewed as a form of documentation describing what the
intended behaviour of a piece of code is. (Grantz, 2017)
• Code coupling will be reduced since writing tests will mean that any tight coupling
will become obvious. (Reese, et al., 2018)
In this section, we are focussing on how to use MSTest. So, we will create some code first
and then add unit tests to check whether the code works as expected.
Create a new .NET Core Class Library project called UnitTestExperiments. Add the
below class to the project.
© The Independent Institute of Education (Pty) Ltd 2023 Page 212 of 290
IIE Module Manual APPR6312
When creating tests, it is best to have a test project for each code project. (Dietrich, 2017)
In the same solution, create a new project. Choose the MSTest Test Project (.NET Core)
project template. Call the project UnitTestExperiments_Tests.
You will see that a unit test file called UnitTest1.cs is created as a part of the project. It is
a C# class, but what distinguishes it is the fact that it has the [TestClass] attribute. And
the test method has the [TestMethod] attribute. This is how the MSTest framework
knows to execute the methods as unit tests.
In the test project, create a new C# class called CalculatorTests. Remember to add the
using statement to access the test tools (have a look at UnitTest1.cs):
using Microsoft.VisualStudio.TestTools.UnitTesting;
Important! Make the CalculatorTests class public, otherwise, the tests won’t be executed.
(ElGauchooo, 2014)
We are ready to create our first unit test. Let’s focus on the Add method first, and let’s
check that adding zero and one will return one.
It is best practice to name the unit tests in a specific way. The name should contain three
things (Reese, et al., 2018):
• Method that is being tested;
• Scenario that is tested; and
• The expected outcome.
If you look at the list of all the tests, you should be able to know what the purpose of each
test is without looking at the code. (Reese, et al., 2018)
[TestMethod]
public void Add_ZeroPlusOne_ReturnsOne()
{
}
We know three things from the name: we are testing the add method, adding zero and
one and expecting the method to return one.
© The Independent Institute of Education (Pty) Ltd 2023 Page 213 of 290
IIE Module Manual APPR6312
Now that we have the project, class and method in place, we can write the actual test
code. When it comes to structuring a test, there is a common pattern that is considered
best practice (Reese, et al., 2018):
• Arrange – create and initialise any objects and variables that you will need.
• Act – do something with the object that you are testing.
• Assert – check that the expected behaviour happened.
// act
int actual = calculator. Add(ZERO, ONE);
// assert
Assert.AreEqual(ONE, actual);
}
In the arrange section, we initialise everything. We will be testing the Calculator class, so
we will create an instance of it.
We also define two constants for the values zero and one. Here it might seem silly since
the values are so obvious, but it is best practice to avoid magic values. If you are working
with the maximum allowed value, for example, create a constant with the name
MAXIMUM_VALUE. Be as descriptive as possible with the constant names since it makes
the tests easier to understand. (Reese, et al., 2018)
The act section of this test is simple since the example is so trivial. We pass the two
parameters to the method and store the return value in a variable called actual. It is useful
to call this actual, so you don’t confuse the actual and expected values.
Lastly, we assert that the answer is what we expected. MSTest provides a lot of useful
assert methods in the Assert class, for example (Microsoft, n.d. k):
• AreEqual – checks whether the parameters are equal, and throws an exception if
they are not;
• AreNotEqual – checks whether the parameters are not equal, and throws an
exception if they are not;
• AreSame – checks whether the parameters are references to the same object and
throws an exception if they are not.
© The Independent Institute of Education (Pty) Ltd 2023 Page 214 of 290
IIE Module Manual APPR6312
Read the documentation for the Assert class (Microsoft, n.d. k) for the full list.
In MSTest, the expected value should be specified first and the actual value second.
Otherwise, the error messages will not make sense.
As an exercise, write a unit test that tests the subtract method in the scenario where you
subtract a number from itself (e.g., six minus six) and expect to get an answer of zero.
To run all the unit tests in the project, right-click the test project and click Run Tests.
Tests can also be executed for a specific test class by right-clicking on the class.
The add test will pass. The subtract test will fail, since we included the intentional error
that the subtract method adds. This kind of error is typically due to code that was copied
and not fully modified.
2.4 Test Explorer
The test results are shown in the Test Explorer window, which will automatically be
opened when you run tests for the first time.
On the left we see a hierarchy of all the tests – project, class and method. The red x icon (
) indicates that a test failed. As expected, the subtract test fails right now.
Clicking on a test in the hierarchy will display details about it in the Test Detail Summary
panel on the right. Looking at the message, we see that we expected a return value of 0
but got 12 instead. Clicking on the stack trace will take you to the point in the unit test
class where the failure happened.
The test explorer window also shows us how long the tests took to run. In total, it took only
11 ms. It is worthwhile keeping an eye on this, since unit tests are intended to run quickly.
© The Independent Institute of Education (Pty) Ltd 2023 Page 215 of 290
IIE Module Manual APPR6312
At the top of the Text Explorer window, there are several useful tools. Various
combinations of tests can be run from here. For example, if you fixed something in the
code you might want to run just the failed tests to see whether your fix worked. Or you
might want to debug the code so that you can step through it line by line to see why things
are not working as expected.
The next group of buttons filter which test results are visible.
A playlist of tests can be created – a specific set of tests that you want to run. Right-click
on a test class or test method in the hierarchy and click Add to Playlist. A playlist can be
opened using the Open Playlist File button (with icon ).
© The Independent Institute of Education (Pty) Ltd 2023 Page 216 of 290
IIE Module Manual APPR6312
applications, but more often the structure is more complex, and there are dependencies
on other units. What do we do in this case? We fake it.
“Fakes are objects that have working implementations, but not same as production one.
Usually, they take some shortcut and have simplified version of production code.” (Lipski,
2017)
An example of a fake is a data access object that returns in-memory objects rather than
querying the database. (Lipski, 2017) Fakes is a term that describes either mocks or stubs,
depending on how they are used. (Reese, et al., 2018)
“Stub is an object that holds predefined data and uses it to answer calls during tests. It is
used when we cannot or don’t want to involve objects that would answer with real data or
have undesirable side effects.” (Lipski, 2017)
“Mocks are objects that register calls they receive. In test assertion we can verify on
Mocks that all expected actions were performed.” (Lipski, 2017)
Both stubs and mocks have code that is a simplified version of the actual code, but their
purposes are different. A stub just mimics the actual code while a mock is used in an
assert to check whether the test passed.
Say we have a Character class in a game, and it has a method called GetRange which
calculates the how far the character can attack based on the currently equipped weapon.
If we want to test the else part, we will need to set a weapon. So, let’s create a fake
weapon in the test project.
© The Independent Institute of Education (Pty) Ltd 2023 Page 217 of 290
IIE Module Manual APPR6312
We don’t know yet whether it is a mock or a stub because we haven’t seen yet what the
test code is going to look like. So, it is better to call it a fake and then you can use it as
later. (Reese, et al., 2018)
using Microsoft.VisualStudio.TestTools.UnitTesting;
using UnitTestExperiments;
namespace UnitTestExperiments_Tests
{
[TestClass]
public class CharacterTests
{
[TestMethod]
public void GetRange_WeaponWithRangeFour_ReturnRangeTwo()
{
var stubWeapon = new FakeWeapon();
const int RANGE_FOUR = 4;
stubWeapon.Range = RANGE_FOUR;
Character character = new Character();
character.Weapon = stubWeapon;
Assert.AreEqual(RANGE_FOUR, actual);
}
}
}
We create our fake weapon, set the range to what we expect and populate the character
with it. The fake weapon responds to calls in the process, but the assert value comes from
the character. So, our fake weapon here acts as a stub.
What if we wanted to check whether the fake weapon got called, and that the value of 4
was not by coincidence hardcoded in the Character class for all weapons? Mocks
register calls that they receive. So, let’s update our fake weapon to set a flag when the
GetRange method is called.
© The Independent Institute of Education (Pty) Ltd 2023 Page 218 of 290
IIE Module Manual APPR6312
Now we can add a new test method that checks whether the flag was set. It is a best
practice to have only one assert per test method, so don’t be tempted just to add another
assert to our previous test. And there is a good reason for this. When an assert fails, the
test execution stops. Everything after that point will not get tested until that problem is
resolved. (Reese, et al., 2018)
[TestMethod]
public void GetRange_WeaponSet_WeaponGetRangeIsCalled()
{
var mockWeapon = new FakeWeapon();
const int RANGE_FOUR = 4;
mockWeapon.Range = RANGE_FOUR;
Character character = new Character();
character.Weapon = mockWeapon;
character.GetRange();
bool wasCalled = mockWeapon.GetRangeCalled;
Assert.IsTrue(wasCalled);
}
Here the assert is done based on the value from the fake, so it is used as a mock.
Note that Microsoft Fakes is only supported in Visual Studio 2019 Enterprise Edition.
(Microsoft, n.d. m) If you don’t see the features described here, you likely have a different
edition.
© The Independent Institute of Education (Pty) Ltd 2023 Page 219 of 290
IIE Module Manual APPR6312
2.6.1 Stubs
We have seen that we can create stubs ourselves by simply writing normal C# classes.
But there is also a way to create stubs using Microsoft Fakes.
There are two steps to the process: add a fake assembly, and then use the stubs by
providing code for the methods. The instructions described here are adapted from
(Warren, et al., 2016b).
To add a fakes assembly:
Here is the example from (Warren, et al., 2016b) of how to create a stub using its
interface, specifying the return value of one of the methods.
IStockFeed stockFeed =
new StockAnalysis.Fakes.StubIStockFeed()
{
GetSharePriceString = (company) => { return 1234; }
};
2.6.2 Shims
If you look at the above example, you will notice that the fake weapon we created
implemented an interface called IWeapon. This is exactly what a mock and a stub requires
– working with an interface. (Churchman, 2017)
This is great when we have dependencies on other parts of our own code, since then we
have control over whether we have an interface or not. But what if you are dependent on a
third-party class where you don’t have an interface? Then you must use a shim.
(Churchman, 2017)
“Shims divert calls to specific methods to code that you write as part of your test.” (Warren,
et al., 2016)
Read (Warren, et al., 2016) and (Prescott, 2012) for more details.
© The Independent Institute of Education (Pty) Ltd 2023 Page 220 of 290
IIE Module Manual APPR6312
3 Integration Testing
3.1 What is an Integration Test?
Unit tests are great to test isolated parts of the system. But ultimately, the system will be
running as an integrated whole. And lots of unexpected behaviours can crop up when you
integrate all the parts of the system, so that also needs to be tested. Automated tests at
this higher level are called integration tests. (Latham, et al., 2019)
Components that are often included in integration tests are databases and file systems.
Since the actual components are used, integration tests require more code to create and
take much longer to run. (Latham, et al., 2019)
With unit tests you want to test as many scenarios as possible. And that is fine because
the tests run very fast. But be selective when creating integration tests. Only create tests
that will add value, and that cannot be tested using unit tests. (Latham, et al., 2019)
Create the unit tests and integration tests in separate modules, to avoid confusing the
types of tests, and to make it easier to selectively run tests during the build. (Latham, et
al., 2019)
Integration testing, while going through all the layers of the application, typically only
tests a few modules of the software. This is what distinguishes it from system testing,
where the whole system with all its modules is tested. (SoftwareTestingHelp.com, 2019)
Let’s write a test that calls the home page of our DJ Promo web app, to see how this
works. Open the solution containing the DJ Promo web app in Visual Studio before
continuing.
The steps described here are based on information from (Spasojevic, 2019) and (Latham,
et al., 2019).
1. In the same solution, create a new xUnit Test Project (.NET Core) project (make
sure you pick the C# one). Call the project DJPromoWebApp_IntegrationTests.
2. Choose .NET 5.0 as the Target Framework.
© The Independent Institute of Education (Pty) Ltd 2023 Page 221 of 290
IIE Module Manual APPR6312
Run the tests – you should see the one test that passes.
If you see the message that you must build your solution to discover all tests but that
doesn’t help, close the solution and open it again.
}
}
You will notice that there is an unfamiliar attribute here – Fact. This is because we are
working with xUnit for this project. xUnit has two types of tests: facts are always true, while
theories only work for specific cases. (.NET Foundation, n.d.) Theories can have
parameters, that are specified using the InlineData attribute. (Lock, 2017) We will see
an example of that in the next subsection.
With xUnit there is no need for an attribute on the test class, only on the test methods.
© The Independent Institute of Education (Pty) Ltd 2023 Page 222 of 290
IIE Module Manual APPR6312
public HomeControllerIntegrationTests(
WebApplicationFactory<Startup> factory)
{
_factory = factory;
}
[Theory]
[InlineData("/")]
public async Task Get_EndpointsReturnSuccess(string url)
{
// Arrange
var client = _factory.CreateClient();
// Act
var response = await client.GetAsync(url);
// Assert
response.EnsureSuccessStatusCode(); // Status Code 200-299
Assert.Equal("text/html; charset=utf-8",
response.Content.Headers.ContentType.ToString());
}
}
Here we see an example of a theory. The test method has a parameter called URL, and it
will be called multiple times with different values – once for each of the InlineData
attributes.
If we look at the test results in the Test Explorer, we see the three runs of the same test
with different parameters.
While we are looking at the results, notice how long these tests take to run: in the order of
one second. That might not sound long, but if you consider that the unit tests we wrote
before look only a couple of milliseconds, then this is indeed much slower. Subsequent
calls to the same page in the same test class will be a bit faster.
© The Independent Institute of Education (Pty) Ltd 2023 Page 223 of 290
IIE Module Manual APPR6312
One of the ways to make the integration tests faster is to run against an in-memory
database. Entity framework does provide an in-memory database. By creating a custom
class that extends from WebApplicationFactory, this in-memory database can be
injected instead of the normal one.
Read (Spasojevic, 2019) and (Latham, et al., 2019) for more information on how to do
that.
What if we want to configure the behaviour of the client, for example to log information or
to not handle cookies?
But what if you want to do something more complex like logging, or reinitialising an in-
memory database for a specific test? Then we can use _factory.WithWebHostBuilder.
Add the following using statement (necessary for BuildServiceProvider in the code to
follow):
using Microsoft.Extensions.DependencyInjection;
© The Independent Institute of Education (Pty) Ltd 2023 Page 224 of 290
IIE Module Manual APPR6312
Then change the client creation as follows (code from (Latham, et al., 2019) with
modifications):
© The Independent Institute of Education (Pty) Ltd 2023 Page 225 of 290
IIE Module Manual APPR6312
Load tests “[t]est whether the app can handle a specified load of users for a certain
scenario while still satisfying the response goal. The app is run under normal conditions.”
(Anderson, et al., 2019b)
A very closely related concept is a stress test. In stress testing, the load is above the
normal levels, and the purpose of the testing is to see whether the system can recover
from abnormally high loads. (Anderson, et al., 2019b)
Load and stress tests are collectively called performance tests. (Guru99, n.d.)
Load tests can be executed at various levels in the software – on the database, at the
application programming interface (API) level where the services are load tested, or on
the user interface.
To perform load tests, we need a tool that simulates the number of users that we want to
test for. There are many tools that provide this functionality, including Visual Studio. Other
options include Apache JMeter, Locust and Netling. (Anderson, et al., 2019b)
Although Visual Studio 2019 is the last version of Visual Studio to support load tests
(Anderson, et al., 2019b), we will still use it since it illustrates the concepts that can be
applied to other testing tools.
The Visual Studio 2019 load testing tools are only available in the enterprise edition, and
you must install the Web performance and load testing tools component.
1. In the same solution as the DJPromoWebApp, create a new project using the Web
Performance and Load Test Project [Deprecated] template for C#. Name the
project DJPromoWebApp_LoadTests.
© The Independent Institute of Education (Pty) Ltd 2023 Page 226 of 290
IIE Module Manual APPR6312
2. In the Solution Explorer, right-click the load tests project and click Add then New
Item.
3. Under the Test category, choose the Load Test template.
4. Enter the Name HomePageLoadTest.loadtest.
5. Click Add.
6. The new load test wizard will be displayed. Choose On-premises Load Test for the
type of test and click Next.
7. The next page allows you to configure the run settings (see Figure 250). Change the
Run duration to 1 minute, just to make the test faster to run for our purposes.
8. Enter a Description for the test.
9. Click Next.
10. Enter the name FridayAfternoon for the load test scenario name.
© The Independent Institute of Education (Pty) Ltd 2023 Page 227 of 290
IIE Module Manual APPR6312
11. Click Finish. This will leave the rest of the settings on defaults.
The load test has now been created, but it doesn’t do anything yet. First, we need to
create a web test, and then specify that the load test should run the web test.
1. Create another new item in the load test project, this time using the Web
Performance Test template. Name the item LoadHomePage.webtest.
2. An Internet Explorer window will be opened where you can record the actions you
want to take for the test. On the first record, you need to enable the plugin that does
the recording. Click the Settings button (with the icon ) and choose Manage Add-
ons.
3. Enable the Web Test Recorder 15.0 add-on then close the dialog.
4. If the controls of the web test recorder are disabled on the first run as shown in
Figure 251:
a. Close the Internet Explorer window.
b. In Visual Studio, on the LoadHomePage.webtest tab, click Stop Recording.
© The Independent Institute of Education (Pty) Ltd 2023 Page 228 of 290
IIE Module Manual APPR6312
7. Once the page has loaded, click Stop on the Web Test Recorder.
Now we can see all the actions that we recorded in Visual Studio. There are some bing
requests that happened during the recording, that we don’t want as part of our load test.
The good news is that you can edit the web test now that it has been recorded. Right-click
on each of the bing requests and click Delete. Remember to save the web test after
editing it.
© The Independent Institute of Education (Pty) Ltd 2023 Page 229 of 290
IIE Module Manual APPR6312
To add the web test to the test mix for the load test:
© The Independent Institute of Education (Pty) Ltd 2023 Page 230 of 290
IIE Module Manual APPR6312
We only have the one web test right now, so it makes up 100% of our load test. But if you
have a website that has a lot of pages that users interact with, it would be useful to specify
multiple tests making up different percentages of the load test.
For more information about creating different test scenarios, read (Warren, et al., 2016c).
© The Independent Institute of Education (Pty) Ltd 2023 Page 231 of 290
IIE Module Manual APPR6312
While the test is running, you will see the test status in the Test Results window. And
when completed, you will see the results.
© The Independent Institute of Education (Pty) Ltd 2023 Page 232 of 290
IIE Module Manual APPR6312
“User interface (UI) testing is a process used to test if the application is functioning
correctly. UI testing can be performed manually by a human tester, or it can be performed
automatically with the use of a software program.” (Urbonas, 2013)
When we think of software testing, UI testing might be the first thing that comes to mind.
Manual testers often perform tasks that users would do to test that the system works end
to end. And that is useful. But since these testing tasks are performed by humans, there is
only so much time available to do testing. In a large system, it is just not possible to test
every aspect manually for every build of software.
This is where automated UI testing comes in. Using some tool, the UI is automatically
exercised according to instructions that are usually created by automation testers. Large
numbers of tests can be executed frequently, even on multiple platforms, often since it
doesn’t involve any human effort.
5.1.1 Selenium
There are lots of tools (open source and commercial) for user interface testing, many of
which are quite specific to the types of applications that they are designed to test.
Desktop, mobile and web UI testing tools typically work in quite different ways, but it can
even come down to which programming language the application was developed in on the
desktop.
We will be using Selenium in this module. Selenium is a very popular open-source web
testing tool that forms the basis of several other testing tools that have been developed
over the years. (ATC Team, 2019)
There are several tools that are included in the Selenium suite (Software Freedom
Conservancy, n.d.):
• Selenium WebDriver (preferred) – tests are written using language specific binds.
• Selenium IDE – an integrated development environment that makes it easy to create
scripts and allows for recording of interactions in Chrome and Firefox.
• Selenium Grid – used to scale testing by distributing the tests across multiple
computers.
We will specifically be using Selenium WebDriver since that can be integrated quite easily
into Visual Studio.
© The Independent Institute of Education (Pty) Ltd 2023 Page 233 of 290
IIE Module Manual APPR6312
• Choose descriptive names for tests. (Bushnev, 2019) Just like with unit tests, the
names of the UI tests should be descriptive so that you can easily identify where a
problem is just by looking at the name of a test.
• Keep tests simple. If the tests are getting so complicated that you must add
comments to explain what is going on, consider simplifying the test instead.
(Bushnev, 2019)
• Make sure all tests should be able to pass. Don’t leave tests for features that were
never implemented or will never be able to pass for some reason in the build. If a
test fails, it must mean that something is wrong that needs to be addressed.
(Bushnev, 2019)
• Keep all tests independent of one another. If the testing process is ever run in
parallel, dependencies will cause issues. (Bushnev, 2019)
• Create detailed reports. When choosing a tool, have a look at the reports generated
– choose one that will give a lot of detail in the reports. (Felder, 2019)
1. In the same solution as the DJPromoWebApp, create a new project using the
template MSTest Test Project (.NET Core) for C#. Call the project
DJPromoWebApp_UITests.
2. In project properties, change the project's Target framework to be .NET Core 2.1.
3. Add the following NuGet packages to the project:
Selenium.WebDriver
Selenium.WebDriver.ChromeDriver
4. Rename UnitTest1 to HomePageTest.
5. Copy the code on the next page into HomePageTest. (Code adapted from (Homer,
et al., 2019) and (Davood, 2018)).
© The Independent Institute of Education (Pty) Ltd 2023 Page 234 of 290
IIE Module Manual APPR6312
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.IO;
using System.Reflection;
namespace DJPromoWebApp_UITests
{
[TestClass]
public class HomePageTest
{
private IWebDriver driver;
private string appURL;
public HomePageTest()
{
}
[TestMethod]
[TestCategory("Chrome")]
public void CheckHomePageTitleTest()
{
driver.Navigate().GoToUrl(appURL + "/");
Assert.IsTrue(driver.Title.Contains("Gig List"),
"Verified title of the page");
}
[TestInitialize()]
public void SetupTest()
{
appURL = "http://localhost:60257";
[TestCleanup()]
public void MyTestCleanup()
{
driver.Quit();
}
}
}
6. Run the tests just like you would for unit tests. You should see one test passing.
The example loads a page and just checks the page title. This can be useful, but
obviously we want to do much more.
© The Independent Institute of Education (Pty) Ltd 2023 Page 235 of 290
IIE Module Manual APPR6312
There are two types of things that you can do using Selenium: find an element on the
page and perform an action on the element that you have found.
To find an element, call the WebDriver.FindElement method. There are multiple things
that you can find an element by (Selenium.dev, 2020):
• Class name;
• Class selector;
• Id;
• Name;
• Link text;
• Partial link text;
• Tag name; and
• XPath expression.
Add a new link with the text About Us to the home page. To find that link, we could do the
following:
• SendKeys(“keys to type”)
• Click()
If we wanted to click on the About Us link, and then check that it went to the right page,
we can do this:
[TestMethod]
[TestCategory("Chrome")]
public void NavigateFromHomeToAbout()
{
driver.Navigate().GoToUrl(appURL + "/");
IWebElement aboutLink = driver.FindElement(By.LinkText("About Us"));
aboutLink.Click();
Assert.IsTrue(driver.Title.Contains("About"),
"Verified title of the page");
}
© The Independent Institute of Education (Pty) Ltd 2023 Page 236 of 290
IIE Module Manual APPR6312
• Remove the load tests project from the solution. You don’t need to delete the
files, just remove it from the solution. It is a .NET Framework project, which will add
unnecessary complications to the pipeline.
• Make sure that all the projects target .NET Core 5.0.
• Commit and push all the changes.
1. In Azure DevOps Pipelines, create a new pipeline using the ASP.NET Core
template.
2. Choose the repository for the DJPromoWebApp.
To run the integration tests, add the following task to the end of the configuration (from
(thomps23, et al., 2019)):
- task: DotNetCoreCLI@2
inputs:
command: test
projects: '**/*IntegrationTests/*.csproj'
arguments: '--configuration $(buildConfiguration)'
If you look at the results of the build job, you will see that there is now also a link to the
test results.
We currently have four tests, all of which passed. The tests took almost 12 seconds to
execute.
© The Independent Institute of Education (Pty) Ltd 2023 Page 237 of 290
IIE Module Manual APPR6312
Running UI tests in Azure DevOps Pipelines is possible, but it requires a different type of
configuration since it requires browsers and user interfaces.
To do this, you need to publish artifacts and set up a release pipeline that releases to a
test environment. Read (Homer, et al., 2019b) for more information.
“Code coverage is the percentage of code which is covered by automated tests. Code
coverage measurement simply determines which statements in a body of code have been
executed through a test run, and which statements have not.” (Atlassian, n.d. k)
The percentage of code that should be covered by tests is a decision that is made by
each team. Certain parts of the code may be critical and will require 100% code coverage,
while other parts may not.
To collect the coverage results for our Linux-based build, replace the test task with the
following (from (thomps23, et al., 2019) and (issacnitin, 2019)):
- task: DotNetCoreCLI@2
inputs:
command: test
projects: '**/*IntegrationTests/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage"'
displayName: Run Tests
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . dotnet-reportgenerator-globaltool
displayName: Install ReportGenerator tool
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml
Note that the arguments and script elements should all be on one line as shown in Figure
259.
© The Independent Institute of Education (Pty) Ltd 2023 Page 238 of 290
IIE Module Manual APPR6312
If you look at the artifacts for the build, you will notice that there is now a coverage report
too. It is made up of several files, but you can download the whole thing by clicking the
download button next to the artifact name.
Extract the .zip file and open index.html in your browser to view the report. An example is
shown in Figure 261.
© The Independent Institute of Education (Pty) Ltd 2023 Page 239 of 290
IIE Module Manual APPR6312
The same report can also be seen on the build results page.
© The Independent Institute of Education (Pty) Ltd 2023 Page 240 of 290
IIE Module Manual APPR6312
Kolodiy, S., n.d.. Unit Tests, How to Write Testable Code and Why it Matters. [Online].
Available at: https://www.toptal.com/qa/how-to-write-testable-code-and-why-it-matters
[Accessed 14 July 2021].
Latham, L., Nelson, J. C., Smith, S. & van der Til, J., 2019. Integration tests in ASP.NET
Core. [Online]. Available at: https://docs.microsoft.com/en-us/aspnet/core/test/integration-
tests?view=aspnetcore-2.1 [Accessed 14 July 2021].
Mathurin, C., 2018. NET Core 2: Why xUnit and not NUnit or MSTest. [Online]. Available
at: https://dev.to/hatsrumandcode/net-core-2-why-xunit-and-not-nunit-or-mstest--aei
[Accessed 14 July 2021].
Prescott, A., 2012. A "Shim-ple" Tutorial with Microsoft Fakes. [Online]. Available at:
https://adamprescott.net/2012/08/21/a-shim-ple-tutorial-with-microsoft-fakes/ [Accessed
14 July 2021].
Reese, J. et al., 2018. Unit testing best practices with .NET Core and .NET Standard.
[Online]. Available at: https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-
best-practices [Accessed 14 July 2021].
Spasojevic, M., 2019. Automated UI tests with Selenium and ASP.NET Core MVC.
[Online]. Available at: https://code-maze.com/automatic-ui-testing-selenium-asp-net-core-
mvc/ [Accessed 14 July 2021].
Warren, G. et al., 2016. Use shims to isolate your app for unit testing. [Online]. Available
at: https://docs.microsoft.com/en-us/visualstudio/test/using-shims-to-isolate-your-
application-from-other-assemblies-for-unit-testing?view=vs-2019 [Accessed 14 July 2021].
Warren, G. et al., 2016b. Isolate code under test with Microsoft Fakes. [Online]. Available
at: https://docs.microsoft.com/en-us/visualstudio/test/isolating-code-under-test-with-
microsoft-fakes?view=vs-2019 [Accessed 14 July 2021].
© The Independent Institute of Education (Pty) Ltd 2023 Page 241 of 290
IIE Module Manual APPR6312
Warren, G., Casey, C., Hogenson, G. & Jacobs, M., 2016c. Edit load test scenarios.
[Online]. Available at: https://docs.microsoft.com/en-us/visualstudio/test/edit-load-test-
scenarios?view=vs-2019 [Accessed 14 July 2021].
If you want to learn more about Selenium, work through the Selenium C# tutorials at
https://www.toolsqa.com/selenium-c-sharp/
© The Independent Institute of Education (Pty) Ltd 2023 Page 242 of 290
IIE Module Manual APPR6312
1 Introduction
So far in this module, we have seen how to do continuous integration and automated
testing. But in DevOps, the aim is to automate everything all the way to deployment. The
tools that make continuous deployment possible are the topic of this learning unit.
2 Continuous Deployment
2.1 What is Continuous Deployment?
This concise definition captures the essence of continuous deployment very well. The first
thing to note is that everything is automated. Once changes have been pushed by the
developers, no more manual steps are necessary to get the changes into production.
If you haven’t worked in a company on a large software project yet, this may sound
obvious. But often implementing continuous deployment means a big change in culture
for a company. Traditionally, software releases were tightly controlled through manual
approval processes.
That made perfect sense when the tools for continuous deployment were not yet
available. And there is still a case to be made for manual approvals in safety critical
systems. However, for most business systems the tools that are available are perfectly
suited for automating everything.
© The Independent Institute of Education (Pty) Ltd 2023 Page 243 of 290
IIE Module Manual APPR6312
Culture is just as important as the tools used for continuous delivery. (CA Southern Africa,
2014)
The second point to note is that automated testing is very important for continuous
deployment to work well. There is no sign-off by manual testers before the software is
deployed to production, but that does not mean that the software is untested. Automated
tests are used to make sure that the changes that were made are correct and that there
are no regressions.
Another way to ensure that there are no issues in production, is to roll out changes only
to a small group of customers first. That is then automatically monitored for a period
before it is deployed to the full user base. (CollabNet VersionOne, 2019b) If you use
Gmail or Outlook.com email, you might have seen preview versions of features that you
can try out early. This doesn’t mean that the changes were automatically deployed, but it
is a similar concept in terms of partial deployment.
Are there any companies that do fully automated deployments? Yes, although it is still
rare, there are some big companies that do this successfully. Companies that do
continuous deployments include Netflix, Amazon, Pinterest, Flickr and Google. (CollabNet
VersionOne, 2019b)
Continuous delivery is the process of getting the software ready to deploy in an automated
way. (CollabNet VersionOne, 2019b) The code is built and automatically tested and is
ready to be deployed at any moment. But the deployment needs to be automated.
Another interesting perspective on the DevOps continuum is that the different stages
benefit different stakeholders. Continuous integration benefits the developers of the
software most since it improves feedback and productivity. Continuous delivery benefits
the business users since it helps to get features to them quicker. Continuous deployment
benefits all the stakeholders since features become immediately available. (Snodgrass,
2017)
© The Independent Institute of Education (Pty) Ltd 2023 Page 244 of 290
IIE Module Manual APPR6312
• The company can respond very fast to market changes since new features can be
deployed rapidly. (Pittet, n.d.)
• When a customer provides feedback, the company can react very quickly. (Pittet,
n.d.)
• New features become available as soon as they are developed. (Pittet, n.d.)
• Repetitive tasks are automated, allowing everybody, including testers, to focus on
more interesting work. (Belagatti, 2016)
• Automating a large part of the process means that the company can scale their
development efforts to multiple projects without adding much overhead. (Belagatti,
2016)
• Smaller releases that have fewer changes also have lower associated risks when
they are deployed. (Lucidchart Content Team, 2018)
• Deployment issues due to human error can be eliminated by automating the
process. (Shash, 2019)
• Keep source code in a central repository, to make sure that the code is clean and
available when needed to create a build. (Lucidchart Content Team, 2018)
• Changes need to be pushed regularly to avoid as many conflicts as possible.
(Lucidchart Content Team, 2018)
• Automate the process of building the code, executing tests, and deploying to a
production environment. (Lucidchart Content Team, 2018)
• Choose which tests to run for which builds. Tests are essential, but there are some
automated tests (for example integration tests) that take a long time to run.
(Mekhanikov, 2018) So, for example, a possible compromise would be to run unit
tests for every push, and integration tests during a nightly build.
• Shorten the build time as much as possible. If you make a small change, you don’t
want to wait an hour for the build to complete. Build times can be improved by
running parts of a build in parallel or even by installing faster hard drives in the build
server. (Mekhanikov, 2018)
• Automate the installation of software as much as possible. If you need to set up
virtual machines and install and configure software on them before you can make a
build, that takes too much time. Automate this process as much as possible.
(Mekhanikov, 2018)
• Always have a backup plan if things do go wrong during a deployment. (Gordon,
n.d.)
© The Independent Institute of Education (Pty) Ltd 2023 Page 245 of 290
IIE Module Manual APPR6312
If you have a very straightforward deployment, just deploying code straight to production
without anything else happening, you can use Kudu. It is simple and quick to configure. If
you want to run tests, build Docker images and other more advanced features, you need
the power of Azure Pipelines (Brown & Tardif, n.d.)
Both the build providers allow for source code to be pulled from Azure Repos, GitHub,
Bitbucket or a local Git repo. We will use an Azure Repos Git repository. There are also
manual push/sync options that could be useful for non-technical users. These include
OneDrive, Dropbox, a public Git or Mercurial repo or an FTP site. We won’t be going into
the details for any of those options.
It is recommended that you continue using the repository and build from Learning Unit 4 to
following along with the steps below.
For each Azure App Service, there is a Kudu dashboard that you can access that provides
a lot of interesting information.
© The Independent Institute of Education (Pty) Ltd 2023 Page 246 of 290
IIE Module Manual APPR6312
3. Scroll down on the list of options on the left until you get to the Development Tools
category.
4. Click Advanced Tools.
5. Click Go.
1. Browse to the Azure App Service that you want to deploy to in the Azure Portal.
2. Under the Deployment category, click Deployment Centre.
© The Independent Institute of Education (Pty) Ltd 2023 Page 247 of 290
IIE Module Manual APPR6312
3. The first step is to select the source control to use. Under the Continuous
Deployment (CI/CD) category, click Azure Repos and then click Continue.
4. The second step is to select the build provider. Choose App Service build service
and click Continue.
5. The third step is to configure the source control details, as shown in Figure 266. Pick
the Azure DevOps Organisation that you created, followed by the Project,
Repository and Branch.
6. Click Continue.
7. A summary page will be displayed. Click Finish.
© The Independent Institute of Education (Pty) Ltd 2023 Page 248 of 290
IIE Module Manual APPR6312
8. Wait for the process to complete. You will see a page showing the status of the
deployment as successful.
To see the continuous deployment of the site in action, make a change to the website.
Commit and push the change, and then return to the deployment centre. You will see a
second deployment. (You may have to click Refresh to see this result.)
If you browse to the site now, you will see that the change has been made to the live
website.
© The Independent Institute of Education (Pty) Ltd 2023 Page 249 of 290
IIE Module Manual APPR6312
If you look at the website now, you will see that it has reverted to the previous version.
Only one continuous deployment can be set up per app service, but multiple app
services can use the same repo. This is useful if you have, for example, a development
branch that you want to deploy to a test environment, in the same repository as a master
branch that is the one deployed to production. (Brown & Tardif, n.d.)
To stop continuously deploying using Kudu, click the Disconnect button on this page.
You will be prompted whether you really want to do that – click OK.
Disconnect the Kudu deployment now, so that we can use the same app service in the
next section.
The Deployment Centre does have an option to set up an Azure Pipelines build. However,
since we haven’t connected the DevOps organisation to the App Service yet, that process
won’t work.
It is best practice to split the build and release processes into two separate pipelines.
This provides flexibility in choosing when to deploy. For example, only once a build
succeeds can it be used to deploy. And if a manual approval step is required before
deployment to production, the split is essential to make it possible to manually trigger the
automated deployment.
When looking at Azure Pipelines, we also see that there are two different categories – one
for Pipelines and another for releases.
© The Independent Institute of Education (Pty) Ltd 2023 Page 250 of 290
IIE Module Manual APPR6312
In the build pipeline, we will do everything to the point where we create the deployable
artifacts. And in the release pipeline, we deploy those artefacts. Have a look again at
Figure 221 on p.189 to see the whole process.
We already have a pipeline for the DJPromoWebApp, that we created in Learning Unit 4.
You will recall that it includes the tasks for performing automated tests.
Note that the arguments in the publish task should all be on one line after you copy the
code, as shown in Figure 269.
If you look at the results of the build job, you will see that there is one artifact called
DJPromoWebApp.zip.
Before continuing, make a change to the website and push it, so that we can check that
the process works.
© The Independent Institute of Education (Pty) Ltd 2023 Page 251 of 290
IIE Module Manual APPR6312
The below instructions for setting up release pipelines and creating releases were
adapted from (Homer, et al., 2018).
To set up a release pipeline:
4. You will be prompted to select a template. This is the easiest way to get started with
releases. Select the Azure App Service deployment template and click Apply.
5. For stage 1, you can specify a Stage name and Stage owner. The defaults will be
good enough for this case. Click the cross in the top-right corner to close the
properties.
© The Independent Institute of Education (Pty) Ltd 2023 Page 252 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 253 of 290
IIE Module Manual APPR6312
If you want to double check that it is the right subscription, you can see your subscriptions
on the Azure Portal, under Subscriptions.
© The Independent Institute of Education (Pty) Ltd 2023 Page 254 of 290
IIE Module Manual APPR6312
Now we have set up the release, but the release doesn’t get triggered automatically. We
need to instruct pipelines to do the release now.
This is a very simple release. The website is deployed to the App Service, and that is the
end of it.
But releases can be much more complex than this. You can have multiple artifacts. You
can have
multiple stages with different tasks. And you can set up scheduled releases.
If you now have a look at the Deployment Centre for the App Service, you will see that the
Azure
Pipelines deployment is now linked up. And because the deployment is linked to a build
pipeline, you
can also access the build job’s status right from the Deployment Centre.
© The Independent Institute of Education (Pty) Ltd 2023 Page 255 of 290
IIE Module Manual APPR6312
The free Azure plan does not have access to this feature, so we won’t go into too much
detail. If you want to try it out, have a look at the Microsoft Learn module Stage a web app
deployment for testing and rollback by using App Service deployment slots listed in
Section 8.
There is a very useful feature in Azure App Services that allows you to have multiple
deployment slots (only in standard, premium or isolated app service plans). A
deployment slot is a way for you to deploy your changes to a live environment without
affecting the current production software. (Freeberg, et al., 2019)
It is a running app with its own URL that you can use to deploy and test your changes.
And when you are ready, you can swap the app in the deployment slot into production.
The benefit of this is that there is no downtime. And rolling back a swap is as easy as just
swapping back the slots again. (Freeberg, et al., 2019)
Before continuing, create a new Azure Repos Git repository and push the Azure Functions
project that we created in Learning Unit 2.
If you created Azure Functions in the Azure Portal, you can download the source code so
that you can commit it to a repository. To do so, go to the Overview of the Functions App,
and click Download app content. (Gailey, et al., 2019e)
© The Independent Institute of Education (Pty) Ltd 2023 Page 256 of 290
IIE Module Manual APPR6312
The structure that is required for continuous deployment of Azure Functions is quite
specific. (Gailey, et al., 2019e) Luckily, the Visual Studio project takes care of that during
the build. (Dykstra, et al., 2018)
Just as with Azure App Services, there are two possibilities for setting up continuous
deployments for Azure Functions – the App Service build service (Kudu) and Azure
Pipelines.
To set up continuous deployment using App Service build service (adapted from (Gailey,
et al., 2019e)):
© The Independent Institute of Education (Pty) Ltd 2023 Page 257 of 290
IIE Module Manual APPR6312
When the deployment is complete, you will see that the Deployment Centre now shows
the full history for the deployments, including the push deployment that we did from Visual
Studio in Learning Unit 2.
Just like with App Services, you can redeploy any version by clicking on the Logs button
next to the deployment, and then clicking Redeploy.
© The Independent Institute of Education (Pty) Ltd 2023 Page 258 of 290
IIE Module Manual APPR6312
If you looked carefully at the generated configuration (or at the build progress as shown in
Figure 280), you would have noticed that these builds and deploys the functions app. You
could split the two parts by deleting the deployment parts of the pipeline, and then setting
up a release just like we did for the App Services.
If you look at the Deployment Centre now, you will see the first successful Azure
Pipelines deployment.
© The Independent Institute of Education (Pty) Ltd 2023 Page 259 of 290
IIE Module Manual APPR6312
“A data-tier application (DAC) is a logical database management entity that defines all of
the SQL Server objects – like tables, views, and instance objects, including logins –
associated with a user's database.” (Guyer, et al., 2016)
DAC was first introduced in SQL Server 2008 R2. (Ozar, 2009)
In a DAC, all the changes required to a database can easily be described, and a target
database selected. Out of that is created an artifact called a DAC package (DACPAC)
which can then be used to deploy changes to a database. (Guyer, et al., 2016) The terms
data-tier application and DACPAC can be used interchangeably.
A DAC can be used by developers to specify the required changes, and by database
administrators (DBAs) to deploy changes. (Guyer, et al., 2016) And the same DAC can
also be used for automated deployment.
A DACPAC can be created using either SQL Server Management Studio (SSMS) or Visual
Studio. We will focus on using Visual Studio. For more information about using SSMS, read
(Nowinski, 2018).
Copy the CREATE TABLE script on p.91 into a new text file and save it somewhere
accessible. We will use this to import the existing structure.
© The Independent Institute of Education (Pty) Ltd 2023 Page 260 of 290
IIE Module Manual APPR6312
You will see the structure as shown in Figure 281. This is a good structure to use – a
folder for the schema, then one for the type of objects (Tables in this case) and then the
actual tables.
Open one of the files to see what the design view looks like.
© The Independent Institute of Education (Pty) Ltd 2023 Page 261 of 290
IIE Module Manual APPR6312
© The Independent Institute of Education (Pty) Ltd 2023 Page 262 of 290
IIE Module Manual APPR6312
Use the Design view to specify the columns VenueTypeID and Type as shown in Figure
284. Remember to save.
At this point, we have a change that we can publish – creating the VenueType table. But
there are still a few things we need to set up before we can publish the change.
A DACPAC is configured to work with a specific SQL database version. If you forget to
specify the correct version, you will get an error message when you try to deploy.
© The Independent Institute of Education (Pty) Ltd 2023 Page 263 of 290
IIE Module Manual APPR6312
The password will never get saved in the config file that is created in the project during this
process, regardless of what you choose here.
6. Click Test Connection. If the connection fails, check whether your IP address is
allowed by the firewall.
7. Click OK.
© The Independent Institute of Education (Pty) Ltd 2023 Page 264 of 290
IIE Module Manual APPR6312
8. The Database name will automatically be populated with the name that you
selected.
9. (Optional) Change the Publish script name to reflect the name of the database.
10. Click Save Profile As.
11. Enter the file name DJPromoDatabase.publish.xml.
12. Click Save.
13. Click Generate Script so that we can look at what the changes will do when we
publish them.
If we look at the script, we will see that there are some prints and some logging that is
happening. But the main part of the change is the CREATE TABLE command, just like we
would expect.
The generated script reflects the changes that the DACPAC will make. And in fact, you
could give this generated script to a DBA to run on the database.
Remember we saved the profile before? You will see the file in the root of the project.
Let’s publish the change using the saved settings.
© The Independent Institute of Education (Pty) Ltd 2023 Page 265 of 290
IIE Module Manual APPR6312
Now if we look at the database in the Azure Portal Query Editor, we will see the new
table in our database.
What if we wanted to do something like create a schema first and then add tables to it?
Well, you can add SQL scripts that will end up being part of the process.
Add a Script to the project, and when you are prompted for which type of item to create,
choose Script (build). If you do that, it will be included as part of what will be executed on
the database if it is required.
To add a script that maintains the lookup data in our VenueType table:
© The Independent Institute of Education (Pty) Ltd 2023 Page 266 of 290
IIE Module Manual APPR6312
:r .\dbo\Lookups\VenueType.sql
Generate the script again, and you will see that the MERGE statement will appear at the
end of the script – that is where the post deploy will be.
There are some things that the DACPAC will do that may be unexpected if you haven’t
encountered these things before. That is why it is always a good idea to have a quick look
at the script to make sure that it won’t do something unexpected.
For example, if the collation of the database is changed, it will by default drop and
recreate the database … which is likely not the desired outcome.
Also, by default when you add a column to a table somewhere in between the existing
columns, it will create a new table with the new field in the exact location that you
specified, insert all the rows from the existing table to the new table, drop the old table and
then rename the new table. While this is a perfectly safe operation that will not lose data,
this can be a very slow process if you have lots of records in that table.
It is possible to configure to very fine detail what the DACPAC will and will not do.
© The Independent Institute of Education (Pty) Ltd 2023 Page 267 of 290
IIE Module Manual APPR6312
The details of what everything here does is beyond the scope of this module. But be
aware that you can have different configurations for different deployments. For example,
you can have settings that always drops and recreates the database for the test
environment, in parallel with production database settings that are non-destructive.
For more information about these settings, read (Zhou, 2018) and (AppVeyor.com, n.d.).
© The Independent Institute of Education (Pty) Ltd 2023 Page 268 of 290
IIE Module Manual APPR6312
To build the DACPAC using Azure Pipelines, create a new Pipeline and choose the .NET
Desktop template. (Danielson, et al., 2017b) You can delete the test task.
DJDatabase\bin\Release\DJDatabase.dacpac
© The Independent Institute of Education (Pty) Ltd 2023 Page 269 of 290
IIE Module Manual APPR6312
7. Specify the following value for the Publish Profile. Again, check the path carefully.
DJDatabase\DJPromoDatabase.publish.xml
8. Click Add.
9. You will notice that the password is now stored in clear text in the file. Let’s move
that to a variable. Click Variables.
10. Click New Variable.
SqlPassword: '$(databasePassword)'
If you encounter an issue with resource authorisation (see Figure 294), then try to remove
the Free Trial part, build, then add it back in with a space before the opening bracket and
© The Independent Institute of Education (Pty) Ltd 2023 Page 270 of 290
IIE Module Manual APPR6312
build again. At least, that is what worked for me. It might also just take time for the
authorisation to happen.
© The Independent Institute of Education (Pty) Ltd 2023 Page 271 of 290
IIE Module Manual APPR6312
6 Concluding Remarks
We have now looked at deploying the various parts of our application independently. But
depending on project requirements, it might be more sensible to create multiple build pipelines
that all feed into the same deployment pipeline.
Nowinski, K., 2018. How to create DACPAC file?. [Online]. Available at:
https://sqlplayer.net/2018/10/how-to-create-dacpac-file/ [Accessed 14 July 2021].
TestingNews, 2019. Continuous Delivery vs. Continuous Deployment: Where to draw the
line? [Online]. Available at: https://dev.to/katalon/continuous-delivery-vs-continuous-
deployment-where-to-draw-the-line-18ld
[Accessed 14 July 2021].
Zhou, N. B., 2018. Using Advanced Publish Settings for Visual Studio Database Project.
[Online]. Available at: https://www.mssqltips.com/sqlservertip/5456/using-advanced-publish-
settings-for-visual-studio-database-project/
[Accessed 14 July 2021].
© The Independent Institute of Education (Pty) Ltd 2023 Page 272 of 290
IIE Module Manual APPR6312
Bibliography
.NET Foundation, n.d.. Getting Started with xUnit.net. [Online] Available at:
https://xunit.net/docs/getting-started/netcore/cmdline [Accessed 11 January 2020].
Anderson, R. et al., 2019. Add a model to an ASP.NET Core MVC app. [Online]
Available at: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-
app/adding-model?view=aspnetcore-3.1&tabs=visual-studio [Accessed 18
December 2019].
Anderson, R. et al., 2019b. ASP.NET Core load/stress testing. [Online] Available at:
https://docs.microsoft.com/en-us/aspnet/core/test/load-tests?view=aspnetcore-3.1
[Accessed 11 January 2020].
ATC Team, 2019. 14 of the Best Automation Testing Tools Available Today. [Online]
Available at: https://dzone.com/articles/14-of-the-best-automation-testing-tools-
available [Accessed 13 January 2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 273 of 290
IIE Module Manual APPR6312
Babu, R., 2019. SQL Server MERGE Statement overview and examples. [Online]
Available at: https://www.sqlshack.com/sql-server-merge-statement-overview-and-
examples/ [Accessed 8 January 2020].
Batkoski, E. et al., 2017. Views on Azure DevOps Services feeds. [Online] Available
at: https://docs.microsoft.com/en-
gb/azure/devops/artifacts/concepts/views?view=azure-devops [Accessed 2 January
2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 274 of 290
IIE Module Manual APPR6312
Bisson, S., 2017. .Net Framework or .Net Core? When to use which. [Online]
Available at: https://www.infoworld.com/article/3180478/development-tools/net-
framework-or-net-core-when-to-use-which.html [Accessed 21 September 2018].
Brown, D. & Tardif, B., n.d.. An overview of Azure App Service Deployment Center.
[Online] Available at: https://azure.microsoft.com/en-gb/resources/videos/azure-
friday-an-overview-of-azure-app-service-deployment-center/ [Accessed 6 January
2020].
Bushnev, Y., 2019. Top 15 UI Test Automation Best Practices You Should Follow.
[Online] Available at: https://www.blazemeter.com/blog/top-15-ui-test-automation-
best-practices-you-should-follow/ [Accessed 13 January 2020].
Carter, P., A, A., Addie, S. & Wenzel, M., 2018. Choosing between .NET Core and
.NET Framework for server apps. [Online] Available at:
https://docs.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server
[Accessed 21 September 2018].
Churchman, M., 2017. Mock Frameworks vs. Microsoft Fakes. [Online] Available at:
https://saucelabs.com/blog/mock-frameworks-vs-microsoft-fakes [Accessed 10
January 2020].
Clark, A. et al., 2019. Install the Azure CLI. [Online] Available at:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
[Accessed 17 December 2019].
Cokely, D., 2019. Creating NuGet packages in Azure DevOps with Azure Pipelines
and YAML. [Online] Available at: https://medium.com/@dan.cokely/creating-nuget-
packages-in-azure-devops-with-azure-pipelines-and-yaml-d6fa30f0f15e [Accessed 3
January 2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 275 of 290
IIE Module Manual APPR6312
Costa, I., 2018. How to Undo the Last Commit. [Online] Available at:
https://code.likeagirl.io/how-to-undo-the-last-commit-393e7db2840b [Accessed 1
January 2020].
Danielson, S., 2018. Azure Repos Git tutorial. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/repos/git/gitworkflow?view=azure-
devops [Accessed 31 December 2019].
Danielson, S. et al., 2018d. Best practices for using Azure Artifacts. [Online]
Available at: https://docs.microsoft.com/en-gb/azure/devops/artifacts/concepts/best-
practices?view=azure-devops [Accessed 2 January 2020].
Danielson, S. et al., 2019. Plan your organizational structure. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/user-guide/plan-your-azure-devops-
org-
structure?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&bc=%2Fazure%
2Fdevops%2Forganizations%2Fbreadcrumb%2Ftoc.json&view=azure-devops
[Accessed 4 December 2019].
Danielson, S. et al., 2017. Choosing the right version control for your project. [Online]
Available at: https://docs.microsoft.com/en-us/azure/devops/repos/tfvc/comparison-
git-tfvc?view=azure-devops [Accessed 24 December 2019].
Danielson, S., KathrynEE & chcomley, 2018c. Apply changes with rebase. [Online]
Available at: https://docs.microsoft.com/en-
us/azure/devops/repos/git/rebase?view=azure-devops&tabs=visual-studio [Accessed
1 January 2020].
Danielson, S., KathrynEE, Jacobs, M. & chcomley, 2018b. Get started with Git from
the command line. [Online].
Danielson, S. et al., 2017b. Build your SQL server database. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/aspnet/build-aspnet-
dacpac?view=azure-devops [Accessed 8 January 2020].
Davood, H., 2018. ChromeDriver does not exist in Selenium WebDriver C# test
script. [Online] Available at:
© The Independent Institute of Education (Pty) Ltd 2023 Page 276 of 290
IIE Module Manual APPR6312
https://stackoverflow.com/questions/9088367/chromedriver-does-not-exist-in-
selenium-webdriver-c-sharp-test-script [Accessed 13 January 2020].
Dietrich, E., 2017. Unit Test Frameworks for C#: The Pros and Cons of the Top 3.
[Online] Available at: https://stackify.com/unit-test-frameworks-csharp/ [Accessed 10
January 2020].
Digital.ai, 2021. 15th Annual State of Agile Report. [Online] Available at:
https://digital.ai/resource-center/analyst-reports/state-of-agile-report [Accessed 28
April 2022].
Dixon, H., 2018. Deep dive into Azure Artifacts. [Online] Available at:
https://azure.microsoft.com/en-gb/blog/deep-dive-into-azure-artifacts/ [Accessed 2
January 2020].
Driessen, V., 2010. A successful Git branching model. [Online] Available at:
https://nvie.com/posts/a-successful-git-branching-model/ [Accessed 31 December
2019].
Dykstra, T. et al., 2019. Azure Functions triggers and bindings concepts. [Online]
Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
triggers-bindings [Accessed 20 December 2019].
Ebbo, D., 2012. Introducing Kudu: the Open Source engine behind 'git push azure
master'. [Online] Available at: http://blog.davidebbo.com/2012/06/introducing-open-
source-engine-behind.html [Accessed 6 January 2020].
ElGauchooo, 2014. Tests not running in Test Explorer. [Online] Available at:
https://stackoverflow.com/questions/23363073/tests-not-running-in-test-explorer
[Accessed 10 January 2020].
Ellis, S., 2008. Frameworks, Methodologies and Processes. [Online] Available at:
http://vsellis.com/frameworks-methodologies-and-processes/ [Accessed 3 December
2019].
© The Independent Institute of Education (Pty) Ltd 2023 Page 277 of 290
IIE Module Manual APPR6312
Ernst, M., 2018. Version control concepts and best practices. [Online] Available at:
https://homes.cs.washington.edu/~mernst/advice/version-control.html [Accessed 23
December 2019].
Farcic, V., 2013. Test Driven Development (TDD): Example Walkthrough. [Online]
Available at: https://technologyconversations.com/2013/12/20/test-driven-
development-tdd-example-walkthrough/ [Accessed 9 January 2020].
Felder, D., 2019. UI Test Automation Best Practices. [Online] Available at:
https://www.testcraft.io/ui-test-automation-best-practices-infographic/ [Accessed 13
January 2020].
Freeberg, J. et al., 2019. Set up staging environments in Azure App Service. [Online]
Available at: https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots
[Accessed 6 January 2020].
Gailey, G., Alberts, M., Dunn, J. & Tresness, C., 2019d. Develop Azure Functions by
using Visual Studio Code. [Online] Available at: https://docs.microsoft.com/en-
us/azure/azure-functions/functions-develop-vs-code?tabs=nodejs [Accessed 22
December 2019].
Gailey, G. et al., 2019b. Create your first function using Visual Studio. [Online]
Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
create-your-first-function-visual-studio [Accessed 20 December 2019].
Gailey, G. et al., 2019. Develop Azure Functions using Visual Studio. [Online]
Available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-
develop-vs [Accessed 20 December 2019].
Gailey, G. et al., 2019c. Use Azure Functions to connect to an Azure SQL Database.
[Online] Available at: https://docs.microsoft.com/en-us/azure/azure-
functions/functions-scenario-database-table-cleanup [Accessed 20 December 2019].
Gailey, G. et al., 2017b. Azure Functions HTTP triggers and bindings. [Online]
Available at: https://docs.microsoft.com/en-gb/azure/azure-functions/functions-
© The Independent Institute of Education (Pty) Ltd 2023 Page 278 of 290
IIE Module Manual APPR6312
Gentz, M. et al., 2019. Welcome to Azure Cosmos DB. [Online] Available at:
https://docs.microsoft.com/en-us/azure/cosmos-db/introduction [Accessed 16
December 2019].
Git, n.d. b. 7.2 Git Tools - Interactive Staging. [Online] Available at: https://git-
scm.com/book/en/v2/Git-Tools-Interactive-Staging [Accessed 1 January 2020].
Gordon, L., n.d.. Continuous Integration & Continuous Deployments Best Practices.
[Online] Available at: https://by.dialexa.com/continuous-integration-continuous-
deployments-best-practices [Accessed 6 January 2020].
Grammatikos, G. C., 2018. About Team Foundations Server (TFS) And Visual
Studio Team Services (VSTS). [Online] Available at:
https://cloudopszone.com/about-team-foundation-server-and-visual-studio-team-
services/ [Accessed 4 December 2019].
Gratis, B., 2018. 5 Reasons Agile isn’t working for your team. [Online] Available at:
https://backlog.com/blog/5-reasons-agile-isnt-working-your-team/ [Accessed 18
October 2018].
Green, S., 2016. Choose Your Project Management Methodology: Pros and Cons of
Agile, Waterfall, PRiSM and more. [Online] Available at:
https://www.workflowmax.com/blog/choose-your-project-management-methodology-
pros-and-cons-of-agile-waterfall-prism-and-more [Accessed 18 October 2018].
© The Independent Institute of Education (Pty) Ltd 2023 Page 279 of 290
IIE Module Manual APPR6312
Hamill, P., 2004. Unit Test Frameworks - Chapter 1. Unit Test Frameworks: An
Overview. [Online] Available at: https://www.oreilly.com/library/view/unit-test-
frameworks/0596006896/ch01.html [Accessed 10 January 2020].
Hollan, J., 2019. Using Entity Framework with Azure Functions. [Online] Available at:
https://dev.to/azure/using-entity-framework-with-azure-functions-50aa [Accessed 20
December 2019].
Homer, A. et al., 2018. Deploy a web app to Azure App Services. [Online] Available
at: https://docs.microsoft.com/en-gb/azure/devops/pipelines/apps/cd/deploy-
webdeploy-webapps?view=azure-devops [Accessed 7 January 2020].
huypub, 2019. Install the Azure PowerShell module. [Online] Available at:
https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.1.0
[Accessed 17 December 2019].
issacnitin, 2019. dotnet cli Reportgenerator custom command fails #9472. [Online]
Available at: https://github.com/microsoft/azure-pipelines-tasks/issues/9472
[Accessed 13 January 2020].
IT Central Station, 2019. Compare JIRA vs. Microsoft Azure DevOps. [Online]
Available at:
https://www.itcentralstation.com/products/comparisons/jira_vs_microsoft-azure-
devops [Accessed 4 December 2019].
Joshi, K., 2018. Using “Kudu” to Manage Azure Web Apps. [Online] Available at:
https://www.gslab.com/blogs/kudu-azure-web-app [Accessed 6 January 2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 280 of 290
IIE Module Manual APPR6312
KathrynEE, et al., 2019b. Sign up for free and invite others to collaborate on your
project. [Online] Available at: https://docs.microsoft.com/en-
us/azure/devops/boards/get-started/sign-up-invite-teammates?view=azure-devops
[Accessed 4 December 2019].
KathrynEE, et al., 2019. About dashboards, charts, reports, & widgets. [Online]
Available at: https://docs.microsoft.com/en-
us/azure/devops/report/dashboards/overview?view=azure-devops [Accessed 5
December 2019].
Kolodiy, S., n.d.. Unit Tests, How to Write Testable Code and Why it Matters.
[Online] Available at: https://www.toptal.com/qa/how-to-write-testable-code-and-why-
it-matters [Accessed 9 January 2020].
Latham, L., Nelson, J. C., Smith, S. & van der Til, J., 2019. Integration tests in
ASP.NET Core. [Online] Available at: https://docs.microsoft.com/en-
us/aspnet/core/test/integration-tests?view=aspnetcore-2.1 [Accessed 10 January
2020].
Lazar, A., 2018. How to call an Azure function from an ASP.NET Core MVC
application. [Online] Available at: https://hub.packtpub.com/azure-function-asp-net-
core-mvc-application/ [Accessed 23 December 2019].
© The Independent Institute of Education (Pty) Ltd 2023 Page 281 of 290
IIE Module Manual APPR6312
Lin, C., Petersen, T. & Potapenko, N., 2017. Azure App Service plan overview.
[Online] Available at: https://docs.microsoft.com/en-gb/azure/app-service/overview-
hosting-plans [Accessed 16 December 2019].
Lin, C., Petersen, T. & Uribe, C., 2019c. Scale up an app in Azure App Service.
[Online] Available at: https://docs.microsoft.com/en-us/azure/app-service/manage-
scale-up [Accessed 20 December 2019].
Lin, C., Sherer, T., Petersen, T. & Caserio, C., 2019. Create an ASP.NET
Framework web app in Azure. [Online] Available at: https://docs.microsoft.com/en-
gb/azure/app-service/app-service-web-get-started-dotnet-framework [Accessed 18
December 2019].
Lin, C. et al., 2019b. Create an ASP.NET Core web app in Azure. [Online] Available
at: https://docs.microsoft.com/en-gb/azure/app-service/app-service-web-get-started-
dotnet [Accessed 19 December 2019].
Lipski, M., 2017. Test Doubles — Fakes, Mocks and Stubs. [Online] Available at:
https://blog.pragmatists.com/test-doubles-fakes-mocks-and-stubs-1a7491dfa3da
[Accessed 10 January 2020].
Lock, A., 2017. Creating parameterised tests in xUnit with [InlineData], [ClassData],
and [MemberData]. [Online] Available at: https://andrewlock.net/creating-
parameterised-tests-in-xunit-with-inlinedata-classdata-and-memberdata/ [Accessed
11 January 2020].
L, R., 2021. Announcing .NET 6 — The Fastest .NET Yet. [Online] Available at:
https://devblogs.microsoft.com/dotnet/announcing-net-6/ [Accessed 28 April 2022].
Lucidchart Content Team, 2018. Continuous Deployment 101: Best Practices for the
Popular Engineering Approach. [Online] Available at:
https://www.lucidchart.com/blog/continuous-deployment-best-practices [Accessed 6
January 2020].
Luijbregts, B., 2018. Demystify the .NET Ecosystem. [Online] Available at:
https://dzone.com/articles/demystify-the-net-ecosystem-understand-its-runtime
[Accessed 21 September 2018].
Luk, J. et al., 2019. Overview of Azure Cloud Shell. [Online] Available at:
https://docs.microsoft.com/en-us/azure/cloud-shell/overview [Accessed 17
December 2019].
© The Independent Institute of Education (Pty) Ltd 2023 Page 282 of 290
IIE Module Manual APPR6312
Mantini, N., 2018. Design Thinking, Lean Startup and Agile: What is the difference?.
[Online] Available at: https://medium.com/xplor8/design-thinking-lean-startup-and-
agile-what-is-the-difference-1eed3594b121 [Accessed 3 December 2019].
Mathurin, C., 2018. NET Core 2: Why xUnit and not NUnit or MSTest. [Online]
Available at: https://dev.to/hatsrumandcode/net-core-2-why-xunit-and-not-nunit-or-
mstest--aei [Accessed 10 January 2020].
McKane, J., 2019. Huawei Cloud launches in South Africa. [Online] Available at:
https://mybroadband.co.za/news/cloud-hosting/298252-huawei-cloud-launches-in-
south-africa.html [Accessed 16 December 2019].
McLeod, D., 2019. Oracle to build cloud infrastructure region in South Africa. [Online]
Available at: https://techcentral.co.za/oracle-to-build-cloud-infrastructure-region-in-
south-africa/92658/ [Accessed 16 December 2019].
Meiling, J., 2019. Kanban in Organizations Part II. [Online] Available at:
https://www.projectwizards.net/en/blog/2019/01/kanban-corepractices [Accessed 3
December 2019].
Mekhanikov, E., 2018. 5 CI/CD Best Practices for Better Code Quality. [Online]
Available at: https://www.blazemeter.com/blog/5-ci-cd-best-practices-for-better-code-
quality/ [Accessed 6 January 2020].
Michaelis, M., 2019. .NET Reunified: Microsoft’s Plans for .NET 5. [Online] Available
at: https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/july/csharp-net-
reunified-microsoft%e2%80%99s-plans-for-net-5 [Accessed 28 April 2022].
Microsoft Corporation, 2018. .NET Downloads for Linux, macOS, and Windows.
[Online] Available at: https://www.microsoft.com/net/download [Accessed 21
September 2018].
© The Independent Institute of Education (Pty) Ltd 2023 Page 283 of 290
IIE Module Manual APPR6312
Microsoft, n.d. b. Azure SQL Database - Platform as a Service. [Online] Available at:
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-paas-index
[Accessed 16 December 2019].
Microsoft, n.d. d. Determine the best trigger for your Azure function. [Online]
Available at: https://docs.microsoft.com/en-us/learn/modules/execute-azure-function-
with-triggers/2-determine-best-trigger [Accessed 20 December 2019].
© The Independent Institute of Education (Pty) Ltd 2023 Page 284 of 290
IIE Module Manual APPR6312
Microsoft, n.d. m. Compare Visual Studio 2019 Editions. [Online] Available at:
https://visualstudio.microsoft.com/vs/compare/ [Accessed 10 January 2020].
Moyo, A., 2019. South African companies make Microsoft Azure shift. [Online]
Available at: https://www.itweb.co.za/content/dgp45MaGbJlvX9l8 [Accessed 16
December 2019].
Nowinski, K., 2018. How to create DACPAC file?. [Online] Available at:
https://sqlplayer.net/2018/10/how-to-create-dacpac-file/ [Accessed 8 January 2020].
Oracle, 2022. Oracle Opens First Cloud Region in Africa. [Online] Available at:
https://www.oracle.com/za/news/announcement/oracle-cloud-johannesburg-region-
2022-01-19/ [Accessed 28 April 2022].
Oslake, M., 2019. Choose between the vCore and the DTU purchasing models.
[Online] Available at: https://docs.microsoft.com/en-us/azure/sql-database/sql-
database-purchase-models [Accessed 17 December 2019].
Owen, 2019. How To Use Azure Resource Groups: A Simple Explanation. [Online]
Available at: https://www.otava.com/reference/how-to-use-azure-resource-groups-a-
simple-explanation/ [Accessed 16 December 2019].
Ozar, B., 2009. SQL Server 2008 R2: The DAC Pack. [Online] Available at:
https://www.brentozar.com/archive/2009/08/sql-server-2008-r2-the-dac-pack/
[Accessed 8 January 2020].
Petersen, T., Lin, C., Freeberg, J. & Bradley, M., 2019. Continuous deployment to
Azure App Service. [Online] Available at: https://docs.microsoft.com/en-
us/azure/app-service/deploy-continuous-deployment [Accessed 6 January 2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 285 of 290
IIE Module Manual APPR6312
Powell-Morse, A., 2017b. Rational Unified Process: What Is It And How Do You Use
It?. [Online] Available at: https://airbrake.io/blog/sdlc/rational-unified-process
[Accessed 18 October 2018].
Prescott, A., 2012. A "Shim-ple" Tutorial with Microsoft Fakes. [Online] Available at:
https://adamprescott.net/2012/08/21/a-shim-ple-tutorial-with-microsoft-fakes/
[Accessed 10 January 2020].
Rabeler, C. et al., 2019c. Quickstart: Use .NET and C# in Visual Studio to connect to
and query an Azure SQL database. [Online] Available at:
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-
dotnet-visual-studio [Accessed 17 December 2019].
Rabeler, C. et al., 2019. Choose the right deployment option in Azure SQL. [Online]
Available at: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-
paas-vs-sql-server-iaas [Accessed 17 December 2019].
Reese, J. et al., 2018. Unit testing best practices with .NET Core and .NET
Standard. [Online] Available at: https://docs.microsoft.com/en-
us/dotnet/core/testing/unit-testing-best-practices [Accessed 10 January 2020].
Rehkopf, M., n.d.. Epics, Stories, Themes, and Initiatives. [Online] Available at:
https://www.atlassian.com/agile/project-management/epics-stories-themes
[Accessed 3 December 2019].
Ries, E., n.d.. The Lean Startup Methodology. [Online] Available at:
http://theleanstartup.com/principles [Accessed 3 December 2019].
Riggins, J., 2017. Unit Testing: Time Consuming but Product Saving. [Online]
Available at: https://thenewstack.io/unit-testing-time-consuming-product-saving/
[Accessed 10 January 2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 286 of 290
IIE Module Manual APPR6312
Roseke, B., 2012. The Life Cycle of an Engineering Project. [Online] Available at:
http://www.projectengineer.net/the-life-cycle-of-an-engineering-project/ [Accessed 18
October 2018].
Ross, E. et al., 2019. What is Azure Active Directory?. [Online] Available at:
https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-
directory-whatis [Accessed 16 December 2019].
Schwaber, K. & Sutherland, J., 2017. The Scrum Guide. The Definitive Guide to
Scrum: The Rules of the Game. [Online] Available at:
https://www.scrumguides.org/docs/scrumguide/v2017/2017-Scrum-Guide-
US.pdf#zoom=100 [Accessed 3 December 2019].
Shash, M., 2019. Deployment Automation Best Practices: When Should You Start to
Automate?. [Online] Available at: https://levelup.gitconnected.com/deployment-
automation-best-practices-when-should-you-start-to-automate-28b682cdd4e2
[Accessed 6 January 2020].
Shigihalli, U., 2019. Perfecting Continuous Delivery of NuGet packages for Azure
Artifacts. [Online] Available at: https://cloudblogs.microsoft.com/industry-blog/en-
gb/technetuk/2019/06/18/perfecting-continuous-delivery-of-nuget-packages-for-
azure-artifacts/ [Accessed 2 January 2020].
Singh, M., 2018. How do you “do” Scrumban?. [Online] Available at:
https://www.digite.com/blog/how-do-you-do-scrumban/ [Accessed 4 Decemeber
2019].
Snodgrass, M., 2017. Dev Leaders Compare Continuous Delivery vs. Continuous
Deployment vs. Continuous Integration. [Online] Available at:
© The Independent Institute of Education (Pty) Ltd 2023 Page 287 of 290
IIE Module Manual APPR6312
https://stackify.com/continuous-delivery-vs-continuous-deployment-vs-continuous-
integration/ [Accessed 6 January 2020].
Spasojevic, M., 2019. Automated UI tests with Selenium and ASP.NET Core MVC.
[Online] Available at: https://code-maze.com/automatic-ui-testing-selenium-asp-net-
core-mvc/ [Accessed 13 January 2020].
Spasojevic, M., 2019. Integration Testing in ASP.NET Core MVC. [Online] Available
at: https://code-maze.com/integration-testing-asp-net-core-mvc/ [Accessed 11
January 2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 288 of 290
IIE Module Manual APPR6312
thomps23, et al., 2019. Build, test, and deploy .NET Core apps. [Online] Available at:
https://docs.microsoft.com/en-gb/azure/devops/pipelines/ecosystems/dotnet-
core?view=azure-devops [Accessed 6 January 2020].
Urbonas, R., 2013. Automated User Interface Testing. [Online] Available at:
https://www.devbridge.com/articles/automated-user-interface-testing/ [Accessed 13
January 2020].
Verheyen, G., 2013b. There’s value in the Scrum Values. [Online] Available at:
https://guntherverheyen.com/2013/05/03/theres-value-in-the-scrum-values/
[Accessed 3 December 2019].
Verheyen, G., 2013. Scrum: Framework, not methodology. [Online] Available at:
https://guntherverheyen.com/2013/03/21/scrum-framework-not-methodology/
[Accessed 3 December 2019].
Vermeulen, J., 2019. AWS data centres for South Africa coming soon. [Online]
Available at: https://mybroadband.co.za/news/cloud-hosting/326139-aws-data-
centres-for-south-africa-coming-soon.html [Accessed 16 December 2019].
Wallin, M., 2019. Best Practices for Version Control in 8 steps. [Online] Available at:
https://ruleoftech.com/2019/best-practices-for-version-control-in-8-steps [Accessed
23 December 2019].
Warren, G., Casey, C., Hogenson, G. & Jacobs, M., 2016c. Edit load test scenarios.
[Online] Available at: https://docs.microsoft.com/en-us/visualstudio/test/edit-load-
test-scenarios?view=vs-2019 [Accessed 12 January 2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 289 of 290
IIE Module Manual APPR6312
Warren, G. et al., 2016b. Isolate code under test with Microsoft Fakes. [Online]
Available at: https://docs.microsoft.com/en-us/visualstudio/test/isolating-code-under-
test-with-microsoft-fakes?view=vs-2019 [Accessed 10 January 2020].
Warren, G. et al., 2016. Use shims to isolate your app for unit testing. [Online]
Available at: https://docs.microsoft.com/en-us/visualstudio/test/using-shims-to-
isolate-your-application-from-other-assemblies-for-unit-testing?view=vs-2019
[Accessed 10 January 2020].
Warren, G. et al., 2018. Quickstart: Create a load test project. [Online] Available at:
https://docs.microsoft.com/en-us/visualstudio/test/quickstart-create-a-load-test-
project?view=vs-2019 [Accessed 12 January 2020].
Wasson, M. et al., 2017. Run a basic web application in Azure. [Online] Available at:
https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/app-
service-web-app/basic-web-app [Accessed 16 December 2019].
Wilson, C. et al., 2018. Get started with NuGet packages in Azure DevOps Services
and TFS. [Online] Available at: https://docs.microsoft.com/en-
gb/azure/devops/artifacts/get-started-nuget?view=azure-devops [Accessed 2
January 2020].
Wilson, C. & chcomley, 2019. Sign up for Azure Artifacts. [Online] Available at:
https://docs.microsoft.com/en-us/azure/devops/artifacts/start-using-azure-
artifacts?view=azure-devops [Accessed 2 January 2020].
Winand, M., n.d.. select without from. [Online] Available at: https://modern-
sql.com/use-case/select-without-from [Accessed 8 January 2020].
Yodis, 2016. Kanban Vs Scrum Benefits, Similarities, Pros and cons. [Online]
Available at: https://www.yodiz.com/blog/kanban-vs-scrum-benefits-similarities-pros-
and-cons/ [Accessed 19 October 2018].
Zhou, N. B., 2018. Using Advanced Publish Settings for Visual Studio Database
Project. [Online] Available at: https://www.mssqltips.com/sqlservertip/5456/using-
advanced-publish-settings-for-visual-studio-database-project/ [Accessed 8 January
2020].
© The Independent Institute of Education (Pty) Ltd 2023 Page 290 of 290