-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Baldwin
committed
Oct 11, 2023
1 parent
6e25463
commit 8ac81a6
Showing
24 changed files
with
542 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="/assets/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
|
||
<title>Locust</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
|
||
<script> | ||
window.templateArgs = {{ template_args|tojson }} | ||
window.theme = "{{theme}}" | ||
</script> | ||
|
||
<script> | ||
{{ static_js|safe }} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="/assets/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
|
||
<title>Locust</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
|
||
<script> | ||
window.templateArgs = {{ template_args|tojson }} | ||
window.theme = "{{theme}}" | ||
</script> | ||
|
||
<script> | ||
{{ static_js|safe }} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import { Box, Typography, Container, Link } from '@mui/material'; | ||
import CssBaseline from '@mui/material/CssBaseline'; | ||
import { ThemeProvider } from '@mui/material/styles'; | ||
|
||
import { ExceptionsTable } from 'components/ExceptionsTable/ExceptionsTable'; | ||
import { FailuresTable } from 'components/FailuresTable/FailuresTable'; | ||
import ResponseTimeTable from 'components/ResponseTimeTable/ResponseTimeTable'; | ||
import { StatsTable } from 'components/StatsTable/StatsTable'; | ||
import { SwarmCharts } from 'components/SwarmCharts/SwarmCharts'; | ||
import { SwarmRatios } from 'components/SwarnRatios/SwarmRatios'; | ||
import createTheme, { THEME_MODE } from 'styles/theme'; | ||
import { IReport } from 'types/swarm.types'; | ||
|
||
const theme = createTheme(window.theme || THEME_MODE.LIGHT); | ||
|
||
export default function Report({ | ||
locustfile, | ||
showDownloadLink, | ||
startTime, | ||
endTime, | ||
charts, | ||
host, | ||
exceptionsStatistics, | ||
requestsStatistics, | ||
failuresStatistics, | ||
responseTimeStatistics, | ||
tasks, | ||
}: IReport) { | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
|
||
<Container maxWidth='lg' sx={{ my: 4 }}> | ||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}> | ||
<Typography | ||
component='h1' | ||
noWrap | ||
sx={{ | ||
fontWeight: 700, | ||
}} | ||
variant='h3' | ||
> | ||
Locust Test Report | ||
</Typography> | ||
{showDownloadLink && ( | ||
<Link href={`?download=1&theme=${window.theme}`}>Download the Report</Link> | ||
)} | ||
</Box> | ||
<Box sx={{ my: 2 }}> | ||
<Box sx={{ display: 'flex', columnGap: 0.5 }}> | ||
<Typography fontWeight={600}>During:</Typography> | ||
<Typography> | ||
{startTime} - {endTime} | ||
</Typography> | ||
</Box> | ||
|
||
<Box sx={{ display: 'flex', columnGap: 0.5 }}> | ||
<Typography fontWeight={600}>Target Host:</Typography> | ||
<Typography>{host || 'None'}</Typography> | ||
</Box> | ||
|
||
<Box sx={{ display: 'flex', columnGap: 0.5 }}> | ||
<Typography fontWeight={600}>Script:</Typography> | ||
<Typography>{locustfile}</Typography> | ||
</Box> | ||
</Box> | ||
|
||
<Box sx={{ display: 'flex', flexDirection: 'column', rowGap: 4 }}> | ||
<Box> | ||
<Typography component='h2' mb={1} noWrap variant='h4'> | ||
Request Statistics | ||
</Typography> | ||
<StatsTable stats={requestsStatistics} /> | ||
</Box> | ||
<Box> | ||
<Typography component='h2' mb={1} noWrap variant='h4'> | ||
Response Time Statistics | ||
</Typography> | ||
<ResponseTimeTable responseTimes={responseTimeStatistics} /> | ||
</Box> | ||
<Box> | ||
<Typography component='h2' mb={1} noWrap variant='h4'> | ||
Failures Statistics | ||
</Typography> | ||
<FailuresTable errors={failuresStatistics} /> | ||
</Box> | ||
{!!exceptionsStatistics.length && ( | ||
<Box> | ||
<Typography component='h2' mb={1} noWrap variant='h4'> | ||
Exceptions Statistics | ||
</Typography> | ||
<ExceptionsTable exceptions={exceptionsStatistics} /> | ||
</Box> | ||
)} | ||
|
||
<Box> | ||
<Typography component='h2' mb={1} noWrap variant='h4'> | ||
Charts | ||
</Typography> | ||
<SwarmCharts charts={charts} /> | ||
</Box> | ||
<Box> | ||
<Typography component='h2' mb={1} noWrap variant='h4'> | ||
Final ratio | ||
</Typography> | ||
<SwarmRatios ratios={tasks} /> | ||
</Box> | ||
</Box> | ||
</Container> | ||
</ThemeProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
locust/webui/src/components/ResponseTimeTable/ResponseTimeTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useMemo } from 'react'; | ||
|
||
import Table from 'components/Table/Table'; | ||
import { IResponseTime } from 'types/ui.types'; | ||
|
||
const tableStructure = [ | ||
{ key: 'method', title: 'Method' }, | ||
{ key: 'name', title: 'Name' }, | ||
]; | ||
|
||
interface IResponseTimeTable { | ||
responseTimes: IResponseTime[]; | ||
} | ||
|
||
export default function ResponseTimeTable({ responseTimes }: IResponseTimeTable) { | ||
const percentileColumns = useMemo( | ||
() => | ||
Object.keys(responseTimes[0]) | ||
.filter(value => Boolean(Number(value))) | ||
.map(percentile => ({ key: percentile, title: `${Number(percentile) * 100}%ile (ms)` })), | ||
[responseTimes], | ||
); | ||
|
||
return <Table rows={responseTimes} structure={[...tableStructure, ...percentileColumns]} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.