Why you should use Test::Class

 

Test::Class attempts to provide simple xUnit testing that integrates simply with the standard perl *.t style of testing. In particular:

  • All the advantages of xUnit testing. You can easily create test fixtures and isolate tests. It provides a framework that should be familiar to people who have used other xUnit style test systems.
  • It is built with Test::Builder and should co-exist happily with all other Test::Builder based modules. This makes using test classes in *.t scripts, and refactoring normal tests into test classes, much simpler because:
    • You do not have to learn a new set of new test APIs and can continue using ok(), like(), etc. from Test::More and friends.
    • Skipping tests and todo tests are supported.
    • You can have normal tests and Test::Class classes co-existing in the same *.t script. You don't have to re-write an entire script, but can use test classes as and when it proves useful.
  • You can easily package your tests as classes/modules, rather than *.t scripts. This simplifies reuse, documentation and distribution, encourages refactoring, and allows tests to be extended by inheritance.
  • You can have multiple setup/teardown methods. For example have one teardown method to clean up resources and another to check that class invariants still hold.
  • It can make running tests faster. Once you have refactored your *.t scripts into classes they can be easily run from a single script. This gains you the (often considerable) start up time that each separate *.t script takes.

Why you should not use Test::Class

  • If your *.t scripts are working fine then don't bother with Test::Class. For simple test suites it is almost certainly overkill. Don't start thinking about using Test::Class until issues like duplicate code in your test scripts start to annoy.
  • If you are distributing your code it is yet another module that the user has to have to run your tests (unless you distribute it with your test suite of course).
  • If you are used to the TestCase/Suite/Runner class structure used by JUnit and similar testing frameworks you may find Test::Unit more familiar (but try reading "HELP FOR CONFUSED JUNIT USERS" before you give up).
(venv) gapinyc@DESKTOP-9QS7RL5:~/superset/superset-frontend$ npm run build > superset@5.0.0 build > cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV="${BABEL_ENV:=production}" webpack --color --mode production [Superset Plugin] Use symlink source for @superset-ui/chart-controls @ ./packages/superset-ui-chart-controls [Superset Plugin] Use symlink source for @superset-ui/core @ ./packages/superset-ui-core [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-calendar @ ./plugins/legacy-plugin-chart-calendar [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-chord @ ./plugins/legacy-plugin-chart-chord [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-country-map @ ./plugins/legacy-plugin-chart-country-map [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-horizon @ ./plugins/legacy-plugin-chart-horizon [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-map-box @ ./plugins/legacy-plugin-chart-map-box [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-paired-t-test @ ./plugins/legacy-plugin-chart-paired-t-test [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-parallel-coordinates @ ./plugins/legacy-plugin-chart-parallel-coordinates [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-partition @ ./plugins/legacy-plugin-chart-partition [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-rose @ ./plugins/legacy-plugin-chart-rose [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-world-map @ ./plugins/legacy-plugin-chart-world-map [Superset Plugin] Use symlink source for @superset-ui/legacy-preset-chart-deckgl @ ./plugins/legacy-preset-chart-deckgl [Superset Plugin] Use symlink source for @superset-ui/legacy-preset-chart-nvd3 @ ./plugins/legacy-preset-chart-nvd3 [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-cartodiagram @ ./plugins/plugin-chart-cartodiagram [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-echarts @ ./plugins/plugin-chart-echarts [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-handlebars @ ./plugins/plugin-chart-handlebars [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-pivot-table @ ./plugins/plugin-chart-pivot-table [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-table @ ./plugins/plugin-chart-table [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-word-cloud @ ./plugins/plugin-chart-word-cloud [Superset Plugin] Use symlink source for @superset-ui/switchboard @ ./packages/superset-ui-switchboard Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme 10% building 0/8 entries 8/8 dependencies 0/5 modulesBrowserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) 10% building 0/8 entries 8/9 dependencies 0/5 modules`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme 10% building 0/8 entries 10/10 dependencies 0/7 modules`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) 10% building 0/8 entries 133/231 dependencies 3/72 modulesBrowserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) 10% building 0/8 entries 206/300 dependencies 11/115 modules`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration` at isModuleDeclaration (/home/gapinyc/superset/superset-frontend/node_modules/@babel/types/lib/validators/generated/index.js:2793:35) at PluginPass.Program (/home/gapinyc/superset/superset-frontend/node_modules/babel-plugin-lodash/lib/index.js:102:44) 92% sealing asset processing CssMinimizerPluginBrowserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: browsers data (caniuse-lite) is 9 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme (venv) gapinyc@DESKTOP-9QS7RL5:~/superset/superset-frontend$
最新发布
10-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值