• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dumb question about unit testing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dumb question about unit testing


  • Subject: Re: Dumb question about unit testing
  • From: William Squires <email@hidden>
  • Date: Tue, 20 Nov 2012 07:55:05 -0600

  In other words, you bootstrapped the process, right? You generated a class that had encodeWithCoder:, wrote out the results, then went back and coded initWithCoder:, using the written out stuff to pull it back in? That's what I was thinking, too. I was just wondering if there was some way to make an app that could create/edit these saved objects directly at the binary level so I could make sure of the intermediate results from option #1!
  Otherwise, if the test failed, how would you know which half failed, the initWithCoder: part, or the encodeWithCoder: part? I think I'll do #2. Thanks for the help!

On Nov 19, 2012, at 12:18 PM, Sean McBride wrote:

> On Sun, 18 Nov 2012 21:26:09 -0600, William Squires said:
>
>> What's the recommended procedure for (unit) testing the initWithCoder:
>> and encodeWithCoder: methods of a class that conforms to NSCoding protocol?
>
> I do two things: 1) a test that encodes then immediately decodes, then compares the original with the copy. 2) I create files on disk with serialized data, then build new objects from them by deserializing.  If/when your format changes, you then have a collection of old formats to test too.
>
> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 email@hidden
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Dumb question about unit testing
      • From: Graham Cox <email@hidden>
References: 
 >Dumb question about unit testing (From: William Squires <email@hidden>)
 >Re: Dumb question about unit testing (From: Sean McBride <email@hidden>)

  • Prev by Date: Re: Getting a .icns file from IconRef data
  • Next by Date: Re: Getting a .icns file from IconRef data
  • Previous by thread: Re: Dumb question about unit testing
  • Next by thread: Re: Dumb question about unit testing
  • Index(es):
    • Date
    • Thread