Skip to content

Commit 8afc936

Browse files
authored
Merge pull request #25 from PractiTest/xunit-support
xUnit nexted `testsuite` support
2 parents bfe4811 + a410c1c commit 8afc936

13 files changed

Lines changed: 158 additions & 21 deletions

File tree

.clj-kondo/babashka/fs/config.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:lint-as {babashka.fs/with-temp-dir clojure.core/let}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
{:hooks
3+
{:analyze-call {org.httpkit.server/with-channel httpkit.with-channel/with-channel}}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(ns httpkit.with-channel
2+
(:require [clj-kondo.hooks-api :as api]))
3+
4+
(defn with-channel [{node :node}]
5+
(let [[request channel & body] (rest (:children node))]
6+
(when-not (and request channel) (throw (ex-info "No request or channel provided" {})))
7+
(when-not (api/token-node? channel) (throw (ex-info "Missing channel argument" {})))
8+
(let [new-node
9+
(api/list-node
10+
(list*
11+
(api/token-node 'let)
12+
(api/vector-node [channel (api/vector-node [])])
13+
request
14+
body))]
15+
16+
{:node new-node})))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{:lint-as
2+
{rewrite-clj.zip/subedit-> clojure.core/->
3+
rewrite-clj.zip/subedit->> clojure.core/->>
4+
rewrite-clj.zip/edit-> clojure.core/->
5+
rewrite-clj.zip/edit->> clojure.core/->>}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:hooks {:analyze-call {taoensso.encore/defalias taoensso.encore/defalias}}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(ns taoensso.encore
2+
(:require
3+
[clj-kondo.hooks-api :as hooks]))
4+
5+
(defn defalias [{:keys [node]}]
6+
(let [[sym-raw src-raw] (rest (:children node))
7+
src (if src-raw src-raw sym-raw)
8+
sym (if src-raw
9+
sym-raw
10+
(symbol (name (hooks/sexpr src))))]
11+
{:node (with-meta
12+
(hooks/list-node
13+
[(hooks/token-node 'def)
14+
(hooks/token-node (hooks/sexpr sym))
15+
(hooks/token-node (hooks/sexpr src))])
16+
(meta src))}))

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ config.json
1616
/.lsp/sqlite.db
1717
/.lsp/.cache
1818
/.clj-kondo/.cache
19-
19+
/.mise.toml

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,22 @@ If the structure of the report changes (new tests are added for example), you wi
66
If you don't have an existing CONFIG_FILE and you want to use it, go to https://firecracker-ui-prod.practitest.com/ and generate one.
77
To login, you can use your PractiTest credentials and follow the instructions in the link. Then you can continue here and set the config-path to your configuration file path.
88

9+
## Pre-requisites
10+
11+
- JDK 11
12+
- Babashka
13+
- Clojure CLI
14+
15+
## REPL
16+
17+
```shell
18+
bb dev
19+
```
20+
921
## Building uberjar
1022

1123
```shell
12-
clojure -A:depstar -m hf.depstar.uberjar practitest-firecracker-standalone.jar -C -m practitest-firecracker.core
24+
bb release
1325
```
1426

1527
## Usage
@@ -18,16 +30,17 @@ clojure -A:depstar -m hf.depstar.uberjar practitest-firecracker-standalone.jar -
1830

1931
At every point you can run:
2032

21-
``` shell
33+
```shell
2234
java -jar practitest-firecracker-standalone.jar help
2335
```
36+
2437
to get more information about the parameters and commands.
2538

2639
### version
2740

2841
To check your jar version you can you this command:
2942

30-
``` shell
43+
```shell
3144
java -jar practitest-firecracker-standalone.jar version
3245
```
3346

@@ -37,14 +50,15 @@ This will attempt to do the two actions above at once. It will search for a Test
3750

3851
Example:
3952

40-
``` shell
53+
```shell
4154
java -jar practitest-firecracker-standalone.jar \
4255
--reports-path=REPORTS_FOLDER_PATH \
4356
--author-id=PRACTITEST_USER_ID \
4457
--config-path=CONFIG_FILE \
4558
create-and-populate-testset
4659
```
47-
* author-id is not required in case of PAT (personal api token) is in use
60+
61+
- author-id is not required in case of PAT (personal api token) is in use
4862

4963
The call above will analyze the surefire reports and create and populate tests and the testset. If a test already exists, it will be reused.
5064

@@ -65,9 +79,9 @@ parameters:
6579
--additional-run-fields '{"custom-fields": {"---f-124": "test"}, "system-fields"{}}
6680
if they are relevant to the run (additional-fields not required).
6781

68-
6982
Example:
70-
``` shell
83+
84+
```shell
7185
java -jar practitest-firecracker-standalone.jar \
7286
--api-token=YOUR_API_TOKEN \
7387
--email=YOUR_EMAIL \
@@ -87,6 +101,7 @@ You can set various custom fields for tests when they are created (especially us
87101
Replace the field ids with the actual IDs, you can see all your custom fields by calling this API call: [get-all-custom-fields-in-your-project](https://www.practitest.com/api-v2/#get-all-custom-fields-in-your-project)
88102

89103
### Additional options
104+
90105
If you want to use firecracker custom uris you will need to add this --api-uri parameter like this
91106
for stage:
92107
--api-uri=https://stage.practitest.com/

bb.edn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{:tasks
2+
{dev {:doc "Run dev repl"
3+
:task (clojure "-M:dev")}
4+
release {:doc "Build uberjar"
5+
:task (clojure "-T:build uber")}}}

build.clj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
(ns build
2+
(:require
3+
[clojure.tools.build.api :as b]))
4+
5+
(def lib 'practitest/practitest-firecracker)
6+
(def version (format "2.1.%s" (b/git-count-revs nil)))
7+
(def class-dir "target/classes")
8+
(def uber-file (format "target/%s-%s-standalone.jar" (name lib) version))
9+
10+
;; delay to defer side effects (artifact downloads)
11+
(def basis (delay (b/create-basis {:project "deps.edn"})))
12+
13+
(defn clean [_]
14+
(b/delete {:path "target"}))
15+
16+
(defn uber [_]
17+
(clean nil)
18+
(b/copy-dir {:src-dirs ["src"]
19+
:target-dir class-dir})
20+
(b/compile-clj {:basis @basis
21+
:ns-compile '[practitest-firecracker.core]
22+
:class-dir class-dir})
23+
(b/uber {:class-dir class-dir
24+
:uber-file uber-file
25+
:basis @basis
26+
:main 'practitest-firecracker.core}))

0 commit comments

Comments
 (0)