diff --git a/404.html b/404.html index d76029d5ec..063c6f3da9 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@ Page Not Found | TUnit - + diff --git a/assets/js/cb1d92ed.0b366f50.js b/assets/js/cb1d92ed.0b366f50.js new file mode 100644 index 0000000000..843b8cce57 --- /dev/null +++ b/assets/js/cb1d92ed.0b366f50.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktunit_docs_site=self.webpackChunktunit_docs_site||[]).push([[6617],{4421:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>r,default:()=>p,frontMatter:()=>a,metadata:()=>d,toc:()=>c});var s=t(4848),o=t(8453);const a={sidebar_position:11},r="Depends On",d={id:"tutorial-extras/depends-on",title:"Depends On",description:"A test can depend on another test. This means that your test will not start unless the other test has finished.",source:"@site/docs/tutorial-extras/depends-on.md",sourceDirName:"tutorial-extras",slug:"/tutorial-extras/depends-on",permalink:"/TUnit/docs/tutorial-extras/depends-on",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:11,frontMatter:{sidebar_position:11},sidebar:"tutorialSidebar",previous:{title:"Not in Parallel",permalink:"/TUnit/docs/tutorial-extras/not-in-parallel"},next:{title:"Ordering Tests",permalink:"/TUnit/docs/tutorial-extras/order"}},i={},c=[{value:"Getting other tests",id:"getting-other-tests",level:2}];function l(e){const n={code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"depends-on",children:"Depends On"})}),"\n",(0,s.jsx)(n.p,{children:"A test can depend on another test. This means that your test will not start unless the other test has finished."}),"\n",(0,s.jsxs)(n.p,{children:["To do this, add a ",(0,s.jsx)(n.code,{children:"[DependsOn]"})," to your test."]}),"\n",(0,s.jsxs)(n.p,{children:["This takes a test name, which you can easily reference by using the ",(0,s.jsx)(n.code,{children:"nameof(TestMethod)"})," keyword. And if your test you depend on has parameters, you must include the types of those too."]}),"\n",(0,s.jsx)(n.p,{children:"e.g.:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-csharp",children:"public void Test1(string value1, int value2) { ... }\n\n[DependsOn(nameof(Test1), [typeof(string), typeof(int)])]\npublic void Test2() { ... }\n"})}),"\n",(0,s.jsx)(n.p,{children:"This means you can create more complex test suites, without having to compromise on parallelism or speed."}),"\n",(0,s.jsx)(n.p,{children:"For example, performing some operations on a database and asserting a count at the end:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-csharp",children:"[Test]\npublic async Task AddUser1() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser2() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser3() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser4() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser5() \n{\n ...\n}\n\n[Test, DependsOn(nameof(AddUser1))]\npublic async Task AddItemToBagForUser1() \n{\n ...\n}\n\n[Test, DependsOn(nameof(AddUser2))]\npublic async Task AddItemToBagForUser2() \n{\n ...\n}\n\n[Test, DependsOn(nameof(AddUser3))]\npublic async Task AddItemToBagForUser3() \n{\n ...\n}\n\n[Test]\n[DependsOn(nameof(AddUser4)]\n[DependsOn(nameof(AddUser5)]\n[DependsOn(nameof(AddItemToBagForUser1)]\n[DependsOn(nameof(AddItemToBagForUser2)]\n[DependsOn(nameof(AddItemToBagForUser3)]\npublic async Task AssertItemsInDatabase() \n{\n ...\n}\n"})}),"\n",(0,s.jsx)(n.h2,{id:"getting-other-tests",children:"Getting other tests"}),"\n",(0,s.jsx)(n.p,{children:"If your tests depends on another test, it's possible to retrieve that test's context. This allows you to do things like check its result, or retrieve objects from its object bag."}),"\n",(0,s.jsxs)(n.p,{children:["This is done by calling the ",(0,s.jsx)(n.code,{children:"GetTests"})," method on a ",(0,s.jsx)(n.code,{children:"TestContext"})," object. It takes the test's method name (so you can use ",(0,s.jsx)(n.code,{children:"nameof(...)"}),") and optionally the parameter types for if there's multiple overloads."]}),"\n",(0,s.jsx)(n.p,{children:"You'll notice this returns an array - This is because tests may be data driven and be invoked multiple times - If this is the case you'll have to find the one you want yourself."}),"\n",(0,s.jsx)(n.p,{children:"Example:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-csharp",children:'[Test]\npublic async Task AddItemToBag() \n{\n var itemId = await AddToBag();\n TestContext.Current!.ObjectBag.Add("ItemId", itemId);\n}\n\n[Test]\n[DependsOn(nameof(AddItemToBag)]\npublic async Task DeleteItemFromBag() \n{\n var addToBagTestContext = TestContext.Current!.GetTests(nameof(AddItemToBag)).First();\n var itemId = addToBagTestContext.ObjectBag["ItemId"];\n await DeleteFromBag(itemId);\n}\n'})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>d});var s=t(6540);const o={},a=s.createContext(o);function r(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cb1d92ed.791bfd81.js b/assets/js/cb1d92ed.791bfd81.js deleted file mode 100644 index c6b8ad5af9..0000000000 --- a/assets/js/cb1d92ed.791bfd81.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktunit_docs_site=self.webpackChunktunit_docs_site||[]).push([[6617],{4421:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>i,contentTitle:()=>a,default:()=>l,frontMatter:()=>r,metadata:()=>d,toc:()=>c});var t=s(4848),o=s(8453);const r={sidebar_position:11},a="Depends On",d={id:"tutorial-extras/depends-on",title:"Depends On",description:"A test can depend on another test. This means that your test will not start unless the other test has finished.",source:"@site/docs/tutorial-extras/depends-on.md",sourceDirName:"tutorial-extras",slug:"/tutorial-extras/depends-on",permalink:"/TUnit/docs/tutorial-extras/depends-on",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:11,frontMatter:{sidebar_position:11},sidebar:"tutorialSidebar",previous:{title:"Not in Parallel",permalink:"/TUnit/docs/tutorial-extras/not-in-parallel"},next:{title:"Ordering Tests",permalink:"/TUnit/docs/tutorial-extras/order"}},i={},c=[];function p(e){const n={code:"code",h1:"h1",header:"header",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"depends-on",children:"Depends On"})}),"\n",(0,t.jsx)(n.p,{children:"A test can depend on another test. This means that your test will not start unless the other test has finished."}),"\n",(0,t.jsxs)(n.p,{children:["To do this, add a ",(0,t.jsx)(n.code,{children:"[DependsOn]"})," to your test."]}),"\n",(0,t.jsxs)(n.p,{children:["This takes a test name, which you can easily reference by using the ",(0,t.jsx)(n.code,{children:"nameof(TestMethod)"})," keyword. And if your test you depend on has parameters, you must include the types of those too."]}),"\n",(0,t.jsx)(n.p,{children:"e.g.:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-csharp",children:"public void Test1(string value1, int value2) { ... }\n\n[DependsOn(nameof(Test1), [typeof(string), typeof(int)])]\npublic void Test2() { ... }\n"})}),"\n",(0,t.jsx)(n.p,{children:"This means you can create more complex test suites, without having to compromise on parallelism or speed."}),"\n",(0,t.jsx)(n.p,{children:"For example, performing some operations on a database and asserting a count at the end:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-csharp",children:"[Test]\npublic async Task AddUser1() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser2() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser3() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser4() \n{\n ...\n}\n\n[Test]\npublic async Task AddUser5() \n{\n ...\n}\n\n[Test, DependsOn(nameof(AddUser1))]\npublic async Task AddItemToBagForUser1() \n{\n ...\n}\n\n[Test, DependsOn(nameof(AddUser2))]\npublic async Task AddItemToBagForUser2() \n{\n ...\n}\n\n[Test, DependsOn(nameof(AddUser3))]\npublic async Task AddItemToBagForUser3() \n{\n ...\n}\n\n[Test]\n[DependsOn(nameof(AddUser4)]\n[DependsOn(nameof(AddUser5)]\n[DependsOn(nameof(AddItemToBagForUser1)]\n[DependsOn(nameof(AddItemToBagForUser2)]\n[DependsOn(nameof(AddItemToBagForUser3)]\npublic async Task AssertItemsInDatabase() \n{\n ...\n}\n"})})]})}function l(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>a,x:()=>d});var t=s(6540);const o={},r=t.createContext(o);function a(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.a28b8fdf.js b/assets/js/runtime~main.6c9c06e6.js similarity index 98% rename from assets/js/runtime~main.a28b8fdf.js rename to assets/js/runtime~main.6c9c06e6.js index c2c3f3ad22..b840a4fa1a 100644 --- a/assets/js/runtime~main.a28b8fdf.js +++ b/assets/js/runtime~main.6c9c06e6.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,t,r,d,b={},c={};function f(e){var a=c[e];if(void 0!==a)return a.exports;var t=c[e]={exports:{}};return b[e].call(t.exports,t,t.exports,f),t.exports}f.m=b,e=[],f.O=(a,t,r,d)=>{if(!t){var b=1/0;for(i=0;i=d)&&Object.keys(f.O).every((e=>f.O[e](t[o])))?t.splice(o--,1):(c=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[t,r,d]},f.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return f.d(a,{a:a}),a},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,f.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var d=Object.create(null);f.r(d);var b={};a=a||[null,t({}),t([]),t(t)];for(var c=2&r&&e;"object"==typeof c&&!~a.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,f.d(d,b),d},f.d=(e,a)=>{for(var t in a)f.o(a,t)&&!f.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce(((a,t)=>(f.f[t](e,a),a)),[])),f.u=e=>"assets/js/"+({1114:"e322696d",1235:"a7456010",1379:"0b7a5dd9",1647:"b1a8519a",1747:"f7b7b503",2225:"4b18aed1",2321:"ba8db043",2473:"b3030475",2748:"822bd8ab",2984:"c566dcac",3604:"5c580d35",3818:"7c0d1a7d",3976:"0e384e19",4134:"393be207",4298:"13e939a4",4583:"1df93b7f",4761:"13f17bf8",4956:"e10a8de7",5742:"aba21aa0",5770:"6a12013c",5803:"f08d5324",6061:"1f391b9e",6168:"49462f00",6220:"5dbdde90",6458:"58d4c641",6532:"914d3ab3",6538:"a34b2a44",6617:"cb1d92ed",6866:"73e1c817",6969:"14eb3368",7098:"a7bd4aaa",7326:"e1f02bbc",7543:"55c176cd",7564:"2a9ef78c",7846:"be2154f8",7969:"4c5555c4",8401:"17896441",8584:"ba7c896e",8715:"d3238b2f",8732:"8b247495",9048:"a94703ab",9069:"3609cdcd",9081:"85aaec92",9372:"a66eab3e",9647:"5e95c892",9814:"6a21048e"}[e]||e)+"."+{1114:"f4dd2fa6",1235:"1b4d7e11",1379:"85acd131",1647:"53c91cd1",1747:"ea0dbea5",2225:"0c56640f",2237:"c8d6c83b",2321:"bdf9e885",2473:"de698c01",2748:"fe87e631",2984:"125628dc",3604:"f2c6c9a7",3818:"6d6b04e6",3976:"e9e5f0fd",4134:"732e1955",4298:"47b824e8",4583:"d6ed1caa",4761:"5ce21056",4956:"68069e8f",5742:"f183b5b5",5770:"084d3609",5803:"38c4634b",6061:"15657c49",6168:"de4f77f2",6220:"992b9492",6458:"cde25215",6532:"a452d988",6538:"fbd23d73",6617:"791bfd81",6866:"aecc372e",6969:"704ce381",7098:"c8828b34",7326:"9903d8bd",7543:"e307765c",7564:"79cf4a3d",7846:"3ee10f1b",7969:"aa2b97b0",8401:"6598443e",8584:"3ba96841",8715:"5e75c1d0",8732:"d126cedf",9048:"f6a389b6",9069:"3bafc862",9081:"7f5e34db",9372:"f2528433",9408:"c19ac7d6",9647:"897aecb3",9814:"6affd329"}[e]+".js",f.miniCssF=e=>{},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r={},d="tunit-docs-site:",f.l=(e,a,t,b)=>{if(r[e])r[e].push(a);else{var c,o;if(void 0!==t)for(var n=document.getElementsByTagName("script"),i=0;i{c.onerror=c.onload=null,clearTimeout(s);var d=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),d&&d.forEach((e=>e(t))),a)return a(t)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=l.bind(null,c.onerror),c.onload=l.bind(null,c.onload),o&&document.head.appendChild(c)}},f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.p="/TUnit/",f.gca=function(e){return e={17896441:"8401",e322696d:"1114",a7456010:"1235","0b7a5dd9":"1379",b1a8519a:"1647",f7b7b503:"1747","4b18aed1":"2225",ba8db043:"2321",b3030475:"2473","822bd8ab":"2748",c566dcac:"2984","5c580d35":"3604","7c0d1a7d":"3818","0e384e19":"3976","393be207":"4134","13e939a4":"4298","1df93b7f":"4583","13f17bf8":"4761",e10a8de7:"4956",aba21aa0:"5742","6a12013c":"5770",f08d5324:"5803","1f391b9e":"6061","49462f00":"6168","5dbdde90":"6220","58d4c641":"6458","914d3ab3":"6532",a34b2a44:"6538",cb1d92ed:"6617","73e1c817":"6866","14eb3368":"6969",a7bd4aaa:"7098",e1f02bbc:"7326","55c176cd":"7543","2a9ef78c":"7564",be2154f8:"7846","4c5555c4":"7969",ba7c896e:"8584",d3238b2f:"8715","8b247495":"8732",a94703ab:"9048","3609cdcd":"9069","85aaec92":"9081",a66eab3e:"9372","5e95c892":"9647","6a21048e":"9814"}[e]||e,f.p+f.u(e)},(()=>{var e={5354:0,1869:0};f.f.j=(a,t)=>{var r=f.o(e,a)?e[a]:void 0;if(0!==r)if(r)t.push(r[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((t,d)=>r=e[a]=[t,d]));t.push(r[2]=d);var b=f.p+f.u(a),c=new Error;f.l(b,(t=>{if(f.o(e,a)&&(0!==(r=e[a])&&(e[a]=void 0),r)){var d=t&&("load"===t.type?"missing":t.type),b=t&&t.target&&t.target.src;c.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",c.name="ChunkLoadError",c.type=d,c.request=b,r[1](c)}}),"chunk-"+a,a)}},f.O.j=a=>0===e[a];var a=(a,t)=>{var r,d,b=t[0],c=t[1],o=t[2],n=0;if(b.some((a=>0!==e[a]))){for(r in c)f.o(c,r)&&(f.m[r]=c[r]);if(o)var i=o(f)}for(a&&a(t);n{"use strict";var e,a,t,r,d,b={},c={};function f(e){var a=c[e];if(void 0!==a)return a.exports;var t=c[e]={exports:{}};return b[e].call(t.exports,t,t.exports,f),t.exports}f.m=b,e=[],f.O=(a,t,r,d)=>{if(!t){var b=1/0;for(i=0;i=d)&&Object.keys(f.O).every((e=>f.O[e](t[o])))?t.splice(o--,1):(c=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[t,r,d]},f.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return f.d(a,{a:a}),a},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,f.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var d=Object.create(null);f.r(d);var b={};a=a||[null,t({}),t([]),t(t)];for(var c=2&r&&e;"object"==typeof c&&!~a.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,f.d(d,b),d},f.d=(e,a)=>{for(var t in a)f.o(a,t)&&!f.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce(((a,t)=>(f.f[t](e,a),a)),[])),f.u=e=>"assets/js/"+({1114:"e322696d",1235:"a7456010",1379:"0b7a5dd9",1647:"b1a8519a",1747:"f7b7b503",2225:"4b18aed1",2321:"ba8db043",2473:"b3030475",2748:"822bd8ab",2984:"c566dcac",3604:"5c580d35",3818:"7c0d1a7d",3976:"0e384e19",4134:"393be207",4298:"13e939a4",4583:"1df93b7f",4761:"13f17bf8",4956:"e10a8de7",5742:"aba21aa0",5770:"6a12013c",5803:"f08d5324",6061:"1f391b9e",6168:"49462f00",6220:"5dbdde90",6458:"58d4c641",6532:"914d3ab3",6538:"a34b2a44",6617:"cb1d92ed",6866:"73e1c817",6969:"14eb3368",7098:"a7bd4aaa",7326:"e1f02bbc",7543:"55c176cd",7564:"2a9ef78c",7846:"be2154f8",7969:"4c5555c4",8401:"17896441",8584:"ba7c896e",8715:"d3238b2f",8732:"8b247495",9048:"a94703ab",9069:"3609cdcd",9081:"85aaec92",9372:"a66eab3e",9647:"5e95c892",9814:"6a21048e"}[e]||e)+"."+{1114:"f4dd2fa6",1235:"1b4d7e11",1379:"85acd131",1647:"53c91cd1",1747:"ea0dbea5",2225:"0c56640f",2237:"c8d6c83b",2321:"bdf9e885",2473:"de698c01",2748:"fe87e631",2984:"125628dc",3604:"f2c6c9a7",3818:"6d6b04e6",3976:"e9e5f0fd",4134:"732e1955",4298:"47b824e8",4583:"d6ed1caa",4761:"5ce21056",4956:"68069e8f",5742:"f183b5b5",5770:"084d3609",5803:"38c4634b",6061:"15657c49",6168:"de4f77f2",6220:"992b9492",6458:"cde25215",6532:"a452d988",6538:"fbd23d73",6617:"0b366f50",6866:"aecc372e",6969:"704ce381",7098:"c8828b34",7326:"9903d8bd",7543:"e307765c",7564:"79cf4a3d",7846:"3ee10f1b",7969:"aa2b97b0",8401:"6598443e",8584:"3ba96841",8715:"5e75c1d0",8732:"d126cedf",9048:"f6a389b6",9069:"3bafc862",9081:"7f5e34db",9372:"f2528433",9408:"c19ac7d6",9647:"897aecb3",9814:"6affd329"}[e]+".js",f.miniCssF=e=>{},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r={},d="tunit-docs-site:",f.l=(e,a,t,b)=>{if(r[e])r[e].push(a);else{var c,o;if(void 0!==t)for(var n=document.getElementsByTagName("script"),i=0;i{c.onerror=c.onload=null,clearTimeout(s);var d=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),d&&d.forEach((e=>e(t))),a)return a(t)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=l.bind(null,c.onerror),c.onload=l.bind(null,c.onload),o&&document.head.appendChild(c)}},f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.p="/TUnit/",f.gca=function(e){return e={17896441:"8401",e322696d:"1114",a7456010:"1235","0b7a5dd9":"1379",b1a8519a:"1647",f7b7b503:"1747","4b18aed1":"2225",ba8db043:"2321",b3030475:"2473","822bd8ab":"2748",c566dcac:"2984","5c580d35":"3604","7c0d1a7d":"3818","0e384e19":"3976","393be207":"4134","13e939a4":"4298","1df93b7f":"4583","13f17bf8":"4761",e10a8de7:"4956",aba21aa0:"5742","6a12013c":"5770",f08d5324:"5803","1f391b9e":"6061","49462f00":"6168","5dbdde90":"6220","58d4c641":"6458","914d3ab3":"6532",a34b2a44:"6538",cb1d92ed:"6617","73e1c817":"6866","14eb3368":"6969",a7bd4aaa:"7098",e1f02bbc:"7326","55c176cd":"7543","2a9ef78c":"7564",be2154f8:"7846","4c5555c4":"7969",ba7c896e:"8584",d3238b2f:"8715","8b247495":"8732",a94703ab:"9048","3609cdcd":"9069","85aaec92":"9081",a66eab3e:"9372","5e95c892":"9647","6a21048e":"9814"}[e]||e,f.p+f.u(e)},(()=>{var e={5354:0,1869:0};f.f.j=(a,t)=>{var r=f.o(e,a)?e[a]:void 0;if(0!==r)if(r)t.push(r[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((t,d)=>r=e[a]=[t,d]));t.push(r[2]=d);var b=f.p+f.u(a),c=new Error;f.l(b,(t=>{if(f.o(e,a)&&(0!==(r=e[a])&&(e[a]=void 0),r)){var d=t&&("load"===t.type?"missing":t.type),b=t&&t.target&&t.target.src;c.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",c.name="ChunkLoadError",c.type=d,c.request=b,r[1](c)}}),"chunk-"+a,a)}},f.O.j=a=>0===e[a];var a=(a,t)=>{var r,d,b=t[0],c=t[1],o=t[2],n=0;if(b.some((a=>0!==e[a]))){for(r in c)f.o(c,r)&&(f.m[r]=c[r]);if(o)var i=o(f)}for(a&&a(t);n Test Framework Comparisons | TUnit - + diff --git a/docs/category/tutorial---assertions/index.html b/docs/category/tutorial---assertions/index.html index ff68990a8e..d26ef0d679 100644 --- a/docs/category/tutorial---assertions/index.html +++ b/docs/category/tutorial---assertions/index.html @@ -4,7 +4,7 @@ Tutorial - Assertions | TUnit - + diff --git a/docs/category/tutorial---basics/index.html b/docs/category/tutorial---basics/index.html index 6bb4c38fda..5e238174fb 100644 --- a/docs/category/tutorial---basics/index.html +++ b/docs/category/tutorial---basics/index.html @@ -4,7 +4,7 @@ Tutorial - Basics | TUnit - + diff --git a/docs/category/tutorial---extras/index.html b/docs/category/tutorial---extras/index.html index c9f9386565..983c2b2d1c 100644 --- a/docs/category/tutorial---extras/index.html +++ b/docs/category/tutorial---extras/index.html @@ -4,7 +4,7 @@ Tutorial - Extras | TUnit - + diff --git a/docs/comparison/attributes/index.html b/docs/comparison/attributes/index.html index 87b9058aef..ee7fdbe4a4 100644 --- a/docs/comparison/attributes/index.html +++ b/docs/comparison/attributes/index.html @@ -4,7 +4,7 @@ Attributes | TUnit - + diff --git a/docs/comparison/framework-differences/index.html b/docs/comparison/framework-differences/index.html index 5f45fabb85..24f1bab3d8 100644 --- a/docs/comparison/framework-differences/index.html +++ b/docs/comparison/framework-differences/index.html @@ -4,7 +4,7 @@ Framework Differences | TUnit - + diff --git a/docs/intro/index.html b/docs/intro/index.html index 53a4945892..d309c77576 100644 --- a/docs/intro/index.html +++ b/docs/intro/index.html @@ -4,7 +4,7 @@ Intro | TUnit - + diff --git a/docs/tutorial-assertions/and-conditions/index.html b/docs/tutorial-assertions/and-conditions/index.html index d30f89b4be..3302c971bc 100644 --- a/docs/tutorial-assertions/and-conditions/index.html +++ b/docs/tutorial-assertions/and-conditions/index.html @@ -4,7 +4,7 @@ And Conditions | TUnit - + diff --git a/docs/tutorial-assertions/awaiting/index.html b/docs/tutorial-assertions/awaiting/index.html index bf11d0edc1..c03abb2b84 100644 --- a/docs/tutorial-assertions/awaiting/index.html +++ b/docs/tutorial-assertions/awaiting/index.html @@ -4,7 +4,7 @@ Awaiting | TUnit - + diff --git a/docs/tutorial-assertions/congratulations/index.html b/docs/tutorial-assertions/congratulations/index.html index 83ac56c8a1..d1f0f7adc1 100644 --- a/docs/tutorial-assertions/congratulations/index.html +++ b/docs/tutorial-assertions/congratulations/index.html @@ -4,7 +4,7 @@ Congratulations | TUnit - + diff --git a/docs/tutorial-assertions/delegates/index.html b/docs/tutorial-assertions/delegates/index.html index eac92aa31b..1aa0254e58 100644 --- a/docs/tutorial-assertions/delegates/index.html +++ b/docs/tutorial-assertions/delegates/index.html @@ -4,7 +4,7 @@ Delegates | TUnit - + diff --git a/docs/tutorial-assertions/or-conditions/index.html b/docs/tutorial-assertions/or-conditions/index.html index 2d16d1f7c5..c43e99e735 100644 --- a/docs/tutorial-assertions/or-conditions/index.html +++ b/docs/tutorial-assertions/or-conditions/index.html @@ -4,7 +4,7 @@ Or Conditions | TUnit - + diff --git a/docs/tutorial-assertions/type-checking/index.html b/docs/tutorial-assertions/type-checking/index.html index 5ccb6c4e0d..bb7e6c80ac 100644 --- a/docs/tutorial-assertions/type-checking/index.html +++ b/docs/tutorial-assertions/type-checking/index.html @@ -4,7 +4,7 @@ Type Checking | TUnit - + diff --git a/docs/tutorial-basics/congratulations/index.html b/docs/tutorial-basics/congratulations/index.html index 639e4d7f16..57be6777d9 100644 --- a/docs/tutorial-basics/congratulations/index.html +++ b/docs/tutorial-basics/congratulations/index.html @@ -4,7 +4,7 @@ Congratulations! | TUnit - + diff --git a/docs/tutorial-basics/data-driven-tests/index.html b/docs/tutorial-basics/data-driven-tests/index.html index b2a27a7b07..a05b6331e9 100644 --- a/docs/tutorial-basics/data-driven-tests/index.html +++ b/docs/tutorial-basics/data-driven-tests/index.html @@ -4,7 +4,7 @@ Data Driven Tests | TUnit - + diff --git a/docs/tutorial-basics/data-source-driven-tests/index.html b/docs/tutorial-basics/data-source-driven-tests/index.html index 78f9628f8d..9754fd664c 100644 --- a/docs/tutorial-basics/data-source-driven-tests/index.html +++ b/docs/tutorial-basics/data-source-driven-tests/index.html @@ -4,7 +4,7 @@ Data Source Driven Tests | TUnit - + diff --git a/docs/tutorial-basics/installing/index.html b/docs/tutorial-basics/installing/index.html index fd5e3ae136..c4346a5bf1 100644 --- a/docs/tutorial-basics/installing/index.html +++ b/docs/tutorial-basics/installing/index.html @@ -4,7 +4,7 @@ Installing TUnit | TUnit - + diff --git a/docs/tutorial-basics/matrix-tests/index.html b/docs/tutorial-basics/matrix-tests/index.html index 8291a94f22..c8acef1310 100644 --- a/docs/tutorial-basics/matrix-tests/index.html +++ b/docs/tutorial-basics/matrix-tests/index.html @@ -4,7 +4,7 @@ Matrix Tests | TUnit - + diff --git a/docs/tutorial-basics/running-your-tests/index.html b/docs/tutorial-basics/running-your-tests/index.html index 8b0e3d7b69..bd28c45cf0 100644 --- a/docs/tutorial-basics/running-your-tests/index.html +++ b/docs/tutorial-basics/running-your-tests/index.html @@ -4,7 +4,7 @@ Running your tests | TUnit - + diff --git a/docs/tutorial-basics/things-to-know/index.html b/docs/tutorial-basics/things-to-know/index.html index 1713a4e2dd..5688546627 100644 --- a/docs/tutorial-basics/things-to-know/index.html +++ b/docs/tutorial-basics/things-to-know/index.html @@ -4,7 +4,7 @@ Things to know | TUnit - + diff --git a/docs/tutorial-basics/writing-your-first-test/index.html b/docs/tutorial-basics/writing-your-first-test/index.html index 1a2fec1f47..2f2036fc37 100644 --- a/docs/tutorial-basics/writing-your-first-test/index.html +++ b/docs/tutorial-basics/writing-your-first-test/index.html @@ -4,7 +4,7 @@ Writing your first test | TUnit - + diff --git a/docs/tutorial-extras/cleanup/index.html b/docs/tutorial-extras/cleanup/index.html index 6e28375bc7..d95b8484c3 100644 --- a/docs/tutorial-extras/cleanup/index.html +++ b/docs/tutorial-extras/cleanup/index.html @@ -4,7 +4,7 @@ Test Clean Ups | TUnit - + diff --git a/docs/tutorial-extras/depends-on/index.html b/docs/tutorial-extras/depends-on/index.html index 6fc855ece7..15400c8b3f 100644 --- a/docs/tutorial-extras/depends-on/index.html +++ b/docs/tutorial-extras/depends-on/index.html @@ -4,11 +4,11 @@ Depends On | TUnit - + -

Depends On

+

Depends On

A test can depend on another test. This means that your test will not start unless the other test has finished.

To do this, add a [DependsOn] to your test.

This takes a test name, which you can easily reference by using the nameof(TestMethod) keyword. And if your test you depend on has parameters, you must include the types of those too.

@@ -16,6 +16,12 @@
public void Test1(string value1, int value2) { ... }

[DependsOn(nameof(Test1), [typeof(string), typeof(int)])]
public void Test2() { ... }

This means you can create more complex test suites, without having to compromise on parallelism or speed.

For example, performing some operations on a database and asserting a count at the end:

-
[Test]
public async Task AddUser1()
{
...
}

[Test]
public async Task AddUser2()
{
...
}

[Test]
public async Task AddUser3()
{
...
}

[Test]
public async Task AddUser4()
{
...
}

[Test]
public async Task AddUser5()
{
...
}

[Test, DependsOn(nameof(AddUser1))]
public async Task AddItemToBagForUser1()
{
...
}

[Test, DependsOn(nameof(AddUser2))]
public async Task AddItemToBagForUser2()
{
...
}

[Test, DependsOn(nameof(AddUser3))]
public async Task AddItemToBagForUser3()
{
...
}

[Test]
[DependsOn(nameof(AddUser4)]
[DependsOn(nameof(AddUser5)]
[DependsOn(nameof(AddItemToBagForUser1)]
[DependsOn(nameof(AddItemToBagForUser2)]
[DependsOn(nameof(AddItemToBagForUser3)]
public async Task AssertItemsInDatabase()
{
...
}
+
[Test]
public async Task AddUser1()
{
...
}

[Test]
public async Task AddUser2()
{
...
}

[Test]
public async Task AddUser3()
{
...
}

[Test]
public async Task AddUser4()
{
...
}

[Test]
public async Task AddUser5()
{
...
}

[Test, DependsOn(nameof(AddUser1))]
public async Task AddItemToBagForUser1()
{
...
}

[Test, DependsOn(nameof(AddUser2))]
public async Task AddItemToBagForUser2()
{
...
}

[Test, DependsOn(nameof(AddUser3))]
public async Task AddItemToBagForUser3()
{
...
}

[Test]
[DependsOn(nameof(AddUser4)]
[DependsOn(nameof(AddUser5)]
[DependsOn(nameof(AddItemToBagForUser1)]
[DependsOn(nameof(AddItemToBagForUser2)]
[DependsOn(nameof(AddItemToBagForUser3)]
public async Task AssertItemsInDatabase()
{
...
}
+

Getting other tests

+

If your tests depends on another test, it's possible to retrieve that test's context. This allows you to do things like check its result, or retrieve objects from its object bag.

+

This is done by calling the GetTests method on a TestContext object. It takes the test's method name (so you can use nameof(...)) and optionally the parameter types for if there's multiple overloads.

+

You'll notice this returns an array - This is because tests may be data driven and be invoked multiple times - If this is the case you'll have to find the one you want yourself.

+

Example:

+
[Test]
public async Task AddItemToBag()
{
var itemId = await AddToBag();
TestContext.Current!.ObjectBag.Add("ItemId", itemId);
}

[Test]
[DependsOn(nameof(AddItemToBag)]
public async Task DeleteItemFromBag()
{
var addToBagTestContext = TestContext.Current!.GetTests(nameof(AddItemToBag)).First();
var itemId = addToBagTestContext.ObjectBag["ItemId"];
await DeleteFromBag(itemId);
}
\ No newline at end of file diff --git a/docs/tutorial-extras/executors/index.html b/docs/tutorial-extras/executors/index.html index 063e48b905..3054b89782 100644 --- a/docs/tutorial-extras/executors/index.html +++ b/docs/tutorial-extras/executors/index.html @@ -4,7 +4,7 @@ Executors | TUnit - + diff --git a/docs/tutorial-extras/explicit/index.html b/docs/tutorial-extras/explicit/index.html index 3afdc35903..cdeeea4b8e 100644 --- a/docs/tutorial-extras/explicit/index.html +++ b/docs/tutorial-extras/explicit/index.html @@ -4,7 +4,7 @@ Explicit | TUnit - + diff --git a/docs/tutorial-extras/not-in-parallel/index.html b/docs/tutorial-extras/not-in-parallel/index.html index 3461abc141..9bbe4322c8 100644 --- a/docs/tutorial-extras/not-in-parallel/index.html +++ b/docs/tutorial-extras/not-in-parallel/index.html @@ -4,7 +4,7 @@ Not in Parallel | TUnit - + diff --git a/docs/tutorial-extras/order/index.html b/docs/tutorial-extras/order/index.html index 6019e61ab2..54ca268960 100644 --- a/docs/tutorial-extras/order/index.html +++ b/docs/tutorial-extras/order/index.html @@ -4,7 +4,7 @@ Ordering Tests | TUnit - + diff --git a/docs/tutorial-extras/parallel-limiter/index.html b/docs/tutorial-extras/parallel-limiter/index.html index 3da4089e4d..c7a55ca17b 100644 --- a/docs/tutorial-extras/parallel-limiter/index.html +++ b/docs/tutorial-extras/parallel-limiter/index.html @@ -4,7 +4,7 @@ Parallel Limiter | TUnit - + diff --git a/docs/tutorial-extras/properties/index.html b/docs/tutorial-extras/properties/index.html index 6e8356ac73..241b6a0872 100644 --- a/docs/tutorial-extras/properties/index.html +++ b/docs/tutorial-extras/properties/index.html @@ -4,7 +4,7 @@ Properties | TUnit - + diff --git a/docs/tutorial-extras/repeating/index.html b/docs/tutorial-extras/repeating/index.html index 39e45abea7..5ee4b161ab 100644 --- a/docs/tutorial-extras/repeating/index.html +++ b/docs/tutorial-extras/repeating/index.html @@ -4,7 +4,7 @@ Repeating | TUnit - + diff --git a/docs/tutorial-extras/retrying/index.html b/docs/tutorial-extras/retrying/index.html index 8d0b48be81..5a3a1ef912 100644 --- a/docs/tutorial-extras/retrying/index.html +++ b/docs/tutorial-extras/retrying/index.html @@ -4,7 +4,7 @@ Retrying | TUnit - + diff --git a/docs/tutorial-extras/setup/index.html b/docs/tutorial-extras/setup/index.html index a3ae9d16ae..d870e58a86 100644 --- a/docs/tutorial-extras/setup/index.html +++ b/docs/tutorial-extras/setup/index.html @@ -4,7 +4,7 @@ Test Set Ups | TUnit - + diff --git a/docs/tutorial-extras/test-context/index.html b/docs/tutorial-extras/test-context/index.html index b6a7d42d04..0efeda4fc6 100644 --- a/docs/tutorial-extras/test-context/index.html +++ b/docs/tutorial-extras/test-context/index.html @@ -4,7 +4,7 @@ Test Context | TUnit - + diff --git a/docs/tutorial-extras/test-filters/index.html b/docs/tutorial-extras/test-filters/index.html index 4e39ed96af..9ac1610a06 100644 --- a/docs/tutorial-extras/test-filters/index.html +++ b/docs/tutorial-extras/test-filters/index.html @@ -4,7 +4,7 @@ Test Filters | TUnit - + diff --git a/docs/tutorial-extras/timeouts/index.html b/docs/tutorial-extras/timeouts/index.html index ef1128d5bd..6982ad12fd 100644 --- a/docs/tutorial-extras/timeouts/index.html +++ b/docs/tutorial-extras/timeouts/index.html @@ -4,7 +4,7 @@ Timeouts | TUnit - + diff --git a/index.html b/index.html index ae3d2afc51..6c947d26cf 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Hello from TUnit | TUnit - + diff --git a/markdown-page/index.html b/markdown-page/index.html index b1c635329e..3e9718e16f 100644 --- a/markdown-page/index.html +++ b/markdown-page/index.html @@ -4,7 +4,7 @@ Markdown page example | TUnit - +