39
멀티플랫폼 개발과 테스팅 ===================== - 2013622() 오후 2~ 4- 선문대학교 글로컬 IT 융복합기술센터 스마트 창작터 https://github.com/wookay

멀티플랫폼 앱 개발과 테스팅

Embed Size (px)

DESCRIPTION

## platforms * ios * android * unity ## logic * objective-c * java * csharp * javascript

Citation preview

Page 1: 멀티플랫폼 앱 개발과 테스팅

멀티플랫폼 앱 개발과 테스팅=====================

- 2013년 6월 22일 (토) 오후 2시 ~ 4시 - 선문대학교 글로컬 IT 융복합기술센터 스마트 앱 창작터

https://github.com/wookay

Page 2: 멀티플랫폼 앱 개발과 테스팅

iOS https://developer.apple.com/technologies/ios/ Xcode developer toolset https://developer.apple.com/technologies/tools/

Android SDK http://developer.android.com/sdk/ Android Studio http://developer.android.com/sdk/installing/studio.html

Unity http://unity3d.com/unity/download/

Node.js http://nodejs.org/download/

����������� ������������������  개발����������� ������������������  SDK,����������� ������������������  툴����������� ������������������  다운로드

Page 3: 멀티플랫폼 앱 개발과 테스팅

플랫폼 별 숫자 곱하기 2 하는 앱을 만들어 봅니다

Page 4: 멀티플랫폼 앱 개발과 테스팅

input

resultbutton

Page 5: 멀티플랫폼 앱 개발과 테스팅

input

resultbutton

Page 6: 멀티플랫폼 앱 개발과 테스팅
Page 7: 멀티플랫폼 앱 개발과 테스팅
Page 8: 멀티플랫폼 앱 개발과 테스팅
Page 9: 멀티플랫폼 앱 개발과 테스팅
Page 10: 멀티플랫폼 앱 개발과 테스팅
Page 11: 멀티플랫폼 앱 개발과 테스팅
Page 12: 멀티플랫폼 앱 개발과 테스팅

소스����������� ������������������  코드와����������� ������������������  프로젝트����������� ������������������  파일은����������� ������������������  아래에����������� ������������������  올려뒀습니다

https://github.com/wookay/multiply2/

git clone [email protected]:wookay/multiply2.git

Page 13: 멀티플랫폼 앱 개발과 테스팅

• UI 인터페이스: ViewController_iPhone.xib

• 헤더 파일: ViewController.h

• 구현 파일: ViewController.m

Page 14: 멀티플랫폼 앱 개발과 테스팅
Page 15: 멀티플랫폼 앱 개발과 테스팅

// platforms/ios/Sample/Sample/ViewController.h

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (strong, nonatomic) IBOutlet UITextField* input;@property (strong, nonatomic) IBOutlet UILabel* result;

- (IBAction) touchedButton:(id)sender;

@end

Page 16: 멀티플랫폼 앱 개발과 테스팅

// platforms/ios/Sample/Sample/ViewController.m

#import "ViewController.h"

@interface ViewController ()@end

@implementation ViewController

- (void)viewDidLoad {    [super viewDidLoad];        _input.placeholder = @"숫자를 입력하시오";    _input.keyboardType = UIKeyboardTypeNumberPad;    _input.font = [UIFont fontWithName:@"Helvetica" size:26];    [_input becomeFirstResponder];}

- (IBAction) touchedButton:(id)sender {    int num = _input.text.intValue;    _result.text = [NSString stringWithFormat:@"%d x 2 = %d", num, num * 2];    NSLog(@"input: %d", num);}

@end

Page 17: 멀티플랫폼 앱 개발과 테스팅

• 레이아웃: layout/activity_main.xml

• 메인 클래스: MainActivity.java

