Unit Test - Node Test Case

Can anybody explain the working of Node Test Case?
I have created a Node Test Case and it checks a particular node. I do not know how it checks.
0
17 comments
Avatar
Permanently deleted user
How can you be sure that all assertions ran? Or that they ran in the correct order? This is where nodeunit comes in, a tool for defining and running unit tests in the simplest way possible.
0
Avatar
Permanently deleted user
hi,
I have just created an Editor test. I did the following,
In Before,
   If Statement.
In Result
   Ctrl+Space over the <exprn> and type "true" and press Enter.

I also write the steps in Code block.

But Unit test fails. Why? I have attached the screenshot.
myDoc
0
The screenshot is not attached. You need to use [my doc|^sample.zip] to make the attachment visible
0
Avatar
Permanently deleted user
[mydoc|^sample.zip] means..
0
... that a sample.zip file will be linked through a mydoc text.
0
Avatar
Permanently deleted user
Sorry I didn't get. Can you please explain the steps to attach an image file
0
Sure - you "add file" by clicking on the link right bellow the editor. Let say it is called "foo.png". Then you use the Wiki syntax to insert a link to the attached file into the text, e.g. "Click [here|^foo.png] to get the file."
0
Avatar
Permanently deleted user
Yes I got it. Thanks.
0
You test is perfectly valid. It is a bug in 3.1 that requires you to use any instead of none for the VK_Enter key. We're try to fix the issue in one of the 3.2 releases.
FYI, you may omit the two "press key" commands in your case, since the "true" constant completes automatically.
0
Avatar
Permanently deleted user
@Vaclav thanks for your response. In this case it is OK. But If I use PressKey <ctrl> <VK_Space> and also for some other PressKey commands, it won't work.

And I have one more question.
Unit test is not working in code base for example mbeddr as code base. I think that it is working only for plugins inside MPS plugins directory. Is it? It works fine if I use mbeddr as plugins.

It shows errors like..... can't find language..  No concept for language..
0
Could I ask you to give us the tests with PressKey that fail for you? You might well feed them directly into the corresponding issue - https://youtrack.jetbrains.com/issue/MPS-20964
0
Could you be more specific about the cases when the tests cannot find the tested languages, please? In general, you should be able to use any imported languages in your tests. Just make sure they are listed in the User languages sections of the test solution as well as the test model.
0
Avatar
Permanently deleted user
Yes, Everything is listed in the Used languages section.
There are two cases,
1. Using Plugins
     - There is a need to list languages in the Used languages section(from MPS Plugins directory)
     - The test run perfectly
2. Using Code base(Specified in Global Libraries section)(languages are placed in git directory -Outside of MPS Plugins directory)
     - There is a need to list languages in the Used languages section (from git directory outside of MPS plugins directory)
     - The test doesn't run correctly (It shows some errors like No concept found...  No language for: ... .structure..)

I think that The test get the Node ID and searches inside the MPS Plugins and the test fails (Because those languages are in some other directory) Is it?
0
Global libraries will not be included on the class path when running tests in 3.1, since the test runner creates a fresh new copy of the MPS process and passes in fresh configurations settings. In 3.2 we're allow for in-process tests, that will eliminate this limitation.

A better approach, both in 3.1 and in general, would be using "Project libraries" instead.
0
@Vaclav.....Is these bugs are fixed in MPS 3.2?  I ran the test like this "press keys <ctrl>+<vk_space>, press keys <any>+<vk_enter>". But it is not performing the editor test as earlier told by Palpandi.
0
The problems listed in https://youtrack.jetbrains.com/issue/MPS-20964 have not yet been tackled. Please vote for the issue, if you'd like to push it a bit.
0

Please sign in to leave a comment.