-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding functionality to output test results in .xml format #77
Conversation
nairmai
commented
Aug 26, 2019
- Created a new class (XmlWriterService.ts) to provide this functionality
- Wrote unit tests for this class (XmlWriterService.test.ts)
- Added some helper utilities and interfaces (Utils.ts and types.ts)
- Modified the options for the d-ser-t-cli flags and d-ser-t-service main.ts to handle xml output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not working on this close enough to feel comfortable approving, most of this looks good. Frankly not familiar with Typescript enough to know if interfaces are widely used, but I'd say that's the most important bit of my review.
const outputFileType = path.extname(String(this.outFile)).substr(1); | ||
console.log('Output file type: ' + outputFileType); | ||
|
||
if (outputFileType === 'json') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block makes me think that we might want this.localFileService
to be an interface that either jsonWriterService
or xmlWriterService
implements, each of which would have a writeToTextFile
method. That way this if
statement doesn't get too long.
That may be overkill and I'm not sure how many output file types we're really going to end up supporting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can totally see needing to extend this in the future. I think for now we want a working version of this merged in as soon as we can so I'll create an issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*/ | ||
public static zeroPrefix(arr: string[]): string[] { | ||
arr.forEach((elem, i) => { | ||
if (Number(elem) < 10) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this would freak out if we ever got something negative. I don't actually think we should fix it, if we get a negative here I think we want it to fail, but interested to hear what others think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote this with the only intention of using it to format timestamps neatly, which I assumed would never have a negative input, but I've added a check within that if statement to only prepend '0' if elem is within [0,10).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most pressing change is creating the test_results/
folder if it does not already exist.
We want to merge this in by EOD, so any other fixes you can get done by then would be an added bonus.
const outputFileType = path.extname(String(this.outFile)).substr(1); | ||
console.log('Output file type: ' + outputFileType); | ||
|
||
if (outputFileType === 'json') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can totally see needing to extend this in the future. I think for now we want a working version of this merged in as soon as we can so I'll create an issue for this.