Skip to content

Instantly share code, notes, and snippets.

@forki
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forki/9018549 to your computer and use it in GitHub Desktop.
Save forki/9018549 to your computer and use it in GitHub Desktop.
UnitTests in NAV2013
let connectionInfo = createRTCConnectionInfo navClientVersion nstServer nstServiceTierName nstPort company
let rec runSuite index =
tracefn " Starting Codeunit Index %i" index
CleanDir nstConfigDir
WriteConfigFile (nstConfigDir @@ "navconfig.txt")
["TestSuite", index.ToString()
"RootPath", FullName "."]
RunCodeunit connectionInfo 80500
let messageFile = nstConfigDir @@ "message.txt"
let runTime =
try
WaitForMessageFile messageFile (System.TimeSpan.FromMinutes 5.)
with exn ->
if fileExists (messageFile + ".temp") then
CopyFile buildDir (messageFile + ".temp")
raise exn
CopyFile buildDir messageFile
match analyzeTestResults messageFile with
| None -> 0,0
| Some results ->
UnitTestHelper.reportTestResults results
let failed,allTests = runSuite (index + 1)
failed + List.length(results.GetFailed()),allTests + results.GetTestCount()
let failed,allTests = runSuite 1
if failed > 0 then
failwithf "%d of %d tests failed." failed allTests
@forki
Copy link
Author

forki commented Feb 15, 2014

// NavServiceTier (nst) connection Info
let nstConfigDir = "C:/temp/NAV"
let nstServer = "localhost"
let nstPort = 7046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment