semvec/pypi-packages huggingface dataset:
custmaker 1.0.1.0
create customer data in local database
License: MIT
Requires Python: >=3.8

# Python 'custmaker' package

## How to install
```bash
pip install custmaker
```

## How to use

### 0. Prerequisite

#### a) DB config file

1) Make '.sqlalchemy' folder in your home directory.
2) Make 'config.yaml' file in '.sqlalchemy' directory.
   And then set your local database information in the 'config.yaml'.
   
```
username: username
password: password
host: host
port: port
db_name: db_name
```

#### b) population ratio data (reference distribution)
In your local database, you should have firstname, lastname, age, sex ratio data.

ex) sex ratio data

|sex|ratio|
|------|---|
|Male|0.4986|
|Female|0.5014|


### 1. Connect to database
Create database engine using the DB config file.

```python
from custmaker.setting import create_db_engine

# create_db_engine(DB config file path)
engine = create_db_engine('~\\.sqlalchemy\\config.yaml')
```

### 2. Create customer table
Create customer DB table using the DB engine.

```python
from custmaker.setting import create_customer_table

# create_customer_table(DB engine)
create_customer_table(engine)
```
### 3. Create customer data

Create customer data repeatly.

```python
from custmaker.making import create_customer

# create_customer(join_date, # of customer, db_engine_name)
create_customer('20211129', 10, engine)
```
### 4. Compare reference and actual distribution

Compare the distribution of the reference data with the data you actually created.

```python
from custmaker.comparing import show_compare_plot

# show_compare_plot(db_engine_name)
show_compare_plot(engine)
```

## Dependencies
- PyYAML
- SQLAlchemy
- numpy
- pandas
- plotly
swagger2case 0.0.2
Convert SWAGGER data to JSON testcases for HttpRunner.
License: MIT
Keywords: swagger converter json

# swagger2case

[![LICENSE](https://img.shields.io/github/license/HttpRunner/swagger2case.svg)](https://github.com/HttpRunner/swagger2case/blob/master/LICENSE) [![Build Status](https://travis-ci.org/HttpRunner/swagger2case.svg?branch=master)](https://travis-ci.org/HttpRunner/swagger2case) [![coveralls](https://coveralls.io/repos/github/HttpRunner/swagger2case/badge.svg?branch=master)](https://coveralls.io/github/HttpRunner/swagger2case?branch=master)

Convert swagger data to yaml testcases for HttpRunner.

## usage

To see ``swagger2case`` version:

```shell
$ sw2case -V
0.0.1
```

To see available options, run

```shell
$ sw2case -h
usage: sw2case [-h] [-V] [--log-level LOG_LEVEL]
               [swagger_testset_file] [output_testset_file]

Convert swagger testcases to JSON testcases for HttpRunner.

positional arguments:
  swagger_testset_file  Specify swagger testset file.
  output_testset_file   Optional. Specify converted JSON testset file.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show version
  --log-level LOG_LEVEL
                        Specify logging level, default is INFO.
```

## examples

In most cases, you can run ``swagger2case`` like this:

```shell
$ sw2case test/test.json output.json
INFO:root:Generate JSON testset successfully: output.json
```

As you see, the first parameter is swagger source file path, and the second is converted JSON file path.

The output testset file type is detemined by the suffix of your specified file.

If you only specify swagger source file path, the output testset is in JSON format by default and located in the same folder with source file.

```shell
$ sw2case test/test.json
INFO:root:Generate JSON testset successfully: test/test.output.json
```

## generated testset

generated JSON testset ``output.json`` shows like this:

```json
[
    {
        "test": {
            "name": "/api/v1/Account/Login",
            "request": {
                "method": "POST",
                "url": "https://httprunner.top/api/v1/Account/Login",
                "headers": {
                    "Content-Type": "application/json"
                },
                "json": {
                    "UserName": "test001",
                    "Pwd": "123",
                    "VerCode": ""
                }
            },
            "validate": []
        }
    }
]
```