Skip to content

Commit

Permalink
Adding read me. Commenting out Jenkins.
Browse files Browse the repository at this point in the history
  • Loading branch information
chiara committed Apr 6, 2015
1 parent 9f0d3d7 commit 40ae25d
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 118 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
### Status
[![Build Status](https://travis-ci.org/kul3r4/droidConf.png)](https://travis-ci.org/kul3r4/droidConf)
# droidConf
This project has been created for attending DroidConfIT 2015.
The main idea is having a talk around a sample app to explain the main ideas and show results.
The project is organized in 4 main modules:
* App module
* Java Lib module
* Acceptance tests module
* Bespoke.js presentation module

## londonWeather
This is a really simple app which shows the weather. It contains a Mapping strategy for the icon to display.

## londonWeatherAcceptance
This contains Selenium Acceptance Tests.
In order to run them:
* Clean and build the londonWeather application
* Start your emulator or device
* Use the following VM options: -ea -Daut="com.cchiappini.londonweather" -DapkPath=pathToYourAPK -DhubURL="http://localhost:4444/wd/hub"
pathToYourAPK for me is -DapkPath="/Users/cchiappini/IProjects/droidConfRefactor/londonWeather/build/outputs/apk/londonWeather-debug.apk"

## londonweatherlib
This contains domain model logic in Java

##src
This contains the bespoke.js presentation.
In order to add a new slide, use index.jade.
To generate a new presentation on your local machine, run gulp. (Instructions here: https://github.com/markdalgleish/bespoke.js)

171 changes: 114 additions & 57 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ <h2>lunch time walk</h2>
<h2>weather today?</h2>
</div>
</section>
<section class="green">
<div class="background-div">
<h2>Add a sketch here</h2>
</div>
</section>
<section class="baby-lego-background">
<div class="background-div">
<h2>Time to build
Expand Down Expand Up @@ -130,22 +135,17 @@ <h2>Testing frameworks for Android</h2>
</section>
<section class="green">
<div class="background-div">
<h2>Unit testing</h2>
<h2 class="bullet">Modules</h2><img src="images/modules.png" class="img-small-with-text">
</div>
</section>
<section class="green">
<div class="background-div">
<h2 class="bullet">Modules</h2><img src="images/modules.png" class="img-small"><br><br>
<ul>
<li>separation of concerns</li>
<li>reusability</li>
<li>supported by Android Studio</li>
</ul>
<h2>Unit testing</h2>
</div>
</section>
<section class="green">
<div class="background-div">
<h2 class="bullet">Java module</h2><br>
<h2 class="bullet">Java testing</h2><br>
<ul>
<li>Junit tests</li>
</ul>
Expand All @@ -155,12 +155,13 @@ <h2 class="bullet">Java module</h2><br>
<pre class="size-dimension"><code class="language-javascript">@Test
public void shouldReturnASunnyWeather(){
Weather expectedWeather =
new Weather(SUN_IS_SHINING, TEMPERATURE, ICON_ID);
new Weather("Sun is shining", 15.0, "sun");
assertEquals(expectedWeather, weatherOracle.getWeather());
}
</code></pre>
</section>
<section class="green">
<pre class="size-dimension"><code class="language-javascript">assertEquals(expectedWeather, weatherOracle.getWeather());</code></pre>
<pre class="size-dimension"><code class="language-javascript">public class WeatherOracle {
public static final String SUN_IS_SHINING = "Sun is shining";
public static final double TEMPERATURE = 15.0;
Expand All @@ -173,7 +174,7 @@ <h2 class="bullet">Java module</h2><br>
</section>
<section class="green">
<div class="background-div">
<h2 class="bullet">Android module</h2><br>
<h2 class="bullet">Android testing</h2><br>
<ul>
<li>Android test framework</li>
<li>Robolectric</li>
Expand Down Expand Up @@ -208,8 +209,8 @@ <h2 class="bullet">Android module</h2><br>
@Test
public void shouldReturnTheRightIconWhenSunny()
throws IconNotFoundException {
Weather weather = new Weather(WEATHER_DESCRIPTION,
WEATHER_TEMPERATURE, SUN_ICON_ID);
Weather weather = new Weather("Sun is shining",
15.0, "sun");
int expectedIcon = R.drawable.sun;
assertEquals(expectedIcon,
getIconResourceIdForWeather(weather));
Expand All @@ -218,17 +219,8 @@ <h2 class="bullet">Android module</h2><br>
</code></pre>
</section>
<section class="green">
<pre class="size-dimension"><code class="language-javascript">public void shouldThrowAnExceptionWhenIconIsNotFound()
throws IconNotFoundException {
Weather weather = new Weather(A_WEATHER_DESCRIPTION,
A_WEATHER_TEMPERATURE, UNKNOWN_ICON_ID);
int expectedIcon = R.drawable.sun;
assertEquals(expectedIcon,getIconResourceIdForWeather(weather));
}

</code></pre>
</section>
<section class="green">
<pre class="size-dimension"><code class="language-javascript">assertEquals(expectedIcon,
getIconResourceIdForWeather(weather));</code></pre>
<pre class="size-dimension"><code class="language-javascript">public class WeatherIconMapper {

public static int getIconResourceIdForWeather(Weather weather)
Expand All @@ -243,7 +235,7 @@ <h2 class="bullet">Android module</h2><br>
</section>
<section class="doughnuts">
<div class="background-div">
<h2>Functional testing</h2><br>
<h2 class="bullet">Functional testing</h2><br>
<ul>
<li>Selendroid</li>
<li>Calabash</li>
Expand All @@ -261,7 +253,6 @@ <h2 class="bullet">Selendroid</h2><br>
<li>open source automation framework</li>
<li>android native, hybrid and mobile web application</li>
<li>emulator and real device</li>
<li>Json Wire Protocol to run webdriver test scripts on device</li>
<li>integration with selenium grid for parallel execution on multiple node</li>
</ul>
</div>
Expand All @@ -270,14 +261,50 @@ <h2 class="bullet">Selendroid</h2><br>
<pre class="size-dimension"><code class="language-javascript">@Test
public void userCanGetWeatherDescription() {
WebElement weatherText = findWeatherText();
assertEquals(SUN_IS_SHINING, weatherText.getText());
assertEquals("sun is shining", weatherText.getText());
}

@Test
public void userCanGetWeatherTemperature() {
WebElement weatherTemp = findTemperatureText();
assertEquals(EXPECTED_TEMPERATURE, weatherTemp.getText());
assertEquals("15.0", weatherTemp.getText());
}
</code></pre>
</section>
<section class="green">
<pre class="size-dimension"><code class="language-javascript">@Before
public void setup() throws Exception {
SelendroidConfiguration config = new SelendroidConfiguration();
//my apkPath is /Users/cchiappini/IProjects/droidConfRefactor
// /londonWeather/build/outputs/apk/londonWeather-debug.apk
String apkPath = System.getProperty("apkPath");
//my aut is "com.cchiappini.londonweather"
String aut = System.getProperty("aut");
//my hubURL is http://localhost:4444/wd/hub
String hubUrl = System.getProperty("hubURL");
config.addSupportedApp(apkPath);
config.setPort(4444);
SelendroidLauncher selendroidServer = new SelendroidLauncher(config);
selendroidServer.launchSelendroid();

SelendroidCapabilities capa = new SelendroidCapabilities(aut);
driver = new SelendroidDriver(new URL(hubUrl), capa);

</code></pre>
</section>
<section class="green">
<pre class="size-dimension"><code class="language-javascript">private WebElement findTemperatureText() {
return findElementById(WEATHER_TEMP);
}

private WebElement findWeatherText() {
return findElementById(WEATHER_DESCRIPTION);
}

private WebElement findElementById(String id) {
return driver.findElement(By.id(id));
}

</code></pre>
</section>
<section class="nutella">
Expand Down Expand Up @@ -318,6 +345,17 @@ <h2 class="bullet">Travis</h2><br>
</ul>
</div>
</section>
<section class="steps">
<div class="background-div">
<h2 class="bullet">steps</h2><br>
<ul>
<li>Go to <a href="https://travis-ci.org">Travis CI</a></li>
<li>Sign In with Github user</li>
<li>Activate GitHub Webhook</li>
<li>Add .travis.yml file to your repository</li>
</ul>
</div>
</section>
<section class="green">
<div class="background-div">
<h3>.travis.yml</h3>
Expand All @@ -338,36 +376,55 @@ <h3>.travis.yml</h3>
- ./gradlew clean build</code></pre>
</div>
</section>
<section class="green"><img src="images/travis-snaphot1.png" class="img-fit"></section>
<section class="green">
<div class="background-div"><img src="images/jenkins_logo.png" class="img-fit bullet"><br>
<ul>
<li>plugins</li>
<li>support the entire deployment pipeline</li>
<li>web interface</li>
<li>manually updating</li>
</ul>
</div>
</section>
<section class="green">
<div class="background-div"><img src="images/chef.svg" class="img-fit bullet"><br><br>
<ul>
<li>infrastructure as code</li>
<li>automate your infrastructure</li>
<li>more maintainable, versionable, testable and collaborative</li>
</ul>
</div>
</section>
<section class="green">
<div class="background-div">
<h2>Jenkins for Android and Chef</h2>
</div>
</section>
<section class="green">
<div class="background-div">
<h2>Jenkins jobs</h2>
</div>
</section>
<section class="green"><img src="images/travis-snaphot1.png" class="img-fit-entire-screen"></section>
<!--
section.green
div.background-div
img.img-fit(src="images/jenkins_logo.png").bullet
br
ul
li plugins
li support the entire deployment pipeline
li web interface
li manually updating
section.green
div.background-div
img.img-fit(src="images/chef.svg").bullet
br
br
ul
li infrastructure as code
li automate your infrastructure
li more maintainable, versionable, testable and collaborative
section.cooking
div.background-div
h2.bullet
br
ul
li a computer managed by Chef is a node
li a recipe defined in a cookbook
li recipe applied to the node
section.green
div.background-div
h2.bullet How we worked with Chef for Android SDK
br
ul
li ruby
li remote machine
li <a href="https://supermarket.chef.io">Chef supermarket</a>
li clone the recipe in our repository
li customized the recipe
li run the recipe on the remote machine
section.green
div.background-div
h2 Jenkins jobs
-->
<section class="green">
<div class="background-div"></div>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@ public class LondonWeatherAcceptanceTest {
@Before
public void setup() throws Exception {
SelendroidConfiguration config = new SelendroidConfiguration();
config.addSupportedApp("/Users/cchiappini/IProjects/droidConfRefactor/londonWeather/build/outputs/apk/londonWeather-debug.apk");
//mine is /Users/cchiappini/IProjects/droidConfRefactor
// /londonWeather/build/outputs/apk/londonWeather-debug.apk
String apkPath = System.getProperty("apkPath");
//aut is for me "com.cchiappini.londonweather"
String aut = System.getProperty("aut");
//my hubURL is http://localhost:4444/wd/hub
String hubUrl = System.getProperty("hubURL");
config.addSupportedApp(apkPath);
config.setPort(4444);
SelendroidLauncher selendroidServer = new SelendroidLauncher(config);
selendroidServer.launchSelendroid();

SelendroidCapabilities capa = new SelendroidCapabilities("com.cchiappini.londonweather");
capa.setPlatformVersion(DeviceTargetPlatform.ANDROID18);
driver = new SelendroidDriver(new URL("http://localhost:4444/wd/hub"), capa);

SelendroidCapabilities capa = new SelendroidCapabilities(aut);
//capa.setPlatformVersion(DeviceTargetPlatform.ANDROID18);
driver = new SelendroidDriver(new URL(hubUrl), capa);
}

@Test
Expand All @@ -49,6 +57,7 @@ public void userCanGetWeatherTemperature() {
assertEquals(EXPECTED_TEMPERATURE, weatherTemp.getText());
}


private WebElement findTemperatureText() {
return findElementById(WEATHER_TEMP);
}
Expand All @@ -57,14 +66,9 @@ private WebElement findWeatherText() {
return findElementById(WEATHER_DESCRIPTION);
}

// private WebElement findWeatherButton() {
// return findElementById("weather_button");
// }

private WebElement findElementById(String id) {
return driver.findElement(By.id(id));
}

@After
public void tearDown() {
driver.quit();
Expand Down
Loading

0 comments on commit 40ae25d

Please sign in to comment.