Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidelines for running automation test #3

Merged
merged 13 commits into from Jun 8, 2018
Merged

Conversation

lilyhdo
Copy link
Contributor

@lilyhdo lilyhdo commented May 31, 2018

@duylam Please take a look at this content

@@ -0,0 +1 @@
.DS_Store

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do ".DS_Store" files still appear ? Do we need it ?


![manage-jenkins](../../images/2-manage-jenkins.png)

Click on the tab 'Available', search for the GitHub Integration Plugin, and install it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add image in here for easier to follow.


![deploy-key](../../images/2-deploy-key.png)

To check everything is working, enter the following command as the Jenkins user in your console.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it. What do you mean by "as the Jenkins user" ? If I run this local terminal, how can Jenkins and github know and return the expected result ?


![error](../../images/2-error.png)

To fix this, you must set up the credentials under "Source Code Management" under "Repositories" in the configuration.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand the issues with the image below but the explanation make me confuse. I suggest somethings like: "In the 'Source Code Management' section, looking for credential field...."


Select the Credential you just created in the Credentials dropdown.

For more information on setting up the credentials, refer to https://www.thegeekstuff.com/2016/10/jenkins-git-setup/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a note, so you should make it look separate with the other.


![automation](../../images/2-automation.png)

3. On the right hand side, you can select your preferred language, and in the left side of the window you will see the desiredCaps.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I though, the desiredCaps should be in the right hand and in the left is the setting for automation ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! I got my left and right mixed up

```
docker ps
```
Copy the status and enter it in the next command.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Copy the bold status" ??

```
Copy the admin password that shows up, and go to http://localhost:8080

Enter in your Kobiton username and password. Enter the admin password you got from the terminal when Jenkins prompts you to do so.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really confusing me, If I do as this step, so I have to type 3 times? My username, my password and admin password ? Is it correct ?

Copy link
Contributor Author

@lilyhdo lilyhdo Jun 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. i will try to make more clear


Follow our guide on how to trigger a Jenkins build from a Git push and set up the configurations stated.

Add NodeJS Plugin on Jenkins. To do this, go to 'Manage Jenkins' -> 'Manage Plugins' -> Available. Search for NodeJS and install it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that, we are running the nodejs test script so we need to install the nodejs plugin on Jenkins, is it right ?

If it correct, what will happen when I run test script with java, C#, etc.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or using node js for build jobs is an default setting in Jenkins ?

@@ -0,0 +1 @@
# 3. Using HockeyApp to manage apps

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, nothing here to preview.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part will be completed soon because we want to focus on automation testing using Kobiton.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, we don't need this section


![automation](../../images/2-automation.png)

3. On the left hand side, you can select your preferred language, and in the right side of the window you will see the desiredCaps.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I saw, there are much more option that we should focus such as: App type, Devices group, Orientation. I suggest we should mention these field and ask reader to check this carefully because it will change the desiredCaps.

@tiennguyenhoan
Copy link

tiennguyenhoan commented Jun 4, 2018

@baotn166 (cc. @duylam) LGMT


Follow our guide on how to trigger a Jenkins build from a Git push and set up the configurations stated.

This guide is executing the NodeJS test script from the Koboton samples, so we will add the NodeJS Plugin on Jenkins to execute NodeJS script as a build step. To do this, go to 'Manage Jenkins' -> 'Manage Plugins' -> Available. Search for NodeJS and install it.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change "Koboton" to "Kobiton"

@baotn166
Copy link

baotn166 commented Jun 4, 2018

LGTM

Copy link
Contributor

@duylam duylam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilyhdo Comments, em

@@ -0,0 +1,122 @@
# 1. Triggering a Jenkins build from a push to GitHub
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As user, I don't know the agenda for the guideline since there is no central place to introduce high-level what this repo is and which section that I'm going to read, please update the README.md at root folder to present the agenda. Something like https://github.com/sindresorhus/awesome-nodejs

@@ -0,0 +1,122 @@
# 1. Triggering a Jenkins build from a push to GitHub

Guidance on integrating Kobiton service into the build pipeline of mobile app development: Jenkins, HockeyApp, Appium and ReactNative
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this statement is off-topic ?

# 1. Triggering a Jenkins build from a push to GitHub

Guidance on integrating Kobiton service into the build pipeline of mobile app development: Jenkins, HockeyApp, Appium and ReactNative

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My recommend structure for the guideline (this and more in further) is, please share if you can see better one

Jenkins-HockeyApp-Appium-ReactNative
    |- README.md
    |- LICENSE
    |- assets (keep static files for all like images, logo, code, template, etc.)
    |- 1-foo-bar.md (these are details section)
    |- 2-foo-bar.md
    |- 3-foo-bar (in case the section contains many info, we can put in a folder and use the README inside to guide a brief)
           |- README.md
           |- 1-foo-bar.md
           |- 2-foo-bar.md


Guidance on integrating Kobiton service into the build pipeline of mobile app development: Jenkins, HockeyApp, Appium and ReactNative

**Triggering a Jenkins build from a push to GitHub**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current content has following problems:

  • distractions on information (e.g. lilyhdo/pipeline-test, docker)
  • the reading flow is not clear (new line, paragraph)

Here is my suggest structure

## Triggering a Jenkins build from a push to Github

#### 1.1 Install Github Integration plugin on Jenkins

....

#### 1.2 Configure Github repo to push to Jenkins

...

#### 1.3 Allow Jenkins to access to the Github repository

...

(use 1.1 to consistent with other section)

On README say something

Let's assume we're a company having a mobile app, and has a domain https://awesome-mapp.com. We're developing the app and we need to integrate Kobiton into our development and testing pipeline. At awesome-mapp, we uses

- Jenkins for build the app
- HocketApps for keeping the daily app build
...

Notes for improvement:

  • Make sure the content organization looks clear
  • No need to mention docker, just assume user needs to have a Jenkins server available with public domain , say ci.awesome-mapp.com
  • Avoid using external link like https://www.thegeekstuff.com/2016/10/jenkins-git-setup/
  • Skip Add GitHub project to Jenkins configuration

@@ -0,0 +1,202 @@
# 2. Running automation test with Kobiton
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use kobiton-org-demo account, @baotn166 please transfer the credential to Lily

## 2.2 Setup Jenkins
#### How to setup Jenkins to run automation testing

Jenkins is an open source automation server that provides hundreds of plugins to support building, deploying, and automating any project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to mention docker here


![project](../../images/2-project.png)

### 2.2.2 For Jenkins Pipeline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to mention pipeline here (avoid distraction)


## 2.1 Prerequisites

* Username
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My recommend structure

#### 2.1 Prepare Kobiton c...

...

#### 2.2 Create new Jenkins project to execute the Automation test

**2.2.1 Write the automation test script**

Select from kobiton samples ....

Configure nodejs on Jenkins ...

**2.2.2 Create Jekins project**

**2.2.3 Trigger Jenkins project by pushing on Github** (it's the `2.3.2 Output`)

Make a push to github repo

Observe the jenkins execution (

**2.2.4 Get the Automation session data through Kobiton REST API**

No need to use nodejs, we can use bash to generate base64 and make http with `curl` tool

to generate base 64 `echo $1 | python -m base64 -d`

Should layout as list of endpoints to use

- Update test result to session (https://api.kobiton.com/docs/#update-session-information)
- Get session info
- Get session commands

* Error: "The environment you requested was unavailable."
- This means that the device you selected is already booked. Either select a different device or wait a few moments until your device becomes available
* Other
- Contact Kobiton for support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show user how to submit a Zendesk on Production, ask @NguyenHoanTien

@@ -0,0 +1 @@
# 3. Using HockeyApp to manage apps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, we don't need this section


![deploy-key](assets/2-deploy-key.png)

Since we are running Jenkins in a Docker container, we need to run commands as the Jenkins user and not just in your local terminal.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't ask the client installing Jenkins by using Docker in the prerequisites. What should client do if they use brew or download directly to install Jenkins?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I meant to take out all the information about Docker but I forget this tidbit. I will fix!


Upload the app you want to test to a GitHub repo.

Go to Jenkins and create a new freestyle project.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this step should be moved to # 1.3


![githubproject](assets/2-githubproject.png)

* Under the 'Build Triggers' section, check the box with 'GitHub hook trigger for GITScm polling'.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be after step on Source Code Management

@@ -0,0 +1,115 @@
# Triggering a Jenkins build from a push to GitHub
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should describe the purpose of this file
  2. The Prerequisites

@tuyetngo
Copy link

tuyetngo commented Jun 7, 2018

@lilyhdo I have some feedbacks above.
cc a @duylam I don't understand what is related with HockeyApp and NativeReact here?

Copy link
Contributor

@duylam duylam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments


This guide will demonstrate how to get Jenkins to build your project everytime your source code is changed and pushed to GitHub.

### Prerequisites
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilyhdo Update as below

*Prerequisites*

- Jenkins is installed, let's assume it's at https://ci.awesome-mapp.com

*Follow below steps to setup Jenkins for Github*

#### 1.1 Install the GitHub integration plugin

...

```
PUT /sessions/{sessionId}
```
To make a request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make a request:

  1. Encode your credential in base 64 for HTTP Basic Authentication, you may use below command and note the text result
echo -n <your username>:<your api-key> | base64
  1. Use encoded base64 from above in curl commands, like below
curl -X GET https://api.kobiton.com/v1/sessions \
  -H 'Authorization: Basic dGVzdHVzZXI6MTIzZWQtMTIzZmFjLTkxMzdkY2E='
  -H 'Accept: application/json'

And below are necessary Kobiton Rest API endpoints that you may need

  1. Get session info

...

README.md Outdated

2. The second guide will demonstrate how to run automation tests on your app with the Kobiton service.

<!-- Let's we're a company or individual that has a mobile application and we have a domain, https://awesome-mapp.com. While developing the app we need to integrate Kobiton into the development and testing pipeline. Here at awesome-mapp, we use:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

README.md Outdated
The guidelines in this repo will show you how to trigger a Jenkins build from a push on GitHub (i.e. everytime a change is made to your source code), and how to run automation tests with Kobiton.

## Contents
1. First guide will demonstrate how to trigger a Jenkins build from a push to GitHub.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1. First guide will demonstrate [how to trigger a Jenkins build from a push to GitHub](./1-triggering-jenkins.md). 
2. The second guide will demonstrate [how to run automation tests on your app with the Kobiton service](...)

@duylam duylam merged commit cc69dee into kobiton:master Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants