K6 Test Script (test.js)
The actual k6 script that generated these results:
import http from 'k6/http';
import { check, group, sleep } from 'k6';
import { Rate } from 'k6/metrics';
export let errorRate = new Rate('errors');
export let options = {
scenarios: {
default: {
executor: 'ramping-vus',
startVUs: 1,
stages: [
{ duration: '2s', target: 2 },
{ duration: '4s', target: 10 },
{ duration: '2s', target: 0 }
],
gracefulRampDown: '30s',
gracefulStop: '30s'
}
},
thresholds: {
http_req_duration: ['p(95)<1000'],
http_req_failed: ['rate<0.1'],
errors: ['rate<0.1']
}
};
export function setup() {
console.log('Starting load test for QA Automation Resume website');
}
export default function testHomepageLoad() {
group('Homepage Load Test', function() {
console.log('Testing homepage load performance');
let response = http.get('https://your-qa-resume-site.com');
let checkResult = check(response, {
'Homepage loads successfully': (r) => r.status === 200,
'Homepage load time is acceptable': (r) => r.timings.duration < 1000,
'Homepage contains HTML content': (r) => r.body.includes('<html'),
'Homepage has proper content type': (r) => r.headers['content-type'].includes('text/html'),
'Homepage body is not empty': (r) => r.body.length > 0,
'Page has title tag': (r) => r.body.includes('<title'),
'Page has some navigation elements': (r) => r.body.includes('nav') || r.body.includes('menu'),
'Page has main content area': (r) => r.body.includes('main') || r.body.includes('content')
});
errorRate.add(!checkResult);
});
group('Navigation Tests', function() {
console.log('Found undefined links on the page');
console.log('Link testing skipped - could not parse HTML');
});
group('Content Validation', function() {
console.log('Validating page content and SEO elements');
let response = http.get('https://your-qa-resume-site.com');
check(response, {
'Contains resume-related keywords': (r) => r.body.toLowerCase().includes('resume') || r.body.toLowerCase().includes('experience'),
'Has HTML structure': (r) => r.body.includes('<html') && r.body.includes('</html>'),
'Contains title tag': (r) => r.body.includes('<title'),
'Has meta tags': (r) => r.body.includes('<meta'),
'Page has meta description': (r) => r.body.includes('name="description"'),
'Page has heading elements': (r) => r.body.includes('<h1') || r.body.includes('<h2'),
'Page has footer': (r) => r.body.includes('<footer') || r.body.includes('footer')
});
});
group('Performance Tests', function() {
console.log('Testing static resources performance');
});
sleep(1);
}
export function teardown() {
console.log('Load test completed for QA Automation Resume website');
console.log('Check the test results above for performance metrics and any failures');
}
Detailed Test Results
✅ PASSED CHECKS:
• Homepage loads successfully
• Homepage load time is acceptable
• Homepage contains HTML content
• Homepage has proper content type
• Homepage body is not empty
• Contains resume-related keywords
• Has HTML structure
• Contains title tag
• Has meta tags
❌ FAILED CHECKS:
• Page has title tag (0% pass rate)
• Page has some navigation elements (0% pass rate)
• Page has main content area (0% pass rate)
• Page has meta description (0% pass rate)
• Page has heading elements (0% pass rate)
• Page has footer (0% pass rate)
⚠️ ERRORS DETECTED:
• TypeError: Value is not an object: undefined
• 50% error rate during execution
• Threshold violations on 'errors' metric