Giter VIP home page Giter VIP logo

Comments (22)

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

Hi Vittorio!

Thank you for your good ideas.
My experience with UT is limited only with OCUnit/XCTest frameworks.
If you give a starting point of how to write UT with Kiwi - I will start to learn Kiwi from your snippets & will try to help.

Best wishes.

from ekalgorithms.

vittoriom avatar vittoriom commented on August 17, 2024

It's your project, so it's up to you.
If you'd rather use XCTest, it's ok for me.
If you would like to learn some Kiwi, even better :)

Thanks

from ekalgorithms.

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

I see popularity of Kiwi among iOS community & also BDD paradigm is an interesting experience, I think.
So I would like to have some Kiwi skills :)
Thnx.

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

I want to suggest a couple of design notes I find useful on these days:

  • I suggest using the word "Spec" and "Specs" than "Test" and "Tests" because what they should do is more likely to describe aspects of algorithms than test their stability and correctness. Stability and correctness of course are also ensured but this is done in a second order.
  • I suggest the following directory structure and file organization conventions:
    • EKAlgorithms (Algorithms code)
    • EKAlgorithmsDevelopmentApp (Xcode app like current EKElgorithms/EKAlgoritms.xcodeproj is)
    • Specs

A structure of each logical part of EKAlgoritms and its files should correspond to analogous structure in Specs/ folder:

EKAlgorithms/NSArray/Sorting.{h,m} -> Specs/NSArray/Sorting.m (Spec file)


The key thing is to organize file classes properly. The result would be a very convenient project structure easy to read, spec and maintain.

A good example of such approach is my FoundationExtensions - I've built it from a ground with these things in mind.

And yes, as @vittoriom does it, I prefer Kiwi over classical OCUnit.

Let me know what you think!

from ekalgorithms.

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

Hi Stanislaw!

Thnx for good idea that you provide!
Undoubtedly - this idea has a common sense. It would be really nice & useful to organize file classes properly.
But unfortunately, in the near future I can not have some extra time for this issue.

Thanks again & have a nice day,
Evgeny

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

Don't forget to

[!] From now on use `EKAlgorithmsApp.xcworkspace`.

👍

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

If you like the changes proposed in #33, the next step would be something like decomposition of NSArray methods into a separate categories like NSArray/SortingAlgorithms and NSArray/SearchAlgorithms and so on.

from ekalgorithms.

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

Hi Stanislaw!

How to run Kiwi tests/specs?
I am trying to run - but result is an error "Library not loaded: @rpath/SenTestingKit.framework/Versions/A/SenTestingKit"

Also there is no Test option on Product pop-down menu
http://d.pr/i/nIt8

What am I doing wrong?
I am not familiar with Kiwi, sorry.

Thanks!

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

Writing you an answer...

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

There is a trick behind this setup. I wanted to document it somewhere, but forgot.

The main.m file of EKAlgorithmsSpecs contains the only following line:

SenSelfTestMain();

You should run it by switching your target to EKAlgorithmSpecs and using Run as you would go with the first target.

Technical note: this is possible only when Scheme EKAlgorithmSpecs (see "Edit scheme/EKAlgorithmSpecs/Environment variables") has the following environment variable:

DYLD_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Library/Frameworks`

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

Let me know, if it became clear to you.

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

In other words there are two Mac OS command-line applications now and you should run the second (EKAlgorithmsSpecs) to run specs!

from ekalgorithms.

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

Ok.
I will try this trick now.
Thnx

from ekalgorithms.

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

Thank !
It works now!
I am happy :)

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

I think, this issue can be closed as well. And you?

from ekalgorithms.

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

I don't mind
But maybe Vittorio means - "To cover all the code with UT?"
http://zsoltfabok.com/images/posts/2012-02-11-fix-all-the-failing-test-cases/fix-all-the-failing-test-cases.png
LOL

from ekalgorithms.

vittoriom avatar vittoriom commented on August 17, 2024

Hi, I'm sorry for the absence but I've been quite busy at work during these days!
Anyway yes, I meant something like: 100% code coverage with UT :)

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

I do agree that 100% code coverage is much desired, but I thought that it could be done incrementally by opening corresponding tickets/PRs that is why I suggested to close this one. We can reopen it for sure!

I do think that this work is related to a desired (I think!) decomposition of NSArray (and other classes) into smth like NSArray/SortingAlgorithms, NSArray/SearchAlgorithms and so on with writing corresponding groups of specs for each of the abstracted group of algorithms!

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

Ideally, it would be nice to have EKAlgorithms structured in way so it could be easy to read & learn algorithms like if if it was a published book with a solid structure/contents! ;)

from ekalgorithms.

vittoriom avatar vittoriom commented on August 17, 2024

Hi @stanislaw, of course when I created this ticket I just had in mind to put down some plan for covering the code base, which framework to use and so on.
I actually wanted to start covering code with Kiwi myself, but as I said before I have very little spare time at the moment to do this.
So basically yes, this ticket can be closed and more sub tickets can be created when a class or a specific part of it is going to be covered by someone :)

from ekalgorithms.

stanislaw avatar stanislaw commented on August 17, 2024

I feel we look in the same direction. Let's see, how it will go ;)

from ekalgorithms.

EvgenyKarkan avatar EvgenyKarkan commented on August 17, 2024

Guys - thanks for your activities in project!
I am going to continue develop my another yet "pet project" for the rest of the day. ;)
Thanks again for your brilliant ideas!

from ekalgorithms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.