简体   繁体   English

Android中Cocos2d-X的TDD

[英]TDD for Cocos2d-X in android

How do I write the TDD for " is sprite added or not " in the scene for cocos2d-x in eclipse. 如何在Eclipse中的cocos2d-x场景中为“ 是否添加了Sprite ”编写TDD。 Here is my code 这是我的代码

CCSprite *sprite  =null;

//adding sprite code
sprite = new CCSprite();
sprite->initWithSpriteFrameName(“abc.png");
this->addChild(sprite);

Any blog or help in right direction will be appreciated. 任何博客或正确方向的帮助将不胜感激。 Thanks 谢谢

Generally speaking, you don't test the platform (or framework) you're using. 一般来说,您不需要测试所使用的平台 (或框架)。 You trust that it works. 您相信它有效。 You do need to test that your code interacts with it correctly instead. 您确实需要测试您的代码是否与其正确交互。

This usually means hiding external APIs behind an interface, and then mocking that interface. 这通常意味着将外部API隐藏在接口后面,然后模拟该接口。 This video explains how to approach that. 视频说明了如何解决这一问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM