github.com/kubeshop/testkube@v1.17.23/pkg/test/detector/detector_test_examples.go (about) 1 package detector 2 3 const ( 4 examplePostmanContent = `{ "info": { "_postman_id": "3d9a6be2-bd3e-4cf7-89ca-354103aab4a7", "name": "Testkube", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Health", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{URI}}/health", "host": [ "{{URI}}" ], "path": [ "health" ] } }, "response": [] } ] } ` 5 6 exampleArtilleryFilename = "artillery.yaml" 7 exampleArtilleryContent = `config: 8 target: "https://testkube.kubeshop.io/" 9 phases: 10 - duration: 1 11 arrivalRate: 1 12 scenarios: 13 - flow: 14 - get: 15 url: "/" 16 - think: 0.1` 17 18 exampleCurlFilename = "curl.json" 19 exampleCurlContent = `{ 20 "command": [ 21 "curl", 22 "https://reqbin.com/echo/get/json", 23 "-H", 24 "'Accept: application/json'" 25 ], 26 "expected_status": "200", 27 "expected_body": "{\"success\":\"true\"}" 28 }` 29 30 exampleJMeterFilename = "jmeter.jmx" 31 exampleJMeterContent = `<?xml version="1.0" encoding="UTF-8"?> 32 <jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13.19691222"> 33 <hashTree> 34 <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> 35 <stringProp name="TestPlan.comments"></stringProp> 36 <boolProp name="TestPlan.functional_mode">false</boolProp> 37 <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> 38 <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> 39 <collectionProp name="Arguments.arguments"/> 40 </elementProp> 41 <stringProp name="TestPlan.user_define_classpath"></stringProp> 42 </TestPlan> 43 <hashTree> 44 <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> 45 <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> 46 <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> 47 <boolProp name="LoopController.continue_forever">false</boolProp> 48 <stringProp name="LoopController.loops">1</stringProp> 49 </elementProp> 50 <stringProp name="ThreadGroup.num_threads">1</stringProp> 51 <stringProp name="ThreadGroup.ramp_time">1</stringProp> 52 <longProp name="ThreadGroup.start_time">1668426657000</longProp> 53 <longProp name="ThreadGroup.end_time">1668426657000</longProp> 54 <boolProp name="ThreadGroup.scheduler">false</boolProp> 55 <stringProp name="ThreadGroup.duration"></stringProp> 56 <stringProp name="ThreadGroup.delay"></stringProp> 57 </ThreadGroup> 58 <hashTree> 59 <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Testkube - HTTP Request" enabled="true"> 60 <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> 61 <collectionProp name="Arguments.arguments"/> 62 </elementProp> 63 <stringProp name="HTTPSampler.domain">testkube.kubeshop.io</stringProp> 64 <stringProp name="HTTPSampler.port"></stringProp> 65 <stringProp name="HTTPSampler.connect_timeout"></stringProp> 66 <stringProp name="HTTPSampler.response_timeout"></stringProp> 67 <stringProp name="HTTPSampler.protocol"></stringProp> 68 <stringProp name="HTTPSampler.contentEncoding"></stringProp> 69 <stringProp name="HTTPSampler.path"></stringProp> 70 <stringProp name="HTTPSampler.method">GET</stringProp> 71 <boolProp name="HTTPSampler.follow_redirects">true</boolProp> 72 <boolProp name="HTTPSampler.auto_redirects">false</boolProp> 73 <boolProp name="HTTPSampler.use_keepalive">true</boolProp> 74 <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> 75 <boolProp name="HTTPSampler.monitor">false</boolProp> 76 <stringProp name="HTTPSampler.embedded_url_re"></stringProp> 77 </HTTPSamplerProxy> 78 <hashTree/> 79 <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> 80 <collectionProp name="Asserion.test_strings"> 81 <stringProp name="49586">200</stringProp> 82 </collectionProp> 83 <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> 84 <boolProp name="Assertion.assume_success">false</boolProp> 85 <intProp name="Assertion.test_type">8</intProp> 86 </ResponseAssertion> 87 <hashTree/> 88 <ResultCollector guiclass="AssertionVisualizer" testclass="ResultCollector" testname="Assertion Results" enabled="true"> 89 <boolProp name="ResultCollector.error_logging">false</boolProp> 90 <objProp> 91 <name>saveConfig</name> 92 <value class="SampleSaveConfiguration"> 93 <time>true</time> 94 <latency>true</latency> 95 <timestamp>true</timestamp> 96 <success>true</success> 97 <label>true</label> 98 <code>true</code> 99 <message>true</message> 100 <threadName>true</threadName> 101 <dataType>true</dataType> 102 <encoding>false</encoding> 103 <assertions>true</assertions> 104 <subresults>true</subresults> 105 <responseData>false</responseData> 106 <samplerData>false</samplerData> 107 <xml>false</xml> 108 <fieldNames>false</fieldNames> 109 <responseHeaders>false</responseHeaders> 110 <requestHeaders>false</requestHeaders> 111 <responseDataOnError>false</responseDataOnError> 112 <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> 113 <assertionsResultsToSave>0</assertionsResultsToSave> 114 <bytes>true</bytes> 115 <threadCounts>true</threadCounts> 116 </value> 117 </objProp> 118 <stringProp name="filename"></stringProp> 119 </ResultCollector> 120 <hashTree/> 121 </hashTree> 122 </hashTree> 123 </hashTree> 124 </jmeterTestPlan>` 125 126 exampleK6Filename = "k6.js" 127 exampleK6Content = `import http from 'k6/http'; 128 import { check } from 'k6'; 129 130 if (__ENV.K6_ENV_FROM_PARAM != "K6_ENV_FROM_PARAM_value") { 131 throw new Error("Incorrect K6_ENV_FROM_PARAM ENV value"); 132 } 133 134 if (__ENV.K6_SYSTEM_ENV != "K6_SYSTEM_ENV_value") { 135 throw new Error("Incorrect K6_SYSTEM_ENV ENV value"); 136 } 137 138 export default function () { 139 http.get('https://testkube.kubeshop.io/'); 140 }` 141 142 exampleSoapUIFilename = "soapui-project.xml" 143 exampleSoapUIContent = `<?xml version="1.0" encoding="UTF-8"?> 144 <con:soapui-project id="a4d0c33f-8a17-4764-8657-7b1491450f1d" activeEnvironment="Default" name="soapui-smoke-test" resourceRoot="" soapui-version="5.7.0" xmlns:con="http://eviware.com/soapui/config"><con:settings/><con:interface xsi:type="con:RestService" id="3034130b-11fd-4fff-b8f6-ad001d746b11" wadlVersion="http://wadl.dev.java.net/2009/02" name="https://testkube.kubeshop.io" type="rest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:settings/><con:definitionCache/><con:endpoints><con:endpoint>https://testkube.kubeshop.io</con:endpoint></con:endpoints><con:resource name="" path="/" id="9b7558bb-3f97-4eed-b6f9-784bf4197177"><con:settings/><con:parameters/><con:method name="1" id="1b46195c-80e1-43ee-9e11-406d5374b0e8" method="GET"><con:settings/><con:parameters/><con:request name="testkube-website" id="1a3b73f2-1eb1-47ec-a634-b865d11e1e2d" mediaType="application/json"><con:settings/><con:endpoint>https://testkube.kubeshop.io</con:endpoint><con:parameters/></con:request></con:method></con:resource></con:interface><con:properties/><con:wssContainer/><con:oAuth2ProfileContainer/><con:oAuth1ProfileContainer/></con:soapui-project>` 145 )