I have written installer with multiple sections in nsis. i would like have framework similar to java to unit test the code a developer writes. request all to share there practises
Announcement
Collapse
No announcement yet.
automate unit test for nsis installer
Collapse
X
-
Unit tests for macros and functions are possible but I'm not sure how you would do it for sections. Or to be more specific, the file installing and registry parts. It would make more sense to me to automate running the installer silently and performing tests on the thing you installed.
If you had something like
PHP Code:Function DoubleIt
Exch $0
IntOp $0 $0 * 2
Exch $0
FunctionEnd
Section
Push 42
Call DoubleIt
Pop $0
SetOutPath $InstDir\$0
File Foo.exe
File Bar.dll
SectionEnd
IntOp $PostCount $PostCount + 1
-
For functions, one thing you can verify is that they don't clobber the registers.
PHP Code:StrCpy $0 Reg0
...
StrCpy $R9 RegR9
Push whatever
Call TheFunction
StrCmp $0 Reg0 ...
...
For most functions/macros you need something custom for each.
If a function deals with paths for example then you can test it by calling it with "C:", "C:\", "C:foo", "C:\foo", "C:\foo\", "\foo" and ".\foo" and verify that the result is what you expect...IntOp $PostCount $PostCount + 1
Comment
Comment