Working with VSTS personal branches

Reading This Manual

Copying all content from this file and pasting it at https://jbt.github.io/markdown-editor/ will not display images and gif animations since they are stored locally within the repository. It is strongly recommended to read this document inside Atom text editor using Ctrl + Shift + M to display the rendered preview.

Introduction

Use Git and VSTS to save your work and coordinate code changes across your team.

How to work with VSTS personal branches:

  1. Create a branch for the changes that you plan to make, and name it accordingly.
  2. Add your branch to the Post-commit build definition trigger.
  3. After working changes are committed, Push your branch to the remote repository.

1. Create a branch for the changes that you plan to make, and name it accordingly

Go to Code -> Branches. Click New branch and create branch under the following convention: [firstname].[lastname]. Select the created branch to work with it.

2. Add your branch to the Post-commit build definition trigger

Go to the Build and Release -> Build -> All Definitions -> Post-commit Build -> Edit -> Triggers. Add your branch to Branch Filters. Click Save and queue -> Save.

3. After working changes are committed, Push your branch to the remote repository

Share changes made in commits and branch using the push command. Push your branch to the remote repository, where Git takes the commits and adds them to an existing branch on the remote or creates a new branch with the same commits as your local branch.

If there are any conflicts between your local commits and the commits on the remote branch, you must first resolve these conflicts before you can push your changes. You should pull the changes from others first, resolve the conflicts and commit the changes, then reattempt the push.

Author: Dmitry Andreev

How to configure VSTS to use Espresso

Reading This Manual

Copying all content from this file and pasting it at https://jbt.github.io/markdown-editor/ will not display images and gif animations since they are stored locally within the repository. It is strongly recommended to read this document inside Atom text editor using Ctrl + Shift + M to display the rendered preview.

Introduction

Configure VSTS to use Espresso for UI tests.

1. Add a Gradle task

  • Go to the Build and Release -> Build -> All Definitions -> Gated Build -> Edit.
  • Click on Add Task.
  • Search for Gradle and click Add.

 

 

 

 

2. Configure the task

  • In the Display Name field, type in gradlew connectedAndroidTest.
  • In the Tasks field, type in connectedAndroidTest.
  • Click Save

 

3. Build

Now, when the Gated Build definition is run, VSTS will perform the UI tests.

These UI tests have been implemented using Espresso and the Green Coffee library and are located in the app/src/androidTest directory.

Author: Nahom Abi

Android Studio Built-in VCS Integration

Reading This Manual

Copying all content from this file and pasting it at https://jbt.github.io/markdown-editor/ will not display images and gif animations since they are stored locally within the repository. It is strongly recommended to read this document inside Atom text editor using Ctrl + Shift + M to display the rendered preview.

Introduction

Git has become an indispensable tool for every serious and successful software project. But there are times when developers wish they have some visual representation of what they are working on instead of ‘bashing out’ everything blindly using a black console screen. In fact, many programs exist solely for that purpose but as separate software running separate windows and requiring more resources from your machine. Luckily, smart IDEs like Android Studio have a built-in VCS integration that supports almost every functionality provided by Git within the same window. This manual aims to show you how to integrate Git in your Android Studio, show you around some of its features and simulate doing basic Git operations using a basic workflow scenario.

How to Integrate VCS in Android Studio

Option 1

1. Clone the repository using the command $ git clone <YOUR_GIT_REPO>

git clone

2. Open Android Studio, click on “Open an existing Android Studio project” option and then select the project folder and click “OK”
3. Once Android Studio has finished loading, The IDE will show a popup saying that it has detected an unregistered VCS root. Click “Add root”. Now Android Studio Version Control tab is available for you.

How to integrate VCS in Android Studio: Option 1

Option 2

1. Open Android Studio and select “Checkout project from version control” option and then select “Git” from the dropdown menu
2. Paste the Git Repository URL and then click on Clone.
3. Once cloned, Android Studio will ask you whether you want to open the project you just cloned or not. Click Yes.
4. Version Control tab will automatically be there as soon as loading the project finishes.

How to integrate VCS in Android Studio: Option 2

Version Control Tab

The Version Control tab contains two main sections: 1. Local Change: This section keeps track of locally made file changes. File names are shown in different colors. See File Color Code in Android Studio VCS section to learn more.

VCS local change

  1. Log: This section displays local and remote branches, commits, commit messages, authors, timestamp, etc. Clicking on one commit displays the different changes introduced in the right pane.

VCS log

File Color Code in Android Studio VCS

To make file changes like addition, modification, deletion etc. stand out, Android Studio uses a smart color code: – Red: Newly added file to the Local repository that is neither added to Git nor is included in .gitignore file. – Green: Newly added file to the Local repository that has been added to Git. – Blue: Modified file. – Grey: Deleted file in a commit. – Black: Anything that is not the above.