Page 18: 멀티플랫폼 앱 개발과 테스팅
Page 19: 멀티플랫폼 앱 개발과 테스팅

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:paddingLeft="@dimen/activity_horizontal_margin"    android:paddingRight="@dimen/activity_horizontal_margin"    android:paddingTop="@dimen/activity_vertical_margin"    android:paddingBottom="@dimen/activity_vertical_margin"    tools:context=".MainActivity">

    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="Result"        android:layout_marginLeft="17dp"        android:id="@+id/result"        android:textSize="20dp"        android:layout_below="@+id/input"        android:layout_alignParentLeft="true"        android:layout_marginTop="14dp"/>

    <EditText            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:inputType="number"            android:ems="10"            android:id="@+id/input"            android:layout_marginTop="18dp"            android:layout_alignParentTop="true"            android:layout_alignLeft="@+id/result"/>

    <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="x 2"            android:id="@+id/button"            android:layout_alignBottom="@+id/input"            android:layout_toRightOf="@+id/input"/>

</RelativeLayout>platforms / android / SampleProject / Sample / src / main / res / layout / activity_main.xml

Page 20: 멀티플랫폼 앱 개발과 테스팅

// platforms/android/SampleProject/Sample/src/main/java/com/factorcat/sample/MainActivity.java

package com.factorcat.sample;

import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.widget.EditText;import android.widget.Button;import android.widget.TextView;import android.view.View;import android.view.View.OnClickListener;import android.util.Log;

public class MainActivity extends Activity {    EditText input;    Button button;    TextView result;

    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);

        input = (EditText) this.findViewById(R.id.input);        button = (Button) this.findViewById(R.id.button);        result = (TextView) this.findViewById(R.id.result);        button.setOnClickListener(new OnClickListener() {            @Override            public void onClick(final View v) {                int num = 0;                try {                    num = Integer.parseInt(input.getText().toString());                } catch (NumberFormatException e) {                }                result.setText(String.format("%d x 2 = %d", num, num*2));                Log.i("[log]", "input: " + num);            }        });    }

Page 21: 멀티플랫폼 앱 개발과 테스팅

로직 테스트

• ios

• objective-c

• android

• java

Page 22: 멀티플랫폼 앱 개발과 테스팅

// logic/objective-c/Test.m

#import "UnitTest.h"

int main (int argc, const char * argv[]) {  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

  assert_equal( 1 , 1 );  assert_equal( 3 , 1+2 );  assert_equal( @"a" , @"a" );

  [pool release];  return 0;}

~/multiply2/logic/objective-c master$ makegcc -framework Foundation -o Test Test.m UnitTest.m~/multiply2/logic/objective-c master$ ./Testpassed: 1passed: 3passed: a

Page 23: 멀티플랫폼 앱 개발과 테스팅

// logic/java/Test.java

class Test {  static void assert_equal(int expected, int got) {    if (expected==got) {      System.out.println("passed: " + expected);    } else {      System.out.println("Assertion failed\nExpected: " + expected +        "\nGot: " + got);    }  }

  static void assert_equal(String expected, String got) {    if (expected.equals(got)) {      System.out.println("passed: " + expected);    } else {      System.out.println("Assertion failed\nExpected: " + expected +        "\nGot: " + got);    }  }

  public static void main(String[] args) {

    assert_equal( 1 , 1 );    assert_equal( 3 , 1+2 );    assert_equal( "a" , "a" );

  }} ~/multiply2/logic/java master$ make

javac Test.java~/multiply2/logic/java master$ CLASSPATH=. java Testpassed: 1passed: 3passed: a

Page 24: 멀티플랫폼 앱 개발과 테스팅

쉬는 시간

Page 25: 멀티플랫폼 앱 개발과 테스팅

• C# 버전: NewBehaviourScript.cs

• 자바스크립트 버전: NewBehaviourScript.js

Page 26: 멀티플랫폼 앱 개발과 테스팅

// platforms/unity/CSharpSample/Assets/NewBehaviourScript.cs

using UnityEngine;using System.Collections;using System;

public class NewBehaviourScript : MonoBehaviour {

" private string input = "";" private string result = "Result";

" void OnGUI () {

" " GUI.Label(new Rect(20,102,204,21), result);" " input = GUI.TextField(new Rect(20,50,200,30), input);" " if (GUI.Button(new Rect(236,43,67,43), "x 2")) {            int num = 0;            try {                num = Convert.ToInt32(input);            } catch (FormatException) {            }            result = String.Format("{0} x 2 = {1}", num, num*2);

" " Debug.Log(String.Format("input: {0}", num));        }

" }

}

Page 27: 멀티플랫폼 앱 개발과 테스팅

// platforms/unity/JavascriptSample/Assets/NewBehaviourScript.js

#pragma strict

var input : String = "";var result : String = "Result";

function OnGUI () {  GUI.Label(Rect(20,102,204,21), result);  input = GUI.TextField(Rect(20,50,200,30), input);  if (GUI.Button(Rect(236,43,67,43), "x 2")) {    var num = parseInt(input);    result = String.Format("{0} x 2 = {1}", num, num * 2 );    Debug.Log(String.Format("input: {0}", num));  }}

Page 28: 멀티플랫폼 앱 개발과 테스팅

로직 테스트

• unity

• C#

• javascript

Page 29: 멀티플랫폼 앱 개발과 테스팅

// logic/csharp/Test.cs

using System;

class Test {  static void assert_equal(object expected, object got) {    if (expected.Equals(got)) {      Console.WriteLine("passed: " + expected);    } else {      Console.WriteLine("Assertion failed\nExpected: " + expected + "\nGot: " + got);    }  }

  static void Main() {

    assert_equal( 1 , 1 );    assert_equal( 3 , 1+2 );    assert_equal( "a" , "a" );

  }}

~/multiply2/logic/csharp master$ makemcs Test.cs~/multiply2/logic/csharp master$ mono Test.exepassed: 1passed: 3passed: a

Page 30: 멀티플랫폼 앱 개발과 테스팅

// logic/javascript/Test.js

function assert_equal(expected, got) {  if (expected==got) {    console.log("passed: " + expected);  } else {    console.log("Assertion failed\nExpected: " + expected + "\nGot: " + got);  }}

assert_equal( 1 , 1 );assert_equal( 3 , 1+2 );assert_equal( "a" , "a" );

~/multiply2/logic/javascript master$ node Test.jspassed: 1passed: 3passed: a

Page 31: 멀티플랫폼 앱 개발과 테스팅

## 돈 벌기인앱 구매 달기 In-App Purchase for Developers https://developer.apple.com/in-app-purchase/광고 달기: 구글 애드몹 http://google.com/ads/admob/쏘셜 펀딩: 텀블벅 프로젝트 보기 / 게임 https://tumblbug.com/ko/projects

## SNS 플랫폼카카오게임 플랫폼 http://with.kakao.com/game페이스북 개발자 http://developers.facebook.com

## 개발프로젝트 할일 관리: 트렐로 http://trello.com쏘셜 코딩: 깉헙 https://github.com발표 슬라이드 공유 http://slideshare.net인맥관리 링크드인 http://linkedin.com

## 방송게임 개발자 랩소디 http://agebreak.iblug.com/생활 코딩 http://opentutorials.org

참고����������� ������������������  사이트

Page 32: 멀티플랫폼 앱 개발과 테스팅

프로젝트 할일 관리: 트렐로 http://trello.com

Page 33: 멀티플랫폼 앱 개발과 테스팅

쏘셜 코딩: 깉헙 https://github.com

Page 34: 멀티플랫폼 앱 개발과 테스팅

발표 슬라이드 공유 http://slideshare.net

Page 35: 멀티플랫폼 앱 개발과 테스팅

게임 개발자 랩소디 http://agebreak.iblug.com/

Page 36: 멀티플랫폼 앱 개발과 테스팅

생활 코딩 http://opentutorials.org

Page 37: 멀티플랫폼 앱 개발과 테스팅

쏘셜 펀딩: 텀블벅 프로젝트 보기 / 게임 https://tumblbug.com/ko/projects

Page 38: 멀티플랫폼 앱 개발과 테스팅

Q&A

• 질문

Page 39: 멀티플랫폼 앱 개발과 테스팅