Is any one using any harnesses that might work for this?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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:
A step-by-step guide to implementing TDD Best Practice in NinjaTrader 8 with NUnit and Visual Studio Community Edition.
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 johntraderuser2, Today, 02:34 AM
|
0 responses
6 views
0 likes
|
Last Post Today, 02:34 AM | ||
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
12 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
4 views
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
||
Started by gleichnerany, Today, 01:17 AM
|
0 responses
5 views
0 likes
|
Last Post
by gleichnerany
Today, 01:17 AM
|
||
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
47 views
0 likes
|
Last Post Today, 12:28 AM |
Comment