Revert Option

The developer can sometimes change a file so much that going back to the original repository version becomes impossible using Ctrl + Z shortcut. For that, Android Studio provides you with the simple “Revert” option to sort this out. Simply use Ctrl + Alt + Z shortcut.

VCS revert

Basic Workflow Scenario

Commit Changes to a New Branch

  1. First, you should update the project to make sure that you are branching out from the latest revision.
  2. Create a new local branch from the latest revision of master.
  3. Add unversioned files to Git (or to .gitignore if you don’t want to include them in your commit).
  4. Use the shortcut Ctrl + K to open “Commit Changes…” Window. Write your commit message, then click on “Commit and Push”
  5. You could include the author’s name if you want, but Git does that automatically anyways.
  6. A “Push…” window will pop up. Just click on push. Git will create a remote branch with the same name as the local one and push the changes made on the local branch to its remote counterpart.

See the animation below:

Commit changes to a new branch

Merge into master

To merge our branch into master, we will need to follow these steps: 1. Checkout the master branch. 2. Right click on the latest revision of our branch and select “Merge” option from the “Branch branch” menu.

See the animation below:

Merge into master

Push Changes

Now that you merged into master, it remains to make that change happen on the remote repository as well. in other words, the merge we did in the previous step was only done locally and we still have to push the changes to remote master branch. To do that, simply use Ctrl + Shift + K to open “Push…” window and then click on “Push” button from there.

See the animation below:

Push changes

Conclusion

You are now set to work with Git using the built-in Android Studio VCS Integration functionality. Of course, Git operations are not just the ones covered in this manual. However, if you mastered the above operations, you will be able to do all other operations, like diff for example, just as easy.

Author: Iskander Gaba

How to Run the Backend Server for SMS Sending with Twilio

Reading This Manual

Copying all content from this file and pasting it at online markdown editor (like https://jbt.github.io/markdown-editor/) will not display images since they are stored locally within the repository. It is strongly recommended to read this document inside Atom text editor using Ctrl + Shift + M to display the rendered preview.

Introduction

Twilio is a developer platform for communications. Twilio API adds capabilities like voice, video, and messaging to the application. This enables businesses to provide the right communications experience for their customers. Behind Twilio API is a software layer that connects and optimizes communications networks around the world, allow to call and message anyone anywhere.
This manual aims to show how to run the Backend Server for using SMS Sending mechanism with Twilio on the local machine.

Dependencies

1. Android Studio
2. ngrok

How to Run the Backend Server for SMS Sending with Twilio

1. Open Android Studio, go to the menu File – Open

Open Android Studio

2. Choose the SMSBackend project.

Choose the Project

3. Run the Project. shadowJar is used for this purpose

Run the Project

4. When the build is finished go to the project tab and find the path build/libs/ There is the .jar file inside. Right-click on it and choose the point “Run”

Run the Snapshot

5. After finish, you can see the following information

Look at the Address
1. Check the http://127.0.0.1:4567/ in your browser. You should see the text “Hello world”
2. Open the ngrok window:

Open the ngrok
1. Type the command ngrok http 4567and press Enter
2. You should see the following. The application is available externally now

Results of ngrok
1. Return to Android Studio and open your project. Go to the Activity file and find the code that used for SMS sending. Replace the old link with the new link from ngrok:

Change the Link in the Activity File

1. Save and build the project.

Conclusion

Now you are know how to run the Backend Server for using SMS Sending mechanism with Twilio on your local machine.

Author: Natalia Tretiakova

Configure Microsoft Visual Studio Team Services to build and run unit tests against the Android application

Reading This Manual

Copying all content from this file and pasting it at https://jbt.github.io/markdown-editor/ will not display images and gif animations since they are stored locally within the repository. It is strongly recommended to read this document inside Atom text editor using Ctrl + Shift + M to display the rendered preview.

Introduction

Configure Microsoft Visual Studio Team Services to build and run unit tests against the Android application.

1. Setting up your workspace

Make sure to read working-with-VSTS-personal-branches manual first to configure your personal VSTS.

2. Configuring Unit Tests

Go to the Build and Release -> Build -> All Definitions -> Gated Build -> Edit.

We’ll need to tell VSTS how to run unit tests. Click on Add Task and search for Gradle and click Add.

Select the newly added task and look for the Tasks text field. In the field, replace build with a test.

VSTS can now run the .\gradlew test command which will run the tests added in task #331.

Click Save & queue -> Save.

3. Queue a build

Go to the Build and Release -> Build -> All Definitions -> Gated Build. Click Queue new build. Choose your branch from the Branch drop-down. Click Queue.

4. After the build is done,

You should see a build status and logs of the tests it ran.

If the test was successful, you will need to go to ./app/build/reports/tests/testDebugUnitTest/index.html to see the result.

Author: Nahom Abi