Header

  1. View current page

    DoNT - Do Not Think!!!

Profile_img_172x172_08
DoNT - Do Not Think!!!
14

Codeigniter 에 SimpleTest 연동하기

Codeigniter 에 SimpleTest 연동하기

  • Codeigniter 를 사용하고 있어야 합니다.

 

SimpleTest 설치

 simpletest.png

 

SimpleTester 설치
  • SimpleTester (Codeigniter library) 다운로드

  • 압축을 풀면 config, library, tests 디렉토리가 나오는데, Codeigniter/application 에 모두 복사합니다.
  • 설정을 변경하지 않으면 localhost에서만 테스트 할 수 있습니다.

simpletester.png

 

브라우저에서 테스트 결과를 확인하기 위해 컨트롤러/뷰 만들기
  • 컨트롤러
  1. <?php

    class Test extends Controller {
       
        function Test()
        {
            parent::Controller();       
            $this->load->library('simpletester');
        }
       
       
        function index()
        {
            $this->load->view('test.php');
        }
    }
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Unit Testing</title>
    </head>
    <body>
    <h1>Unit Testing</h1>
    </body>
    </html>

 

브라우저 확인
  • http://localhost/test 로 접속하면 테스트 결과가 브라우저 오른쪽 상단에 나타납니다.

확인.png  

 

테스트 코드 작성하기
  • simpletester 를 설치하면, tests 디렉토리에 기본 샘플 파일이 있는데, 해당 샘플 파일을 참고해서 테스트 코드를 작성합니다.

History

Last edited on 09/04/2009 18:17 by duddns

Comments (0)

You must log in to leave a comment. Please sign in.