Go to Page... |
Compatibility: | Shadows of Argus (7.3.0) |
Updated: | 05-31-18 03:34 AM |
Created: | 05-27-18 07:29 AM |
Downloads: | 492 |
Favorites: | 1 |
MD5: | |
Categories: | Developer Utilities, Libraries |
QhunUnitTest
Lua as an interpreter language without and support for good code intelligence and suggestion is a difficult to write language. With the technically old World of Warcraft addon API the task is even harder.
In the past i have written many addons and any change to some feature resulted in a may work or may not work situation. I have to test everything myself and this is time and happyness consuming . Without further ado i present you an object oriented unit test framework for World of Warcraft addons.
I adopted the common unit test design patterns and names from other languages like php, java and typescript to allow easy step in into unit testing with World of Warcraft and Lua.
Happy testing!
Please also visit the Github page for issues, contribution and documentation! Github [wartoshika/wow-QhunUnitTest]
Support
The following main features were supported:
- Testsuites
- A bunch of assert functions
- Setup and teardown on class and method level
- Easy to understand result print
- Ingame command line interface
- Count of tests, errors and asserts
- Powerfull abstract test class for your component
- Wrapping / Mocking existing objects to test for method calls (even with exact arguments)
- An Error per test system (All tests will run, even if one failed)
Contribution
If you want to contribute to this addon, please develop your features/bug fixes on a fork of this project. You can then make a pull request and we can discuss the changes within a separate ticket.
Example
This is a simple test class.
if not IsAddOnLoaded("QhunUnitTest") then return end QhunCore.Test.Storage = {} QhunCore.Test.Storage.__index = QhunCore.Test.Storage -- constructor function QhunCore.Test.Storage.new() -- call super class local instance = QhunUnitTest.Base.new() -- bind current values setmetatable(instance, QhunCore.Test.Storage) return instance end -- set inheritance setmetatable(QhunCore.Test.Storage, {__index = QhunUnitTest.Base}) --[[ TESTS ]] -- the name of the method will be visible in the test report function QhunCore.Test.Storage:canBeInstantiated() -- create a storage instance local instance = QhunCore.Storage.new() -- test if the returned instance is a class of type QhunCore.Storage self:assertClassOf(instance, QhunCore.Storage) end
-- check if the unit test addon is available if IsAddOnLoaded("QhunUnitTest") then -- create a test suite local suite = QhunUnitTest.Suite.new("QhunCore") -- register the defined test class suite:registerClass("Storage", QhunCore.Test.Storage.new()) -- register for slash suite:registerForSlashCommand() end
/test QhunCore
There have been no comments posted to this file.
Be the first to add one. |
You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.