Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:31:58+00:00 2026-05-24T04:31:58+00:00

Background: I wrote a test for a new class ( in OO System for

  • 0

Background:

I wrote a test for a new class ( in OO System for Mathematica ). I ran the test using Workbench and I expected a failure in the MUnit test-report because the class does not exist yet ( test first, code later method ).

The test is:

 Test[
     clist = loadClass["UList"]         
     ,
     Class["UList`"]
     ,
     TestID->"UListTest-20110730-loadClass"
 ]

MUnit gave no report at all, MUnit did not get control, it ended prematurely, this was reported in the Console window in Workbench.

 -------------------
 Start Run Session
 Connected
 <<X3/Kernel/init.m
 Initialization Complete
 Running Test File: X3/Tests/UListTest.mt

 {Get::noopen}
 Error -> Exit
 End Session
 -------------------

The message {Get::noopen} occurs when you try to load a non-existing class. I would like to catch this in MUnit and report the testcase as failed.

Question:

How can I trap a situation like the one as described above ( i.e. something unexpected goes wrong ) in MUnit ? ( Deciding if it is an error or test failure should be handled programmatically in the test code. )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:31:59+00:00Added an answer on May 24, 2026 at 4:31 am

    Ok, there are several parts here.

    First, I set up a WB project to test your input, and while I do get the same error messages when running the unit test, I do not get the kernel hang – rather I either get the test to fail (if I do not wrap the test code in Quiet – see below for the explanation), or it exits prematurely (for the reason, also see below). But note that I changed the oosys' context name (also see below).

    enter image description here

    One thing to check is that in the WB project, your packages’ contexts should be sub-contexts of the main context of your application. Therefore, oosys' becomes (in my case) OOSystemTests'oosys'. This should be reflected both in the package itself, and in the package imports (calls to Needs ets). For example, your version of oosys will start as BeginPackage["OOSystemTests'oosys'"]; (change single quotes to context marks).

    Next, one thing which is good to know is that messages produced during the run of the unit test are by default considered an error, so the test will fail. You can specify that the messages are expected, to avoid that (see this page for details), or you can wrap your test code in Quiet). You should do either of this to get past through it, to the end of your test (I wrapped the test code in Quiet).

    Once you do that, your test runs, but MUnit reports that the kernel exits prematurely. And this brings us back to the application, OO System. To my mind, it does contain interesting ideas, but it falls short of being a professionally written mma extension package, on several grounds. First, the reason why it exits prematurely: if you look at loadClass implementation, you will notice the call to checkClass function, inside which you can see a number of calls to Quit[]. I don’t know whether or not I should explain why this is a wrong way of doing it, but I’ve said quite a bit about mma error-reporting techniques before, and calling Quit[] inside a lower-level function is not listed there, for a reason. This is not even mma-specific: it is a standard wisdom in software engineering that the lower-level functions normally should not make decisions of the scale that only high-level functions address (such as exiting an application). Another place which I noticed upon a really superficial reading of the code is in the newContext function, where the oosys' context is listed explicitly as string (hard-coded), which means a possibility of breaking whenever the context name is changed (say, as in our case). The way debugging is organized also does not look very exciting to me. Perhaps, there are other things, I did not read very carefully.

    I hope I gave enough pointers so that you can make it through the MUnit with the desirable outcome, perhaps modifying some of the OO System source code in the process (if its license allows that). In this regard, I would repeat an advice I already gave to you: if you want to use it really productively, read the code carefully, take the good ideas (which I am sure there are there), and implement your own object model in the way you want it, so that you control all the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background Hey everyone! I'm new to using R, and became interested in using it
Background: I'm new to CakePHP. I have a small test site (mostly composted of
Background: At my company we are developing a bunch applications that are using the
Background: Some time ago, I built a system for recording and categorizing application crashes
Background I am writing and using a very simple CGI-based (Perl) content management tool
Background I've been using the C preprocessor to manage and compile semi-large javascript projects
So I come from a background in Java where you can create a class
Background : I currently write test cases for the client side of a network
Background: I'm using Google's protobuf , and I would like to read/write several gigabytes
Background Information: Ultimately, I would like to write an emulator of a real machine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.