pt-br
Esta é uma prova de conceito para avaliação automatizada de exercícios usando NodeJS + Jest + Github Actions.
Aqui, levando em consideração 5 exercícios, que devem ser construídos dentro da pasta challenges respeitando o formato 01.js; 02.js; 03.js; 04.js (com exceção do 5º, que deve ser feito dentro da pasta challenges/ex5) (Isso não é uma regra, mas pra efeitos de organização, utilizei essa disposição)
Os exercícios são:
- Faça uma função
sumque receba dois parâmetros 'a' e 'b', somando a saída - Faça uma função
subque receba dois parâmetros 'a' e 'b', subtraindo a saída - Faça uma função
mulque receba dois parâmetros 'a' e 'b', multiplicando a saída - Faça uma função
divque receba dois parâmetros 'a' e 'b', dividindo a saída - Faça uma lista de afazeres simples com html, css e javascript
- A página deve contér um form com um input e um botão de submissão, e fora dele, uma lista não ordenada, conforme data-test-id's:
task-form;input-task;add-task;task-list.
- O corpo da página (body) deve ter fundo azul (blue) e texto branco (white);
- O primeiro parâmetro do
style.cssdeve ser obody; - O primeiro atributo do
bodydeve ser a cor de fundo; - O segundo atributo do
bodydeve ser a cor de texto;
- O primeiro parâmetro do
- Sem atualizar a página, deve ser possível identificar itens adicionados à lista, quando o botão de submissão é acionado.
Para testar, crie uma PR, resolvendo os desafios, e aguarde a execução da ação para validar os exercícios. Ela vai aparecer no seu página do seu PR, na parte inferior, onde você pode acessar os detalhes para verificar o processo (Exemplo com todos corretos / Exemplo com um exercício incorreto / Exemplo atualizado, incluindo o 5º exercício).
Considerações importantes:
- É possível testar páginas Web utilizando uma biblioteca de testes E2E, chamada Puppeteer, porém, esses testes tem mais custo em termos de tempo de execução (exercício 5);
- Existem várias formas de validar código, o contexto aqui, pensa em um teste de execução (então um problema pode ser resolvido de mais de uma forma), e não uma validação textual (o código está escrito certo/errado, baseado em um gabarito), como é feito com o teste de css no ex. 5;
- Existe um custo de execução de ações no Github. Sugestões aqui:
- Considerar um plano
GitHub Enterprise Cloudpara a instituição, caso esse metodo vá escalar de maneira interna (considerando que os desafios serão realizados dentro da própria organização); - De outra forma, orientar estudantes a fazer um
forkdo template do dia, e executar os testes em seus próprios repositórios (cada conta tem, gratuitamente, até 2000 minutos por mês (Dez/2022), para executar ações).
- Considerar um plano
en-us
This is a proof of concept for automated assignment assessment using NodeJS + Jest + Github Actions.
Here, taking into account 5 exercises, which must be built within the challenges folder respecting the 01.js format; 02.js; 03.js; 04.js (with the exception of the 5th, which must be done within the challenges/ex5 folder) (This is not a rule, but for organizational purposes, I used this arrangement)
The exercises are:
- Make a
sumfunction that takes two parameters 'a' and 'b', summing the output - Make a
subfunction that takes two parameters 'a' and 'b', subtracting the output - Make a function
multhat takes two parameters 'a' and 'b', multiplying the output - Make a
divfunction that takes two parameters 'a' and 'b', dividing the output - Make a simple to-do list with html, css and javascript
- The page must contain a form with an input and a submit button, and outside of it, an unordered list, according to data-test-id's:
task-form;input-task;add-task;task-list.
- The body of the page must have a blue background and white text;
- The first parameter of
style.cssmust bebody; - The first attribute of
bodymust be the background color; - The second attribute of
bodymust be the text color;
- The first parameter of
- Without refreshing the page, it should be possible to identify items added to the list when the submit button is clicked.
- The page must contain a form with an input and a submit button, and outside of it, an unordered list, according to data-test-id's:
To test, create a PR, solving the challenges, and wait for the action to be executed to validate the exercises. It will appear on your PR page, at the bottom, where you can access the details to check the process ([Example with all correct](https://github.com/mjgargani/dnc-eval-action-poc/ actions/runs/3714103159/jobs/6297564244#step:5:19) / [Example with an incorrect exercise](https://github.com/mjgargani/dnc-eval-action-poc/actions/runs/3714096655/jobs /6297549598#step:5:19) / Example updated, including the 5th exercise).
Important considerations:
- It is possible to test Web pages using an E2E testing library, called Puppeteer, however, these tests are more expensive in terms of execution time (exercise 5);
- There are several ways to validate code, the context here, think of an execution test (so a problem can be solved in more than one way), and not a textual validation (the code is written right/wrong, based on a template ), as is done with the css test in ex. 5;
- There is a running cost of actions on Github. Suggestions here:
- Consider a
GitHub Enterprise Cloudplan for the institution, if this method will scale internally (considering that the challenges will be carried out within the organization itself); - Otherwise, guide students to fork the template of the day, and run the tests in their own repositories (each account has, free of charge, up to 2000 minutes per month (Dec/2022), to run actions).
- Consider a