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

GraalJS and runner and reporter improvements - performance, streams, config #1281

Closed
ptrthomas opened this issue Sep 4, 2020 · 5 comments
Closed

Comments

@ptrthomas
Copy link
Member

ptrthomas commented Sep 4, 2020

this is an "umbrella" issue and I may close some of the existing issues as duplicates. there is a refactoring that will go along with this, perhaps the graal migration

  • ✅ introduce a scenario stream concept
    • a "generator function" that can produce scenarios at run-time, lazily for best performance
    • split scenarios for parallel execution
    • result streams can be combined to aggregate results
    • can Scenario Outline take a stream as the data-source ? may be hard
    • at the very least support a "generator" as the call argument
  • ✅ test-run progress reporting
    • something we've discussed for the karate-runner VS Code plugin project
    • remaining tests progress indicator
    • dump stats to file that VS Code can pick up as it changes
    • move / rename previous report to backup file so it is not lost / overwritten (good to have)
  • ✅ improve Embed design to store files and not hold all the bytes of large images in memory
  • run in "quiet" mode, no reports and less logs, to enable bots and high-perf use
  • ✅ report performance Karate hangs after finishing the test (with large number of inputs) #1245
    • don't write JSON, XML, HTML when instructed
    • can a file-stream be introduced for perf especially when the no of scenarios is huge
    • re-write JUnit XML report to use something SAX-like not DOM, also see https://stackoverflow.com/q/63747415/143475
  • ✅ report vs console logging
  • ❌ runner pipelines (defer to later)
    • use-case to be able to sequence some tags (or scenario streams) to run first
    • and some control to be able to conditionally abort test after that phase
    • if that is too hard, at the very least plan to introduce a karate.abortAll() api to stop the entire test-suite
  • ✅ retry
    • re-design the results objects so that we keep track of re-tries and still report "final" results without messing up scenario / pass / fail counts. this should play well with the "scenario streams" above
    • also support being able to "combine" 2 Result instances, so you can use the Runner multiple times in a "suite" but have a single report Merging two results objects into one object #1263
  • ✅ user custom doc can appear inline [enhance] inline doc that appears in HTML report #951
  • ✅ improve HTML reporting
    • use new GraalJS based engine
    • templating and re-use system, allow users to create custom reports and contribute as plugin / JAR files
  • ✅ report dry-run concept and @todo tag
    • the goal is to NOT require a test-management tool (as far as possible :)
    • you should be able to run tests in “dry run” mode. this will give you the same old HTML report showing what features will be run, we will show all steps so you can read the HTML report. note that we now include comments - but of course the actual times, and logs will be missing. everything will pass
    • the useful part of the “dry run” report is the “Tags” section, showing what tags will run. this should suffice as a feature “coverage” report, provided you have a rich set of tags. e.g. @smoke @module=one @module=two etc
  • ✅ because graal-js JS / match improvements - e.g. the JS arrow operator will finally be usable
  • ✅ improve match failure reporting Enhancement: Display Expected Results for a Contains Only Failure Using Json Formatting #1012
  • ✅ remove / deprecate cucumber reports from stand-alone JAR
  • ✅ unify CLI com.intuit.karate:karate-netty:0.9.5 not in maven ? #1177 - right now there are 2 for karate-core and karate-netty
  • ✅ debug - improve variables display Show debug variables as json (instead of strings) kirksl/karate-runner#68
  • ✅ header names should be case-insensitive Behavior of header matching should treat field names as case-insensitive, but not values #1360
@ptrthomas ptrthomas added this to the 1.0.0 milestone Sep 4, 2020
@ptrthomas ptrthomas self-assigned this Sep 4, 2020
@ptrthomas ptrthomas changed the title runner and reporter improvements - performance, streams, configuration GraalJS and runner and reporter improvements - performance, streams, config Sep 4, 2020
@KostasKgr
Copy link

Thanks for raising this Peter, You've noted everything I had in mind.

In case it helps I have crafted a simple example similar to what I had used in a project. Checking task manager in windows it consumes 4.2gb of memory with 2000 elements in the dynamic scenario.
https://github.com/KostasKgr/karate-issues/blob/heavy_cpu_memory_on_dynamic_scenario/src/test/java/examples/example.feature

I had also noticed something weird with the xml report, but for the life of me I can't get the xml report to get generated now that I am at my home windows pc, if I manage to reproduce it I will update this comment.

Cheers

@ptrthomas
Copy link
Member Author

@KostasKgr XML report maybe it is this problem someone just reported: https://stackoverflow.com/q/63747415/143475 - I've added it to the master list

