용오름체험휴양마을영농조합법인 / 홍천 용오름캠핑장 팸투어 다녀왔어요.

용오름체험휴양마을영농조합법인 / 홍천 용오름캠핑장 팸투어 다녀왔어요.강원도 홍천 서석면에 위치해있으며 1급수 용오름계곡 바로 옆에 있습니다.홍천군 1등 마을로 마을에서 직접 관리하는 용오름캠핑장,펜션 10개를 운영하고 있으며 각종 모임이 가능하도록 식당,회의실,야외무대가 설치되어 있습니다.홍천군 1등 마을답게 캠핑장,펜션 마을 전지역 wi-fi 사용이 가능하며 매년 봄 팸투어 실시, 여름엔 마을에서 재배한 홉으로 직접만든 맥주축제,마리소리 음악축제 를 열고 있습니다.계곡의 경우 수심이 다양하여 다이빙 포인트가 2곳이 있으며 아이들이 안전하게 물놀이를 할 수 있는 곳도 여러 곳 있습니다.홍천 용오름캠핑장 팸투어 다녀왔어요.요즘은 농산촌체험마을에서 캠핑과 여러프로그램을 같이 하는 곳이 추세더라고요. 아미산이 둘러쌓인 청정계곡이 흐르는 아름다운 용오름체험휴양마을 에서 운영하는 홍천 용오름캠핑장 팸투어 다녀왔어요. 테크 앞 강이...붕어빵 가족의 담너머 세상구경https://m.blog.naver.com/1092119/220711235599가을여행-홍천여행- 홍천 용오름 마을 첫째날여행의 계절 가을입니다. 요즘 저희는 강원도에 꽃힌 상태인지라...카페 행복한 이티씨와 함께하는 홍천 용오름 마을 1박2일 체험에 참가를 하였답니다! 평소 체험 시간보다 조금 늦은 출발을 해서 차가 밀리지 않으려나...귀여운 단지https://m.blog.naver.com/sanguidan/50181593653용오름마을 캠핑장여름휴가의 시즌이다.. 강원도의 계곡과 시원함을 만끽하기 위해 캠핑장을 검색하다 우연히 알게 된 홍천의 용오름 캠핑장.. 성수기라 캠핑장 요금들이 사악하다 용오름캠핑장 옆엔 해미르 캠핑장이 있는데...★살로몬의 잇츠캠핑★https://m.blog.naver.com/freeguy9040/20163628934맥주효모로 만든 용오름맥주마을 바쏘 맥주샴푸와 맥주마스크팩...1988년까지 맥주 원료인 홉을 재배하며 번성했던 강원도 홍천군 서석면 용오름 마을이란 곳이 있었습니다…

Continuous testing in PHP with Eclipse

Continuous testing in PHP with Eclipse

into a terminal.

This post will show you how to set up a project with the Eclipse MakeGood plugin, which is a continuous test runner for the Eclipse IDE. When it is enabled, the plugin runs a set of tests every time you save a file.

This is best used on projects which are:

Small — so you tests run in a reasonable timeframe.

— so you tests run in a reasonable timeframe. Complex — reasonably high risk of introducing defects.

— reasonably high risk of introducing defects. Well-tested — so your unit tests are reasonably likely to identify defects.

Set up your machine

Your machine needs Eclipse PDT, MakeGood and composer.

Eclipse PDT

If you've found this post via Google, then you probably already run Eclipse and PHP. If not, fetch the "Eclipse for PHP developers" distribution from here

You need to pick up the XDebug extension to really make use of this setup. On Debian-based distributions, this is achieved via:

sudo apt - get install php5 - xdebug

If you don't use Eclipse yet, then check whether languages or tools you've used before have plugins in the Eclipse Marketplace. There's a good chance that Eclipse will do the whole lot.

MakeGood

MakeGood is simply an Eclipse plugin, so you can fetch it from the Eclipse Marketplace.

Navigate to Help → Eclipse Marketplace and search for "makegood":

Wait for the info to be fetched:

Check all the boxes, and then click Confirm:

Accept the terms, and wait for the install:

At one point, you will be prompted to accept a developer's certificate, which you need to do before continuing:

This feature will not work unless you have a PHP binary set up. You need to configure this under Window → Preferences → PHP → PHP executables.:

This is system dependent: Windows users will find a file somewhere called php-cli.exe , while Linux users might find it at /usr/bin/php .

After this, MakeGood is installed. It is configured per-project, so we'll get to that after the next section.

Composer

Composer is a dependency manager which is widely used in the PHP world.

You can get it from https://getcomposer.org/download/

Rather than use the install process which is suggested there, you can simply download the phar, make it executable, and place it somewhere like /usr/bin :

wget https : / / getcomposer . org / composer . phar chmod + x composer . phar sudo mv composer . phar / usr / bin / composer composer -- version

By using composer to load PHPUnit, MakeGood becomes much easier to configure.

Project setup

To start, make a new PHP project by clicking File → New → PHP Project. Name it something like "Example".

We are using composer here because it provides an easy way to make sure MakeGood can see the PHPUnit code. So let's set a few things up:

First, add a composer.json file which adds a recent version of PHPUnit as a require-dev dependency. Right-click Example project, and navigate to New → File, naming it composer.json :

{ "require-dev": { "phpunit/phpunit": "4.5.*" } }

Note that with the way that MakeGood constructs its command-line, newer versions of PHPUnit do not appear to work correctly at the time of writing.

Next up, install the new dependency with the help of Composer:

$ composer install Loading composer repositories with package information Installing dependencies ( including require - dev ) - Installing sebastian / version ( 1.0 . 6 ) - Installing sebastian / global - state ( 1.0 . 0 ) - Installing sebastian / recursion - context ( 1.0 . 1 ) - Installing sebastian / exporter ( 1.2 . 1 ) - Installing sebastian / environment ( 1.3 . 2 ) - Installing sebastian / diff ( 1.3 . 0 ) - Installing sebastian / comparator ( 1.2 . 0 ) - Installing symfony / yaml ( v2 .7 . 3 ) - Installing doctrine / instantiator ( 1.0 . 5 ) - Installing phpdocumentor / reflection - docblock ( 2.0 . 4 ) - Installing phpspec / prophecy ( v1 .4 . 1 ) - Installing phpunit / php - text - template ( 1.2 . 1 ) - Installing phpunit / phpunit - mock - objects ( 2.3 . 6 ) - Installing phpunit / php - timer ( 1.0 . 7 ) - Installing phpunit / php - token - stream ( 1.4 . 3 ) - Installing phpunit / php - file - iterator ( 1.3 . 4 ) - Installing phpunit / php - code - coverage ( 2.2 . 2 ) - Installing phpunit / phpunit ( 4.5 . 1 ) sebastian / global - state suggests installing ext - uopz ( * ) phpdocumentor / reflection - docblock suggests installing dflydev / markdown ( ~ 1.0 ) phpdocumentor / reflection - docblock suggests installing erusev / parsedown ( ~ 1.0 ) phpunit / phpunit suggests installing phpunit / php - invoker ( ~ 1.1 ) Writing lock file Generating autoload files

Set up an Example.php class with a bit of code:

Set up a test/unit folder and create a ExampleTest class with a useful test case in it, like so:

assertTrue ( $e - > isPalindrone ( "" ) ) ; $this - > assertTrue ( $e - > isPalindrone ( "a" ) ) ; $this - > assertTrue ( $e - > isPalindrone ( "ABBA" ) ) ; $this - > assertFalse ( $e - > isPalindrone ( "test" ) ) ; } }

The unit tests go in their own folder, in case you decide to add more extensive (slower) tests later. MakeGood should only be configured to run fast tests!

Now add a test/bootstrap.php for test cases to load classes (NB: At scale, you would have composer autoload your classes, and use that as your PHPUnit class loader).

Optionally, also add a phpunit.xml file in your project root to configure PHPUnit with, so that you can run it on the command-line:

If all goes to plan, your project should look something like this:

- Continuous testing example |- (.. code ..) |- Example.php |- test/ | |- (.. other types of tests ..) | |- unit/ | | |- ExampleTest.php | |- bootstrap.php |- vendor | |- (.. dependencies ..) | |- autoload.php |- composer.json |- phpunit.xml

And more to the point, you should be able to use PHPUnit on the command-line to run the test case. It will look something like this:

Example$ php vendor / bin / phpunit test / unit / PHPUnit 4.7 . 7 by Sebastian Bergmann and contributors . . Time : 71 ms , Memory : 4 . 50Mb OK ( 1 test , 4 assertions )

Configure MakeGood

Now that the project is coming along nicely, it's time to configure MakeGood to run the test automatically from within Eclipse.

Go to Project → Properties → MakeGood, and add the path to your unit tests, along with a link to the bootstrap.php . This bootstrap file will let MakeGood load the classes to test, along with PHPUnit itself.

Now fire up the MakeGood view. If it doesn't come up automatically, then open it via Window → Show View → Other. Clicking the "play" button should kick off all available tests, adn if your project structure is correct, then everything will work at this point:

Once you save a file, a small box will appear in the bottom-right to indicate whether the tests worked.

As you introduce changes and save them, MakeGood will flag whether the tests are passing by changing the colour of the icon.

In this case, it is green. From the small delay that is caused when running the tests, you can see why it's important to keep unit tests fast if you use this tool.

A test-driven bugfix cycle

Of course, Linus' Law suggests that any code will probably have more bugs. So, say somebody reports that the palindrome "abcdedcba" is causing incorrect results. In test-driven development, you would expose this as a test case over the isPalindrome() function:

assertTrue($e -> isPalindrone("abcdedcba")); $this -> assertFalse($e -> isPalindrone("abc")); } ...

As soon as this is submitted, things start to turn red in MakeGood. In response to the broken test, you can then tweak the code.

You would then do the smallest amount of programming needed to pass all the tests. A palindrome checker which does not contain intentional bugs is as simple as this one-liner:

< php function isPalindrone ( $str ) { return $str == strrev ( $str ) ; }

This change causes MakeGood to report that the unit tests are all passing.

Summary

A continuous test runner adds faster feedback for tedious but well-tested code. If you have to write anything in PHP which does some real computer work, then I suggest setting up MakeGood so that you can make changes to tricky code, and have a good idea of whether it's producing sane outputs.

As this post has touched on before, slow tests should not run each time you save the code. This is why we worked in a Unit test folder. Slower integration or functional tests can still be run via the command-line in this model. An example of a project which uses this setup is escpos-php, which is a heavily test-driven PHP driver for thermal line printers.

from http://csslab.tistory.com/30 by ccl(A) rewrite - 2020-03-06 14:54:14

댓글

이 블로그의 인기 게시물

용오름체험휴양마을영농조합법인 / 홍천 용오름캠핑장 팸투어 다녀왔어요.

[C언어] 백준 알고리즘 - 숫자의 개수(2577번)

[2020 정보처리기사 실기 - 프로그래밍 언어 활용] 2. 언어 특성 활용...