Is any one using any harnesses that might work for this?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Unit testing
Collapse
X
-
Unit testing
Is there a practical way to unit test NinjaScript code (e.g. custom stratgies, indicators, add-ons)?
Is any one using any harnesses that might work for this?Tags: None
-
Hello AnotherTrader,
Thank you for the post.
This item is likely going be best answered by the community members who have experience with this specific concept as this is not something our support would have direct information on.
From my knowledge of unit testing, it would likely be possible to access NinjaScript objects from the test. However, in contrast to how unit testing works, it may not be directly possible to recreate accurately what the platform does with the objects you would be testing (indicator, strategy). There are many steps required in correctly instantiating a NinajScript object that happens internally so that portion of this concept would not easily be recreated in a test.
If any other community members have further information on this topic, I am sure they will post their knowledge here as well.
I look forward to being of further assistance.
JesseNinjaTrader Customer Service
-
To continue this thread, I have posted some code on github ...
https://github.com/Abattia/NinjaTrader8_UnitTests Experiment to devise a means to unit test NinjaScript
My objective is to write higher quality NinjaScript code by devising a way to use Test Driven Development ( https://en.wikipedia.org/wiki/Test-driven_development ).
As I outline in the github README.md, I don't think this is possible at present. Tools like MSTest cannot be applied in NinjaScript projects (for perfectly understandable reasons related to keeping the NT proprietary code proprietary!).
So, the github project is an invitation to anyone out there who might have ideas of how we might devise an alternative that achieves the same objective, i.e. higher quality NinjaScript code.
Here is the sort of log output the current code produces:
All contributions and suggestions greatefully received ...
- Likes 1
Comment
-
FYI Updated this: https://github.com/Abattia/NinjaTrader8_UnitTests Experiment to devise a means to unit test NinjaScript
- Likes 2
Comment
-
Originally posted by junkone View Posti like this idea. i will try to use your templates. I also want to store the results of the test in a format that i can compare the results over iteration. will keep posted on this.
If you have any ideas on how to develop it further or to extend it, or you would like to contribute to the github repo, please just let me know.
Comment
-
Hi everyone,
I have used the above "framework" for a bit - It generally works.
If you want to use Visual Studio with NUnit to test Ninja Strategies or Indicators there is now a step-by-step guide available here:
HTH
Frank
- Likes 1
Comment
-
Originally posted by AnotherTrader View PostIs there a practical way to unit test NinjaScript code (e.g. custom stratgies, indicators, add-ons)?
Is any one using any harnesses that might work for this?A unit testing framework for NinjaTrader that provides a simple and easy-to-use API for writing and running unit tests for NinjaScript code. - GitHub - samuelcaldas/NinjaTraderUnitTesting: A unit testing framework for NinjaTrader that provides a simple and easy-to-use API for writing and running unit tests for NinjaScript code.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by gmacjapan, Today, 09:32 PM
|
0 responses
5 views
0 likes
|
Last Post
![]()
by gmacjapan
Today, 09:32 PM
|
||
Started by paulo_br, 09-13-2024, 08:41 AM
|
6 responses
1,133 views
0 likes
|
Last Post
![]()
by rockmanx00
Today, 09:15 PM
|
||
Started by HungryGhost, 03-02-2025, 07:16 PM
|
6 responses
68 views
0 likes
|
Last Post
![]()
by HungryGhost
Today, 08:39 PM
|
||
Started by joehanus, 03-11-2025, 03:41 PM
|
10 responses
65 views
0 likes
|
Last Post
![]()
by joehanus
Today, 07:27 PM
|
||
Started by bgboym3, 10-08-2019, 09:58 AM
|
7 responses
2,548 views
0 likes
|
Last Post
![]()
by defa0009
Today, 06:41 PM
|
Comment