ptrthomas added a commit that referenced this issue Sep 12, 2020
introduced processor and subscriber interfaces based on the java reactive streams / spi
much better parallel exec only one executor service is needed instead of two
no more flaky countdown-latch, using completable-future and try-catch blocks to avoid runner hang
todo: fix dynamic scenario to return proper lazy iterator, but now we have the foundation for that
todo: simplify the feature-execution-unit and scenario-execution-unit
since now the parallel-processor does more of the async orchestration
also todo: make runner-options --> feature-context --> heirarchy more sane
ptrthomas added a commit that referenced this issue Sep 13, 2020
this even handles dynamic scenario-oulines and sets us up for un-bounded data-sources
ptrthomas added a commit that referenced this issue Sep 13, 2020
a huge step forward for dynamic data driven scenarios
ptrthomas added a commit that referenced this issue Oct 1, 2020
if you are reading this - there is a lot of interesting stuff in this
start of moving to graal for the js engine and armeria for server, possibly client also
including thymeleaf for html templating, and a proof-of-concept of an html server-side framework with demo
temporarily using a karate-core2 maven module to manage the extreme changes in flight
pretty much re-creating karate from scratch - the core is coming together
most of the complex match logic is done, and way better designed than how it was
ptrthomas added a commit that referenced this issue Oct 10, 2020
ptrthomas added a commit that referenced this issue Oct 10, 2020
based om the learnings from the past
ptrthomas added a commit that referenced this issue Nov 11, 2020
ptrthomas added a commit that referenced this issue Nov 11, 2020
now it is simpler, using the http-client-factory, and avoiding js
ptrthomas added a commit that referenced this issue Nov 11, 2020
reverted cookie expiry checks, felt karate should allow any kinds of bad cookies, as a testing tool
karate-jersey is done
previous commit has breaking changes to mock-servlet
of course http client in case anyone has extended is also a breaking change
now the remaining part is karate-ui which is not part of the maven build as tests
ptrthomas added a commit that referenced this issue Nov 13, 2020
one of the hardest things I've ever done, this was even harder than re-writing cucumber
now the satisfaction of deleting code begins
ptrthomas added a commit that referenced this issue Nov 14, 2020
ptrthomas added a commit that referenced this issue Nov 14, 2020
and we will maven-shade it so that there will not be library conflicts in the wild
which means we can remove karate-jersey, it is not needed any more
we can focus on the one true http client and also look at armeria for the future and async
the build time has come down and the number of directories can be reduced in git
next we can try remove the karate-netty module, but the readme may have to remain
the size of the karate-core jar is around 10 mb now, but I think in this day and age it is ok
ptrthomas added a commit that referenced this issue Nov 14, 2020
so now the fatjar and the maven module is unified
ptrthomas added a commit that referenced this issue Nov 15, 2020
now the http client abstraction for ui driver etc is based on this, and log appender swapping
ptrthomas added a commit that referenced this issue Nov 18, 2020
driver.dialog api changed to driver.dialogText so as to not collide with getters :(
switch frames seems broken, putting it as a todo investigate
and one checkbox test
ptrthomas added a commit that referenced this issue Nov 18, 2020
see previous commit for diff
also improved junit 4 to properly handle one time init
ptrthomas added a commit that referenced this issue Nov 20, 2020
now using the io.github.classgraph lib, for performance we try to use the default classloader
but now we should be able to load from jars and other non-file locations
ptrthomas added a commit that referenced this issue Nov 28, 2020
made sure that vs code karate-runner plugin will still be backwards compatible, which applies only
for the combination of vs-code and a maven / gradle project cc @kirksl
ptrthomas added a commit that referenced this issue Nov 29, 2020
system property any more, added -w flag to set working directory
guessing it may be useful for karate-runner ide support in future cc @kirksl
other improvement is even when using file-system, karate will attempt to use
relative paths in reports etc, just to reduce clutter / maybe better security as well
ptrthomas added a commit that referenced this issue Nov 29, 2020
and brought it back from previous commits, but now the suite-init is quite clean
more unification across cli - standalone - maven - junit
one big change is reports, json, xml etc will now go into <build-dir>/[karate-reports]
it is about time
@ptrthomas
Copy link
Member Author

I'm going to declare this as done ! have updated the first comment with the 2 pieces we didn't get to. but very happy with all that we were able to accomplish. we are on GraalJS, karate runs on JDK 16 and the code has been cleaned up very effectively

@dersvenhesse
Copy link
Contributor

That's wonderful news, thank you! Is there an ETA for the changes to be released in a new version?

@ptrthomas
Copy link
Member Author

@dersvenhesse please see https://github.com/intuit/karate/wiki/1.0-upgrade-guide - so right now you can test 0.9.9.RC3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants