Skip to content
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

Optimized test case execution time && Tests to verify the api endpoint. #58

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

venkatesh21bit
Copy link

Fixes #27
What I did?
For Optimization:
Screenshot 2024-12-25 111548
I logged the time taken for computehash func and command execution func and found that it took more time for the command execution .
Screenshot 2024-12-25 153100
So I changed some synchronus func to async
It worked!!
Screenshot 2024-12-25 223720
A test file for the api endpoint is also added

@venkatesh21bit
Copy link
Author

@Ashrockzzz2003 @Abhinav-ark Can u review this?

@Ashrockzzz2003
Copy link
Member

Will review soon @venkatesh21bit
Thanks for the contribution!

Copy link
Member

@Ashrockzzz2003 Ashrockzzz2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the optimization looks good. Nice work @venkatesh21bit.
Love the async idea.

Please look into the changes suggested.

bin/index.js Outdated Show resolved Hide resolved
templates/basic/basic_api.test.js Outdated Show resolved Hide resolved
templates/basic/basic_api.test.js Outdated Show resolved Hide resolved
templates/basic/server.js Outdated Show resolved Hide resolved
test/init.test.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@Ashrockzzz2003 Ashrockzzz2003 added this to the Enhance the tool. milestone Dec 28, 2024
Copy link
Member

@Ashrockzzz2003 Ashrockzzz2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The app.listen inside basic template is the cause of this issue. Try n fix it please.

@venkatesh21bit
Copy link
Author

venkatesh21bit commented Dec 28, 2024

Its bcoz of starting the express server it just couldn't end the test correctly
image

@venkatesh21bit
Copy link
Author

Think everythings good now
image

Copy link
Member

@Ashrockzzz2003 Ashrockzzz2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of an optimization that we could do, which I think will reduce the time.

We can precompute the SHA256 hash of templates and hardcode it as a const. We can use this to compare in tests. This way, only once the SHA256 hash will be computed. Can you try this one?

You'll get 5 more bonus points.

const hashes
Copy link
Member

@Ashrockzzz2003 Ashrockzzz2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Why is this failing in mine? Let's do one thing, this is not speeding up the test case execution, the qse init is what is taking time. So let's go back to the way it was, let the hash be computed in runtime.

@venkatesh21bit
Copy link
Author

It's bcoz of different directory structures it will generate different hashes Its good we go back to the way it was

test/init.test.js Outdated Show resolved Hide resolved
templates/basic/server.js Show resolved Hide resolved
Copy link
Member

@Ashrockzzz2003 Ashrockzzz2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I'm still not convinced that template test imports are part of qse.
@Abhinav-ark please take a look.

Do note that comparing to the latest test invocation from main, speed has improved.

Previously it took 13s, now 7s Awesome @venkatesh21bit

@venkatesh21bit
Copy link
Author

@Ashrockzzz2003 what do u mean by 'template test imports are part of qse'. The test case for template is only the server.test file . The other tests inside the test dir are for the qse commands .

@Ashrockzzz2003
Copy link
Member

@Ashrockzzz2003 what do u mean by 'template test imports are part of qse'. The test case for template is only the server.test file . The other tests inside the test dir are for the qse commands .

Express and supertest are now part of package.json of the cli tool just for the sake of running tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Test cases for basic template.
2 participants