• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Test suite for MagicMirror²

Scheduled Pinned Locked Moved Upcoming Features
42 Posts 5 Posters 37.0k Views 6 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    roramirez Core Contributors @qistoph
    last edited by May 20, 2017, 4:47 PM

    @qistoph Well I’ve testing de CircleCI vs Travis.

    For same Build
    Failed: https://travis-ci.org/roramirez/MagicMirror/builds/234342109
    Sucess: https://circleci.com/gh/roramirez/MagicMirror/6

    Easy module development with MagicMirror Module Template

    Q 1 Reply Last reply May 22, 2017, 1:29 PM Reply Quote 0
    • Q Offline
      qistoph @roramirez
      last edited by May 22, 2017, 1:29 PM

      @roramirez
      Except for one of the errors I think all can still be explained by my last post.

      R 1 Reply Last reply May 26, 2017, 3:31 AM Reply Quote 0
      • R Offline
        roramirez Core Contributors @qistoph
        last edited by May 26, 2017, 3:31 AM

        @qistoph said in Test suite for MagicMirror²:

        Except for one of the errors I think all can still be explained by my last post.

        Yes, you’re rigth. Can you help in this area?

        Easy module development with MagicMirror Module Template

        R 1 Reply Last reply Jul 24, 2017, 1:08 AM Reply Quote 0
        • R Offline
          roramirez Core Contributors @roramirez
          last edited by Jul 24, 2017, 1:08 AM

          Yay! After a long fight the test are passing in Travis CI

          https://github.com/MichMich/MagicMirror/pull/953

          Easy module development with MagicMirror Module Template

          1 Reply Last reply Reply Quote 2
          • C Offline
            Cato Module Developer
            last edited by Aug 5, 2017, 7:15 AM

            I’m trying to find some information on testing in Magic Mirror for devs/contributors but it’s (too) hard to find. I can’t find any related forum, it’s not mentioned in the “MagicMirror² Module Development Documentation”, and not directly mentioned in any README-ish files on GitHub.

            Of course, some of this can be deduced from the source code, but a small “Getting Started” guide would help more people getting … eh started. :-)

            I’m living in Visual Studio as my day job, but not so much with writing tests, so my knowledge of other tools are limited. What I need is some information on software requirements and where tests should be and how testing is done.

            R 1 Reply Last reply Aug 5, 2017, 6:23 PM Reply Quote 0
            • R Offline
              roramirez Core Contributors @Cato
              last edited by Aug 5, 2017, 6:23 PM

              @Cato Hi!, The documentation for tests are living only in test source ;) This is something. We need to an better documentation.

              Are you interested to do it? https://trello.com/c/UwqL27A3/29-add-documentation-of-testsuite

              I’m not a very good at writing documentation.

              But in short terms,

              The tests are living in tests directory, there two kind of test, unit and e2e.

              We are using mocha and spectron`, the last one is for the tests of e2e. For every e2e test is using a configuration file. When the test run load the configuration file and we check expected result of the MagicMirror instance in Electron mode.

              You can using the follow sentences to run testsuite

              • Unit test: npm run test:unit
              • E2e tests: npm run test:e2e
              • Unit + e2e: npm test

              If you can run especific test you need execute mocha from your path where is installed, in my case inside of MagicMirror directorio. Example of running the specific unit test for calendar functions.

              NODE_ENV=test ./node_modules/mocha/bin/mocha tests/unit/functions/calendar_spec.js

              Result:

                Functions into modules/default/calendar/calendar.js
                  capFirst
                    ✓ for 'rodrigo' should return 'Rodrigo'
                    ✓ for '123m' should return '123m'
                    ✓ for 'magic mirror' should return 'Magic mirror'
                    ✓ for ',a' should return ',a'
                    ✓ for 'ñandú' should return 'Ñandú'
                  shorten
                    ✓ for ' String with whitespace at the beginning that needs trimming' should return 'String with whit…'
                    ✓ for 'long string that needs shortening' should return 'long string that…'
                    ✓ for 'short string' should return 'short string'
                    ✓ for 'long string with no maxLength defined' should return 'long string with no maxLength defined'
                    ✓ should return an empty string if shorten is called with a non-string
                    ✓ should not shorten the string if shorten is called with a non-number maxLength
                    ✓ should wrap the string instead of shorten it if shorten is called with wrapEvents = true (with maxLength defined as 20)
                    ✓ should wrap the string instead of shorten it if shorten is called with wrapEvents = true (without maxLength defined, default 25)
              
              
                13 passing (29ms)
              

              If need something is not clear let me know.

              Easy module development with MagicMirror Module Template

              1 Reply Last reply Reply Quote 1
              • 1
              • 2
              • 3
              • 4
              • 5
              • 5 / 5
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy