Skip to content

Instantly share code, notes, and snippets.

@njleonzhang
Last active April 9, 2018 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njleonzhang/a905756df2c32f93e70f95c61c036712 to your computer and use it in GitHub Desktop.
Save njleonzhang/a905756df2c32f93e70f95c61c036712 to your computer and use it in GitHub Desktop.
testLink 生成每人进度报告。
http://192.168.0.156:3315/testlink/lib/testcases/tcAssignedToUser.php?show_all_users=1&show_inactive_and_closed=1&format=0&tplan_id=2681
result = [];

[].slice.call(document.getElementsByClassName('x-grid-group')).map(user => {
	let nameEl = user.getElementsByClassName('x-grid-group-title')
	let caseEls = user.getElementsByClassName('x-grid3-row')
	
	let nameStr = nameEl[0].innerText
	let nameItems = nameStr.match(/用户:\s(\S*)\s\((\d*)\sItems*\)/)
	let name = nameItems[1]
	let total = nameItems[2]
	let notRun = user.getElementsByClassName('not_run_text').length
	let passed = user.getElementsByClassName('passed_text').length
	let failed = user.getElementsByClassName('failed_text').length
	let runed = total - notRun
	
	result.push({
		'姓名': name,
		'总用例数': total,
		'已执行': runed,
		'尚未执行': notRun,
		'通过的用例数': passed,
		'失败的用例数': failed,
		'锁定的用例数': total - notRun - passed - failed,
		'执行率': ((runed) / total * 100).toFixed(2) + '%',
		'通过率': (passed / total * 100).toFixed(2) + '%'
	})
})

console.table(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment